diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2016-06-30 09:54:21 +0800 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2016-06-30 22:48:39 +0200 |
commit | 559a7d1177fcbb4e276f864f465fce9297624eaf (patch) | |
tree | ffb1a0ee7c988c154f511c8e758cc3c41e03ab2b /target/linux/ar71xx/image/generic.mk | |
parent | ea284d704b34fd6222693be1382b31b5fd03b157 (diff) | |
download | mtk-20170518-559a7d1177fcbb4e276f864f465fce9297624eaf.zip mtk-20170518-559a7d1177fcbb4e276f864f465fce9297624eaf.tar.gz mtk-20170518-559a7d1177fcbb4e276f864f465fce9297624eaf.tar.bz2 |
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/linux/ar71xx/image/generic.mk')
-rw-r--r-- | target/linux/ar71xx/image/generic.mk | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 3e3dc69..b8e70a4 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 |