How to build additional bin with adding dependency via Makefiles

Michal Simek michal.simek at xilinx.com
Thu Sep 30 16:59:57 CEST 2021


Hi,

I am trying to build one configuration blob which should be included in
SPL. And still I didn't find the right way how to do it.

I need to build C file just as object and run objcopy -O binary.
I can be done with host gcc or target gcc. Both of them are little
endian that's why it shouldn't be a problem.

I just created rules in Makefile


OBJCOPYFLAGS := -O binary
KBUILD_CFLAGS := -nostdlib -nostartfiles -nodefaultlibs

$(obj)/%.bin: $(obj)/%.o FORCE
	$(call if_changed,objcopy)

obj-y += pm_obj.bin

binary is generated properly but I have a problem to setup dependency.

The same file is referenced via CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE and
should be included in pm_cfg_obj.o as the part of SPL.

This is the rule (a little bit update compare to version upstream)
ifneq ($(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE),"")
PM_CFG_OBJ_FILE := $(shell cd $(srctree); readlink -f
$(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE))
obj-$(CONFIG_SPL_BUILD) += pm_cfg_obj.o
$(obj)/pm_cfg_obj.o: $(PM_CFG_OBJ_FILE) FORCE
endif

And there is dependency on binary file but I think my issue is that
pm_obj.bin is not listed in targets that's why that dependency is not
handled properly.

Would be good to get some hints how to do it properly.

It is PMU fw configuration blob which PMUFW requires to setup proper
permission for IPs that I think it would be good to have generic version
of this file in u-boot source code that it doesn't need to be created
outside of u-boot.
At the end there is new option for applying configuration object
overlays which will bring new functionality later in boot process that's
why generic configuration could work for the most of boards. And if not
additional binary could be applied via existing zynqmp pmufw command.

Thanks,
Michal


More information about the U-Boot mailing list