2002-06-23 18:39:53

by Kai Germaschewski

[permalink] [raw]
Subject: kbuild fixes and more


I suppose we won't see any official / -dj releases any time soon, since
everybody is at OLS, so I figured it may make sense to publish my
current tree, which fixes some outstanding build problems and adds more
cleanup.

Most notably:

make KBUILD_VERBOSE= bzImage

(or export KBUILD_VERBOSE=0 / setenv KBUILD_VERBOSE 0; make bzImage)

looks certainly improved now.

Fixes include:
o the defkeymap/loadkeys issue
o calling host programs for khttpd / soundmodem
o make net_dev_init() a subsys_initcall, to make sure it's called
before any net device registers.

Patch is available from

http://www.tp1.ruhr-uni-bochum.de/~kai/kbuild/patch-2.5.24-kg1.gz

or

bk pull http://linux-isdn.bkbits.net/linux-2.5.make


Feedback is very welcome, of course ;)

--Kai


ChangeLog:

-----------------------------------------------------------------------------
[email protected], 2002-06-20 11:57:34-05:00, [email protected]
kbuild: Assorted cleanups

o Provide $(obj),$(objtree) and friends in the top-level Makefile as well
for consistency (Sam Ravnborg)
o Make $(call cmd,whatever) consistent with $(call if_changed,whatever),
i.e. both will execute $(cmd_whatever)
o Add $(echo_target), which will print the current target in a suitable
way for the quiet output format (i.e. target name relative to the
top-level directory)
o Fix the dependencies for host compiled programs to work for files in
subdirectories (missed converting them when introducing $(depfile))
o Add commands which will be useful when generating boot images.

----------------------------------------------------------------------------
Makefile | 13 ++++++++---
Rules.make | 70 ++++++++++++++++++++++++++++++++++++++++++++-----------------
2 files changed, 61 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 12:07:42-05:00, [email protected]
kbuild: Prepare LDFLAGS for general use

Some arch Makefiles use LDFLAGS to keep special flags for the final
vmlinux link. However, we'd rather use LDFLAGS along the lines of
CFLAGS, AFLAGS etc, so get rid of these special cases.

----------------------------------------------------------------------------
i386/Makefile | 3 +--
parisc/Makefile | 3 +--
s390/Makefile | 3 +--
s390x/Makefile | 3 +--
x86_64/Makefile | 3 +--
5 files changed, 5 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 12:25:11-05:00, [email protected]
kbuild: Rename ld flags for vmlinux to LDFLAGS_vmlinux

Everywhere else we use CFLAGS_<target> etc to designate special flags
for an object, so handle vmlinux the same way.

----------------------------------------------------------------------------
Makefile | 4 ++--
arch/alpha/Makefile | 2 +-
arch/arm/Makefile | 2 +-
arch/cris/Makefile | 2 +-
arch/i386/Makefile | 2 +-
arch/ia64/Makefile | 2 +-
arch/m68k/Makefile | 4 ++--
arch/mips/Makefile | 4 ++--
arch/mips64/Makefile | 10 +++++-----
arch/parisc/Makefile | 2 +-
arch/ppc/Makefile | 2 +-
arch/ppc64/Makefile | 2 +-
arch/s390/Makefile | 2 +-
arch/s390x/Makefile | 2 +-
arch/sh/Makefile | 8 ++++----
arch/sparc/Makefile | 4 ++--
arch/sparc64/Makefile | 2 +-
arch/x86_64/Makefile | 2 +-
18 files changed, 29 insertions(+), 29 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 12:50:29-05:00, [email protected]
kbuild: Put flags for ld into LDFLAGS

Some archs sneaked additional flags for ld into $(LD). This can be done
cleaner now, by just using $(LDFLAGS).

----------------------------------------------------------------------------
Makefile | 2 +-
Rules.make | 4 ++--
arch/i386/Makefile | 2 +-
arch/i386/boot/Makefile | 8 ++++----
arch/i386/boot/compressed/Makefile | 6 +++---
arch/m68k/Makefile | 2 +-
arch/mips/Makefile | 2 +-
arch/mips/philips/nino/ramdisk/Makefile | 2 +-
arch/mips64/Makefile | 2 +-
arch/s390/Makefile | 2 +-
arch/s390/boot/Makefile | 2 +-
arch/s390x/Makefile | 2 +-
arch/sh/Makefile | 1 -
arch/sh/boot/compressed/Makefile | 4 ++--
arch/sparc/Makefile | 2 +-
arch/sparc/boot/Makefile | 2 +-
arch/sparc64/Makefile | 2 +-
drivers/message/fusion/Makefile | 6 ------
18 files changed, 23 insertions(+), 30 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 13:35:15-05:00, [email protected]
kbuild: Put flags for objcopy into OBJCOPYFLAGS

Again, don't just add flags into $(OBJCOPY), but use the
variable $(OBJCOPYFLAGS) instead.

