U-Boot can be configured at compile-time to expect the environment at a set offset of e.g. the MMC.
Signed-off-by: Ahmad Fatoum <[email protected]> --- platforms/u-boot.in | 27 +++++++++++++++++++++++++++ rules/u-boot.make | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/platforms/u-boot.in b/platforms/u-boot.in index bcb78cfc3f5a..4e19d09c74f5 100644 --- a/platforms/u-boot.in +++ b/platforms/u-boot.in @@ -35,6 +35,33 @@ config U_BOOT_CONFIG "yourbox_config". See Uboot's main Makefile for possible configuration targets. +config U_BOOT_ENV + prompt "Generate U-Boot environment binary image" + bool + help + Use U-Boot's mkenvimage to generate an U-Boot environment binary image + (uboot-env.bin) out of a text file (uboot-env.txt) + with entries of the form: + key1=value1 + key2=value2 + +if U_BOOT_ENV + +config U_BOOT_ENV_IMAGE_SIZE + prompt "U-Boot environment image size" + string + default '0x2000' + help + The output image size + +config U_BOOT_ENV_FLASH_REDUNDANT + prompt "Environment has multiple copies in flash" + bool + help + Whether there are multiple copies of the U-Boot environment in flash + +endif + comment "target install" config U_BOOT_INSTALL_SREC diff --git a/rules/u-boot.make b/rules/u-boot.make index d9bcdf5ca64d..39228dbcaf9c 100644 --- a/rules/u-boot.make +++ b/rules/u-boot.make @@ -33,6 +33,16 @@ U_BOOT_CONFIG := $(call ptx/in-platformconfigdir, \ # Prepare # ---------------------------------------------------------------------------- +U_BOOT_ENV_TXT := $(call ptx/in-platformconfigdir, uboot-env.txt) +U_BOOT_ENV_BIN := $(IMAGEDIR)/uboot-env.bin + +ifdef PTXCONF_ENDIAN_BIG + U_BOOT_ENV_FLAGS += -b +endif +ifdef PTXCONF_U_BOOT_ENV_FLASH_REDUNDANT + U_BOOT_ENV_FLAGS += -r +endif + U_BOOT_WRAPPER_BLACKLIST := \ TARGET_HARDEN_RELRO \ TARGET_HARDEN_BINDNOW \ @@ -64,6 +74,23 @@ endif $(STATEDIR)/u-boot.prepare: $(U_BOOT_CONFIG) +# ---------------------------------------------------------------------------- +# Compile +# ---------------------------------------------------------------------------- + +$(STATEDIR)/u-boot.compile: + @$(call targetinfo) + @+cd $(U_BOOT_DIR) && $(U_BOOT_PATH) \ + $(MAKE) $(U_BOOT_MAKE_OPT) +ifdef PTXCONF_U_BOOT_ENV + @$(U_BOOT_DIR)/tools/mkenvimage \ + $(U_BOOT_ENV_FLAGS) -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \ + -o $(U_BOOT_DIR)/uboot-env.bin \ + $(U_BOOT_ENV_TXT) +endif + @$(call touch) + + # ---------------------------------------------------------------------------- # Install # ---------------------------------------------------------------------------- @@ -102,6 +129,10 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL @install -v -D -m644 $(U_BOOT_DIR)/u-boot-with-spl-pbl.bin \ $(IMAGEDIR)/u-boot-with-spl-pbl.bin endif + +ifdef PTXCONF_U_BOOT_ENV + @install -v -D -m644 $(U_BOOT_DIR)/uboot-env.bin $(U_BOOT_ENV_BIN) +endif @$(call touch) # ---------------------------------------------------------------------------- @@ -114,6 +145,7 @@ $(STATEDIR)/u-boot.clean: @rm -vf $(IMAGEDIR)/u-boot.bin $(IMAGEDIR)/u-boot.srec @rm -vf $(IMAGEDIR)/u-boot.elf $(IMAGEDIR)/u-boot.imx @rm -vf $(IMAGEDIR)/u-boot-dtb.bin $(IMAGEDIR)/u-boot-with-spl-pbl.bin + @rm -vf $(U_BOOT_ENV_BIN) # ---------------------------------------------------------------------------- # oldconfig / menuconfig -- 2.19.0 _______________________________________________ ptxdist mailing list [email protected]
