Skip to content

Commit

Permalink
bootscript: rk3588-legacy: sync with boot-rockchip64.cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingfate authored and igorpecovnik committed Oct 5, 2024
1 parent be47af9 commit 94cf4f4
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions config/bootscripts/boot-rk3588-legacy.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ setenv rootfstype "ext4"
setenv docker_optimizations "on"
setenv earlycon "off"

echo "Boot script loaded from ${devtype} ${devnum}"
test -n "${distro_bootpart}" || distro_bootpart=1

echo "Testing for existence ${devtype} ${devnum} ${prefix}armbianEnv.txt ..."
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then
echo "Found ${devtype} ${devnum} ${prefix}armbianEnv.txt - loading ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt ..."
load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt
echo "Loaded environment from ${devtype} ${devnum} ${prefix}armbianEnv.txt into ${load_addr} filesize ${filesize}..."
echo "Importing into environment ..."
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}
echo "armbianEnv.txt imported into environment"
fi

if test "${logo}" = "disabled"; then setenv logo "logo.nologo"; fi
Expand All @@ -38,44 +35,44 @@ else
fi

# get PARTUUID of first partition on SD/eMMC the boot script was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc ${devnum}:1 partuuid; fi
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} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image

load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
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} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
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} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_file}.dtbo; then
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} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then
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} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
else
if test -e ${devtype} ${devnum} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr; then
load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr
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} ${prefix}fixup.scr; then
load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr
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
Expand Down

0 comments on commit 94cf4f4

Please sign in to comment.