[U-Boot] [PATCH v3 00/15] Add macros to ease our life with independent CONFIGs between U-Boot and SPL

Masahiro Yamada yamada.masahiro at socionext.com
Wed Aug 12 00:31:40 CEST 2015


Refer to Simon's question, too:
http://lists.denx.de/pipermail/u-boot/2015-July/219598.html

Since U-boot introduced SPL (not since Kconfig),
enabling features for U-boot and SPL independently is always a PITA.

 - decide if each feature should be supported for SPL or not
 - Add CONFIG_SPL_FRED_SUPPORT into Makefile.spl
 - Add #undef include/config_uncmd_spl.h to disable features
   we do not want to support on SPL
 - Add "ifdef CONFIG_SPL_BUILD ... endif" here and there to adjust things
 - Add "#ifdef CONFIG_SPL_BUILD ... #endif" here and there to fix things up

Things are getting more and more crappy.

When U-boot switched to Kconfig, first I introduced separate .config
(.config, spl/.config, tpl/.config) to clean up them.
But it turned out to be a pain.

So, I believe the current single .config is much better.
But I also admit we need something systematic to subdue our PITA.

One possibility is to support "spl-y" in makefiles.
(This idea is cribbed from barebox.)

  obj-$(CONFIG_FOO) += foo.o
  spl-$(CONFIG_SPL_FOO) += foo.o

is cleaner than

  ifdef CONFIG_SPL_BUILD
    obj-$(CONFIG_SPL_FOO) += foo.o
  else
    obj-$(CONFIG_FOO) += foo.o
  endif

It is a nice improvement in makefile side.
But we still need to do something with C files.

Another option is something like
   CONFIG_FOO=yyn  (yes for U-boot, yes for SPL, no for TPL)

To achieve this, I think a big operation is needed in Kconfig core.
I cannot do that.
(Of course, Patches are welcome if someone else can do that.)

So, I was thinking of something different.

My idea was inspired by IS_ENABLED() macro in include/linux/kconfig.h.

Linux defines different macros for built-in and module,
and it is possible to write
   #if IS_ENABLED(CONFIG_FOO)
           ...
   #endif

 instead of

   #if defined(CONFIG_FOO) || defined(CONFIG_FOO_MODULE)
           ...
   #endif

So, I'd like to propose new macros to write code like

   #if CONFIG_IS_ENABLED(FOO)
            ...
   #endif

 instead of

   #if (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \
         (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))
             ...
   #endif

I hope this series will make our life easier.

The result of buildman:

Summary of 16 commits for 1113 boards (8 threads, 1 job per thread)
01: arm: socfpga: misc: Add support for printing FPGA type
     avr32:  +   atngw100mkii grasshopper atstk1002 atngw100
        sh:  +   sh7753evb sh7785lcr_32bit sh7785lcr
     nios2:  +   nios2-generic
       arm:  +   openrd_base axm openrd_ultimate zynq_zc70x openrd_client taurus
   powerpc:  +   ebony taihu ocotea TQM834x taishan katmai alpr
02: kbuild: fixdep: optimize code slightly
03: kbuild: add a makefile macro useful with per-image config options
04: linux/kconfig.h: add CPP macros useful for per-image config options
05: spl: move SPL driver entries to driver/Makefile
06: dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries
07: clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK
08: clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries
09: ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM
10: ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries
11: led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED
12: led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries
13: dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list
14: fdtdec: fix OF_CONTROL switch
15: of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL
16: of: clean up OF_CONTROL ifdef conditionals


Changes in v3:
  - Rebase on commit bd48c0617b5c721

Changes in v2:
  - Do not delete vpac270 board.
    Instead, change board/vpac270/u-boot-spl.lds
  - Rebase on commit cc35734358540a1

