Re: State of the new config & build system

Kai Germaschewski
2001-12-29T12:44:09Z

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3878 bytes --]

[CC trimmed]

On Sat, 29 Dec 2001, Keith Owens wrote:

> [...]
> Auto detection of changed commands/flags
>
> That was a decent fix for part of the problem, but it did not address
> tracking user commands nor host compiles. It did not allow for
> separate source and object trees, for read only source trees, nor did
> it handle the more esoteric cases like modules being built from
> multiple directories.

Some people asked for what my patch looked like, so I resurrected it. I
moved it to 2.5.2-pre3. As it caused lots of rejects (maintaining kbuild
is a non-trivial task, isn't it, Keith?), I only fixed the problems for my
.config. So the attached patch will break with most .configs. However,
people who want to take a look can take my .config and play with that -
it's strictly proof-of-concept only.
(The breakage is easily fixable, it's just quite a bit of mostly trivial
work).

And yes, it doesn't fix the separate source / objects tree issue. But IMO
that's not a problem that needs to be fixed, it's an additional feature
which I didn't even try to attack (it may be possible to get there with
VPATH, though).

To try it, patch your kernel,

mv ../config-2.5 .config
make oldconfig
make # builds bzImage and modules

A subsequent make will only rebuild what's needed:

[kai@vaio linux-2.5.2-pre3.kbuild]$ time make
make -f Makefile.build boot
make[1]: Entering directory
`/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'
Generating include/linux/compile.h ...
Preprocessing arch/i386/boot/bsetup.s ...
Assembling (AS) arch/i386/boot/bsetup.o ...
Linking arch/i386/boot/bsetup ...
Compiling init/version.o ...
Linking vmlinux ...
Generating System.map ...
Building arch/i386/boot/compressed/piggy.o
Linking arch/i386/boot/compressed/bvmlinux
Copying to arch/i386/boot/compressed/bvmlinux.out
Building arch/i386/boot/bzImage
Root device is (3, 2)
Boot sector 512 bytes.
Setup is 4764 bytes.
System is 715 kB
make[1]: Leaving directory `/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'

real 0m10.230s
user 0m8.510s
sys 0m1.050s

For each make, compile.h is updated, thus causing init/version.o to be
recompiled and vmlinux to be relinked. - I kept the behavior of the
current kbuild. Not regenerating compile.h will give:

[kai@vaio linux-2.5.2-pre3.kbuild]$ time make
make -f Makefile.build boot
make[1]: Entering directory
`/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'
make[1]: Nothing to be done for `boot'.
make[1]: Leaving directory `/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'

real 0m7.155s
user 0m6.790s
sys 0m0.290s

As an example, change one file:

[kai@vaio linux-2.5.2-pre3.kbuild]$ touch drivers/isdn/hisax/callc.c
[kai@vaio linux-2.5.2-pre3.kbuild]$ time make
make -f Makefile.build boot
make[1]: Entering directory
`/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'
Compiling drivers/isdn/hisax/callc.o ...
Linking module drivers/isdn/hisax/hisax.o ...
make[1]: Leaving directory `/home/kai/kernel/v2.5/linux-2.5.2-pre3.kbuild'

real 0m9.433s
user 0m8.780s
sys 0m0.520s

$ diffstat pp-kbuild-2.5.2-pre3

00_version | 5
Documentation/DocBook/Makefile | 3
Makefile | 507 +++----------------------
Makefile.build | 460 ++++++++++++++++++++++
Makefile.config | 32 +
Makefile.end | 37 +
Makefile.vars | 130 ++++++
Rules.make | 326 ----------------
arch/i386/Makefile | 70 ---
[...]
scripts/Makefile | 23 -
scripts/fix_dep.c | 406 ++++++++++++++++++++
scripts/mkdep.c | 628 -------------------------------
169 files changed, 1849 insertions(+), 3107 deletions(-)

[-- Attachment #2: Type: APPLICATION/x-bzip2, Size: 43326 bytes --]

[-- Attachment #3: Type: APPLICATION/x-bzip2, Size: 5717 bytes --]