Просмотр исходного кода

ramips: tidy up image Makefile

- sort recipes alphabetically
- simplify subtarget include directives

Signed-off-by: Sungbo Eo <[email protected]>
Sungbo Eo 5 лет назад
Родитель
Сommit
c5fdab84ed
1 измененных файлов с 87 добавлено и 109 удалено
  1. 87 109
      target/linux/ramips/image/Makefile

+ 87 - 109
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 [email protected]
-	mv [email protected] $@
-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 [email protected]
-	$(MAKE) -C lzma-loader \
-		PKG_BUILD_DIR="[email protected]" \
-		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 [email protected]
-endef
-
-define Build/loader-kernel
-	$(call Build/loader-common,LOADER_DATA="$@")
-endef
-
-define Build/relocate-kernel
-	rm -rf [email protected]
-	$(CP) ../../generic/image/relocate [email protected]
-	$(MAKE) -C [email protected] KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
-	( \
-		dd [email protected]/loader.bin bs=32 conv=sync && \
-		perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
-		cat $@ \
-	) > [email protected]
-	mv [email protected] $@
-	rm -rf [email protected]
+define Build/edimax-header
+	$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o [email protected] $(1)
+	@mv [email protected] $@
 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 [email protected] && mv [email protected] $@
+define Build/fonfxcimage
+	uimage_padhdr -i $@ -o [email protected]
+	mv [email protected] $@
 endef
 
-define Build/edimax-header
-	$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o [email protected] $(1)
-	@mv [email protected] $@
+define Build/jcg-header
+	$(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \
+		$(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \
+		-u $@ -o [email protected]
+	mv [email protected] $@
 endef
 
-define Build/poray-header
-	$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o [email protected]
-	mv [email protected] $@
+define Build/loader-common
+	rm -rf [email protected]
+	$(MAKE) -C lzma-loader \
+		PKG_BUILD_DIR="[email protected]" \
+		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 [email protected]
 endef
 
-define Build/wrg-header
-	mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o [email protected]
-	mv [email protected] $@
+define Build/loader-kernel
+	$(call Build/loader-common,LOADER_DATA="$@")
 endef
 
 # combine kernel and rootfs into one image
 # mkdlinkfw <type> <optional extra arguments to mkdlinkfw binary>
-
 define Build/mkdlinkfw
 	-$(STAGING_DIR_HOST)/bin/mkdlinkfw \
 		-k $(IMAGE_KERNEL) \
@@ -162,8 +100,26 @@ define Build/mkdlinkfw-factory
 	mv [email protected] $@
 endef
 
-define Build/zyimage
-	$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
+define Build/poray-header
+	$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o [email protected]
+	mv [email protected] $@
+endef
+
+define Build/relocate-kernel
+	rm -rf [email protected]
+	$(CP) ../../generic/image/relocate [email protected]
+	$(MAKE) -C [email protected] KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
+	( \
+		dd [email protected]/loader.bin bs=32 conv=sync && \
+		perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
+		cat $@ \
+	) > [email protected]
+	mv [email protected] $@
+	rm -rf [email protected]
+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 [email protected]
+define Build/umedia-header
+	fix-u-media-header -T 0x46 -B $(1) -i $@ -o [email protected] && mv [email protected] $@
+endef
+
+define Build/wrg-header
+	mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o [email protected]
 	mv [email protected] $@
 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))