opi5-efi/boot.cmd

61 lines
2.6 KiB
Batchfile
Raw Normal View History

2023-10-04 23:55:36 +00:00
setenv load_addr "0x9000000"
setenv overlay_error "false"
# default values
2023-10-05 00:00:41 +00:00
setenvrootdev
setenvunamer
2023-10-05 00:19:25 +00:00
setenv envfile "${prefix}uEnv.txt-${unamer}"
setenv dtbdir "${prefix}dtb-${unamer}"
2023-10-04 23:55:36 +00:00
echo "Boot script loaded from ${devtype} ${devnum}"
2023-10-05 00:20:38 +00:00
echo "Testing for existence ${devtype} ${devnum} ${envfile}"
2023-10-05 00:19:25 +00:00
if test -e ${devtype} ${devnum} ${envfile}; then
2023-10-05 00:20:38 +00:00
echo "Loading ${devtype} ${devnum} ${load_addr} ${envfile}"
2023-10-05 00:19:25 +00:00
load ${devtype} ${devnum} ${load_addr} ${envfile}
2023-10-05 00:20:38 +00:00
echo "Loaded ${devtype} ${devnum} ${envfile} into ${load_addr} filesize ${filesize}"
echo "Importing into environment"
2023-10-05 00:19:25 +00:00
env import -t ${load_addr} ${filesize}
echo "${envfile} imported into environment"
2023-10-04 23:55:36 +00:00
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
2023-10-05 00:19:25 +00:00
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd-${unamer}
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}vmlinuz-${unamer}
2023-10-04 23:55:36 +00:00
2023-10-05 00:19:25 +00:00
load ${devtype} ${devnum} ${fdt_addr_r} ${dtbdir}/${fdtfile}
2023-10-04 23:55:36 +00:00
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
2023-10-05 00:19:25 +00:00
if load ${devtype} ${devnum} ${load_addr} ${dtbdir}/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} ${dtbdir}/rockchip/overlay/${overlay_file}.dtbo; then
echo "Applying kernel provided DT overlay ${overlay_file}.dtbo"
fdt apply ${load_addr} || setenv overlay_error "true"
fi
2023-10-04 23:55:36 +00:00
done
for overlay_file in ${user_overlays}; do
2023-10-05 00:19:25 +00:00
if load ${devtype} ${devnum} ${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
2023-10-04 23:55:36 +00:00
done
if test "${overlay_error}" = "true"; then
2023-10-05 00:19:25 +00:00
echo "Error applying DT overlays, restoring original DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${dtbdir}/${fdtfile}
2023-10-04 23:55:36 +00:00
else
2023-10-05 00:19:25 +00:00
if load ${devtype} ${devnum} ${load_addr} ${dtbdir}/rockchip/overlay/${overlay_prefix}-fixup.scr; then
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
echo "Applying user provided fixup script (fixup.scr)"
source ${load_addr}
fi
2023-10-04 23:55:36 +00:00
fi
kaslrseed
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}