Masahiro Yamada (15):
  kbuild: fixdep: optimize code slightly
  kbuild: add a makefile macro useful with per-image config options
  linux/kconfig.h: add CPP macros useful for per-image config options
  spl: move SPL driver entries to driver/Makefile
  dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries
  clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK
  clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries
  ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM
  ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries
  led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED
  led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries
  dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list
  fdtdec: fix OF_CONTROL switch
  of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL
  of: clean up OF_CONTROL ifdef conditionals

 arch/arm/Kconfig                                   |  3 --
 arch/arm/cpu/armv7/am33xx/board.c                  |  2 +-
 arch/arm/cpu/armv7/exynos/Kconfig                  |  8 ----
 arch/arm/cpu/armv7/exynos/pinmux.c                 |  2 +-
 arch/arm/cpu/armv7/s5pc1xx/Kconfig                 |  2 -
 arch/arm/include/asm/arch-exynos/dwmmc.h           |  2 -
 arch/arm/include/asm/arch-exynos/mipi_dsim.h       |  2 -
 arch/arm/include/asm/arch-exynos/mmc.h             |  2 -
 arch/arm/mach-tegra/Kconfig                        |  1 -
 arch/arm/mach-tegra/clock.c                        |  4 +-
 arch/arm/mach-tegra/tegra114/clock.c               |  4 +-
 arch/arm/mach-tegra/tegra124/clock.c               |  4 +-
 arch/arm/mach-tegra/tegra20/clock.c                |  4 +-
 arch/arm/mach-tegra/tegra30/clock.c                |  4 +-
 board/vpac270/u-boot-spl.lds                       |  2 +-
 .../xilinx/microblaze-generic/microblaze-generic.c |  2 +-
 board/xilinx/zynq/board.c                          |  2 +-
 common/cli.c                                       |  4 +-
 common/spl/spl.c                                   |  3 +-
 configs/am335x_boneblack_vboot_defconfig           |  1 -
 configs/arches_defconfig                           |  1 -
 configs/canyonlands_defconfig                      |  1 -
 configs/galileo_defconfig                          |  1 -
 configs/microblaze-generic_defconfig               |  1 -
 configs/odroid_defconfig                           |  1 -
 configs/origen_defconfig                           |  1 -
 configs/s5pc210_universal_defconfig                |  1 -
 configs/socfpga_arria5_defconfig                   |  1 +
 configs/socfpga_cyclone5_defconfig                 |  1 +
 configs/socfpga_socrates_defconfig                 |  1 +
 configs/trats2_defconfig                           |  1 -
 configs/trats_defconfig                            |  1 -
 drivers/Makefile                                   | 42 +++++++++++++++++--
 drivers/clk/Kconfig                                |  2 +-
 drivers/core/Makefile                              |  4 +-
 drivers/core/device.c                              | 10 ++---
 drivers/core/lists.c                               |  2 +-
 drivers/core/root.c                                |  6 +--
 drivers/core/uclass.c                              |  4 +-
 drivers/gpio/mxc_gpio.c                            |  2 +-
 drivers/gpio/vybrid_gpio.c                         |  2 +-
 drivers/i2c/s3c24x0_i2c.c                          |  4 +-
 drivers/input/Makefile                             |  2 +-
 drivers/input/tegra-kbc.c                          |  2 +-
 drivers/led/Kconfig                                |  2 +-
 drivers/mmc/exynos_dw_mmc.c                        |  2 +-
 drivers/mmc/s5p_sdhci.c                            |  2 +-
 drivers/mmc/tegra_mmc.c                            |  2 +-
 drivers/mmc/zynq_sdhci.c                           |  2 +-
 drivers/mtd/spi/sf_probe.c                         |  6 +--
 drivers/net/xilinx_emaclite.c                      |  2 +-
 drivers/net/zynq_gem.c                             |  2 +-
 drivers/power/exynos-tmu.c                         |  2 +-
 drivers/power/pmic/pmic_max77686.c                 |  4 +-
 drivers/ram/Kconfig                                |  2 +-
 drivers/serial/ns16550.c                           |  2 +-
 drivers/serial/serial-uclass.c                     |  4 +-
 drivers/serial/serial_omap.c                       |  2 +-
 drivers/serial/serial_pl01x.c                      |  2 +-
 drivers/serial/serial_tegra.c                      |  4 +-
 drivers/serial/serial_uniphier.c                   |  2 +-
 drivers/serial/serial_zynq.c                       |  2 +-
 drivers/sound/max98095.c                           |  2 +-
 drivers/sound/wm8994.c                             |  2 +-
 drivers/tpm/tpm_tis_i2c.c                          |  2 +-
 drivers/video/exynos_dp_lowlevel.c                 |  2 +-
 drivers/video/exynos_fb.c                          |  8 ++--
 drivers/video/exynos_fimd.c                        |  4 +-
 drivers/video/exynos_mipi_dsi.c                    |  4 +-
 drivers/video/tegra.c                              |  2 +-
 dts/Kconfig                                        |  6 +--
 include/cli.h                                      |  2 +-
 include/config_uncmd_spl.h                         |  4 --
 include/configs/microblaze-generic.h               |  3 +-
 include/configs/socfpga_common.h                   |  2 +-
 include/dm/device-internal.h                       | 10 ++---
 include/dm/device.h                                |  4 +-
 include/dm/uclass-internal.h                       |  4 +-
 include/fdtdec.h                                   | 10 -----
 include/linux/kconfig.h                            | 48 ++++++++++++++++++++++
 lib/Makefile                                       | 13 +++---
 lib/fdtdec.c                                       |  2 +-
 scripts/Kbuild.include                             |  6 +++
 scripts/Makefile.spl                               | 31 +-------------
 scripts/Makefile.uncmd_spl                         |  5 ---
 scripts/basic/fixdep.c                             | 33 +++++++++++++--
 86 files changed, 225 insertions(+), 182 deletions(-)

-- 
1.9.1



More information about the U-Boot mailing list