From: Sungbo Eo Date: Fri, 8 May 2020 16:20:53 +0000 (+0900) Subject: ramips: tidy up image Makefile X-Git-Tag: v21.02.0-rc1~2847 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c5fdab84ed4b84d1ad9517b28adca5002f099791;p=openwrt%2Fstaging%2Fhauke.git ramips: tidy up image Makefile - sort recipes alphabetically - simplify subtarget include directives Signed-off-by: Sungbo Eo --- diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index f93ea8ab2a..4806226fd0 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -25,80 +25,10 @@ KERNEL_LOADADDR := $(loadaddr-y) LOADER_PLATFORM := $(ldrplatform-y) KERNEL_DTB = kernel-bin | append-dtb | lzma -define Device/Default - PROFILES = Default - KERNEL := $(KERNEL_DTB) | uImage lzma - SOC := $(DEFAULT_SOC) - DEVICE_DTS_DIR := ../dts - DEVICE_DTS = $$(SOC)_$(1) - IMAGES := sysupgrade.bin - SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) - sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size -endef -define Device/uimage-lzma-loader - LOADER_TYPE := bin - KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none -endef - -define Device/seama - SEAMA_MTDBLOCK := 2 - IMAGES += factory.bin - - # 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 | append-metadata | check-size - IMAGE/factory.bin := \ - $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size - SEAMA_SIGNATURE := -endef - -define Build/jcg-header - $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \ - $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \ - -u $@ -o $@.new - mv $@.new $@ -endef - -define Build/trx - $(STAGING_DIR_HOST)/bin/trx $(1) \ - -o $@ \ - -m $$(($(subst k, * 1024,$(IMAGE_SIZE)))) \ - -f $(IMAGE_KERNEL) \ - -a 4 -f $(IMAGE_ROOTFS) -endef - -define Build/loader-common - rm -rf $@.src - $(MAKE) -C lzma-loader \ - PKG_BUILD_DIR="$@.src" \ - TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ - BOARD="$(BOARDNAME)" PLATFORM="$(LOADER_PLATFORM)" \ - LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \ - $(1) compile loader.$(LOADER_TYPE) - mv "$@.$(LOADER_TYPE)" "$@" - rm -rf $@.src -endef - -define Build/loader-kernel - $(call Build/loader-common,LOADER_DATA="$@") -endef - -define Build/relocate-kernel - rm -rf $@.relocate - $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) - ( \ - dd if=$@.relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ - cat $@ \ - ) > $@.new - mv $@.new $@ - rm -rf $@.relocate +define Build/edimax-header + $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) + @mv $@.new $@ endef define Build/elx-header @@ -121,28 +51,36 @@ define Build/elx-header rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header endef -define Build/umedia-header - fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@ +define Build/fonfxcimage + uimage_padhdr -i $@ -o $@.new + mv $@.new $@ endef -define Build/edimax-header - $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) - @mv $@.new $@ +define Build/jcg-header + $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \ + $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \ + -u $@ -o $@.new + mv $@.new $@ endef -define Build/poray-header - $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new - mv $@.new $@ +define Build/loader-common + rm -rf $@.src + $(MAKE) -C lzma-loader \ + PKG_BUILD_DIR="$@.src" \ + TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ + BOARD="$(BOARDNAME)" PLATFORM="$(LOADER_PLATFORM)" \ + LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \ + $(1) compile loader.$(LOADER_TYPE) + mv "$@.$(LOADER_TYPE)" "$@" + rm -rf $@.src endef -define Build/wrg-header - mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new - mv $@.new $@ +define Build/loader-kernel + $(call Build/loader-common,LOADER_DATA="$@") endef # combine kernel and rootfs into one image # mkdlinkfw - define Build/mkdlinkfw -$(STAGING_DIR_HOST)/bin/mkdlinkfw \ -k $(IMAGE_KERNEL) \ @@ -162,8 +100,26 @@ define Build/mkdlinkfw-factory mv $@.new $@ endef -define Build/zyimage - $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +define Build/poray-header + $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new + mv $@.new $@ +endef + +define Build/relocate-kernel + rm -rf $@.relocate + $(CP) ../../generic/image/relocate $@.relocate + $(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) + ( \ + dd if=$@.relocate/loader.bin bs=32 conv=sync && \ + perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ + cat $@ \ + ) > $@.new + mv $@.new $@ + rm -rf $@.relocate +endef + +define Build/sercom-footer + $(call Build/sercom-seal,-f) endef define Build/sercom-seal @@ -175,37 +131,59 @@ define Build/sercom-seal $(1) endef -define Build/sercom-footer - $(call Build/sercom-seal,-f) +define Build/trx + $(STAGING_DIR_HOST)/bin/trx $(1) \ + -o $@ \ + -m $$(($(subst k, * 1024,$(IMAGE_SIZE)))) \ + -f $(IMAGE_KERNEL) \ + -a 4 -f $(IMAGE_ROOTFS) endef -define Build/fonfxcimage - uimage_padhdr -i $@ -o $@.new +define Build/umedia-header + fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@ +endef + +define Build/wrg-header + mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new mv $@.new $@ endef -ifeq ($(SUBTARGET),rt288x) -include rt288x.mk -endif +define Build/zyimage + $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +endef -ifeq ($(SUBTARGET),rt305x) -include rt305x.mk -endif +define Device/Default + PROFILES = Default + KERNEL := $(KERNEL_DTB) | uImage lzma + SOC := $(DEFAULT_SOC) + DEVICE_DTS_DIR := ../dts + DEVICE_DTS = $$(SOC)_$(1) + IMAGES := sysupgrade.bin + SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) + sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size +endef -ifeq ($(SUBTARGET),rt3883) -include rt3883.mk -endif +define Device/seama + SEAMA_MTDBLOCK := 2 + IMAGES += factory.bin -ifeq ($(SUBTARGET),mt7620) -include mt7620.mk -endif + # 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 | append-metadata | check-size + IMAGE/factory.bin := \ + $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size + SEAMA_SIGNATURE := +endef -ifeq ($(SUBTARGET),mt7621) -include mt7621.mk -endif +define Device/uimage-lzma-loader + LOADER_TYPE := bin + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none +endef -ifeq ($(SUBTARGET),mt76x8) -include mt76x8.mk -endif +include $(SUBTARGET).mk $(eval $(call BuildImage))