From 4552e6a16ce2dd1687e1e935b696176e395c9a3c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 5 Apr 2023 16:56:54 +0100 Subject: [PATCH] mediatek: introduce KERNEL_LOADADDR to Device/Default template We need to reset KERNEL_LOADADDR if we use it on a per-device base. Otherwise the previous value will be kept in case a device doesn't define KERNEL_LOADADDR and relies on the default. Move initializing KERNEL_LOADADDR to target/linux/mediatek/image/Makefile, similar to how it's done also on the ramips target. This fixes image size related breakage on devices which rely on the default value of KERNEL_LOADADDR. While at it use 0x48000000 which is more common than the previous default 0x44000000 for the filogic subtarget. Fixed: e7c399bee6 ("filogic: add support for ASUS TUF-AX4200") Signed-off-by: Daniel Golle --- target/linux/mediatek/image/Makefile | 6 ++++++ target/linux/mediatek/image/filogic.mk | 6 +----- target/linux/mediatek/image/mt7622.mk | 6 ------ target/linux/mediatek/image/mt7623.mk | 1 - target/linux/mediatek/image/mt7629.mk | 2 -- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/target/linux/mediatek/image/Makefile b/target/linux/mediatek/image/Makefile index 4c17e5845..97164428e 100644 --- a/target/linux/mediatek/image/Makefile +++ b/target/linux/mediatek/image/Makefile @@ -6,6 +6,11 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +loadaddr-$(CONFIG_TARGET_mediatek_mt7622) := 0x44000000 +loadaddr-$(CONFIG_TARGET_mediatek_mt7623) := 0x80008000 +loadaddr-$(CONFIG_TARGET_mediatek_mt7629) := 0x40008000 +loadaddr-$(CONFIG_TARGET_mediatek_filogic) := 0x48000000 + # default all platform image(fit) build define Device/Default PROFILES = Default $$(DEVICE_NAME) @@ -14,6 +19,7 @@ define Device/Default fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS = kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + KERNEL_LOADADDR = $(loadaddr-y) FILESYSTEMS := squashfs DEVICE_DTS_DIR := $(DTS_DIR) IMAGES := sysupgrade.bin diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 9cd3a5014..d3edc346a 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1,7 +1,5 @@ DTS_DIR := $(DTS_DIR)/mediatek -KERNEL_LOADADDR := 0x44000000 - define Image/Prepare # For UBI we want only one extra block rm -f $(KDIR)/ubi_mark @@ -46,7 +44,6 @@ define Device/asus_tuf-ax4200 DEVICE_DTS_LOADADDR := 0x47000000 DEVICE_PACKAGES := kmod-usb3 IMAGES := sysupgrade.bin - KERNEL_LOADADDR := 0x48000000 KERNEL := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_INITRAMFS := kernel-bin | lzma | \ @@ -65,6 +62,7 @@ define Device/bananapi_bpi-r3 DEVICE_DTS_DIR := ../dts DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs IMAGES := sysupgrade.itb + KERNEL_LOADADDR := 0x44000000 KERNEL_INITRAMFS_SUFFIX := -recovery.itb ARTIFACTS := \ emmc-preloader.bin emmc-bl31-uboot.fip \ @@ -145,7 +143,6 @@ TARGET_DEVICES += mediatek_mt7986b-rfb define Device/tplink_tl-common DEVICE_VENDOR := TP-Link DEVICE_DTS_DIR := ../dts - KERNEL_LOADADDR := 0x48000000 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 @@ -174,7 +171,6 @@ define Device/xiaomi_redmi-router-ax6000 DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000 DEVICE_DTS_DIR := ../dts DEVICE_PACKAGES := kmod-leds-ws2812b - KERNEL_LOADADDR := 0x48000000 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index d6d17ecf4..900082d18 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -1,11 +1,5 @@ DTS_DIR := $(DTS_DIR)/mediatek -ifdef CONFIG_LINUX_5_4 - KERNEL_LOADADDR := 0x44080000 -else - KERNEL_LOADADDR := 0x44000000 -endif - define Image/Prepare # For UBI we want only one extra block rm -f $(KDIR)/ubi_mark diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 4ef0aabe4..26befc1c1 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -1,4 +1,3 @@ -KERNEL_LOADADDR := 0x80008000 DEVICE_VARS += UBOOT_TARGET UBOOT_OFFSET UBOOT_IMAGE # The bootrom of MT7623 expects legacy MediaTek headers present in diff --git a/target/linux/mediatek/image/mt7629.mk b/target/linux/mediatek/image/mt7629.mk index 754ce974b..ef4b75235 100644 --- a/target/linux/mediatek/image/mt7629.mk +++ b/target/linux/mediatek/image/mt7629.mk @@ -1,5 +1,3 @@ -KERNEL_LOADADDR := 0x40008000 - define Device/mediatek_mt7629-rfb DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7629 rfb AP