[LEDE-DEV] [PATCH v3 2/2] ar71xx: wrt400n: lift size limit on kernel and rootfs part

Yousong Zhou yszhou4tech at gmail.com
Wed Dec 28 23:26:59 PST 2016


While at it, convert to new build method

Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 .../ar71xx/files/arch/mips/ath79/mach-wrt400n.c    | 12 ++----------
 target/linux/ar71xx/image/generic.mk               | 22 ++++++++++++++++++++++
 target/linux/ar71xx/image/legacy-devices.mk        |  5 -----
 target/linux/ar71xx/image/legacy.mk                | 11 -----------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c
index 6c4c1cb..64126f4 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wrt400n.c
@@ -48,13 +48,9 @@ static struct mtd_partition wrt400n_partitions[] = {
 		.size		= 0x010000,
 		.mask_flags	= MTD_WRITEABLE,
 	}, {
-		.name		= "linux",
+		.name		= "firmware",
 		.offset		= 0x040000,
-		.size		= 0x140000,
-	}, {
-		.name		= "rootfs",
-		.offset		= 0x180000,
-		.size		= 0x630000,
+		.size		= 0x770000,
 	}, {
 		.name		= "nvram",
 		.offset		= 0x7b0000,
@@ -75,10 +71,6 @@ static struct mtd_partition wrt400n_partitions[] = {
 		.offset		= 0x7f0000,
 		.size		= 0x010000,
 		.mask_flags	= MTD_WRITEABLE,
-	}, {
-		.name		= "firmware",
-		.offset		= 0x040000,
-		.size		= 0x770000,
 	}
 };
 
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index a5053be..b982bb9 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -731,3 +731,25 @@ define Device/bhr-4grv2
   IMAGE/factory.bin = append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | mkbuffaloimg
 endef
 TARGET_DEVICES += bhr-4grv2
+
+
+# factory image starts with a header of size 60 (0x3c) bytes.  The header is
+# only used for checking integrity of the firmware image without being written
+# to flash chip.  That means it's okay we include jffs2 pads when computing
+# checksums
+define Build/wrt400n-factory
+	cp $(IMAGE_ROOTFS) $(IMAGE_ROOTFS).tmp
+	$(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS).tmp $(BLOCKSIZE:%k=%)
+	$(STAGING_DIR_HOST)/bin/wrt400n $(IMAGE_KERNEL) $(IMAGE_ROOTFS).tmp $@
+	rm -f $(IMAGE_ROOTFS).tmp
+endef
+
+define Device/wrt400n
+  DEVICE_TITLE := Linksys WRT400N
+  BOARDNAME := WRT400N
+  CONSOLE := ttyS0,115200
+  IMAGES := sysupgrade.bin factory.bin
+  IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size 0x770000
+  IMAGE/factory.bin = wrt400n-factory | check-size 0x77003c
+endef
+TARGET_DEVICES += wrt400n
diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk
index 3f865da..f1274a2 100644
--- a/target/linux/ar71xx/image/legacy-devices.mk
+++ b/target/linux/ar71xx/image/legacy-devices.mk
@@ -582,11 +582,6 @@ define LegacyDevice/WLAEAG300N
 endef
 LEGACY_DEVICES += WLAEAG300N
 
-define LegacyDevice/WRT400N
-  DEVICE_TITLE := Linksys WRT400N
-endef
-LEGACY_DEVICES += WRT400N
-
 define LegacyDevice/WZRHPG300NH
   DEVICE_TITLE := Buffalo WZR-HP-G300NH
   DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk
index 3259016..f890c6e 100644
--- a/target/linux/ar71xx/image/legacy.mk
+++ b/target/linux/ar71xx/image/legacy.mk
@@ -307,15 +307,6 @@ define Image/BuildKernel/Initramfs
 	$(call Image/Build/Initramfs)
 endef
 
-Image/Build/WRT400N/buildkernel=$(call MkuImageLzma,$(2),$(3))
-
-define Image/Build/WRT400N
-	$(call Sysupgrade/KRuImage,$(1),$(2),1310720,6488064)
-	if [ -e "$(call sysupname,$(1),$(2))" ]; then \
-		wrt400n $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR)/root.$(1) $(call factoryname,$(1),$(2)); \
-	fi
-endef
-
 
 define Image/Build/CameoAP94/buildkernel
 	$(call MkuImageLzma,$(2),$(3) $(4))
@@ -1009,8 +1000,6 @@ $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPG300N,whr-hp-g300n,WHR-HP-G30
 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPGN,whr-hp-gn,WHR-HP-GN,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-GN))
 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WLAEAG300N,wlae-ag300n,WLAE-AG300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WLAE-AG300N))
 
-$(eval $(call SingleProfile,WRT400N,64k,WRT400N,wrt400n,WRT400N,ttyS0,115200))
-
 $(eval $(call SingleProfile,WZRHP128K,128kraw,WZRHPG300NH,wzr-hp-g300nh,WZR-HP-G300NH,ttyS0,115200,WZR-HP-G300NH))
 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPG300NH2,wzr-hp-g300nh2,WZR-HP-G300NH2,ttyS0,115200,WZR-HP-G300NH2))
 $(eval $(call SingleProfile,WZRHP64K,64kraw,WZRHPAG300H,wzr-hp-ag300h,WZR-HP-AG300H,ttyS0,115200,WZR-HP-AG300H))
-- 
2.6.4




More information about the Lede-dev mailing list