| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- DEVICE_VARS += SENAO_IMGNAME WATCHGUARD_MAGIC
- # This needs to make OEM config archive 'sysupgrade.tgz' an empty file prior to OEM
- # sysupgrade, as otherwise it will implant the old configuration from
- # OEM firmware when writing rootfs from factory.bin
- # rootfs size and checksum is taken from a squashfs header
- # the header does not exist, therefore, supply the size and md5
- define Build/senao-tar-gz
- -[ -f "$@" ] && \
- mkdir -p [email protected] && \
- touch [email protected]/failsafe.bin && \
- touch [email protected]/FWINFO-$(word 1,$(1))-$(REVISION) && \
- echo '#!/bin/sh' > [email protected]/before-upgrade.sh && \
- echo ': > /tmp/sysupgrade.tgz' >> [email protected]/before-upgrade.sh && \
- echo ': > /tmp/_sys/sysupgrade.tgz' >> [email protected]/before-upgrade.sh && \
- echo -n $$(( $$(cat $@ | wc -c) / 4096 * 4096 )) > [email protected] && \
- dd if=$@ bs=$$(cat [email protected]) count=1 | md5sum - | cut -d ' ' -f 1 > [email protected] && \
- echo '#!/bin/sh' > [email protected]/after-upgrade.sh && \
- printf 'fw_setenv rootfs_size 0x%08x\n' $$(cat [email protected]) >> [email protected]/after-upgrade.sh && \
- printf 'fw_setenv rootfs_checksum %s\n' $$(cat [email protected]) >> [email protected]/after-upgrade.sh && \
- $(CP) $(KDIR)/loader-$(DEVICE_NAME).uImage \
- [email protected]/openwrt-$(word 1,$(1))-uImage-lzma.bin && \
- $(CP) $@ [email protected]/openwrt-$(word 1,$(1))-root.squashfs && \
- $(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
- $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
- -C [email protected] . | gzip -9n > $@ && \
- rm -rf [email protected] [email protected] [email protected]
- endef
- define Build/watchguard-cksum
- -echo -n $(word 1,$(1)) | cat $@ - | md5sum | \
- cut -d ' ' -f1 | tr -d '\n' > [email protected] && \
- cat [email protected] >> $@ && \
- rm -rf [email protected]
- endef
- define Device/senao_loader_okli
- $(Device/loader-okli-uimage)
- KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x73714f4b
- KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
- LOADER_KERNEL_MAGIC := 0x73714f4b
- IMAGES += factory.bin
- IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
- check-size | senao-tar-gz $$$$(SENAO_IMGNAME)
- IMAGE/sysupgrade.bin := $$(IMAGE/factory.bin) | append-metadata
- endef
|