mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 15:02:32 +00:00
1a6f6a1e8c
Only include recovery image in SD card image generated for the BananaPi BPi-R3 if building with CONFIG_TARGET_ROOTFS_INITRAMFS. This allows to build images larger than 32 MB (the limit for initramfs/recovery image) by deselecting initramfs. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
128 lines
4.4 KiB
Makefile
128 lines
4.4 KiB
Makefile
DTS_DIR := $(DTS_DIR)/mediatek
|
|
|
|
KERNEL_LOADADDR := 0x44000000
|
|
|
|
define Image/Prepare
|
|
# For UBI we want only one extra block
|
|
rm -f $(KDIR)/ubi_mark
|
|
echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
|
|
endef
|
|
|
|
define Build/bl2
|
|
cat $(STAGING_DIR_IMAGE)/mt7986-$1-bl2.img >> $@
|
|
endef
|
|
|
|
define Build/bl31-uboot
|
|
cat $(STAGING_DIR_IMAGE)/mt7986_$1-u-boot.fip >> $@
|
|
endef
|
|
|
|
define Build/mt7986-gpt
|
|
cp $@ $@.tmp 2>/dev/null || true
|
|
ptgen -g -o $@.tmp -a 1 -l 1024 \
|
|
$(if $(findstring sdmmc,$1), \
|
|
-H \
|
|
-t 0x83 -N bl2 -r -p 4079k@17k \
|
|
) \
|
|
-t 0x83 -N ubootenv -r -p 512k@4M \
|
|
-t 0x83 -N factory -r -p 2M@4608k \
|
|
-t 0xef -N fip -r -p 4M@6656k \
|
|
-N recovery -r -p 32M@12M \
|
|
$(if $(findstring sdmmc,$1), \
|
|
-N install -r -p 20M@44M \
|
|
-t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
|
|
) \
|
|
$(if $(findstring emmc,$1), \
|
|
-t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
|
|
)
|
|
cat $@.tmp >> $@
|
|
rm $@.tmp
|
|
endef
|
|
|
|
define Device/bananapi_bpi-r3
|
|
DEVICE_VENDOR := Bananapi
|
|
DEVICE_MODEL := BPi-R3
|
|
DEVICE_DTS := mt7986a-bananapi-bpi-r3
|
|
DEVICE_DTS_CONFIG := config-mt7986a-bananapi-bpi-r3
|
|
DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-emmc-nor mt7986a-bananapi-bpi-r3-emmc-snand mt7986a-bananapi-bpi-r3-snand
|
|
DEVICE_DTS_DIR := ../dts
|
|
DEVICE_PACKAGES := kmod-btmtkuart kmod-usb3 kmod-i2c-gpio kmod-sfp e2fsprogs f2fsck mkf2fs
|
|
IMAGES := sysupgrade.itb
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
ARTIFACTS := \
|
|
emmc-preloader.bin emmc-bl31-uboot.fip \
|
|
nor-preloader.bin nor-bl31-uboot.fip \
|
|
sdcard.img.gz \
|
|
snand-preloader.bin snand-bl31-uboot.fip
|
|
ARTIFACT/emmc-preloader.bin := bl2 emmc-ddr4
|
|
ARTIFACT/emmc-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-emmc
|
|
ARTIFACT/nor-preloader.bin := bl2 nor-ddr4
|
|
ARTIFACT/nor-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-nor
|
|
ARTIFACT/snand-preloader.bin := bl2 spim-nand-ddr4
|
|
ARTIFACT/snand-bl31-uboot.fip := bl31-uboot bananapi_bpi-r3-snand
|
|
ARTIFACT/sdcard.img.gz := mt7986-gpt sdmmc |\
|
|
pad-to 17k | bl2 sdmmc-ddr4 |\
|
|
pad-to 6656k | bl31-uboot bananapi_bpi-r3-sdmmc |\
|
|
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
|
|
pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
|
|
) \
|
|
pad-to 44M | bl2 spim-nand-ddr4 |\
|
|
pad-to 45M | bl31-uboot bananapi_bpi-r3-snand |\
|
|
pad-to 49M | bl2 nor-ddr4 |\
|
|
pad-to 50M | bl31-uboot bananapi_bpi-r3-nor |\
|
|
pad-to 51M | bl2 emmc-ddr4 |\
|
|
pad-to 52M | bl31-uboot bananapi_bpi-r3-emmc |\
|
|
pad-to 56M | mt7986-gpt emmc |\
|
|
$(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
|
|
pad-to 64M | append-image squashfs-sysupgrade.itb | check-size | gzip \
|
|
)
|
|
IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
|
|
KERNEL := kernel-bin | gzip
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata
|
|
DTC_FLAGS += -@ --space 32768
|
|
endef
|
|
TARGET_DEVICES += bananapi_bpi-r3
|
|
|
|
define Device/mediatek_mt7986a-rfb
|
|
DEVICE_VENDOR := MediaTek
|
|
DEVICE_MODEL := MTK7986 rfba AP
|
|
DEVICE_DTS := mt7986a-rfb
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
|
KERNEL_LOADADDR := 0x48000000
|
|
DEVICE_DTS_OVERLAY := mt7986a-rfb-spim-nand mt7986a-rfb-spim-nor
|
|
SUPPORTED_DEVICES := mediatek,mt7986a-rfb
|
|
UBINIZE_OPTS := -E 5
|
|
BLOCKSIZE := 128k
|
|
PAGESIZE := 2048
|
|
IMAGE_SIZE := 65536k
|
|
KERNEL_IN_UBI := 1
|
|
IMAGES += factory.bin
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
KERNEL = kernel-bin | lzma | \
|
|
fit lzma $$(KDIR)/$$(firstword $$(DEVICE_DTS)).dtb
|
|
KERNEL_INITRAMFS = kernel-bin | lzma | \
|
|
fit lzma $$(KDIR)/$$(firstword $$(DEVICE_DTS)).dtb with-initrd
|
|
DTC_FLAGS += -@ --space 32768
|
|
endef
|
|
TARGET_DEVICES += mediatek_mt7986a-rfb
|
|
|
|
define Device/mediatek_mt7986b-rfb
|
|
DEVICE_VENDOR := MediaTek
|
|
DEVICE_MODEL := MTK7986 rfbb AP
|
|
DEVICE_DTS := mt7986b-rfb
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
|
KERNEL_LOADADDR := 0x48000000
|
|
SUPPORTED_DEVICES := mediatek,mt7986b-rfb
|
|
UBINIZE_OPTS := -E 5
|
|
BLOCKSIZE := 128k
|
|
PAGESIZE := 2048
|
|
IMAGE_SIZE := 65536k
|
|
KERNEL_IN_UBI := 1
|
|
IMAGES += factory.bin
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
endef
|
|
TARGET_DEVICES += mediatek_mt7986b-rfb
|