----------------------------------------------------------------------------
arm/Makefile | 1 +
arm/boot/Makefile | 6 +++---
arm/boot/compressed/Makefile | 2 +-
cris/Makefile | 4 ++--
cris/boot/compressed/Makefile | 4 ++--
cris/boot/rescue/Makefile | 7 ++++---
i386/Makefile | 4 ++--
i386/boot/Makefile | 4 ++--
i386/boot/compressed/Makefile | 2 +-
ia64/Makefile | 3 ++-
parisc/Makefile | 2 +-
ppc64/boot/Makefile | 4 ++--
s390/Makefile | 2 +-
s390/boot/Makefile | 6 ++----
s390x/Makefile | 2 +-
s390x/boot/Makefile | 6 ++----
sh/Makefile | 2 +-
sh/boot/Makefile | 4 ++--
sh/boot/compressed/Makefile | 2 +-
x86_64/Makefile | 2 +-
x86_64/boot/Makefile | 4 ++--
x86_64/boot/compressed/Makefile | 2 +-
22 files changed, 37 insertions(+), 38 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 15:23:45-05:00, [email protected]
kbuild: clean up arch/i386/boot, part 1

Use the Rules.make provided objcopy command and untangle piggy.o
generation.

----------------------------------------------------------------------------
Makefile | 2 +-
arch/i386/boot/Makefile | 26 +++++++++++++++++---------
arch/i386/boot/compressed/Makefile | 23 ++++++++++++-----------
3 files changed, 30 insertions(+), 21 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 15:39:35-05:00, [email protected]
kbuild: clean up arch/i386/boot, part 2

Use standard Rules.make rules for compiling and assembling.

----------------------------------------------------------------------------
Makefile | 39 +++++++++------------------------------
compressed/Makefile | 11 ++---------
2 files changed, 11 insertions(+), 39 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 15:47:59-05:00, [email protected]
kbuild: clean up arch/i386/boot, part 3

Unify zImage and bzImage generation.

----------------------------------------------------------------------------
Makefile | 32 ++++++++------------------------
compressed/Makefile | 14 ++------------
2 files changed, 10 insertions(+), 36 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 16:11:03-05:00, [email protected]
kbuild: clean up arch/i386/boot, part 4

Use the provided rule for linking files and final polish.
Apart from being internally more logically structured,
"make KBUILD_VERBOSE= bzImage" output looks much improved now as
well.

----------------------------------------------------------------------------
Makefile | 25 +++++++++++++++----------
compressed/Makefile | 25 ++++++++++---------------
compressed/vmlinux.scr | 9 +++++++++
3 files changed, 34 insertions(+), 25 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-20 16:29:43-05:00, [email protected]
kbuild: Add "make help" support

Added the new target "help" that list the most common targets
Calls down to Documentation/Makefile to list documentation targets.
Furthermore calls down to the architecture specific Makefile
to list architecture specific targets.
So far only i386 is supporting this.

----------------------------------------------------------------------------
Documentation/DocBook/Makefile | 4 +++
Makefile | 45 ++++++++++++++++++++++++++++++++++++++++-
arch/i386/boot/Makefile | 12 ++++++++++
3 files changed, 60 insertions(+), 1 deletion(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-23 12:00:50-05:00, [email protected]
kbuild: Fix calling of make_times_h and gentbl

make did normalize away the "./", so we better put the command
explicitly.

(Geert Uytterhoeven, Adam Richter and others)

----------------------------------------------------------------------------
drivers/net/hamradio/soundmodem/Makefile | 2 +-
net/khttpd/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-23 12:17:36-05:00, [email protected]
kbuild: Provide shipped versions of the keymap files

The keyboard maps are generated from appropriate .map files by running
loadkeys --mktable. However, there are two reasons to provide shipped
versions and use those by default

1) Not everybody has loadkeys installed.
2) As pointed out by Andries Brouwer, if changes to the tables occur in
the kernel tree, that may require a new/recompiled version of loadkeys,
so that the version of loadkeys required for the kernel build is
often ahead of the installed base.

For these reasons, we provide shipped versions of the generated files and
use them unless the user explicitly asks for regenerating by uncommenting
the appropriate line in the Makefile.


----------------------------------------------------------------------------
b/drivers/acorn/char/Makefile | 13 +
b/drivers/acorn/char/defkeymap-acorn.c_shipped | 262 ++++++++++++++++++++++++
b/drivers/char/Makefile | 16 +
b/drivers/char/defkeymap.c_shipped | 262 ++++++++++++++++++++++++
b/drivers/char/qtronixmap.c_shipped | 265 +++++++++++++++++++++++++
b/drivers/tc/Makefile | 13 +
b/drivers/tc/lk201-map.c_shipped | 265 +++++++++++++++++++++++++
drivers/acorn/char/defkeymap-acorn.c | 262 ------------------------
8 files changed, 1088 insertions(+), 270 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-23 12:30:04-05:00, [email protected]
kbuild: Distribute "make clean" knowledge

Currently, the top-level Makefile needs to know about all generated
files in the sub directories in order to clean them up.

This patch adds the variable "clean-files" which can be used in the
subdir Makefiles instead, to list files which should be removed by
"make clean".

----------------------------------------------------------------------------
Makefile | 36 +++----------------------------
Rules.make | 27 +++++++++++++++--------
drivers/atm/Makefile | 5 +++-
drivers/char/Makefile | 1
drivers/net/Makefile | 3 --
drivers/net/hamradio/soundmodem/Makefile | 9 ++++++-
drivers/net/sk98lin/Makefile | 9 -------
drivers/net/skfp/Makefile | 6 -----
drivers/net/wan/lmc/Makefile | 4 ---
drivers/pci/Makefile | 2 +
drivers/scsi/Makefile | 5 ++--
drivers/scsi/aic7xxx/Makefile | 10 ++++++--
drivers/scsi/sym53c8xx_2/Makefile | 3 --
drivers/video/Makefile | 2 +
drivers/video/matrox/Makefile | 3 --
drivers/zorro/Makefile | 2 +
fs/umsdos/Makefile | 3 --
init/Makefile | 10 +++++---
net/802/Makefile | 3 ++
net/khttpd/Makefile | 4 ++-
sound/oss/Makefile | 2 +
21 files changed, 64 insertions(+), 85 deletions(-)

-----------------------------------------------------------------------------
[email protected], 2002-06-23 12:40:50-05:00, [email protected]
Make net_dev_init() a subsys_initcall()

This does make sure that net_dev_init() has been called before any
driver calls register_netdev().

Since net_dev_init() calls net_device_init() which in turn will initialize
old style built-in network drivers, it is important that the other
subsystems, PCI in particular are already initialized at this point.
This is currently guaranteed by the link order.

----------------------------------------------------------------------------
dev.c | 52 ++++++++++++++++++++++++----------------------------
1 files changed, 24 insertions(+), 28 deletions(-)



2002-06-23 20:12:31

by Rudmer van Dijk

[permalink] [raw]
Subject: Re: kbuild fixes and more

Hi,

On Sunday 23 June 2002 20:39, Kai Germaschewski wrote:
> I suppose we won't see any official / -dj releases any time soon, since
> everybody is at OLS, so I figured it may make sense to publish my
> current tree, which fixes some outstanding build problems and adds more
> cleanup.
>
> Most notably:
>
> make KBUILD_VERBOSE= bzImage
>
> (or export KBUILD_VERBOSE=0 / setenv KBUILD_VERBOSE 0; make bzImage)
>
> looks certainly improved now.
>
> Fixes include:
> o the defkeymap/loadkeys issue
> o calling host programs for khttpd / soundmodem
> o make net_dev_init() a subsys_initcall, to make sure it's called
> before any net device registers.
>
> Patch is available from
>
> http://www.tp1.ruhr-uni-bochum.de/~kai/kbuild/patch-2.5.24-kg1.gz
>
> or
>
> bk pull http://linux-isdn.bkbits.net/linux-2.5.make
>
>
> Feedback is very welcome, of course ;)

patched against 2.5.24-dj1 (one failed hunk) generates errors:
# make clean
<snip>
make -C /aicasm clean
make: Entering an unknown directory
make: *** /aicasm: No such file or directory. Stop.
make: Leaving an unknown directory
make[3]: *** [clean] Error 2
make[3]: Leaving directory
`/usr/src/kernel/linux-2.5.24-dj1/drivers/scsi/aic7xxx'
make[2]: *** [aic7xxx] Error 2
make[2]: Leaving directory `/usr/src/kernel/linux-2.5.24-dj1/drivers/scsi'
make[1]: *** [scsi] Error 2
make[1]: Leaving directory `/usr/src/kernel/linux-2.5.24-dj1/drivers'
make: *** [_clean_drivers] Error 2

patching it against 2.5.24 (starting from 2.5.13 and patched up to) gives the
same failed hunk as with 2.5.24-dj1

patching it against 2.5.24 (the tarball) generates a lot of failures and
offsets...

so i would like to try it, but it just is not possible...

Rudmer

2002-06-23 20:15:28

by Rudmer van Dijk

[permalink] [raw]
Subject: Re: kbuild fixes and more

Hi,

On Sunday 23 June 2002 20:39, Kai Germaschewski wrote:
> I suppose we won't see any official / -dj releases any time soon, since
> everybody is at OLS, so I figured it may make sense to publish my
> current tree, which fixes some outstanding build problems and adds more
> cleanup.
>
> Most notably:
>
> make KBUILD_VERBOSE= bzImage
>
> (or export KBUILD_VERBOSE=0 / setenv KBUILD_VERBOSE 0; make bzImage)
>
> looks certainly improved now.
>
> Fixes include:
> o the defkeymap/loadkeys issue
> o calling host programs for khttpd / soundmodem
> o make net_dev_init() a subsys_initcall, to make sure it's called
> before any net device registers.
>
> Patch is available from
>
> http://www.tp1.ruhr-uni-bochum.de/~kai/kbuild/patch-2.5.24-kg1.gz
>
> or
>
> bk pull http://linux-isdn.bkbits.net/linux-2.5.make
>
>
> Feedback is very welcome, of course ;)

patched against 2.5.24-dj1 (one failed hunk) generates errors:
# make clean
<snip>
make -C /aicasm clean
make: Entering an unknown directory
make: *** /aicasm: No such file or directory. Stop.
make: Leaving an unknown directory
make[3]: *** [clean] Error 2
make[3]: Leaving directory
`/usr/src/kernel/linux-2.5.24-dj1/drivers/scsi/aic7xxx'
make[2]: *** [aic7xxx] Error 2
make[2]: Leaving directory `/usr/src/kernel/linux-2.5.24-dj1/drivers/scsi'
make[1]: *** [scsi] Error 2
make[1]: Leaving directory `/usr/src/kernel/linux-2.5.24-dj1/drivers'
make: *** [_clean_drivers] Error 2

patching it against 2.5.24 (starting from 2.5.13 and patched up to) gives the
same failed hunk as with 2.5.24-dj1

patching it against 2.5.24 (the tarball) generates a lot of failures and
offsets...

so i would like to try it, but it just is not possible...

Rudmer

2002-06-23 20:31:09

by Kai Germaschewski

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Sun, 23 Jun 2002, Rudmer van Dijk wrote:

> patched against 2.5.24-dj1 (one failed hunk) generates errors:
> # make clean
> <snip>
> make -C /aicasm clean
> make: Entering an unknown directory
> make: *** /aicasm: No such file or directory. Stop.

Grr, I just shouldn't do last minute changes without testing. Anyway,
I just put a fixed version into the same place
(patch-2.5.24-kg2.{gz,bz2}).
(It still has some rough edges which need work, but it should at least
get the job done)

However, I don't see why you get a failed hunk it applies cleanly against
a bitkeeper v2.5.24 tree here. (Could you mail me the .rej file,
privately).

Thanks for testing.

--Kai


2002-06-23 20:59:40

by Rudmer van Dijk

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Sunday 23 June 2002 22:31, Kai Germaschewski wrote:
> On Sun, 23 Jun 2002, Rudmer van Dijk wrote:
> > patched against 2.5.24-dj1 (one failed hunk) generates errors:
> > # make clean
> > <snip>
> > make -C /aicasm clean
> > make: Entering an unknown directory
> > make: *** /aicasm: No such file or directory. Stop.
>
> Grr, I just shouldn't do last minute changes without testing. Anyway,
> I just put a fixed version into the same place
> (patch-2.5.24-kg2.{gz,bz2}).
> (It still has some rough edges which need work, but it should at least
> get the job done)

got this error while patching (against 2.5.24 tarball):

can't find file to patch at input line 1696
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|===== BitKeeper/etc/ignore 1.21 vs 1.22 =====
|--- 1.21/BitKeeper/etc/ignore Mon Jun 17 23:06:10 2002
|+++ 1.22/BitKeeper/etc/ignore Thu Jun 20 16:11:01 2002
--------------------------

after removing this file from the patch it applies cleanly!
make mrproper works (no more unknown directories)
but I got this error after `make KBUILD_VERBOSE= KBUILD_MODULES=1 bzImage`:
<snip>
CC drivers/char/keyboard.o
make[2]: *** No rule to make target `defkeymap.o', needed by `built-in.o'.
Stop.
make[1]: *** [char] Error 2
make: *** [drivers] Error 2

so now defkeymap.c is not generated (it was removed in 2.5.24)
manually generating it works but then this happened:

<snip>
CC arch/i386/boot/compressed/misc.o
make[2]: *** No rule to make target `vmlinux.scr', needed by `piggy.o'. Stop.
make[1]: *** [compressed/vmlinux] Error 2
make: *** [bzImage] Error 2


>
> However, I don't see why you get a failed hunk it applies cleanly against
> a bitkeeper v2.5.24 tree here. (Could you mail me the .rej file,
> privately).

I'm not using a bitkeeper tree, but the bitkeeper tree and the tarball should
be the same...

Rudmer

2002-06-23 22:00:10

by Sam Ravnborg

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Sun, Jun 23, 2002 at 01:39:51PM -0500, Kai Germaschewski wrote:
>
> Feedback is very welcome, of course ;)

1) Tried "make clean"
In the end it gave the following result:
make -C arch/i386/lib clean
Cleaning up
/home/sam/src/linux/kernel/bk/local/Rules.make:134: warning: overriding commands for target `clean'
Makefile:168: warning: ignoring old commands for target `clean'

make clean is too verbose now, especially taken KBUILD_VERBOSE= in consideration.

2) While doing a clean build I spotted:
LD drivers/char/pcmcia/built-in.o
LD drivers/char/built-in.o
rm defkeymap.c
CC drivers/ide/device.o
CC drivers/ide/ide-taskfile.o
This rm looks wrong to me.
Btw. I did not use -j and on UP.

Second make did the following:
CP drivers/char/defkeymap.c
CC drivers/char/defkeymap.o
LD drivers/char/built-in.o
LD drivers/built-in.o
Generating build number
...

Third make completed with success.

3) [email protected]
Within Rules.make in section "Commands useful for boot image"
In the lines
# target: source(s) FORCE
-# $(if_changed,ld/objcopy)
+# $(if_changed,ld/objcopy/gzip)


4) Clean up arch/i386
I miss $(obj) in front of tools/build
zImage: bootsect setup vmlinux.bin tools/build
- tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@
+ $(obj)/tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@


bzImage: bbootsect bsetup bvmlinux.bin tools/build
- tools/build -b bbootsect bsetup bvmlinux.bin $(ROOT_DEV) > $@
+ $(obj)/tools/build -b bbootsect bsetup bvmlinux.bin $(ROOT_DEV) > $@

Reading through the 4 patches I miss $(obj) in many places.
In generally all temporary and final target needs $(obj)

5) jobserver unavailable
I've started too see this when I execute "make -j2":
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
Dunno if this is my local setup??
It happens even with nothing to do, e.g. a second make without changes in-between.
make -v:
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.

Sam

2002-06-23 23:21:03

by Petko Manolov

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Sun, 23 Jun 2002, Rudmer van Dijk wrote:

> On Sunday 23 June 2002 20:39, Kai Germaschewski wrote:
> >
> > bk pull http://linux-isdn.bkbits.net/linux-2.5.make
[snip]
> patching it against 2.5.24 (starting from 2.5.13 and patched up to) gives the
> same failed hunk as with 2.5.24-dj1

Applies cleanly against latest Linus' BK release. And this time i
finally got 2.5.24 to compile. Haven't given it a try yet though, but it
looks much better than the vanilla 2.5.24...


Petko

2002-06-24 00:15:19

by Kai Germaschewski

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Sun, 23 Jun 2002, Rudmer van Dijk wrote:

> got this error while patching (against 2.5.24 tarball):

Hmmh, it seems all three errors you get are related to the same problem: I
don't know the proper command how to create a gnu patch from my bk tree.

Anyway, so now there's a version 3 which I diffed manually. Still has the
warning for "make clean", but should work.

(I couldn't help but wonder: Is three tries enough to get it right?)

--Kai

2002-06-24 01:23:13

by Kai Germaschewski

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Mon, 24 Jun 2002, Sam Ravnborg wrote:

> 1) Tried "make clean"
> In the end it gave the following result:
> make -C arch/i386/lib clean
> Cleaning up
> /home/sam/src/linux/kernel/bk/local/Rules.make:134: warning: overriding commands for target `clean'
> Makefile:168: warning: ignoring old commands for target `clean'
>
> make clean is too verbose now, especially taken KBUILD_VERBOSE= in consideration.

Yeah, that's the "rough edges" I was refering to.

> 2) While doing a clean build I spotted:
> LD drivers/char/pcmcia/built-in.o
> LD drivers/char/built-in.o
> rm defkeymap.c
> CC drivers/ide/device.o
> CC drivers/ide/ide-taskfile.o
> This rm looks wrong to me.
> Btw. I did not use -j and on UP.

That's not so nice, it's caused by make considering defkeymap.c an
intermediate file, and thus removing it when it's no longer necessary.
That's not so good, though, since it causes unnecessary rebuilds. Fixed by
adding explicit

$(obj)/defkeymap.o: $(obj)/defkeymap.c

rules.

> 3) [email protected]
> Within Rules.make in section "Commands useful for boot image"
> In the lines
> # target: source(s) FORCE
> -# $(if_changed,ld/objcopy)
> +# $(if_changed,ld/objcopy/gzip)

Okay ;)

> 4) Clean up arch/i386
> I miss $(obj) in front of tools/build
> zImage: bootsect setup vmlinux.bin tools/build
> - tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@
> + $(obj)/tools/build bootsect setup vmlinux.bin $(ROOT_DEV) > $@
>
>
> bzImage: bbootsect bsetup bvmlinux.bin tools/build
> - tools/build -b bbootsect bsetup bvmlinux.bin $(ROOT_DEV) > $@
> + $(obj)/tools/build -b bbootsect bsetup bvmlinux.bin $(ROOT_DEV) > $@
>
> Reading through the 4 patches I miss $(obj) in many places.
> In generally all temporary and final target needs $(obj)

Yes, I just didn't add those, yet.

> 5) jobserver unavailable

> I've started too see this when I execute "make -j2":
> make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
> Dunno if this is my local setup??

No, though I think this one has been there forever, it just doesn't
surface when not using "make -jX bzImage". Added a + as suggested ;)

Patch with these various improvements is appended. BTW, this whole series
will need to be redone cleanly before it's ready to be submitted to Linus,
so if you're using bk, throw away the clone of my tree before pulling from
Linus' tree again.

--Kai

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.610 -> 1.611
# drivers/acorn/char/Makefile 1.7 -> 1.8
# Makefile 1.273 -> 1.274
# drivers/tc/Makefile 1.5 -> 1.6
# arch/i386/Makefile 1.15 -> 1.16
# Rules.make 1.69 -> 1.70
# drivers/char/Makefile 1.25 -> 1.26
# Documentation/DocBook/Makefile 1.26 -> 1.27
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/23 [email protected] 1.611
# kbuild: assorted small fixes / cosmetics
# --------------------------------------------
#
diff -Nru a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
--- a/Documentation/DocBook/Makefile Sun Jun 23 20:19:30 2002
+++ b/Documentation/DocBook/Makefile Sun Jun 23 20:19:30 2002
@@ -26,7 +26,7 @@
$(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc

-.PHONY: sgmldocs psdocs pdfdocs htmldocs clean mrproper
+.PHONY: sgmldocs psdocs pdfdocs htmldocs mrproper

sgmldocs: $(BOOKS)

@@ -164,22 +164,6 @@
LOG := $(patsubst %.sgml, %.log, $(BOOKS))
OUT := $(patsubst %.sgml, %.out, $(BOOKS))

-clean:
- @echo 'Cleaning up (DocBook)'
- @rm -f core *~
- @rm -f $(BOOKS)
- @rm -f $(DVI) $(AUX) $(TEX) $(LOG) $(OUT)
- @rm -f $(PNG-parportbook) $(EPS-parportbook)
- @rm -f $(C-procfs-example)
-
-mrproper:
- @echo 'Making mrproper (DocBook)'
- @rm -f $(PS) $(PDF)
- @rm -f -r $(HTML)
- @rm -f .depend
- @rm -f $(TOPDIR)/scripts/mkdep-docbook
- @rm -rf DBTOHTML_OUTPUT*
-
%.ps : %.sgml
@(which db2ps > /dev/null 2>&1) || \
(echo "*** You need to install DocBook stylesheets ***"; \
@@ -200,12 +184,9 @@
db2html $<
if [ ! -z "$(PNG-$@)" ]; then cp $(PNG-$@) $@; fi

-#
-# we could have our own dependency generator
-#
-#
-# .depend: $(TOPDIR)/scripts/mkdep-docbook
-# $(TOPDIR)/scripts/mkdep-docbook $(wildcard *.tmpl) > .depend
+clean-files := $(BOOKS) $(DVI) $(AUX) $(TEX) $(LOG) $(OUT) \
+ $(PNG-parportbook) $(EPS-parportbook) $(C-procfs-example) \
+ $(PS) $(PDF) $(HTML) DBTOHTML_OUTPUT*

include $(TOPDIR)/Rules.make

diff -Nru a/Makefile b/Makefile
--- a/Makefile Sun Jun 23 20:19:30 2002
+++ b/Makefile Sun Jun 23 20:19:30 2002
@@ -250,7 +250,7 @@

vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)

-quiet_cmd_link_vmlinux = LD $@
+quiet_cmd_link_vmlinux = LD $@
cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
--start-group \
$(CORE_FILES) \
@@ -611,35 +611,47 @@

include arch/$(ARCH)/Makefile

-$(addprefix _clean_,$(SUBDIRS)):
- make -C $(patsubst _clean_%,%,$@) clean
+CLEAN_SUBDIRS := $(SUBDIRS) Documentation/DocBook

-clean: $(addprefix _clean_,$(SUBDIRS))
- @echo 'Cleaning up'
- @find . -name SCCS -prune -o -name BitKeeper -prune -o \
+$(addprefix _clean_,$(CLEAN_SUBDIRS)):
+ @make -C $(patsubst _clean_%,%,$@) clean
+
+quiet_cmd_clean = CLEAN (TOPDIR)
+define cmd_clean
+ find . -name SCCS -prune -o -name BitKeeper -prune -o \
\( -name \*.[oas] -o -name core -o -name .\*.cmd -o \
-name .\*.tmp -o -name .\*.d \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
- @rm -f $(CLEAN_FILES)
- @$(MAKE) -C Documentation/DocBook clean
+ rm -f $(CLEAN_FILES)
+endef

-mrproper: clean archmrproper
- @echo 'Making mrproper'
- @find . -name SCCS -prune -o -name BitKeeper -prune -o \
+clean: $(addprefix _clean_,$(CLEAN_SUBDIRS))
+ $(call cmd,clean)
+
+quiet_cmd_mrproper = MRPROPER
+define cmd_mrproper
+ find . -name SCCS -prune -o -name BitKeeper -prune -o \
\( -name .depend -o -name .\*.cmd \) \
-type f -print | xargs rm -f
- @rm -f $(MRPROPER_FILES)
- @rm -rf $(MRPROPER_DIRS)
- @$(MAKE) -C Documentation/DocBook mrproper
+ rm -f $(MRPROPER_FILES)
+ rm -rf $(MRPROPER_DIRS)
+endef

-distclean: mrproper
- @echo 'Making distclean'
- @find . -name SCCS -prune -o -name BitKeeper -prune -o \
+mrproper: clean archmrproper
+ $(call cmd,mrproper)
+
+quiet_cmd_distclean = DISTCLEAN
+define cmd_distclean
+ find . -name SCCS -prune -o -name BitKeeper -prune -o \
\( -not -type d \) -and \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \
-print | xargs rm -f
+endef
+
+distclean: mrproper
+ $(call cmd,distclean)

# Generate tags for editors
# ---------------------------------------------------------------------------
diff -Nru a/Rules.make b/Rules.make
--- a/Rules.make Sun Jun 23 20:19:30 2002
+++ b/Rules.make Sun Jun 23 20:19:30 2002
@@ -130,11 +130,13 @@

.PHONY: clean

+quiet_cmd_clean = $(if $(strip $(clean-files) $(host-progs)),CLEAN $(RELDIR))
+cmd_clean = rm -f $(addprefix $(obj)/,$(clean-files) $(host-progs))
+
+
clean: $(subdir-ymn)
- $(if $(strip $(clean-files) $(host-progs)), \
- rm -f $(addprefix $(obj)/,$(clean-files) $(host-progs)))
+ $(call cmd,clean)
$(clean-rule)
- @/bin/true

else
ifeq ($(MAKECMDGOALS),fastdep)
@@ -186,7 +188,7 @@
# files (fix-dep filters them), so touch modversions.h if any of the .ver
# files changes

-quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
+quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > [email protected]

@@ -283,26 +285,26 @@
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)

-quiet_cmd_cc_s_c = CC $(echo_target)
+quiet_cmd_cc_s_c = CC $(echo_target)
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<

%.s: %.c FORCE
$(call if_changed_dep,cc_s_c)

-quiet_cmd_cc_i_c = CPP $(echo_target)
+quiet_cmd_cc_i_c = CPP $(echo_target)
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<

%.i: %.c FORCE
$(call if_changed_dep,cc_i_c)

-quiet_cmd_cc_o_c = CC $(echo_target)
+quiet_cmd_cc_o_c = CC $(echo_target)
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<

%.o: %.c FORCE
$(call if_changed_dep,cc_o_c)

-quiet_cmd_cc_lst_c = ' Generating $(echo_target)'
-cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@
+quiet_cmd_cc_lst_c = MKLST $(echo_target)
+cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@

%.lst: %.c FORCE
$(call if_changed_dep,cc_lst_c)
@@ -318,13 +320,13 @@
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)

