u-boot: Generate boot.scr for mmc

* This gives us a solid automatic entry point to u-boot
* A uEnv.txt specifies the fdt file name
* This should work on any modern u-boot for most architectures
* Non-mmc targets will likely need some work

Change-Id: I9a00316a213a15e85d3f2e18574d64920d9bdb76
This commit is contained in:
Alexander von Gluck IV 2018-05-19 20:03:00 -05:00
parent 3f9e3b0a62
commit 95daec1061

View File

@ -34,6 +34,16 @@ local libFDTSources =
# and we also fake a netbsd loader anyway.
local uImageFakeOS = "netbsd" ;
# Modern u-boot fill in sane addresses for us.
# We only need to fill in the FDT dtb
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.tgz.ub \
fatload mmc 0 ${fdt_addr_r} ${dtb} \
fdt addr ${fdt_addr_r} \
bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}" ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
# First build the non arch dependent parts
@ -242,10 +252,7 @@ BuildUImage haiku_loader.ub : haiku_loader :
-a $(HAIKU_BOOT_LOADER_BASE) -e $(HAIKU_BOOT_LOADER_ENTRY_LINUX)
-n 'Haiku $(TARGET_KERNEL_ARCH) loader' ;
if $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) {
BuildUImageScript $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) :
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT) ;
}
BuildUImageScript boot.scr : $(HAIKU_MMC_UBOOT_SCRIPT) ;
# flash image targets
@ -266,7 +273,7 @@ Depends haiku-flash-uimage : haiku-$(TARGET_KERNEL_ARCH)_flash_image_uimage.img
# SD/mmc image targets
BuildUBootSDImage haiku-$(TARGET_KERNEL_ARCH).mmc :
$(HAIKU_IMAGE) haiku_loader.ub haiku-floppyboot.tgz.ub ;
$(HAIKU_IMAGE) haiku_loader.ub haiku-floppyboot.tgz.ub boot.scr ;
BlessSDImage haiku-$(TARGET_KERNEL_ARCH).mmc ;
NotFile haiku-mmc-image ;
Depends haiku-mmc-image : haiku-$(TARGET_KERNEL_ARCH).mmc ;