mirror of https://github.com/hak5/openwrt-owl.git
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>owl
parent
b81fc29123
commit
fce0b5d893
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue