[U-Boot] [PATCH 00/19] First step towards Kbuild: Use Kbuild style makefiles
Masahiro Yamada
yamada.m at jp.panasonic.com
Sun Sep 8 03:42:01 CEST 2013
Kbuild in U-Boot has been talked for a while
and RFC patches were posted by Simon Glass.
(Refer to "RFC: Add Kbuild system to U-Boot"
posted by Simon, May 12, 2013)
Simon's effort is a good start point but
varous critical features were missing from his patch series.
I have also been eager to introduce Kbuild to U-Boot.
So I have been working on this task for a while
with a little different migration path from Simon's way.
And I succeeded to build a few boards
with support of SPL build, Out-of-tree build,
correct output file names, which were missing from
Simon's patches.
While I were working on my local branch,
the build system and makefiles in U-Boot master repository
always kept changing, of course.
So, my fruit does not fit with the current master repository anymore.
But if someone is interested in my work,
I can push my local branch to somewhere in my GitHub space.
(RFC quality, but might be helpful for just discussions)
I recognize these patches are so rough that
they support only a few ARM boards.
Perfectly covering all architectures and all boards
without breaking any U-Boot features is a too big task
for a sigle indivisual.
Even if I could do that, the patch series would
be extremely big size and the adjustment for U-Boot
would be complecated.
So the review would probably take very long time.
Along with the review process, as time goes by,
the posted patches would become not appled to the master branch.
So we would need to repeat post, review, fix, rebase on the master
and post again, reviwe, ...
again and again for a very big patch series.
I began to be wondering it is possible to switch to Kbuild
in this way.
So I decided to begin with what I can do, one by one.
By stepping little by litte, we can get close to Kbuild
and finally we will arrive at our goal.
I think this strategy is more realistic rather than
adding a big change at one time.
Before adding a real Kbuild, I'd like to adjust our build system
in a form suitable for Kbuild.
First of all, this series convert makefiles in sub directories
to Kbuild style.
What this series do is quite simple:
- Moving common lines in sub makefiles to a new file 'scripts/Makefile.build'
- Renaming COBJS-y and SOBJS-y to obj-y in each sub makefile.
- A little bit more tweaks
That's all.
0001 creates scripts/Makefile.build and tweaks Makefile and spl/Makefile
to use scripts/Makefile.build.
U-Boot conventional makefiles are like this:
include $(TOPDIR)/config.mk
LIB = $(obj)libfoo.o
COBJS := ...
COBJS += ...
SOBJS := ...
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
all: $(obj).depend $(LIB)
$(LIB): $(OBJS)
$(call cmd_link_o_target, $(OBJS))
#########################################################################
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
Top and bottom parts are common in almost all makefiles.
Writing those lines in all makefiles is a big waste.
So common lines have been pushed into scripts/Makefile.build.
In addition, scripts/Makefile.build includes a glue code for supporting 'obj-y'.
Be aware U-Boot conventional makefile sytle is still supported.
So we can change sub makefiles little by little in the following patches.
0002-0019 change sub makefiles into a Kbuild suitable form using obj-y.
In order to avoid creating a big patch file, they are divided
by CPU architectures and categories.
0002-0007: refactor under arch/arm/
0008-0016: refactor libraries which are common for all architectures
0017 : refactor under arch/powerpc/
0018 : refactor under board/ti/
Note arch/arm/cpu/s3c44b0/Makefile was kept untouched.
It is the remainder of dead board and should be deleted.
(See 'ARM: s3c44b0: remove remainders of dead board' posted by me Aug 19)
(I am not a maintainer of TI boards, but I just wanted to
demonstrate in 0018 for example how easily board maintainers can
do this conversion)
Conversion rule is pretty easy:
(1) Delete common parts at top and bottom.
(2) Rename
COBJS -> obj-y
SOBJS -> obj-y
COBJS-$(CONFIG_FOO) -> obj-$(CONFIG_FOO)
SOBJS-$(CONFIG_FOO) -> obj-$(CONFIG_FOO)
START -> extra-y
We can convert almost automatically althogh in some cases
we may need to tweak a little.
I refactored more than 150 makefiles in this series.
But we still have more than 600 makefiles.
(Most of them reside under board/ directory)
We can convert them lator little by little.
Your contribution is welcome! :-)
Note1:
This series breaks _NO_ features in U-Boot.
Beucase it just moves common parts into scripts/Makefile.build
I believe no boards are broken by this refactoring, but
it is humans who can make a mistake.
So, it is very important to do build check before patches are applied.
I tested for ARM and Sandbox like this:
$ CROSS_COMPILE_ARM=arm-linux-gnueabi- ./MAKEALL -a arm -a sandbox
and I got:
--------------------- SUMMARY ----------------------------
Boards compiled: 336
----------------------------------------------------------
I could not test other architectures because I don't have suitable compiler.
Especially PowerPC boards must be checked since I changed under arch/powerpc/
in 0017.
I will be grateful for any custodians' help.
Note2:
This series is _NOT_ RFC.
I believe what these patches are doing is clear.
0001 changes less than 100 lines.
0002-0019 changes lots of makefiles, but the conversion rule is simple.
So, I expect this series will be reviewed in a few weeks
and hopefully applied to master while the next merge window if the review passed.
Note3:
obj-y := foo/ (descending into foo sub directory)
syntax is not supprted in this series.
It is implemented in upcoming patch series.
The reason why I postpone this feature is
I don't want to add a big change at one time.
Adjusting for Kbuild little by litte is my strategy here
for easy review.
Note4:
Of course, scripts/Makefile.build added by 0001 patch is temporary.
It shall be replaced with the one of Linux Kernel in future.
Note5:
I confirmed these patches can be apply on v2013.10-rc2 tag.
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at ti.com>
Masahiro Yamada (19):
Makefile: prepare for using Kbuild-style Makefile
armv7: convert makefiles to Kbuild style
arm926ejs: convert makefiles to Kbuild style
arm920t: convert makefiles to Kbuild style
arm720t: convert makefiles to Kbuild style
ARM: convert makefiles to Kbuild style
ARM: imx-common: convert makefiles to Kbuild style
drivers: net: convert makefiles to Kbuild style
drivers: mtd: convert makefiles to Kbuild style
drivers: usb: convert makefiles to Kbuild style
drivers: convert makefiles to Kbuild style
fs: convert makefiles to Kbuild style
common: convert makefiles to Kbuild style
net: convert a makefile to Kbuild style
lib: convert makefiles to Kbuild style
disk: convert a makefile to Kbuild style
sandbox: convert makefiles to Kbuild style
powerpc: convert makefiles to Kbuild style
board: ti: convert makefiles to Kbuild style
Makefile | 42 +++-
arch/arm/cpu/arm1136/Makefile | 26 +-
arch/arm/cpu/arm1136/mx31/Makefile | 27 +-
arch/arm/cpu/arm1136/mx35/Makefile | 28 +--
arch/arm/cpu/arm1176/Makefile | 26 +-
arch/arm/cpu/arm1176/bcm2835/Makefile | 25 +-
arch/arm/cpu/arm1176/tnetv107x/Makefile | 27 +-
arch/arm/cpu/arm720t/Makefile | 26 +-
arch/arm/cpu/arm720t/tegra-common/Makefile | 25 +-
arch/arm/cpu/arm720t/tegra114/Makefile | 25 +-
arch/arm/cpu/arm720t/tegra20/Makefile | 23 +-
arch/arm/cpu/arm720t/tegra30/Makefile | 23 +-
arch/arm/cpu/arm920t/Makefile | 28 +--
arch/arm/cpu/arm920t/a320/Makefile | 25 +-
arch/arm/cpu/arm920t/at91/Makefile | 33 +--
arch/arm/cpu/arm920t/ep93xx/Makefile | 24 +-
arch/arm/cpu/arm920t/imx/Makefile | 27 +-
arch/arm/cpu/arm920t/ks8695/Makefile | 26 +-
arch/arm/cpu/arm920t/s3c24x0/Makefile | 29 +--
arch/arm/cpu/arm925t/Makefile | 30 +--
arch/arm/cpu/arm926ejs/Makefile | 28 +--
arch/arm/cpu/arm926ejs/armada100/Makefile | 23 +-
arch/arm/cpu/arm926ejs/at91/Makefile | 59 ++---
arch/arm/cpu/arm926ejs/davinci/Makefile | 48 +---
arch/arm/cpu/arm926ejs/kirkwood/Makefile | 31 +--
arch/arm/cpu/arm926ejs/lpc32xx/Makefile | 23 +-
arch/arm/cpu/arm926ejs/mb86r0x/Makefile | 25 +-
arch/arm/cpu/arm926ejs/mx25/Makefile | 23 +-
arch/arm/cpu/arm926ejs/mx27/Makefile | 23 +-
arch/arm/cpu/arm926ejs/mxs/Makefile | 26 +-
arch/arm/cpu/arm926ejs/nomadik/Makefile | 25 +-
arch/arm/cpu/arm926ejs/omap/Makefile | 26 +-
arch/arm/cpu/arm926ejs/orion5x/Makefile | 29 +--
arch/arm/cpu/arm926ejs/pantheon/Makefile | 23 +-
arch/arm/cpu/arm926ejs/spear/Makefile | 36 +--
arch/arm/cpu/arm926ejs/versatile/Makefile | 26 +-
arch/arm/cpu/arm946es/Makefile | 26 +-
arch/arm/cpu/arm_intcm/Makefile | 26 +-
arch/arm/cpu/armv7/Makefile | 32 +--
arch/arm/cpu/armv7/am33xx/Makefile | 51 +---
arch/arm/cpu/armv7/at91/Makefile | 31 +--
arch/arm/cpu/armv7/exynos/Makefile | 34 +--
arch/arm/cpu/armv7/highbank/Makefile | 24 +-
arch/arm/cpu/armv7/mx5/Makefile | 25 +-
arch/arm/cpu/armv7/mx6/Makefile | 23 +-
arch/arm/cpu/armv7/omap-common/Makefile | 43 +---
arch/arm/cpu/armv7/omap3/Makefile | 41 +--
arch/arm/cpu/armv7/omap4/Makefile | 31 +--
arch/arm/cpu/armv7/omap5/Makefile | 33 +--
arch/arm/cpu/armv7/rmobile/Makefile | 51 +---
arch/arm/cpu/armv7/s5p-common/Makefile | 29 +--
arch/arm/cpu/armv7/s5pc1xx/Makefile | 27 +-
arch/arm/cpu/armv7/socfpga/Makefile | 29 +--
arch/arm/cpu/armv7/tegra-common/Makefile | 24 +-
arch/arm/cpu/armv7/tegra114/Makefile | 22 +-
arch/arm/cpu/armv7/tegra20/Makefile | 26 +-
arch/arm/cpu/armv7/tegra30/Makefile | 22 +-
arch/arm/cpu/armv7/u8500/Makefile | 25 +-
arch/arm/cpu/armv7/vf610/Makefile | 25 +-
arch/arm/cpu/armv7/zynq/Makefile | 29 +--
arch/arm/cpu/ixp/Makefile | 30 +--
arch/arm/cpu/pxa/Makefile | 36 +--
arch/arm/cpu/sa1100/Makefile | 28 +--
arch/arm/cpu/tegra-common/Makefile | 25 +-
arch/arm/cpu/tegra114-common/Makefile | 23 +-
arch/arm/cpu/tegra20-common/Makefile | 29 +--
arch/arm/cpu/tegra30-common/Makefile | 26 +-
arch/arm/imx-common/Makefile | 35 +--
arch/arm/lib/Makefile | 86 ++-----
arch/powerpc/cpu/74xx_7xx/Makefile | 28 +--
arch/powerpc/cpu/mpc512x/Makefile | 51 ++--
arch/powerpc/cpu/mpc5xx/Makefile | 27 +-
arch/powerpc/cpu/mpc5xxx/Makefile | 54 ++--
arch/powerpc/cpu/mpc824x/Makefile | 28 +--
arch/powerpc/cpu/mpc8260/Makefile | 30 +--
arch/powerpc/cpu/mpc83xx/Makefile | 58 ++---
arch/powerpc/cpu/mpc85xx/Makefile | 233 ++++++++---------
arch/powerpc/cpu/mpc86xx/Makefile | 50 ++--
arch/powerpc/cpu/mpc8xx/Makefile | 58 ++---
arch/powerpc/cpu/mpc8xxx/Makefile | 30 +--
arch/powerpc/cpu/mpc8xxx/ddr/Makefile | 30 +--
arch/powerpc/cpu/ppc4xx/Makefile | 90 +++----
arch/powerpc/lib/Makefile | 78 ++----
arch/sandbox/cpu/Makefile | 23 +-
arch/sandbox/lib/Makefile | 25 +-
board/ti/am335x/Makefile | 29 +--
board/ti/am3517crane/Makefile | 19 +-
board/ti/am43xx/Makefile | 29 +--
board/ti/beagle/Makefile | 24 +-
board/ti/dra7xx/Makefile | 27 +-
board/ti/evm/Makefile | 19 +-
board/ti/omap1510inn/Makefile | 24 +-
board/ti/omap5912osk/Makefile | 24 +-
board/ti/omap5_uevm/Makefile | 27 +-
board/ti/omap730p2/Makefile | 24 +-
board/ti/panda/Makefile | 21 +-
board/ti/sdp3430/Makefile | 21 +-
board/ti/sdp4430/Makefile | 23 +-
board/ti/ti814x/Makefile | 29 +--
board/ti/ti816x/Makefile | 27 +-
board/ti/tnetv107xevm/Makefile | 25 +-
common/Makefile | 389 ++++++++++++++---------------
common/spl/Makefile | 36 +--
disk/Makefile | 34 +--
drivers/bios_emulator/Makefile | 23 +-
drivers/block/Makefile | 52 ++--
drivers/bootcount/Makefile | 30 +--
drivers/crypto/Makefile | 25 +-
drivers/dfu/Makefile | 25 +-
drivers/dma/Makefile | 30 +--
drivers/fpga/Makefile | 44 +---
drivers/gpio/Makefile | 73 ++----
drivers/hwmon/Makefile | 40 +--
drivers/i2c/Makefile | 70 ++----
drivers/input/Makefile | 36 +--
drivers/misc/Makefile | 52 ++--
drivers/mmc/Makefile | 69 ++---
drivers/mtd/Makefile | 44 +---
drivers/mtd/nand/Makefile | 102 +++-----
drivers/mtd/onenand/Makefile | 27 +-
drivers/mtd/spi/Makefile | 48 +---
drivers/mtd/ubi/Makefile | 28 +--
drivers/net/Makefile | 136 +++++-----
drivers/net/fm/Makefile | 59 ++---
drivers/net/npe/Makefile | 24 +-
drivers/net/phy/Makefile | 60 ++---
drivers/pci/Makefile | 44 +---
drivers/pcmcia/Makefile | 34 +--
drivers/power/Makefile | 47 +---
drivers/power/battery/Makefile | 25 +-
drivers/power/fuel_gauge/Makefile | 25 +-
drivers/power/pmic/Makefile | 31 +--
drivers/qe/Makefile | 25 +-
drivers/rtc/Makefile | 110 ++++----
drivers/serial/Makefile | 82 +++---
drivers/sound/Makefile | 30 +--
drivers/spi/Makefile | 82 +++---
drivers/tpm/Makefile | 29 +--
drivers/twserial/Makefile | 24 +-
drivers/usb/eth/Makefile | 28 +--
drivers/usb/gadget/Makefile | 54 ++--
drivers/usb/host/Makefile | 74 ++----
drivers/usb/musb-new/Makefile | 36 +--
drivers/usb/musb/Makefile | 36 +--
drivers/usb/phy/Makefile | 24 +-
drivers/usb/ulpi/Makefile | 28 +--
drivers/video/Makefile | 84 +++----
drivers/watchdog/Makefile | 36 +--
fs/Makefile | 24 +-
fs/cbfs/Makefile | 24 +-
fs/cramfs/Makefile | 29 +--
fs/ext4/Makefile | 27 +-
fs/fat/Makefile | 31 +--
fs/fdos/Makefile | 27 +-
fs/jffs2/Makefile | 38 +--
fs/reiserfs/Makefile | 26 +-
fs/sandbox/Makefile | 23 +-
fs/ubifs/Makefile | 29 +--
fs/yaffs2/Makefile | 33 +--
fs/zfs/Makefile | 25 +-
lib/Makefile | 114 ++++-----
lib/libfdt/Makefile | 27 +-
lib/lzma/Makefile | 24 +-
lib/lzo/Makefile | 24 +-
lib/rsa/Makefile | 22 +-
lib/tizen/Makefile | 24 +-
lib/zlib/Makefile | 22 +-
net/Makefile | 46 +---
scripts/Makefile.build | 48 ++++
spl/Makefile | 24 +-
170 files changed, 1511 insertions(+), 5095 deletions(-)
create mode 100644 scripts/Makefile.build
--
1.8.1.2
More information about the U-Boot
mailing list