[U-Boot] [PATCH v3 00/19] First step towards Kbuild: Use Kbuild style makefiles
Tom Rini
trini at ti.com
Mon Nov 4 15:16:16 CET 2013
On Thu, Oct 17, 2013 at 05:34:46PM +0900, Masahiro Yamada wrote:
> 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.
> At last 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.
>
> Now my fruit got too old to fit with the current u-boot/master 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 those patches are so rough that
> they could 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, review, ...
> again and again for a very big patch series.
>
> I began to be wondering whether it is really 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 importing a real Kbuild, I'd like to adjust our makefiles
> in the form suitable for Kbuild.
>
> First of all, this series converts 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.
>
> 01/19 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 (non-Kbuild) makefile sytle is still supported.
> So we can change sub makefiles little by little in the following patches.
>
> 02/19-19/19 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.
>
> 02/19-07/19: refactor under arch/arm/
> 08/19-16/19: refactor libraries which are commonly used for all architectures
> 17/19 : refactor under arch/sandbox
> 18/19 : refactor under arch/powerpc/
> 19/19 : refactor under board/ti/
>
>
> 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
>
> In order to prove this series does no harm,
> I compiled all boards excepts nds32 and nios2 architectures
> and checked md5sum matching for ./u-boot (and spl/u-boot-spl if it exists).
>
> I tried md5sum for version 1 and I did the same thing again for version 2.
> I confirmed md5sum perfectly matched.
>
> For the detailed steps how to compare md5sum,
> please refer to the discussion in version 1:
> [U-Boot] [PATCH 00/19] First step towards Kbuild: Use Kbuild style makefiles
>
> Note2:
> 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.
>
> Note3:
> Of course, scripts/Makefile.build added by 01/19 patch is temporary.
> It shall be replaced with the one of Linux Kernel in future.
>
> Note4:
> 01/19 is a prerequisite for 02/19 to 19/19.
> But 02/19 thru 19/19 are order-independent.
> If some of 02/19-19/19 becomes not applied to u-boot/master,
> they can be omitted.
>
> Note5:
> I confirmed this series can be applied on v2013.10
>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at ti.com>
> Cc: Gerhard Sittig <gsi at denx.de>
>
> 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 | 44 +++-
> 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/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 | 36 +--
> 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 | 25 +-
> 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 | 50 +---
> 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 | 31 +--
> 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 | 32 +--
> 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/sandbox/sandbox/Makefile | 21 +-
> 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/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 | 27 +-
> drivers/dma/Makefile | 30 +--
> drivers/fpga/Makefile | 44 +---
> drivers/gpio/Makefile | 73 ++----
> drivers/hwmon/Makefile | 40 +--
> drivers/i2c/Makefile | 68 ++---
> drivers/input/Makefile | 36 +--
> drivers/misc/Makefile | 52 ++--
> drivers/mmc/Makefile | 71 ++----
> drivers/mtd/Makefile | 44 +---
> drivers/mtd/nand/Makefile | 102 +++-----
> drivers/mtd/onenand/Makefile | 27 +-
> drivers/mtd/spi/Makefile | 36 +--
> 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 | 27 +-
> drivers/power/fuel_gauge/Makefile | 25 +-
> drivers/power/mfd/Makefile | 29 +--
> drivers/power/pmic/Makefile | 35 +--
> drivers/qe/Makefile | 25 +-
> drivers/rtc/Makefile | 108 ++++----
> drivers/serial/Makefile | 82 +++---
> drivers/sound/Makefile | 30 +--
> drivers/spi/Makefile | 84 +++----
> drivers/tpm/Makefile | 29 +--
> drivers/twserial/Makefile | 24 +-
> drivers/usb/eth/Makefile | 28 +--
> drivers/usb/gadget/Makefile | 58 ++---
> drivers/usb/host/Makefile | 74 ++----
> drivers/usb/musb-new/Makefile | 35 +--
> drivers/usb/musb/Makefile | 36 +--
> drivers/usb/phy/Makefile | 24 +-
> drivers/usb/ulpi/Makefile | 28 +--
> drivers/video/Makefile | 86 +++----
> drivers/watchdog/Makefile | 38 +--
> 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 | 26 +-
> 170 files changed, 1518 insertions(+), 5100 deletions(-)
> create mode 100644 scripts/Makefile.build
For the series, applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131104/b8ff6ef0/attachment.pgp>
More information about the U-Boot
mailing list