]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
uboot: add support for generating U-Boot boot scripts
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 21 Jun 2017 21:41:42 +0000 (23:41 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Thu, 22 Jun 2017 11:02:47 +0000 (13:02 +0200)
More and more of our defconfigs need to generate a U-Boot boot
script. It's a simple call to mkimage, but we already have 12
instances of this logic in board/, and there are patch series waiting
in patchwork adding 3 more boards that need this.

So let's add an option in the U-Boot package to generate such a boot
script image easily.

Note that we assume a single script needs to be generated, and the
output file name is boot.scr. The only platform for which it seems to
not be the case are the Boundary Devices platforms: they generate two
boot scripts, 6x_bootscript and 6x_upgrade, but they are anyway
installed inside TARGET_DIR, not BINARIES_DIR.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
boot/uboot/Config.in
boot/uboot/uboot.mk

index 547822d0a982479374141120a527fda5a76bee09..52f3a326c6fafe41c3899d501535cfce87f7075c 100644 (file)
@@ -407,6 +407,22 @@ config BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT
 
 endif # BR2_TARGET_UBOOT_ENVIMAGE
 
+config BR2_TARGET_UBOOT_BOOT_SCRIPT
+       bool "Generate a U-Boot boot script"
+       help
+         Generate a U-Boot boot script, given a file listing U-Boot
+         commands to be executed at boot time. The generated boot
+         script will be called 'boot.scr'.
+
+if BR2_TARGET_UBOOT_BOOT_SCRIPT
+
+config BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE
+       string "U-Boot boot script source"
+       help
+         Source file to generate the U-Boot boot script.
+
+endif
+
 if BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
 
 config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
index 904d45a4042f8fb5fe72fe8c7468cea79f6c8488..0f423a8210f0538d259899901621c30efbac7600 100644 (file)
@@ -235,6 +235,10 @@ define UBOOT_INSTALL_IMAGES_CMDS
                        $(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
                        $(if $(filter BIG,$(BR2_ENDIAN)),-b) \
                        -o $(BINARIES_DIR)/uboot-env.bin -)
+       $(if $(BR2_TARGET_UBOOT_BOOT_SCRIPT),
+               $(HOST_DIR)/usr/bin/mkimage -C none -A $(MKIMAGE_ARCH) -T script \
+                       -d $(call qstrip,$(BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE)) \
+                       $(BINARIES_DIR)/boot.scr)
 endef
 
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
@@ -298,6 +302,15 @@ endif
 UBOOT_DEPENDENCIES += host-uboot-tools
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_BOOT_SCRIPT),y)
+ifeq ($(BR_BUILDING),y)
+ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE)),)
+$(error Please define a source file for Uboot boot script (BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE setting))
+endif
+endif
+UBOOT_DEPENDENCIES += host-uboot-tools
+endif
+
 ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy)
 
 #