mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 15:56:49 +00:00
9a82076592
U-Boot already knows where it found the boot.scr, and figuring out the partition UUID becomes trivial at this point. This change allows booting OpenWrt from whatever storage it has been flashed to: SD card, eMMC, USB disk or SATA disk. Signed-off-by: Josua Mayer <josua.mayer97@gmail.com> [replace lede with openwrt, redact commit message] Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
24 lines
852 B
Plaintext
24 lines
852 B
Plaintext
# Standard Boot-Script
|
|
# use only well-known variable names provided by U-Boot Distro boot
|
|
# This script assumes that there is a boot partition,
|
|
# and that the root partition is always the next one.
|
|
|
|
# rootfs is always on the next partition
|
|
setexpr openwrt_rootpart ${distro_bootpart} + 1
|
|
|
|
# figure out partition uuid to pass to the kernel as root=
|
|
part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid
|
|
|
|
# generate bootargs (rootfs)
|
|
setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait
|
|
|
|
# add console= option to bootargs, if any
|
|
if test -n "${console}"; then
|
|
setenv bootargs ${bootargs} console=${console}
|
|
fi
|
|
|
|
echo "Booting Linux with ${bootargs}"
|
|
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile}
|
|
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage
|
|
bootz ${kernel_addr_r} - ${fdt_addr_r}
|