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>
This commit is contained in:
parent
97bd6fe8d4
commit
9f739dd2e8
@ -256,25 +256,6 @@ rule KernelArchitectureSetup architecture
|
||||
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
|
||||
HAIKU_BOOT_LOADER_BASE ?= 0x1000000 ;
|
||||
|
||||
# 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 = "\
|
||||
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 ;
|
||||
|
||||
|
19
data/boot/u-boot/boot-arm.scr.txt
Normal file
19
data/boot/u-boot/boot-arm.scr.txt
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
@ -141,22 +141,23 @@ actions BuildUImage1
|
||||
mkimage $(MKIMAGE_ARGS) -d $(>:J=$(colon)) $(<)
|
||||
}
|
||||
|
||||
rule BuildUImageScript script : content
|
||||
#
|
||||
# Given a txt, generate a binary u-boot script
|
||||
#
|
||||
rule BuildUImageScript script : source
|
||||
{
|
||||
LocalClean clean : $(script) ;
|
||||
SCRIPTCONTENT on $(script) = $(content) ;
|
||||
SCRIPTNAME on $(script) = $(script) ;
|
||||
FAKEOS on $(script) = "linux" ;
|
||||
BuildUImageScript1 $(script) : $(content) ;
|
||||
Depends $(script) : $(source) ;
|
||||
LocalClean clean : $(script) ;
|
||||
SCRIPTNAME on $(script) = $(script) ;
|
||||
FAKEOS on $(script) = "linux" ;
|
||||
BuildUImageScript1 $(script) : $(source) ;
|
||||
}
|
||||
|
||||
actions BuildUImageScript1
|
||||
{
|
||||
rm -f $(<) $(<).txt
|
||||
echo '$(SCRIPTCONTENT)' > $(<).txt
|
||||
mkimage -A $(TARGET_ARCH) -O $(FAKEOS) -T script -C none -n $(SCRIPTNAME) \
|
||||
-d $(<).txt $(<)
|
||||
rm -f $(<).txt
|
||||
rm -f $(1)
|
||||
mkimage -A $(TARGET_ARCH) -O $(FAKEOS) -T script -C none -n $(SCRIPTNAME) \
|
||||
-d $(2) $(1)
|
||||
}
|
||||
|
||||
# the bootsector on haiku_loader.amiga_m68k must be checksummed
|
||||
@ -319,10 +320,12 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
case efi :
|
||||
BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
if $(TARGET_ARCH) = arm || $(TARGET_ARCH) = arm64 {
|
||||
# These platforms sometimes need u-boot to get them going
|
||||
BuildUImage haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) : haiku-floppyboot.tgz :
|
||||
-A $(TARGET_ARCH) -O linux -T ramdisk -C none
|
||||
-n 'Haiku $(TARGET_KERNEL_ARCH) floppyboot' ;
|
||||
BuildUImageScript boot.scr : $(HAIKU_MMC_UBOOT_SCRIPT) ;
|
||||
BuildUImageScript boot.scr
|
||||
: [ FDirName $(HAIKU_TOP) data boot u-boot boot-$(TARGET_ARCH).scr.txt ] ;
|
||||
}
|
||||
|
||||
case bios_ia32 :
|
||||
@ -344,7 +347,8 @@ for platform in [ MultiBootSubDirSetup ] {
|
||||
BuildUImage haiku-floppyboot.tgz.$(TARGET_BOOT_PLATFORM) : haiku-floppyboot.tgz :
|
||||
-A $(TARGET_ARCH) -O linux -T ramdisk -C none
|
||||
-n 'Haiku $(TARGET_KERNEL_ARCH) floppyboot' ;
|
||||
BuildUImageScript boot.scr : $(HAIKU_MMC_UBOOT_SCRIPT) ;
|
||||
BuildUImageScript boot.scr
|
||||
: [ FDirName $(HAIKU_TOP) data boot u-boot boot-$(TARGET_ARCH).scr.txt ] ;
|
||||
|
||||
case amiga_m68k :
|
||||
BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ;
|
||||
|
Loading…
Reference in New Issue
Block a user