opi5-efi/boot.cmd

86 lines
3.3 KiB
Batchfile
Raw Normal View History

2023-10-07 15:03:39 +00:00
# DO NOT EDIT THIS FILE
#
2023-10-07 15:11:22 +00:00
# Please edit /boot/uEnv.txt to set supported parameters
2023-10-07 15:03:39 +00:00
#
2023-10-04 23:55:36 +00:00
setenv load_addr "0x9000000"
setenv overlay_error "false"
# default values
2023-10-07 15:03:39 +00:00
setenv verbosity "1"
setenv console "both"
setenv bootlogo "false"
setenv rootfstype "ext4"
setenv docker_optimizations "on"
setenv earlycon "off"
2023-10-08 08:00:58 +00:00
setenv devtype "mmc"
2023-10-07 15:11:22 +00:00
setenvrootdev
setenvuname_r
2023-10-04 23:55:36 +00:00
2023-10-08 08:00:58 +00:00
if test -e ${devtype} ${devnum}:1 uEnv.txt; then
load ${devtype} ${devnum}:1 ${load_addr} uEnv.txt
2023-10-07 15:03:39 +00:00
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}"
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-07 15:03:39 +00:00
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 swapaccount=1"; fi
2023-10-04 23:55:36 +00:00
2023-10-08 06:43:34 +00:00
#load ${devtype} ${devnum}:2 ${ramdisk_addr_r} uInitrd
#load ${devtype} ${devnum}:2 ${kernel_addr_r} Image
load ${devtype} ${devnum}:2 ${ramdisk_addr_r} uInitrd-${uname_r}
2023-10-08 07:47:46 +00:00
load ${devtype} ${devnum}:2 ${kernel_addr_r} vmlinuz-${uname_r}.old
2023-10-07 15:03:39 +00:00
2023-10-08 06:43:34 +00:00
load ${devtype} ${devnum}:2 ${fdt_addr_r} dtb-${uname_r}/${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-08 06:43:34 +00:00
if load ${devtype} ${devnum}:2 ${load_addr} dtb-${uname_r}/rockchip/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
2023-10-07 15:03:39 +00:00
echo "Applying kernel provided DT overlay ${overlay_prefix}-${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-08 06:43:34 +00:00
if load ${devtype} ${devnum}:2 ${load_addr} overlay-user/${overlay_file}.dtbo; then
2023-10-07 15:03:39 +00:00
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-07 15:03:39 +00:00
echo "Error applying DT overlays, restoring original DT"
2023-10-08 06:43:34 +00:00
load ${devtype} ${devnum}:2 ${fdt_addr_r} dtb-${uname_r}/${fdtfile}
2023-10-04 23:55:36 +00:00
else
2023-10-08 06:43:34 +00:00
if load ${devtype} ${devnum}:2 ${load_addr} dtb-${uname_r}/rockchip/overlay/${overlay_prefix}-fixup.scr; then
2023-10-07 15:03:39 +00:00
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${load_addr}
fi
2023-10-08 06:43:34 +00:00
if test -e ${devtype} ${devnum}:2 fixup.scr; then
load ${devtype} ${devnum}:2 ${load_addr} fixup.scr
2023-10-07 15:03:39 +00:00
echo "Applying user provided fixup script (fixup.scr)"
source ${load_addr}
fi
fi
if test "${ethernet_phy}" = "rtl8211f"; then
fdt set /ethernet@ff540000 tx_delay <0x24>
fdt set /ethernet@ff540000 rx_delay <0x18>
2023-10-04 23:55:36 +00:00
fi
2023-10-07 15:03:39 +00:00
2023-10-04 23:55:36 +00:00
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
2023-10-07 15:03:39 +00:00
# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr