-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
247 additions
and
4,059 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
CONFIG_TARGET_bcm27xx=y | ||
CONFIG_TARGET_bcm27xx_bcm2712=y | ||
CONFIG_TARGET_bcm27xx_bcm2712_DEVICE_rpi-5=y | ||
|
||
CONFIG_PACKAGE_luci-ssl=n # uhttpd服务 | ||
CONFIG_PACKAGE_luci-ssl-nginx=y # nginx | ||
|
||
CONFIG_PACKAGE_kmod-of-mdio=n | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
SHELL_FOLDER=$(dirname $(readlink -f "$0")) | ||
|
||
bash $SHELL_FOLDER/../common/kernel_6.1.sh | ||
|
||
sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile | ||
sed -i 's/ factory.img.gz / /' target/linux/bcm27xx/image/Makefile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
devices/common/diy/package/network/utils/iptables/patches/900-bcm-fullconenat.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- a/extensions/libipt_MASQUERADE.c | ||
+++ b/extensions/libipt_MASQUERADE.c | ||
@@ -11,6 +11,7 @@ | ||
enum { | ||
O_TO_PORTS = 0, | ||
O_RANDOM, | ||
+ O_MODE, | ||
O_RANDOM_FULLY, | ||
}; | ||
|
||
@@ -23,13 +24,16 @@ static void MASQUERADE_help(void) | ||
" --random\n" | ||
" Randomize source port.\n" | ||
" --random-fully\n" | ||
-" Fully randomize source port.\n"); | ||
+" Fully randomize source port.\n" | ||
+" --mode <fullcone|symmetric>\n" | ||
+" NAT mode.\n"); | ||
} | ||
|
||
static const struct xt_option_entry MASQUERADE_opts[] = { | ||
{.name = "to-ports", .id = O_TO_PORTS, .type = XTTYPE_STRING}, | ||
{.name = "random", .id = O_RANDOM, .type = XTTYPE_NONE}, | ||
{.name = "random-fully", .id = O_RANDOM_FULLY, .type = XTTYPE_NONE}, | ||
+ {.name = "mode", .id = O_MODE, .type = XTTYPE_STRING}, | ||
XTOPT_TABLEEND, | ||
}; | ||
|
||
@@ -90,6 +94,8 @@ static void MASQUERADE_parse(struct xt_o | ||
else | ||
portok = 0; | ||
|
||
+ mr->range[0].min_ip = 0; | ||
+ | ||
xtables_option_parse(cb); | ||
switch (cb->entry->id) { | ||
case O_TO_PORTS: | ||
@@ -104,6 +110,15 @@ static void MASQUERADE_parse(struct xt_o | ||
case O_RANDOM_FULLY: | ||
mr->range[0].flags |= NF_NAT_RANGE_PROTO_RANDOM_FULLY; | ||
break; | ||
+ case O_MODE: | ||
+ if (strcasecmp(cb->arg, "fullcone") == 0) | ||
+ mr->range[0].min_ip = 1; | ||
+ else if (strcasecmp(cb->arg, "symmetric") == 0) | ||
+ mr->range[0].min_ip = 0; | ||
+ else | ||
+ xtables_error(PARAMETER_PROBLEM, | ||
+ "Unknown mode %s", cb->arg); | ||
+ break; | ||
} | ||
} | ||
|
||
@@ -126,6 +141,9 @@ MASQUERADE_print(const void *ip, const s | ||
|
||
if (r->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) | ||
printf(" random-fully"); | ||
+ | ||
+ if (r->min_ip == 1) | ||
+ printf(" mode: fullcone"); | ||
} | ||
|
||
static void | ||
@@ -145,6 +163,9 @@ MASQUERADE_save(const void *ip, const st | ||
|
||
if (r->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) | ||
printf(" --random-fully"); | ||
+ | ||
+ if (r->min_ip == 1) | ||
+ printf(" --mode fullcone"); | ||
} | ||
|
||
static int MASQUERADE_xlate(struct xt_xlate *xl, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
From 467ef0219a65a3dd63ce27f41e54f09bf1f2ad64 Mon Sep 17 00:00:00 2001 | ||
From: kiddin9 <48883331+kiddin9@users.noreply.github.com> | ||
Date: Mon, 4 Mar 2024 08:01:42 +0800 | ||
Subject: [PATCH] Update image.mk | ||
Signed-off-by: kiddin9 <48883331+kiddin9@users.noreply.github.com> | ||
--- | ||
include/image.mk | 43 +++++++++++++++++++++++++++++++++++++++++++ | ||
1 file changed, 43 insertions(+) | ||
diff --git a/include/image.mk b/include/image.mk | ||
index 4b6acbe1aad6a..f307dea1ca9a3 100644 | ||
--- a/include/image.mk | ||
+++ b/include/image.mk | ||
@@ -313,6 +313,44 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ | ||
endef | ||
endif | ||
+define Device/Build/targz | ||
+ $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \ | ||
+ $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json, \ | ||
+ $(BIN_DIR)/$$(ROOTFSTZ)) | ||
+ | ||
+ $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json,$(1)) | ||
+ | ||
+ $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json: $(BIN_DIR)/$$(ROOTFSTZ) | ||
+ @mkdir -p $$(shell dirname $$@) | ||
+ DEVICE_ID="$(1)" \ | ||
+ SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ | ||
+ FILE_NAME="$$(notdir $$^)" \ | ||
+ FILE_DIR="$(BIN_DIR)" \ | ||
+ FILE_TYPE="rootfs" \ | ||
+ FILE_FILESYSTEM="rootfs" \ | ||
+ DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \ | ||
+ DEVICE_VENDOR="$$(DEVICE_VENDOR)" \ | ||
+ DEVICE_MODEL="$$(DEVICE_MODEL)" \ | ||
+ DEVICE_VARIANT="$$(DEVICE_VARIANT)" \ | ||
+ DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \ | ||
+ DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \ | ||
+ DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \ | ||
+ DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \ | ||
+ DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \ | ||
+ DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \ | ||
+ DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ | ||
+ DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ | ||
+ DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ | ||
+ DEVICE_TITLE="$$(DEVICE_TITLE)" \ | ||
+ DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ | ||
+ TARGET="$(BOARD)" \ | ||
+ SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \ | ||
+ VERSION_NUMBER="$(VERSION_NUMBER)" \ | ||
+ VERSION_CODE="$(VERSION_CODE)" \ | ||
+ SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \ | ||
+ $(TOPDIR)/scripts/json_add_image_info.py $$@ | ||
+endef | ||
+ | ||
ifdef CONFIG_TARGET_ROOTFS_CPIOGZ | ||
define Image/Build/cpiogz | ||
( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz ) | ||
@@ -394,6 +432,7 @@ define Device/Init | ||
FACTORY_IMG_NAME := | ||
IMAGE_SIZE := | ||
NAND_SIZE := | ||
+ ROOTFSTZ = $$(DEVICE_IMG_PREFIX)-rootfs.tar.gz | ||
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) | ||
KERNEL_SUFFIX := -kernel.bin | ||
KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX) | ||
@@ -631,6 +670,7 @@ endef | ||
define Device/Build/image | ||
GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz)) | ||
+ GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz)) | ||
$$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \ | ||
$(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \ | ||
$(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)) | ||
@@ -667,6 +707,7 @@ define Device/Build/image | ||
FILE_DIR="$(KDIR)/tmp" \ | ||
FILE_TYPE=$(word 1,$(subst ., ,$(2))) \ | ||
FILE_FILESYSTEM="$(1)" \ | ||
+ KERNEL_INITRAMFS_IMAGE="$(subst $(IMG_PREFIX_EXTRA),,$(KERNEL_INITRAMFS_IMAGE))" \ | ||
DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \ | ||
DEVICE_VENDOR="$(DEVICE_VENDOR)" \ | ||
DEVICE_MODEL="$(DEVICE_MODEL)" \ | ||
@@ -758,6 +799,8 @@ define Device/Build | ||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1))) | ||
$(call Device/Build/kernel,$(1)) | ||
+ $(if $(CONFIG_TARGET_ROOTFS_TARGZ),$(call Device/Build/targz,$(PROFILE_SANITIZED))) | ||
+ | ||
$$(eval $$(foreach compile,$$(COMPILE), \ | ||
$$(call Device/Build/compile,$$(compile),$(1)))) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.