mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-02-19 13:31:18 +01:00
package: u-boot: initial support for qoriq arch
This package adds initial u-boot support for qoriq target.
U-boot for qoriq devices must be compiled with 32-bit compiler and
linked with 32-bit linker. It's part of mpc 85xx target. But qoriq
target is 64-bit. As workaround, mpc85xx binary toolchain is downloaded
only for this u-boot.
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/10941
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
(cherry picked from commit c5d3d5fe28)
Link: https://github.com/openwrt/openwrt/pull/21477
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
2dd34796d8
commit
bf7494a644
6 changed files with 231 additions and 0 deletions
78
package/boot/uboot-qoriq/Makefile
Normal file
78
package/boot/uboot-qoriq/Makefile
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Copyright (C) 2016 Jiang Yutang <jiangyutang1978@gmail.com>
|
||||
# Copyright (C) 2025 Pawel Dembicki <paweldembicki@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=2025.01
|
||||
PKG_HASH:=cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TOOLCHAIN_NAME:=openwrt-toolchain-24.10.4-mpc85xx-p2020_gcc-13.3.0_musl.Linux-x86_64
|
||||
TOOLCHAIN_FILE:=$(TOOLCHAIN_NAME).tar.zst
|
||||
TOOLCHAIN_PATH:=$(PKG_BUILD_DIR)/$(TOOLCHAIN_NAME)/toolchain-powerpc_8548_gcc-13.3.0_musl/bin
|
||||
TOOLCHAIN_CROSS_COMPILE:=powerpc-openwrt-linux-musl-
|
||||
|
||||
define Download/uboot-qoriq-toolchain
|
||||
FILE:=$(TOOLCHAIN_FILE)
|
||||
URL:=https://downloads.openwrt.org/releases/24.10.4/targets/mpc85xx/p2020/
|
||||
URL_FILE:=$(TOOLCHAIN_FILE)
|
||||
HASH:=c16566bb3625b6c45e4184b9d37953d4c3c1dcdec1141a45df834da626d4c08d
|
||||
endef
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=qoriq
|
||||
BUILD_SUBTARGET:=generic
|
||||
BUILD_DEVICES:=$(1)
|
||||
ENV_SIZE:=0x2000
|
||||
endef
|
||||
|
||||
define U-Boot/fsl_T4240RDB-nor
|
||||
NAME:=NXP T4240RDB NOR Boot
|
||||
UBOOT_CONFIG:=T4240RDB
|
||||
UBOOT_IMAGE:=u-boot-dtb.bin
|
||||
endef
|
||||
|
||||
define U-Boot/fsl_T4240RDB-sdboot
|
||||
NAME:=NXP T4240RDB SD Card Boot
|
||||
UBOOT_CONFIG:=T4240RDB_SDCARD
|
||||
UBOOT_IMAGE:=u-boot-with-spl-pbl.bin
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
fsl_T4240RDB-nor \
|
||||
fsl_T4240RDB-sdboot
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
$(TAR) -I $(STAGING_DIR_HOST)/bin/zstd -xf $(DL_DIR)/$(TOOLCHAIN_FILE) -C $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile/U-Boot
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TOOLCHAIN_PATH)/$(TOOLCHAIN_CROSS_COMPILE) \
|
||||
$(if $(DTC),DTC="$(DTC)") \
|
||||
$(UBOOT_MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) \
|
||||
$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin
|
||||
$(PKG_BUILD_DIR)/tools/mkenvimage -b -s $(ENV_SIZE) \
|
||||
-o $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot-env.bin \
|
||||
files/$(BUILD_VARIANT)-uEnv.txt
|
||||
endef
|
||||
|
||||
define Package/u-boot/install/default
|
||||
endef
|
||||
|
||||
$(eval $(call Download,uboot-qoriq-toolchain))
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
8
package/boot/uboot-qoriq/files/fsl_T4240RDB-nor-uEnv.txt
Normal file
8
package/boot/uboot-qoriq/files/fsl_T4240RDB-nor-uEnv.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
bootm_size=0x180000000
|
||||
loadaddr=0x2000000
|
||||
fwaddr=0xe8000000
|
||||
hwconfig=fsl_ddr:ctlr_intlv=3way_4KB,bank_intlv=auto;usb1:dr_mode=host,phy_type=utmi
|
||||
nor_boot=bootm $fwaddr
|
||||
bootargs=console=ttyS0,115200
|
||||
bootcmd=echo starting OpenWrt ...;run nor_boot
|
||||
bootdelay=3
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
bootm_size=0x180000000
|
||||
loadaddr=0x2000000
|
||||
hwconfig=fsl_ddr:ctlr_intlv=3way_4KB,bank_intlv=auto;usb1:dr_mode=host,phy_type=utmi
|
||||
sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
|
||||
bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd console=ttyS0,115200 mtdparts=fe8000000.nor:126m(firmware-nor),1m(cortina-ucode),128k(fman),128k(u-boot-env),768k(u-boot)
|
||||
bootcmd=echo starting OpeWwrt ...;run sd_boot
|
||||
bootdelay=3
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
From ec36a44809e22a60fc153a4078d35c83a2bf9676 Mon Sep 17 00:00:00 2001
|
||||
From: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
Date: Thu, 6 Oct 2022 15:18:38 +0200
|
||||
Subject: [PATCH] mpc85xx: adjust T4240RDB config for OpenWrt
|
||||
|
||||
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
---
|
||||
configs/T4240RDB_SDCARD_defconfig | 6 ++++--
|
||||
include/configs/T4240RDB.h | 6 +++++-
|
||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/configs/T4240RDB_SDCARD_defconfig
|
||||
+++ b/configs/T4240RDB_SDCARD_defconfig
|
||||
@@ -4,7 +4,7 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
|
||||
CONFIG_SPL_LIBGENERIC_SUPPORT=y
|
||||
CONFIG_SF_DEFAULT_SPEED=10000000
|
||||
CONFIG_ENV_SIZE=0x2000
|
||||
-CONFIG_ENV_OFFSET=0x100000
|
||||
+CONFIG_ENV_OFFSET=0x101000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="t4240rdb"
|
||||
CONFIG_SYS_MONITOR_LEN=786432
|
||||
CONFIG_SPL_MMC=y
|
||||
@@ -35,7 +35,7 @@ CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_RAMBOOT_PBL=y
|
||||
CONFIG_SYS_FSL_PBL_PBI="$(SRCTREE)/board/freescale/t4rdb/t4_pbi.cfg"
|
||||
CONFIG_SYS_FSL_PBL_RCW="$(SRCTREE)/board/freescale/t4rdb/t4_sd_rcw.cfg"
|
||||
-CONFIG_BOOTDELAY=10
|
||||
+CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_BOARD_SETUP=y
|
||||
CONFIG_OF_STDOUT_VIA_ALIAS=y
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
@@ -71,6 +71,7 @@ CONFIG_CMD_DHCP=y
|
||||
CONFIG_CMD_MII=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_EXT2=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
CONFIG_CMD_FAT=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
@@ -108,7 +109,8 @@ CONFIG_SPI_FLASH_SST=y
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PHYLIB_10G=y
|
||||
CONFIG_PHY_CORTINA=y
|
||||
-CONFIG_CORTINA_FW_ADDR=0x77f000
|
||||
+CONFIG_SYS_CORTINA_FW_IN_MMC=y
|
||||
+CONFIG_CORTINA_FW_ADDR=0x200000
|
||||
CONFIG_PHY_TERANETICS=y
|
||||
CONFIG_PHY_VITESSE=y
|
||||
CONFIG_DM_MDIO=y
|
||||
--- a/configs/T4240RDB_defconfig
|
||||
+++ b/configs/T4240RDB_defconfig
|
||||
@@ -26,7 +26,7 @@ CONFIG_SYS_FSL_NUM_CC_PLLS=5
|
||||
CONFIG_MP=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
-CONFIG_BOOTDELAY=10
|
||||
+CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_BOARD_SETUP=y
|
||||
CONFIG_OF_STDOUT_VIA_ALIAS=y
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
@@ -76,6 +76,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
|
||||
CONFIG_SYS_FLASH_EMPTY_INFO=y
|
||||
CONFIG_SYS_FLASH_CFI=y
|
||||
CONFIG_SYS_FLASH_QUIET_TEST=y
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x1000
|
||||
CONFIG_SYS_MAX_FLASH_SECT=1024
|
||||
CONFIG_SYS_MAX_FLASH_BANKS=2
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From 7041fc96942acca920699b354e956bc4966c9b00 Mon Sep 17 00:00:00 2001
|
||||
From: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
Date: Wed, 19 Nov 2025 11:58:10 +0100
|
||||
Subject: [PATCH] Revert "fsl: mxc: Drop legacy I2c"
|
||||
|
||||
This reverts commit 98dfa70f84f036c7423f1eddf00af8ea555fed8f.
|
||||
|
||||
It broke SDCARD boot in T4240RDB.
|
||||
|
||||
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
---
|
||||
drivers/ddr/fsl/main.c | 3 ++-
|
||||
drivers/i2c/mxc_i2c.c | 1 -
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/ddr/fsl/main.c
|
||||
+++ b/drivers/ddr/fsl/main.c
|
||||
@@ -111,7 +111,7 @@ static int ddr_i2c_read(DEV_TYPE *dev, u
|
||||
#if CONFIG_IS_ENABLED(DM_I2C)
|
||||
ret = dm_i2c_read(dev, 0, buf, len);
|
||||
#else
|
||||
- ret = 0;
|
||||
+ ret = i2c_read(dev->chip, addr, alen, buf, len);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
@@ -162,6 +162,7 @@ static void __get_spd(generic_spd_eeprom
|
||||
};
|
||||
dev = &ldev;
|
||||
|
||||
+ i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_FSL_DDR4
|
||||
--- a/drivers/i2c/mxc_i2c.c
|
||||
+++ b/drivers/i2c/mxc_i2c.c
|
||||
@@ -619,7 +619,6 @@ int enable_i2c_clk(unsigned char enable,
|
||||
__attribute__((weak, alias("__enable_i2c_clk")));
|
||||
|
||||
#if !CONFIG_IS_ENABLED(DM_I2C)
|
||||
-
|
||||
/*
|
||||
* Read data from I2C device
|
||||
*
|
||||
|
|
@ -5,9 +5,35 @@ touch /etc/config/ubootenv
|
|||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
platform_get_rootfs_device() {
|
||||
local majmin sys path
|
||||
|
||||
majmin="$(awk '$5=="/rom"{print $3; exit}' /proc/self/mountinfo 2>/dev/null)"
|
||||
[ -n "$majmin" ] || exit 1
|
||||
|
||||
sys="/sys/dev/block/$majmin"
|
||||
[ -e "$sys" ] || exit 1
|
||||
|
||||
path="$(readlink -f "$sys" 2>/dev/null)" || exit 1
|
||||
basename "$path"
|
||||
}
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
fsl,T4240RDB)
|
||||
local t4240_rootfs="$(platform_get_rootfs_device)"
|
||||
case "$t4240_rootfs" in
|
||||
mmcblk*)
|
||||
ubootenv_add_uci_config "/dev/mmcblk0" "0x101000" "0x2000" "0x1000"
|
||||
;;
|
||||
mtdblock*)
|
||||
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x2000" "0x20000"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
;;
|
||||
watchguard,firebox-m300)
|
||||
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x2000" "0x10000"
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue