haiku/data/boot/u-boot/boot-arm.scr.txt
Alexander von Gluck IV 9f739dd2e8 u-boot/arm: Break script out of Jamfile. Add EFI support.
* boot.scr was growing past Jam MAXLINE and was causing segfaults
* Break out to tree, data/boot could be used for other arches
* boot.scr is getting a bit complex, but supports the old
  u-boot haiku_loader, as well as u-boot starting our EFI loader.

Change-Id: I93a3167ab0bc78747c1d70fedd08595e9ac89662
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2963
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-29 16:18:32 +00:00

20 lines
1.5 KiB
Plaintext

echo "Haiku u-boot script entry"
test -e mmc 0 uEnv.txt && setenv media mmc
test -e virtio 0 uEnv.txt && setenv media virtio
test -e nvme 0 uEnv.txt && setenv media nvme
env exists media || echo "ERROR: Unable to locate uEnv.txt on any known media!" && exit
test -e ${media} 0 uEnv.txt && fatload ${media} 0 ${scriptaddr} uEnv.txt && env import -t ${scriptaddr} ${filesize}
env exists loader || echo "ERROR: uEnv.txt doesn't specify bootloader!" && exit
env exists platform || echo "ERROR: uEnv.txt doesn't specify platform!" && exit
echo "uEnv.txt says to look for ${platform} bootloader named ${loader} on ${media} 0!"
test -e ${media} 0 ${loader} && echo "Found ${loader} on ${media} 0!"
echo "Loading bootloader..."
fatload ${media} 0 ${kernel_addr_r} ${loader}
test -e ${media} 0 haiku_floppyboot.ub && fatload ${media} 0 ${ramdisk_addr_r} haiku_floppyboot.ub
env exists dtb && echo "Using custom DTB..." && fatload ${media} 0 ${fdt_addr_r} ${dtb} && fdt addr ${fdt_addr_r}
env exists dtb || echo "Using internal DTB..." && fdt addr ${fdtcontroladdr}
test "${platform}" = "efi" && echo "Launching EFI loader..." && bootefi ${kernel_addr_r}
test "${platform}" = "u-boot" && env exists dtb && echo "Launching ub loader..." && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdtcontroladdr}
test "${platform}" = "u-boot" && env exists dtb || echo "Launching ub loader (w/custom fdt)..." && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
echo "Haiku u-boot script fell through!" && exit