-quiet_cmd_as_s_S = CPP $(echo_target)
+quiet_cmd_as_s_S = CPP $(echo_target)
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<

%.s: %.S FORCE
$(call if_changed_dep,as_s_S)

-quiet_cmd_as_o_S = AS $(echo_target)
+quiet_cmd_as_o_S = AS $(echo_target)
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<

%.o: %.S FORCE
@@ -342,7 +344,7 @@
# Rule to compile a set of .o files into one .o file
#
ifdef O_TARGET
-quiet_cmd_link_o_target = LD $(echo_target)
+quiet_cmd_link_o_target = LD $(echo_target)
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
@@ -358,7 +360,7 @@
# Rule to compile a set of .o files into one .a file
#
ifdef L_TARGET
-quiet_cmd_link_l_target = AR $(echo_target)
+quiet_cmd_link_l_target = AR $(echo_target)
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)

$(L_TARGET): $(obj-y) FORCE
@@ -371,7 +373,7 @@
# Rule to link composite objects
#

-quiet_cmd_link_multi = LD $(echo_target)
+quiet_cmd_link_multi = LD $(echo_target)
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs),$^)

# We would rather have a list of rules like
@@ -393,7 +395,7 @@
host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m)))
host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs))

-quiet_cmd_host_cc__c = HOSTCC $(echo_target)
+quiet_cmd_host_cc__c = HOSTCC $(echo_target)
cmd_host_cc__c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $<
@@ -401,14 +403,14 @@
$(host-progs-single): %: %.c FORCE
$(call if_changed_dep,host_cc__c)

-quiet_cmd_host_cc_o_c = HOSTCC $(echo_target)
+quiet_cmd_host_cc_o_c = HOSTCC $(echo_target)
cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<

$(host-progs-multi-objs): %.o: %.c FORCE
$(call if_changed_dep,host_cc_o_c)

-quiet_cmd_host_cc__o = HOSTLD $(echo_target)
+quiet_cmd_host_cc__o = HOSTLD $(echo_target)
cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \
$(HOST_LOADLIBES)

@@ -424,9 +426,11 @@
# Shipped files
# ===========================================================================

+quiet_cmd_shipped = SHIPPED $(echo_target)
+cmd_shipped = cp $< $@
+
%:: %_shipped
- @echo ' CP $(echo_target)'
- @cp $< $@
+ $(call cmd,shipped)

# Commands useful for building a boot image
# ===========================================================================
@@ -434,7 +438,7 @@
# Use as following:
#
# target: source(s) FORCE
-# $(if_changed,ld/objcopy)
+# $(if_changed,ld/objcopy/gzip)
#
# and add target to EXTRA_TARGETS so that we know we have to
# read in the saved command line
@@ -442,20 +446,20 @@
# Linking
# ---------------------------------------------------------------------------

-quiet_cmd_ld = LD $(echo_target)
+quiet_cmd_ld = LD $(echo_target)
cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$@) \
$(filter-out FORCE,$^) -o $@

# Objcopy
# ---------------------------------------------------------------------------

-quiet_cmd_objcopy = OBJCPY $(echo_target)
+quiet_cmd_objcopy = OBJCOPY $(echo_target)
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@

# Gzip
# ---------------------------------------------------------------------------

-quiet_cmd_gzip = GZIP $(echo_target)
+quiet_cmd_gzip = GZIP $(echo_target)
cmd_gzip = gzip -f -9 < $< > $@

# ===========================================================================
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile Sun Jun 23 20:19:30 2002
+++ b/arch/i386/Makefile Sun Jun 23 20:19:30 2002
@@ -102,7 +102,7 @@
DRIVERS += arch/i386/pci/pci.o
endif

-MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
+MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot

vmlinux: arch/i386/vmlinux.lds

