[LEDE-DEV] [PATCH v5 1/3] ipq806x: Add new script: scripts/its-maker.sh

Felix Fietkau nbd at nbd.name
Mon Dec 12 01:19:48 PST 2016


On 2016-11-27 06:28, J Mo wrote:
> its-maker.sh creates an .its file, given a series of arguments, which is
> then used to create a FIT image with mkimage.
> 
> Required to support the tew827dru, but intended to support the creation
> of nearly any .its file.
> 
> Documentation thread on the OpenWRT forum:
> https://forum.openwrt.org/viewtopic.php?pid=337783
> 
> Signed-off-by: Jesse Molina <jmomo at jmomo.net>
I just took a look at this script and its output from calling it the
way you do for your device. I think this script is way too complex for
its rather simple output. Since the command line of the script is only
marginally more concise than the output it generates, I think you should
drop this script entirely.

Here's how I think this could work instead (untested pseudocode)

define Device/TEW827DRU/its
/dts-v1/;
/ {
  description = "LEDE FIT image for $(DEVICE_NAME)";
  #address-cells = <1>;
    images {
      script at 0 {
        data = /incbin/("tew827dru-flash.scr");
        description = "u-boot-HTTP firmware update script";
        type = "script";
        compression = "none";
        arch = "$(ARCH)";
        hash at 0 {
          algo = "crc32";
        };
      };
      ubi-image at 1 {
        data = /incbin/("%ROOTFS_IMAGE%");
        description = "UBI rootfs image";
        type = "firmware";
        compression = "none";
        arch = "$(ARCH)";
        hash at 0 {
          algo = "crc32";
        };
      };
      bootconfig at 2 {
        data = /incbin/("tew827dru-bootconfig.bin");
        description = "BOOTCONFIG: boot from APPSBL and rootfs";
        type = "firmware";
        compression = "none";
        arch = "$(ARCH)";
        hash at 0 {
          algo = "crc32";
        };
      };
    };
  };
endef
$(eval $(call shexport,Device/TEW827DRU/its))

define Build/mkfit-TEW827DRU
	$(SH_FUNC) var2file "$(call shvar,Device/TEW827DRU/its)" $@.its
	$(SED) 's,%ROOTFS_IMAGE%,$@,' $@.its
	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.fit
	rm -f $@.its
	mv $@.fit $@
endef

A few more notes about this:
When in context of an image makefile, don't specify the absolute path
using $(TOPDIR)/...., instead assume that the image/ directory of your
target is the current directory.

- Felix



More information about the Lede-dev mailing list