u-boot: cleanups on arm, load from more media

* Attempt to find haiku loader on mmc,nvme,virtio
* Fixes automatic boot under u-boot on qemu
* Remove boot.scr to ensure it's regenerated each build
* Remove obsolete HAIKU_BOARD_SDIMAGE_UBOOT_UENV

Change-Id: I60cd518ec69e408ddbd7ea17371f4f4f56fa7f7b
This commit is contained in:
Alexander von Gluck IV 2020-01-20 16:22:18 -06:00
parent cc0226fad0
commit 1aab1c0e28
2 changed files with 17 additions and 6 deletions

View File

@ -258,12 +258,22 @@ rule KernelArchitectureSetup architecture
# Modern u-boot fill in sane addresses for us.
# Leverage the built-in fdt dtb for this board, unless a custom dtb is specified in uEnv.txt
# We skip uEnv.txt on virtio due to an unknown lockup in qemu around it.
HAIKU_MMC_UBOOT_SCRIPT = "\
test -e mmc 0 uEnv.txt && fatload mmc 0 ${scriptaddr} uEnv.txt && env import -t ${scriptaddr} ${filesize} \
fatload mmc 0 ${kernel_addr_r} haiku_loader.ub \
fatload mmc 0 ${ramdisk_addr_r} haiku_floppyboot.ub \
env exists dtb && fatload mmc 0 ${fdt_addr_r} ${dtb} && fdt addr ${fdt_addr_r} && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} \
fdt addr ${fdtcontroladdr} && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdtcontroladdr}" ;
echo \"Haiku u-boot script entry\" \
test -e mmc 0 haiku_loader.ub && setenv media mmc \
test -e virtio 0 haiku_loader.ub && setenv media virtio \
test -e nvme 0 haiku_loader.ub && setenv media nvme \
env exists media && echo \"Found Haiku on ${media} 0!\" \
env exists media || echo \"ERROR: Unable to locate Haiku loader on any media!\" && exit \
test ${media} != virtio && test -e ${media} 0 uEnv.txt && fatload ${media} 0 ${scriptaddr} uEnv.txt && env import -t ${scriptaddr} ${filesize} \
echo \"Loading haiku_loader...\" \
fatload ${media} 0 ${kernel_addr_r} haiku_loader.ub \
echo \"Loading haiku_floppyboot...\" \
fatload ${media} 0 ${ramdisk_addr_r} haiku_floppyboot.ub \
env exists dtb && echo \"Loading DTB...\" && fatload ${media} 0 ${fdt_addr_r} ${dtb} && fdt addr ${fdt_addr_r} && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} \
echo \"Booting Haiku!\" \
fdt addr ${fdtcontroladdr} && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdtcontroladdr}" ;
case arm64 :
HAIKU_KERNEL_PLATFORM ?= efi ;

View File

@ -39,7 +39,7 @@ actions BuildUBootSDImage1
MTOOLSRC=$(1).mtools mformat -L 32 -v "HAIKU" i:
# generate u-boot environment variables
echo '$(HAIKU_BOARD_SDIMAGE_UBOOT_UENV)' > uEnv.txt
echo 'os=haiku' > uEnv.txt
# populate
$(CP) $(2[2-2]) haiku_loader.ub
MTOOLSRC=$(1).mtools mcopy haiku_loader.ub i:
@ -58,6 +58,7 @@ actions BuildUBootSDImage1
# cleanup
$(RM) $(1).mtools
$(RM) uEnv.txt
$(RM) boot.scr
# Add haiku bootstrap partition to MMC image
cat $(2[0]) >> $(1)
}