aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-10-11 20:32:24 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-10-11 20:32:24 +0200
commitfce0b5d8938ae900057766679139e6eb8b0f8c54 (patch)
tree66fc99fdfe84f879df3cb271801b6d02f6f81242 /target/linux/ar71xx
parentb81fc29123f777f61d99c59c214a69e253cb2cc0 (diff)
downloadupstream-fce0b5d8938ae900057766679139e6eb8b0f8c54.tar.gz
upstream-fce0b5d8938ae900057766679139e6eb8b0f8c54.tar.bz2
upstream-fce0b5d8938ae900057766679139e6eb8b0f8c54.zip
ar71xx: clean up SEAMA image build code
Split seama-factory and seama-sysupgrade into smaller pieces (similar to the ramips code) to make the image generation more flexible. Also use standard pad-offset instead of adding a block of zeros at the beginning of the image that is later cut off again. Standard pad-rootfs can be used as the seal header doesn't contain an image size or checksum. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/image/generic.mk52
1 files changed, 18 insertions, 34 deletions
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 0307b26370..d1e847b813 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -472,51 +472,35 @@ endef
TARGET_DEVICES += hiwifi-hc6361
-# The pre-filled 64 bytes consist of
-# - 28 bytes seama_header
-# - 36 bytes of META data (4-bytes aligned)
-define Build/seama-factory
- ( dd if=/dev/zero bs=64 count=1; cat $(IMAGE_KERNEL) ) >$@.loader.tmp
- ( dd if=$@.loader.tmp bs=64k conv=sync; dd if=$(IMAGE_ROOTFS) ) >$@.tmp.0
- tail -c +65 $@.tmp.0 >$@.tmp.1
- $(STAGING_DIR_HOST)/bin/seama \
- -i $@.tmp.1 \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"
- $(STAGING_DIR_HOST)/bin/seama \
- -s $@ \
- -m "signature=$(1)" \
- -i $@.tmp.1.seama
- rm -f $@.loader.tmp $@.tmp.*
-endef
-
-define Build/seama-sysupgrade
- $(STAGING_DIR_HOST)/bin/seama \
- -i $(IMAGE_KERNEL) \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"
- ( dd if=$(IMAGE_KERNEL).seama bs=64k conv=sync; dd if=$(IMAGE_ROOTFS) ) >$@
- rm -f $(IMAGE_KERNEL).seama
-endef
-
-define Build/seama-initramfs
- $(STAGING_DIR_HOST)/bin/seama \
- -i $@ \
- -m "dev=/dev/mtdblock/1" -m "type=firmware"
+define Build/seama
+ $(STAGING_DIR_HOST)/bin/seama -i $@ $(if $(1),$(1),-m "dev=/dev/mtdblock/1" -m "type=firmware")
mv $@.seama $@
endef
-define Build/seama-pad-rootfs
- $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 64 >>$@
+define Build/seama-seal
+ $(call Build/seama,-s $@.seama $(1))
endef
define Device/seama
CONSOLE := ttyS0,115200
LOADER_TYPE := bin
+ BLOCKSIZE := 64k
KERNEL := kernel-bin | lzma | loader-kernel-cmdline | lzma
- KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | seama-initramfs
+ KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | seama
KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX).seama
IMAGES := sysupgrade.bin factory.bin
- IMAGE/sysupgrade.bin := seama-sysupgrade $$$$(SEAMA_SIGNATURE) | seama-pad-rootfs | check-size $$$$(IMAGE_SIZE)
- IMAGE/factory.bin := seama-factory $$$$(SEAMA_SIGNATURE) | seama-pad-rootfs | check-size $$$$(IMAGE_SIZE)
+
+ # 64 bytes offset:
+ # - 28 bytes seama_header
+ # - 36 bytes of META data (4-bytes aligned)
+ IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
+ IMAGE/sysupgrade.bin := \
+ $$(IMAGE/default) | seama | pad-rootfs | \
+ check-size $$$$(IMAGE_SIZE)
+ IMAGE/factory.bin := \
+ $$(IMAGE/default) | seama | pad-rootfs | \
+ seama-seal -m "signature=$$$$(SEAMA_SIGNATURE)" | \
+ check-size $$$$(IMAGE_SIZE)
SEAMA_SIGNATURE :=
DEVICE_VARS += SEAMA_SIGNATURE
endef