diff -Nru a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile
--- a/drivers/acorn/char/Makefile Sun Jun 23 20:19:30 2002
+++ b/drivers/acorn/char/Makefile Sun Jun 23 20:19:30 2002
@@ -20,6 +20,8 @@

include $(TOPDIR)/Rules.make

+$(obj)/defkeymap-acorn.o: $(obj)/defkeymap-acorn.c
+
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
@@ -28,6 +30,6 @@
ifdef GENERATE_KEYMAP

$(obj)/defkeymap-acorn.c: $(obj)/%.c: $(src)/%.map
- $(LOADKEYS) --mktable $< > $@
+ loadkeys --mktable $< > $@

endif
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
--- a/drivers/char/Makefile Sun Jun 23 20:19:30 2002
+++ b/drivers/char/Makefile Sun Jun 23 20:19:30 2002
@@ -220,6 +220,10 @@
$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
$(obj)/conmakehash $< > $@

+$(obj)/defkeymap.o: $(obj)/defkeymap.c
+
+$(obj)/qtronixmap.o: $(obj)/qtronixmap.c
+
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
@@ -228,7 +232,7 @@
ifdef GENERATE_KEYMAP

$(obj)/defkeymap.c $(obj)/qtronixmap.c: $(obj)/%.c: $(src)/%.map
- $(LOADKEYS) --mktable $< > [email protected]
+ loadkeys --mktable $< > [email protected]
sed -e 's/^static *//' [email protected] > $@
rm [email protected]

diff -Nru a/drivers/tc/Makefile b/drivers/tc/Makefile
--- a/drivers/tc/Makefile Sun Jun 23 20:19:30 2002
+++ b/drivers/tc/Makefile Sun Jun 23 20:19:30 2002
@@ -15,6 +15,8 @@

include $(TOPDIR)/Rules.make

+$(obj)/lk201-map.o: $(obj)/lk201-map.c
+
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
@@ -23,6 +25,6 @@
ifdef GENERATE_KEYMAP

$(obj)/lk201-map.c: $(obj)/%.c: $(src)/%.map
- $(LOADKEYS) --mktable $< > $@
+ loadkeys --mktable $< > $@

endif

2002-06-24 06:27:52

by David Miller

[permalink] [raw]
Subject: Re: kbuild fixes and more


BTW, Kai, a bug was added when you changed the path of the
'host-progs' value in drivers/video/Makefile, the build looks
for a dependency file that isn't there.

Amusingly, eliminating the host-progs line in this Makefile results in
a successful build.

This is an area that needs dealing with, a host build program that is
used by multiple directories. I think conmakehash, this particular
case, belongs in scripts/. That might be the generic solution to
build tools used by multiple places of the tree.

2002-06-24 17:55:49

by Rudmer van Dijk

[permalink] [raw]
Subject: Re: kbuild fixes and more

On Monday 24 June 2002 02:15, Kai Germaschewski wrote:
> On Sun, 23 Jun 2002, Rudmer van Dijk wrote:
> > got this error while patching (against 2.5.24 tarball):
>
> Hmmh, it seems all three errors you get are related to the same problem: I
> don't know the proper command how to create a gnu patch from my bk tree.
>
> Anyway, so now there's a version 3 which I diffed manually. Still has the
> warning for "make clean", but should work.

Did not see this warning, it applies cleanly 8-)

>
> (I couldn't help but wonder: Is three tries enough to get it right?)

It looks like it, it compiles in one go! (did not run it (yet))

I was only wondering about this:

# make KBUILD_VERBOSE= KBUILD_MODULES=1 bzImage
<snip>
CP drivers/char/defkeymap.c
<snip>
LD drivers/char/built-in.o
rm defkeymap.c
^^^^^^^^^
<snip>

why is it first copied to this dir and later on, after linking all char
drivers together, it is removed again... isn't it simpler to just leave the
file in place??

I also like the complete silence of the final linking:
BUILD arch/i386/boot/bzImage
Root device is (3, 2)
Boot sector 512 bytes.
Setup is 2636 bytes.
System is 847 kB

This is very nice!

I have a minor 'fix' included

Rudmer

--- linux-2.5.24-kg3/Makefile.orig 2002-06-24 19:48:48.000000000 +0200
+++ linux-2.5.24-kg3/Makefile 2002-06-24 19:49:01.000000000 +0200
@@ -5,7 +5,7 @@

# *DOCUMENTATION*
# Too see a list of typical targets execute "make help"
-# More info can be located in ./Documentation/kbuild
+# More info can be found in ./Documentation/kbuild
# Comments in this file is targeted only to the developer, do not
# expect to learn how to build the kernel reading this file.

-or-

--- linux-2.5.24-kg3/Makefile.orig 2002-06-24 19:48:48.000000000 +0200
+++ linux-2.5.24-kg3/Makefile 2002-06-24 19:49:01.000000000 +0200
@@ -5,7 +5,7 @@

# *DOCUMENTATION*
# Too see a list of typical targets execute "make help"
-# More info can be located in ./Documentation/kbuild
+# More info is located in ./Documentation/kbuild
# Comments in this file is targeted only to the developer, do not
# expect to learn how to build the kernel reading this file.