uboot: integrate mkenvimage
authorArnaud Rébillout <rebillout@syscom.ch>
Thu, 20 Dec 2012 02:47:18 +0000 (02:47 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 24 Mar 2013 19:49:15 +0000 (20:49 +0100)
This commit provides configuration options to automatically generate a
binary environment image for U-Boot.
Two options are available (and mandatory):
 * the location of a text file describing U-Boot environment.
 * the size of the environment.

[Peter: fix Config.in indentation + typo]
Signed-off-by: Arnaud Rébillout <rebillout@syscom.ch>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
boot/uboot/Config.in
boot/uboot/uboot.mk

index d22e23bd72e1803a0420e7c89347aa10b1728eb5..bc5ce19daa2ab238929dafca54530edc5d04cc0b 100644 (file)
@@ -212,4 +212,27 @@ config BR2_TARGET_UBOOT_SPL_NAME
          u-boot build. For most platform it is u-boot-spl.bin
          but not always. It is MLO on OMAP for example.
 
+menuconfig BR2_TARGET_UBOOT_ENVIMAGE
+       bool "Environment image"
+       help
+         Generate a valid binary environment image from a text file
+         describing the key=value pairs of the environment.
+
+         The environment image will be called uboot-env.bin.
+
+if BR2_TARGET_UBOOT_ENVIMAGE
+
+config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
+       string "Source file for environment"
+       help
+         Text file describing the environment.
+
+config BR2_TARGET_UBOOT_ENVIMAGE_SIZE
+       string "Size of environment"
+       help
+         Size of envronment, can be prefixed with 0x for hexadecimal
+         values.
+
+endif # BR2_TARGET_UBOOT_ENVIMAGE
+
 endif # BR2_TARGET_UBOOT
index ea77259d10de9b241909fb08dd652ad4d23f1333..c337e75527cc641480f88d1d0c9546a5a71f0355 100644 (file)
@@ -104,6 +104,9 @@ define UBOOT_INSTALL_IMAGES_CMDS
        cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/
        $(if $(BR2_TARGET_UBOOT_SPL),
                cp -dpf $(@D)/$(BR2_TARGET_UBOOT_SPL_NAME) $(BINARIES_DIR)/)
+       $(if $(BR2_TARGET_UBOOT_ENVIMAGE),
+               $(HOST_DIR)/usr/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
+               -o $(BINARIES_DIR)/uboot-env.bin $(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE))
 endef
 
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
@@ -125,6 +128,19 @@ UBOOT_POST_BUILD_HOOKS += UBOOT_BUILD_OMAP_IFT
 UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_INSTALL_OMAP_IFT_IMAGE
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
+# we NEED a environment settings unless we're at make source
+ifeq ($(filter source,$(MAKECMDGOALS)),)
+ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
+$(error Please define a source file for Uboot environment (BR2_TARGET_UBOOT_ENVIMAGE_SOURCE setting))
+endif
+ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SIZE)),)
+$(error Please provide Uboot environment size (BR2_TARGET_UBOOT_ENVIMAGE_SIZE setting))
+endif
+endif
+UBOOT_DEPENDENCIES += host-uboot-tools
+endif
+
 $(eval $(generic-package))
 
 ifeq ($(BR2_TARGET_UBOOT),y)