On Mon, Aug 9, 2021 at 8:11 PM Tom Rini <tr...@konsulko.com> wrote: > > On Sat, Aug 07, 2021 at 04:23:36PM -0600, Simon Glass wrote: > > Comments welcome! > > I think what this is really showing is that Yamada-san was right. All > the games we need to do so that "make fooboard_config all" results in > building the N stages needed was the wrong track. Taking > khadas-edge-v-rk3399 as an example, if we had instead of > khadas-edge-v-rk3399_defconfig but khadas-edge-v-rk3399_tpl_defconfig > khadas-edge-v-rk3399_spl_defconfig and khadas-edge-v-rk3399_config, each > of which could set CONFIG_TPL, CONFIG_SPL or neither. Then yes, to > build u-boot-rockchip.bin you would need to pass in the separately build > TPL and SPL stages. But, that's true of so so many other platforms. To > pick another example, imx8mm_evk doesn't function without other > binaries. If in theory to build khadas-edge-v-rk3399 you had to do > something like: > $ export CROSS_COMPILE=aarch64-linux- > $ make O=obj/tpl khadas-edge-v-rk3399_tpl_config all > $ make O=obj/spl khadas-edge-v-rk3399_spl_config all > $ make O=obj/khadas-edge-v-rk3399 TPL=obj/tpl/u-boot.bin \ > SPL=obj/spl/u-boot.bin khadas-edge-v-rk3399_config all > > But it also meant that we didn't need to duplicate so so many Kconfig > options and most of our obj rules would just be: > obj-$(CONFIG_FOO) += foo.o > > would be a win.
Oh! I quite like this. Simpler indeed. With all the different components that need to be pulled in to build a bootable image, each of the various U-Boot stages would just be another configuration that needs to be built and included in the result. I've already been playing with a top level build tool that starts with the U-Boot config and chooses the correct configuration of TFA, OPTEE, and any other binaries needed. Basically it is a top level Makefile that includes the U-Boot config and then passes make targets through to the right build directories. This could effectively be the same thing; start with the board config, and then filter it when going into each stages build directory with O= as you have above. If you want to look I've got the repo published here: https://gitlab.arm.com/systemready/u-boot-tfa-build/ g.