aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2016-06-30 09:54:21 +0800
committerJohn Crispin <john@phrozen.org>2016-06-30 22:48:39 +0200
commit559a7d1177fcbb4e276f864f465fce9297624eaf (patch)
treeffb1a0ee7c988c154f511c8e758cc3c41e03ab2b /target
parentea284d704b34fd6222693be1382b31b5fd03b157 (diff)
downloadupstream-559a7d1177fcbb4e276f864f465fce9297624eaf.tar.gz
upstream-559a7d1177fcbb4e276f864f465fce9297624eaf.tar.bz2
upstream-559a7d1177fcbb4e276f864f465fce9297624eaf.zip
ar71xx: seama: fix making factory images
rootfs part needs to be aligned to erase block size which is passed as the 6th argument to Image/Build/Seama and is now 65536 since commit commit 5119ee9 "ar71xx: fix bogus hardcoded kernel image size for Seama images (fixes #20585)", but $(($(6) - 64)) still assumes that the argument is a limit on kernel partition size, i.e. 1310720, so the generated factory image is wrong in that the kernel will fail to find the rootfs (FlySpray link at [1]) This patch will workaround it with the following steps 1. Calculate the required space for seama header and META data in step 5 2. Pre-padding 64 bytes to lzma-compressed loader 3. Generate correctly padded image-$(2).tmp 4. Strip out the padding 5. Seal it with seama utility While at it convert seama to new build method [1] FS#35 - mynet-n750 factory images don't find root partition, https://bugs.lede-project.org/index.php?do=details&task_id=35 Reported-by: Steven Haigh <netwiz@crc.id.au> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/image/generic.mk81
-rw-r--r--target/linux/ar71xx/image/legacy-devices.mk18
-rw-r--r--target/linux/ar71xx/image/legacy.mk40
3 files changed, 81 insertions, 58 deletions
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 3e3dc69d75..b8e70a4154 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -432,3 +432,84 @@ define Device/hiwifi-hc6361
MTDPARTS := spi0.0:64k(u-boot)ro,64k(bdinfo)ro,16128k(firmware),64k(backup)ro,64k(art)ro
endef
TARGET_DEVICES += hiwifi-hc6361
+
+
+# The pre-filled 64 bytes consist of
+# - 28 bytes seama_header
+# - 36 bytes of META data (4-bytes aligned)
+#
+# And as the 4 bytes jffs2 marker will be erased on first boot, they need to
+# be excluded from the calculation of checksum
+define Build/seama-factory
+ ( dd if=/dev/zero bs=64 count=1; cat $(word 1,$^) ) >$@.loader.tmp
+ ( dd if=$@.loader.tmp bs=64k conv=sync; dd if=$(word 2,$^) ) >$@.tmp.0
+ tail -c +65 $@.tmp.0 >$@.tmp.1
+ head -c -4 $@.tmp.1 >$@.tmp.2
+ $(STAGING_DIR_HOST)/bin/seama \
+ -i $@.tmp.2 \
+ -m "dev=/dev/mtdblock/1" -m "type=firmware"
+ $(STAGING_DIR_HOST)/bin/seama \
+ -s $@ \
+ -m "signature=$(1)" \
+ -i $@.tmp.2.seama
+ tail -c 4 $@.tmp.1 >>$@
+ rm -f $@.loader.tmp $@.tmp.*
+endef
+
+define Build/seama-sysupgrade
+ $(STAGING_DIR_HOST)/bin/seama \
+ -i $(word 1,$^) \
+ -m "dev=/dev/mtdblock/1" -m "type=firmware"
+ ( dd if=$(word 1,$^).seama bs=64k conv=sync; dd if=$(word 2,$^) ) >$@
+endef
+
+define Build/seama-initramfs
+ $(STAGING_DIR_HOST)/bin/seama \
+ -i $@ \
+ -m "dev=/dev/mtdblock/1" -m "type=firmware"
+ mv $@.seama $@
+endef
+
+define Device/seama
+ CONSOLE := ttyS0,115200
+ KERNEL := kernel-bin | loader-kernel-cmdline | lzma
+ KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | seama-initramfs
+ KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX).seama
+ IMAGES := sysupgrade.bin factory.bin
+ IMAGE/sysupgrade.bin := seama-sysupgrade $$$$(SEAMA_SIGNATURE) | check-size $$$$(IMAGE_SIZE)
+ IMAGE/factory.bin := seama-factory $$$$(SEAMA_SIGNATURE) | check-size $$$$(IMAGE_SIZE)
+ SEAMA_SIGNATURE :=
+ DEVICE_VARS := SEAMA_SIGNATURE
+endef
+
+define Device/mynet-n600
+$(Device/seama)
+ DEVICE_TITLE := Western Digital My Net N600
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+ BOARDNAME = MYNET-N600
+ IMAGE_SIZE = 15808k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
+ SEAMA_SIGNATURE := wrgnd16_wd_db600
+endef
+
+define Device/mynet-n750
+$(Device/seama)
+ DEVICE_TITLE := Western Digital My Net N750
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2
+ BOARDNAME = MYNET-N750
+ IMAGE_SIZE = 15808k
+ MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
+ SEAMA_SIGNATURE := wrgnd13_wd_av
+endef
+
+define Device/qihoo-c301
+$(Device/seama)
+ DEVICE_TITLE := Qihoo C301
+ DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev kmod-ath10k
+ BOARDNAME = QIHOO-C301
+ IMAGE_SIZE = 15744k
+ MTDPARTS = mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
+ SEAMA_SIGNATURE := wrgac26_qihoo360_360rg
+endef
+
+TARGET_DEVICES += mynet-n600 mynet-n750 qihoo-c301
diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk
index c8e14769b4..07d3df6831 100644
--- a/target/linux/ar71xx/image/legacy-devices.mk
+++ b/target/linux/ar71xx/image/legacy-devices.mk
@@ -542,12 +542,6 @@ define LegacyDevice/MZKW300NH
endef
LEGACY_DEVICES += MZKW300NH
-define LegacyDevice/QIHOO360
- DEVICE_TITLE := Qihoo 360 C301
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev kmod-ath10k
-endef
-LEGACY_DEVICES += QIHOO360
-
define LegacyDevice/RW2458N
DEVICE_TITLE := Redwave RW2458N
DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-ath9k wpad-mini
@@ -608,18 +602,6 @@ define LegacyDevice/DR344
endef
LEGACY_DEVICES += DR344
-define LegacyDevice/MYNETN600
- DEVICE_TITLE := WD My Net N600
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2
-endef
-LEGACY_DEVICES += MYNETN600
-
-define LegacyDevice/MYNETN750
- DEVICE_TITLE := WD My Net N750
- DEVICE_PACKAGES := kmod-usb-core kmod-usb2
-endef
-LEGACY_DEVICES += MYNETN750
-
define LegacyDevice/MYNETREXT
DEVICE_TITLE := WD My Net Wi-Fi Range Extender
DEVICE_PACKAGES := rssileds
diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk
index c771f893ed..18eef4dd09 100644
--- a/target/linux/ar71xx/image/legacy.mk
+++ b/target/linux/ar71xx/image/legacy.mk
@@ -308,10 +308,8 @@ r6100_mtdlayout=mtdparts=ar934x-nfc:128k(u-boot)ro,256k(caldata),256k(caldata-ba
tew823dru_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,15296k(firmware),192k(lang)ro,512k(my-dlink)ro,64k(mac)ro,64k(art)ro
wndr4300_mtdlayout=mtdparts=ar934x-nfc:256k(u-boot)ro,256k(u-boot-env)ro,256k(caldata),512k(pot),2048k(language),512k(config),3072k(traffic_meter),2048k(kernel),23552k(ubi),25600k@0x6c0000(firmware),256k(caldata_backup),-(reserved)
zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs),1472k(kernel),64k(configure)ro,64k(mfg)ro,64k(art)ro,7680k@0x50000(firmware)
-mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
-qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
yun_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6464k(rootfs),1280k(kernel),64k(nvram),64k(art),7744k@0x50000(firmware)
yun_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware)
wrtnode2q_mtdlayout=mtdparts=spi0.0:192k(u-boot),64k(u-boot-env),64k(art),1472k(kernel),14592k(rootfs),16064k@0x50000(firmware),16384k@0x0(fullflash)
@@ -655,39 +653,6 @@ define Image/Build/ALFA
endef
-Image/Build/Seama/loader=$(call Image/BuildLoader,$(1),bin,$(2) $(3),0x80060000)
-
-define Image/Build/Seama
- [ -e "$(KDIR)/loader-$(2).bin" ]
- $(call CompressLzma,$(KDIR)/loader-$(2).bin,$(KDIR_TMP)/loader-$(2).bin.lzma)
- -rm -f $(KDIR_TMP)/image-$(2).tmp
- $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
- [ -e "$(KDIR_TMP)/image-$(2).tmp" ] && { \
- head -c -4 "$(KDIR_TMP)/image-$(2).tmp" > "$(KDIR_TMP)/image-$(2).no-jffs2mark.tmp"; \
- $(STAGING_DIR_HOST)/bin/seama \
- -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"; \
- $(STAGING_DIR_HOST)/bin/seama \
- -s $(call imgname,$(1),$(2))-factory.bin \
- -m "signature=$(5)" \
- -i $(KDIR_TMP)/image-$(2).no-jffs2mark.tmp.seama; \
- tail -c 4 "$(KDIR_TMP)/image-$(2).tmp" >> $(call imgname,$(1),$(2))-factory.bin; \
- }
- cat $(KDIR_TMP)/loader-$(2).bin.lzma > $(KDIR_TMP)/image-$(2)-sysupgrade.tmp
- $(STAGING_DIR_HOST)/bin/seama \
- -i $(KDIR_TMP)/image-$(2)-sysupgrade.tmp \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"
- $(call CatFiles,$(KDIR_TMP)/image-$(2)-sysupgrade.tmp.seama,$(6),$(KDIR)/root.$(1),$(7),$(call sysupname,$(1),$(2)))
-endef
-
-define Image/Build/Seama/initramfs
- $(call PatchKernelLzma,$(2),$(3) $(4),,-initramfs)
- $(STAGING_DIR_HOST)/bin/seama \
- -i $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"
- cat $(KDIR_TMP)/vmlinux-initramfs-$(2).bin.lzma.seama > $(call imgname,initramfs,$(2))-seama.bin
-endef
-
Image/Build/Senao/buildkernel=$(call MkuImageLzma,$(2),$(3) $(4))
Image/Build/Senao/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
@@ -1097,11 +1062,6 @@ $(eval $(call SingleProfile,PB4X,64k,PB44,pb44,PB44,ttyS0,115200))
$(eval $(call SingleProfile,Planex,64kraw,MZKW04NU,mzk-w04nu,MZK-W04NU,ttyS0,115200))
$(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,115200))
-$(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,65536,16187392))
-$(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,65536,16187392))
-
-$(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,65536,16121856))
-
$(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))
$(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))