[U-Boot] Building u-boot.imx and SPL simultaneously

Petr Kulhavy brain at jikos.cz
Fri Sep 2 18:46:29 CEST 2016


Hi,

I'm facing a problem that the iMX Makefile does not allow to build 
u-boot.imx and the SPL binary simultaneously. This would be useful for 
generating images for flash and for a serial loading.
The reason is that each target needs a different config file, but there 
is only one IMX_CONFIG variable.

I have tried to create a dedicated IMX_CONFIG_SPL for the SPL, which 
seems to work and I almost prepared a patch for submit.
Unfortunatelly there is some problem with the dependencies if both 
u-boot.imx and SPL are put in ALL-y. The make with single job runs but 
it fails in multi-job execution.

Could you please help me and throw some light into the dependencies. I 
think this patch could be useful also for others, see below.


Thanks
Petr

---------------------------------------------

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 8f85862..57ea5d3 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -132,16 +132,18 @@ ifdef CONFIG_EFI_LOADER
  OBJCOPYFLAGS += -j .efi_runtime -j .efi_runtime_rel
  endif

-ifneq ($(CONFIG_IMX_CONFIG),)
+ifneq ($(CONFIG_IMX_CONFIG_SPL),)
  ifdef CONFIG_SPL
  ifndef CONFIG_SPL_BUILD
  ALL-y += SPL
  endif
-else
+endif
+endif
+
+ifneq ($(CONFIG_IMX_CONFIG),)
  ifeq ($(CONFIG_OF_SEPARATE),y)
  ALL-y += u-boot-dtb.imx
  else
  ALL-y += u-boot.imx
  endif
  endif
-endif
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index d34a784..b2e3490 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -42,8 +42,9 @@ quiet_cmd_cpp_cfg = CFGS    $@
        cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $<

  IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%).cfgtmp
+IMX_CONFIG_SPL = $(CONFIG_IMX_CONFIG_SPL:"%"=%).cfgtmp

-$(IMX_CONFIG): %.cfgtmp: % FORCE
+$(IMX_CONFIG) $(IMX_CONFIG_SPL): %.cfgtmp: % FORCE
         $(Q)mkdir -p $(dir $@)
         $(call if_changed_dep,cpp_cfg)

@@ -64,7 +65,7 @@ endif
  MKIMAGEFLAGS_SPL = -n $(filter-out $< $(PHONY),$^) -T imximage \
         -e $(CONFIG_SPL_TEXT_BASE)

-SPL: spl/u-boot-spl.bin $(IMX_CONFIG) FORCE
+SPL: spl/u-boot-spl.bin $(IMX_CONFIG_SPL) FORCE
         $(call if_changed,mkimage)

  MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
@@ -92,4 +93,4 @@ cmd_u-boot-nand-spl_imx = (printf 
'\000\000\000\000\106\103\102\040\001' && \
  spl/u-boot-nand-spl.imx: SPL FORCE
         $(call if_changed,u-boot-nand-spl_imx)

-targets += $(addprefix ../../../,$(IMX_CONFIG) SPL u-boot.uim 
spl/u-boot-nand-spl.imx)
+targets += $(addprefix ../../../,$(IMX_CONFIG) $(IMX_CONFIG_SPL) SPL 
u-boot.uim spl/u-boot-nand-spl.imx)

----------------------------------------



More information about the U-Boot mailing list