rk3576: fix booting from boot.scr

This commit is contained in:
amazingfate
2024-11-02 01:02:14 +08:00
committed by Jianfeng Liu
parent bfea917451
commit b451d4f3e3
6 changed files with 153 additions and 4 deletions

View File

@@ -0,0 +1,86 @@
# DO NOT EDIT THIS FILE
#
# Please edit /boot/armbianEnv.txt to set supported parameters
#
setenv load_addr "0x48000000"
setenv overlay_error "false"
# default values
setenv rootdev "/dev/mmcblk0p1"
setenv verbosity "1"
setenv console "both"
setenv bootlogo "false"
setenv rootfstype "ext4"
setenv docker_optimizations "on"
setenv earlycon "off"
test -n "${distro_bootpart}" || distro_bootpart=1
echo "Boot script loaded from ${devtype} ${devnum}:${distro_bootpart}"
if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}armbianEnv.txt; then
load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}armbianEnv.txt
env import -t ${load_addr} ${filesize}
fi
if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi
if test "${earlycon}" = "on"; then setenv consoleargs "earlycon ${consoleargs}"; fi
if test "${bootlogo}" = "true"; then
setenv consoleargs "splash plymouth.ignore-serial-consoles ${consoleargs}"
else
setenv consoleargs "splash=verbose ${consoleargs}"
fi
# get PARTUUID of first partition on SD/eMMC the boot script was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:${distro_bootpart} partuuid; fi
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}"
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory"; fi
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
elif load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
done
for overlay_file in ${user_overlays}; do
if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then
echo "Applying user provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
done
if test "${overlay_error}" = "true"; then
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
else
if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr; then
load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${load_addr}
fi
if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}fixup.scr; then
load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}fixup.scr
echo "Applying user provided fixup script (fixup.scr)"
source ${load_addr}
fi
fi
echo "Trying 'kaslrseed' command... Info: 'Unknown command' can be safely ignored since 'kaslrseed' does not apply to all boards."
kaslrseed # @TODO: This gives an error (Unknown command ' kaslrseed ' - try 'help') on many devices since CONFIG_CMD_KASLRSEED is not enabled
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

View File

@@ -14,11 +14,16 @@ BOOTBRANCH='branch:next-dev-v2024.03' # Always use same version as rk3588, they
BOOTPATCHDIR="legacy/u-boot-radxa-rk35xx" BOOTPATCHDIR="legacy/u-boot-radxa-rk35xx"
OVERLAY_PREFIX='rk35xx' OVERLAY_PREFIX='rk35xx'
if [[ "$BOOT_SOC" == "rk3576" ]]; then
BOOTSCRIPT='boot-rk3576.cmd:boot.cmd'
else
BOOTSCRIPT='boot-rk35xx.cmd:boot.cmd'
fi
case $BRANCH in case $BRANCH in
legacy) legacy)
display_alert "WARNING: 'legacy' branch" "is deprecated and slated for removal. Please switch to another branch unless you know what you're doing :)" "wrn" display_alert "WARNING: 'legacy' branch" "is deprecated and slated for removal. Please switch to another branch unless you know what you're doing :)" "wrn"
BOOTSCRIPT='boot-rk35xx.cmd:boot.cmd'
BOOTDIR='u-boot-rockchip64' BOOTDIR='u-boot-rockchip64'
declare -g KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel. declare -g KERNEL_MAJOR_MINOR="5.10" # Major and minor versions of this kernel.
declare -g -i KERNEL_GIT_CACHE_TTL=120 # 2 minutes; this is a high-traffic repo declare -g -i KERNEL_GIT_CACHE_TTL=120 # 2 minutes; this is a high-traffic repo
@@ -28,7 +33,6 @@ case $BRANCH in
;; ;;
vendor) vendor)
BOOTSCRIPT='boot-rk35xx.cmd:boot.cmd'
BOOTDIR='u-boot-rockchip64' BOOTDIR='u-boot-rockchip64'
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
declare -g -i KERNEL_GIT_CACHE_TTL=120 # 2 minutes; this is a high-traffic repo declare -g -i KERNEL_GIT_CACHE_TTL=120 # 2 minutes; this is a high-traffic repo

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Stephen <stephen@vamrs.com>
Date: Mon, 8 Nov 2021 14:30:00 +0800
Subject: cmd: source: fix the error that the command source failed to execute
Signed-off-by: Stephen <stephen@vamrs.com>
---
cmd/source.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/source.c b/cmd/source.c
index 111111111111..222222222222 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -87,7 +87,7 @@ source (ulong addr, const char *fit_uname)
* past the zero-terminated sequence of image lengths to get
* to the actual image data
*/
- while (*data++ != IMAGE_PARAM_INVAL);
+ while (*data++);
break;
#endif
#if defined(CONFIG_FIT)
--
Armbian

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date: Mon, 1 Aug 2022 15:17:49 +0200
Subject: cmd: inconsistent return type of command_process()
The declarations in the header and in the implementation must match.
Reported-by: Sergei Antonov <saproj@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
include/command.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/command.h b/include/command.h
index 111111111111..222222222222 100644
--- a/include/command.h
+++ b/include/command.h
@@ -137,10 +137,10 @@ enum command_ret_t {
* is left unchanged.
* @param ticks If ticks is not null, this function set it to the
* number of ticks the command took to complete.
- * @return 0 if the command succeeded, 1 if it failed
+ * @return 0 if command succeeded, else non-zero (CMD_RET_...)
*/
-int cmd_process(int flag, int argc, char * const argv[],
- int *repeatable, unsigned long *ticks);
+enum command_ret_t cmd_process(int flag, int argc, char *const argv[],
+ int *repeatable, unsigned long *ticks);
void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
--
Armbian

View File

@@ -189,7 +189,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x2207
CONFIG_USB_GADGET_PRODUCT_NUM=0x350e CONFIG_USB_GADGET_PRODUCT_NUM=0x350e
CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_UFS=y CONFIG_UFS=y
CONFIG_ROCKCHIP_UFS=y
CONFIG_DM_VIDEO=y CONFIG_DM_VIDEO=y
CONFIG_DISPLAY=y CONFIG_DISPLAY=y
CONFIG_DRM_ROCKCHIP=y CONFIG_DRM_ROCKCHIP=y

View File

@@ -189,7 +189,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x2207
CONFIG_USB_GADGET_PRODUCT_NUM=0x350e CONFIG_USB_GADGET_PRODUCT_NUM=0x350e
CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_UFS=y CONFIG_UFS=y
CONFIG_ROCKCHIP_UFS=y
CONFIG_DM_VIDEO=y CONFIG_DM_VIDEO=y
CONFIG_DISPLAY=y CONFIG_DISPLAY=y
CONFIG_DRM_ROCKCHIP=y CONFIG_DRM_ROCKCHIP=y