mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 03:09:08 +08:00
ramips: tidy up image Makefile
- sort recipes alphabetically - simplify subtarget include directives Signed-off-by: Sungbo Eo <mans0n@gorani.run>
This commit is contained in:
parent
fa9e7ca466
commit
c5fdab84ed
@ -25,80 +25,10 @@ KERNEL_LOADADDR := $(loadaddr-y)
|
|||||||
LOADER_PLATFORM := $(ldrplatform-y)
|
LOADER_PLATFORM := $(ldrplatform-y)
|
||||||
|
|
||||||
KERNEL_DTB = kernel-bin | append-dtb | lzma
|
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
|
define Build/edimax-header
|
||||||
LOADER_TYPE := bin
|
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
||||||
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
|
@mv $@.new $@
|
||||||
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
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/elx-header
|
define Build/elx-header
|
||||||
@ -121,28 +51,36 @@ define Build/elx-header
|
|||||||
rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
|
rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/umedia-header
|
define Build/fonfxcimage
|
||||||
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
|
uimage_padhdr -i $@ -o $@.new
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/edimax-header
|
|
||||||
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
|
||||||
@mv $@.new $@
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/poray-header
|
|
||||||
$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new
|
|
||||||
mv $@.new $@
|
mv $@.new $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/wrg-header
|
define Build/jcg-header
|
||||||
mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new
|
$(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \
|
||||||
|
$(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \
|
||||||
|
-u $@ -o $@.new
|
||||||
mv $@.new $@
|
mv $@.new $@
|
||||||
endef
|
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
|
||||||
|
|
||||||
# combine kernel and rootfs into one image
|
# combine kernel and rootfs into one image
|
||||||
# mkdlinkfw <type> <optional extra arguments to mkdlinkfw binary>
|
# mkdlinkfw <type> <optional extra arguments to mkdlinkfw binary>
|
||||||
|
|
||||||
define Build/mkdlinkfw
|
define Build/mkdlinkfw
|
||||||
-$(STAGING_DIR_HOST)/bin/mkdlinkfw \
|
-$(STAGING_DIR_HOST)/bin/mkdlinkfw \
|
||||||
-k $(IMAGE_KERNEL) \
|
-k $(IMAGE_KERNEL) \
|
||||||
@ -162,8 +100,26 @@ define Build/mkdlinkfw-factory
|
|||||||
mv $@.new $@
|
mv $@.new $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/zyimage
|
define Build/poray-header
|
||||||
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
$(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
|
endef
|
||||||
|
|
||||||
define Build/sercom-seal
|
define Build/sercom-seal
|
||||||
@ -175,37 +131,59 @@ define Build/sercom-seal
|
|||||||
$(1)
|
$(1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/sercom-footer
|
define Build/trx
|
||||||
$(call Build/sercom-seal,-f)
|
$(STAGING_DIR_HOST)/bin/trx $(1) \
|
||||||
|
-o $@ \
|
||||||
|
-m $$(($(subst k, * 1024,$(IMAGE_SIZE)))) \
|
||||||
|
-f $(IMAGE_KERNEL) \
|
||||||
|
-a 4 -f $(IMAGE_ROOTFS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/fonfxcimage
|
define Build/umedia-header
|
||||||
uimage_padhdr -i $@ -o $@.new
|
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 $@
|
mv $@.new $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq ($(SUBTARGET),rt288x)
|
define Build/zyimage
|
||||||
include rt288x.mk
|
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
||||||
endif
|
endef
|
||||||
|
|
||||||
ifeq ($(SUBTARGET),rt305x)
|
define Device/Default
|
||||||
include rt305x.mk
|
PROFILES = Default
|
||||||
endif
|
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)
|
define Device/seama
|
||||||
include rt3883.mk
|
SEAMA_MTDBLOCK := 2
|
||||||
endif
|
IMAGES += factory.bin
|
||||||
|
|
||||||
ifeq ($(SUBTARGET),mt7620)
|
# 64 bytes offset:
|
||||||
include mt7620.mk
|
# - 28 bytes seama_header
|
||||||
endif
|
# - 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)
|
define Device/uimage-lzma-loader
|
||||||
include mt7621.mk
|
LOADER_TYPE := bin
|
||||||
endif
|
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
|
||||||
|
endef
|
||||||
|
|
||||||
ifeq ($(SUBTARGET),mt76x8)
|
include $(SUBTARGET).mk
|
||||||
include mt76x8.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(eval $(call BuildImage))
|
$(eval $(call BuildImage))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user