Skip to contentSkip to conversation

kbuild

PATCH In review Sam Ravnborg 15 participants 64 messages Jun 14, 2004 – Jun 13, 2014 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover kbuild

Hi Andrew. Here follows a number of kbuild patches.

The first replaces kbuild-specify-default-target-during-configuration.patch

They have seen ligiht testing here, but on the other hand the do not touch any critical part of kbuild.

Patches:

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.
move rpm to scripts/package: Move rpm support so we are ready for
more package types
add deb-pkg target: Pack kernel in debian format
make clean improved: make clean removes a few more files
external module build doc: Add documentation for building external modules

Above changes can be pulled from linux-sam.bkbits.net/kbuild:
bk pull bk://linux-sam.bkbits.net/kbuild
(Being updated as I type)

Patches follows as individual mails.

If anyone like to cook up a targz-pkg target please feel free.

Sam

#1 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/07 22:56:31+02:00 [email protected]
# kbuild: Default kernel image defined in .config
#

#   During kernel configuration the default kernel image is now being selected.
#   When compiling the kernel the user no longer needs to look up the
#   selected kernel imgae in either the $(ARCH) makefile or in 'make help'.
#   The more natural choice is to select the kernel image during kernel
#   the configuration.
#   The menu is located at the very top, since the other logical place
#   "general setup" did not have an opening for architecture specific
#   options.
#   The added benefit is that packaging tools now have access to the selected
#   kernel imgae, and do not have to do wild guessing based on architectures.

#
# This patch only converts i386, but other architectures should be easy to convert.
# The patch is backward compatible, other architecture will not break due to this change.
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# arch/i386/Makefile
# 2004/06/07 22:56:16+02:00 [email protected] +10 -8
# Teach i386 makefile to use full path to kernel image, along the well known short versions of the names
#
# arch/i386/Kconfig
# 2004/06/07 22:56:16+02:00 [email protected] +36 -0
# Add i386 config options to select kernel image
#
# Makefile

#   2004/06/07 22:56:16+02:00 [email protected] +10 -7
#   Use the new default target selected during kernel configuration.
#   When no kernel image is selected during configuaration vmlinux is assumed default.

#

Makefile +10 -7
diff -Nru a/Makefile b/Makefile
@@ -409,13 +409,6 @@
 
 scripts_basic: include/linux/autoconf.h
 
-
-# That's our default target when none is given on the command line
-# Note that 'modules' will be added as a prerequisite as well, 
-# in the CONFIG_MODULES part below
-
-all:	vmlinux
-
 # Objects we will link into vmlinux / subdirs we need to visit
 init-y		:= init/
 drivers-y	:= drivers/ sound/
@@ -448,6 +441,16 @@
 endif
 
 include $(srctree)/arch/$(ARCH)/Makefile
+
+# Selected kernel image to build in .config, assuming vmlinux
+# if CONFIG_KERNEL_IMAGE is empty (not defined)
+KERNEL_IMAGE := $(if $(CONFIG_KERNEL_IMAGE), \
+                     $(subst ",,$(CONFIG_KERNEL_IMAGE)), vmlinux)
+
+# The all: target has the kernel selected in .config as prerequisite.
+# Hereby user only have to issue 'make' to build the kernel, including
+# selected kernel
+all: $(KERNEL_IMAGE)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 CFLAGS		+= -Os
arch/i386/Kconfig +36 -0
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
@@ -29,6 +29,42 @@
 	bool
 	default y
 
+choice
+	prompt "Default kernel image"
+	default KERNEL_IMAGE_BZIMAGE
+	help
+	  Specify which kernel image to be build when executing 'make' with
+	  no arguments.
+
+config KERNEL_IMAGE_BZIMAGE
+	bool "bzImage - Compressed kernel image"
+	help
+	  bzImage - located at arch/i386/boot/bzImage.
+	  bzImage can accept larger kernels than zImage
+	
+config KERNEL_IMAGE_ZIMAGE
+	bool "zImage - Compressed kernel image"
+	help
+	  zImage - located at arch/i386/boot/zImage.
+	  zImage is seldom used. zImage supports smaller kernels than bzImage,
+	  and is only used in special situations.
+
+config KERNEL_IMAGE_VMLINUX
+	bool "vmlinux - the bare kernel"
+	help
+	  vmlinux - located at the root of the kernel tree
+	  vmlinux contains the kernel image with no additional bootloader.
+	  vmlinux is seldom used as target for i386.
+
+endchoice
+
+config KERNEL_IMAGE
+	string 
+	default arch/i386/boot/bzImage if KERNEL_IMAGE_BZIMAGE
+	default arch/i386/boot/zImage  if KERNEL_IMAGE_ZIMAGE
+	default vmlinux                if KERNEL_IMAGE_VMLINUX
+
+
 source "init/Kconfig"
 
 
arch/i386/Makefile +10 -8
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
@@ -116,18 +116,20 @@
 
 boot := arch/i386/boot
 
-.PHONY: zImage bzImage compressed zlilo bzlilo \
-	zdisk bzdisk fdimage fdimage144 fdimage288 install
+# Shortcut targets to different i386 targets.
+.PHONY: bzImage zImage compressed
+bzImage:    $(boot)/bzImage
+zImage:     $(boot)/zImage
+compressed: $(boot)/zImage	# Deprecated, will be deleted later
 
-all: bzImage
+# Target's that install the kernel
+.PHONY: zlilo bzlilo zdisk bzdisk fdimage fdimage144 fdimage288 install
 
 BOOTIMAGE=arch/i386/boot/bzImage
-zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage
+zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage
 
-zImage bzImage: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
-
-compressed: zImage
+$(boot)/zImage $(boot)/bzImage: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $@
 
 zlilo bzlilo: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
#2 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 4 lines · Sam Ravnborg
#   When compiling the kernel the user no longer needs to look up the
#   selected kernel imgae in either the $(ARCH) makefile or in 'make help'.
#   The more natural choice is to select the kernel image during kernel
#   the configuration.

I'm slightly scared of this. Historically, there's already pressure from boot loader people on ARM to include random file formats to suit their own boot loaders.

In the first place, ARM had Image and zImage and that was it. It was well defined. Then people decided that gzipped Image would be nice and they'd merge the zlib code into their boot loader. I think there's even some people who use gzipped zImage...!

Then ARMboot came along and we eventually ended up with uboot-style wrappings to support uboot / ARMboot, which require an external program to be installed on the host system called "mkimage" (which, incidentally is an incredibly bad choice of name.)

People also came up with the idea of using the ELF file directly and having the boot loader parse the ELF file. I wouldn't put it past someone to want gzipped ELF as well.

There's also srec to support serially downloaded images as well.

So, in total, we have boot loaders which want:

- Image
- zImage
- gzipped Image
- gzipped zImage
- uboot
- ELF
- srec

Basically this is somewhere I don't want to go. My position is that if boot loaders want to have their own proprietary formats, they should do whatever manipulation to the kernel image is necessary as a post processing step themselves from one of the two standard kernel formats - Image or zImage.

However, the problem of offering users all these options is that their first question will be "huh, which one of these 7 do I want?" rather than everyone knowing that they need the kernel build to produce either an Image or zImage and the boot loader documentation telling them what to do with it next.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#3 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 37 lines · Russell King

I'm slightly scared of this. Historically, there's already pressure from boot loader people on ARM to include random file formats to suit their own boot loaders.

In the first place, ARM had Image and zImage and that was it. It was well defined. Then people decided that gzipped Image would be nice and they'd merge the zlib code into their boot loader. I think there's even some people who use gzipped zImage...!

Then ARMboot came along and we eventually ended up with uboot-style wrappings to support uboot / ARMboot, which require an external program to be installed on the host system called "mkimage" (which, incidentally is an incredibly bad choice of name.)

People also came up with the idea of using the ELF file directly and having the boot loader parse the ELF file. I wouldn't put it past someone to want gzipped ELF as well.

There's also srec to support serially downloaded images as well.

So, in total, we have boot loaders which want:

- Image
- zImage
- gzipped Image
- gzipped zImage
- uboot
- ELF
- srec

Basically this is somewhere I don't want to go. My position is that if boot loaders want to have their own proprietary formats, they should do whatever manipulation to the kernel image is necessary as a post processing step themselves from one of the two standard kernel formats - Image or zImage.

Quoted 5 lines

However, the problem of offering users all these options is that their first question will be "huh, which one of these 7 do I want?" rather than everyone knowing that they need the kernel build to produce either an Image or zImage and the boot loader documentation telling them what to do with it next.

The advantage is that you now have a good place to document all of these formats - your Kconfig file.
And you select the default target for the user.

How did I know uboot required mkimage before - now it can be documented in Kconfig.
So the situation above is actually a good example why it is whortwhile to move the kernel image selection to the config stage.

If they all should be part of the kernel build is another discussion.

Sam

#4 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 10 lines · Sam Ravnborg

The advantage is that you now have a good place to document all of these formats - your Kconfig file.
And you select the default target for the user.

How did I know uboot required mkimage before - now it can be documented in Kconfig.
So the situation above is actually a good example why it is whortwhile to move the kernel image selection to the config stage.

If they all should be part of the kernel build is another discussion.

You missed my point.

How does a user know which format they need to build the kernel with _if_ the kernel configuration contains all the formats and the boot loader documentation fails to mention it?

Sure you can document each format in minute detail, but that doesn't tell the user anything useful.

As I tried to point out, boot loaders on ARM historically seem to have been "My First ARM Project" type things so there's lots of them out there - there aren't 3 or so found on x86.

AFAIAC, if the boot loader does not support the standard Image or zImage format, both of which are the fully documented "official" ARM kernel formats, it is up to the boot loader to provide whatever scripts or programs are needed to manipulate the output of the kernel build to whatever the boot loader wants.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#5 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 5 lines · Russell King

AFAIAC, if the boot loader does not support the standard Image or zImage format, both of which are the fully documented "official" ARM kernel formats, it is up to the boot loader to provide whatever scripts or programs are needed to manipulate the output of the kernel build to whatever the boot loader wants.

And we have /sbin/installkernel and ~/bin/installkernel as defined hooks for that. No need to support everything and a kitchensink in the kernel build process. In fact I'd love to reduce what the kernel builds to just vmlinux and vmlinux.gz, but I guess all those lilo user will kill me ;-)

#6 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Russell King

AFAIAC, if the boot loader does not support the standard Image or zImage format, both of which are the fully documented "official" ARM kernel formats, it is up to the boot loader to provide whatever scripts or programs are needed to manipulate the output of the kernel build to whatever the boot loader wants.

And we have /sbin/installkernel and ~/bin/installkernel as defined hooks for that.

installkernel is a hack to install a kernel for current machine mainly. Not what I consider a good generic solution.

Quoted 2 lines

In fact I'd love to reduce what the kernel builds to just vmlinux and vmlinux.gz, but I guess all those lilo user will kill me ;-)

I do not see the point in this.
Better make life easier - but in a nice and structured way.
Take a look at arch/ppc/boot/simple to see that the bootloader step is not trivial.. The concept with a clean and lean kernel that cannot be used in real-life without doing lot's of stuff is a dead end.

Sam

#7 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 1 line · Sam Ravnborg

Better make life easier - but in a nice and structured way.

Life /was/ easy when there was just zImage and Image on ARM. All you had to do was decide whether you wanted a compressed or uncompressed binary image of the kernel, where compressed images were the normal.

And this is the way I'd preferred it to stay since we have a nice sane structured idea of what we provide without any major "what file format do I need" problems.

The problem starts happening when boot loaders think they can dictate to the kernel what format they want the kernel to be in - at that point the number of kernel image formats and methods to boot the kernel increases and everything gets a lot more complex.

This is the whole basis of my argument. We shouldn't make it easy for people to extend this stupid idea that the boot loader defines the format which the kernel shall be in. It's the _wrong_ idea.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#8 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

In reply to Sam Ravnborg
Quoted 6 lines · Sam Ravnborg
Quoted 2 lines · Christoph Hellwig

In fact I'd love to reduce what the kernel builds to just vmlinux and vmlinux.gz, but I guess all those lilo user will kill me ;-)

I do not see the point in this.
Better make life easier - but in a nice and structured way.
Take a look at arch/ppc/boot/simple to see that the bootloader step is not trivial..

That's not a good example of why it's not trivial, really :)
- 2/5th are what final frob'ing do I need to run for the f/w.
- 1/5th are what extension to use in /tftpboot/
- 2/5th are what platform-specific bits do I need
And 1 (so I'm a bit of 100%, shoot me :)) is for an actual CONFIG option, that we only use in the bootloader code as on very small memory machines you might not want to load at the default address for your platform.

We've actually talked about moving all of that code out and using, for example, a stripped down U-Boot (the point of arch/ppc/boot/ stuffs is to not depend on the f/w to do anything aside from load us into memory) that'd just load up the kernel and let it go. All of the information that would be needed by such a program are already avail via IKCONFIG (and could be stripped out afterwards I believe for size).

Quoted 2 lines

The concept with a clean and lean kernel that cannot be used in real-life without doing lot's of stuff is a dead end.

Define "lot's of stuff". IIRC, sparc* has always been just a vmlinux, and 99% of pmac users use yaboot + vmlinux.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#9 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

In reply to Russell King
Quoted 10 lines · Russell King
Quoted 9 lines · Sam Ravnborg

The advantage is that you now have a good place to document all of these formats - your Kconfig file.
And you select the default target for the user.

How did I know uboot required mkimage before - now it can be documented in Kconfig.
So the situation above is actually a good example why it is whortwhile to move the kernel image selection to the config stage.

Quoted 7 lines
Quoted 1 line

If they all should be part of the kernel build is another discussion.

You missed my point.

How does a user know which format they need to build the kernel with _if_ the kernel configuration contains all the formats and the boot loader documentation fails to mention it?

I think what Sam was saying is that you document what boards are supported by what firmwares, in the Kconfig. But what I don't think Sam saw would be just how ugly that's going to look (and become another point where every new board port touches, and possibly conflicts with another new board port).

Quoted 3 lines

As I tried to point out, boot loaders on ARM historically seem to have been "My First ARM Project" type things so there's lots of them out there - there aren't 3 or so found on x86.

And that's another good reason not to.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#10 lore raw

Re: [PATCH 1/5] kbuild: default kernel image

Quoted 5 lines · Tom Rini

I think what Sam was saying is that you document what boards are supported by what firmwares, in the Kconfig. But what I don't think Sam saw would be just how ugly that's going to look (and become another point where every new board port touches, and possibly conflicts with another new board port).

Indeed - however, take a peek at arch/arm/tools/mach-types - that's a list of the various machines which the ARM kernel may or may not have been ported to. Something suggests that creating a list of machine types in the Kconfig help documentation will probably be unmanageable.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#11 lore raw

Re: [PATCH 2/5] kbuild: move rpm to scripts/package

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 21:22:52+02:00 [email protected]
# kbuild: Move rpm target o scripts/package
#

#   To prepare for support of more packages types move suport for rpm to
#   a new directory: scripts/package.
#   Use the generic target "%-pkg" so the new target for rpm is now: rpm-pkg.
#   Kept the old rpm target for backward compatibility.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# scripts/package/Makefile
# 2004/06/14 21:22:37+02:00 [email protected] +55 -0
#

# scripts/package/mkspec
#   2004/06/14 21:22:37+02:00 [email protected] +6 -15
#   Use $KERNEL_IMAGE to locate compiled image, hereby no hardcoding to
#   different architectures.
#   Separate make clean && make steps
# 
# scripts/package/Makefile
#   2004/06/14 21:22:37+02:00 [email protected] +0 -0
#   BitKeeper file /home/sam/bk/kbuild/scripts/package/Makefile
# 
# scripts/Makefile
#   2004/06/14 21:22:37+02:00 [email protected] +1 -1
#   Clean in package/ as well
# 
# Makefile
#   2004/06/14 21:22:37+02:00 [email protected] +14 -32
#   Moved rpm target to scripts/package/Makefile
#   Exported KERNEL_IMAGE to give access to it outside this Makefile
#   Add support for the scripts/package/* stuff
# 
# scripts/packages/mkspec
#   2004/06/07 23:03:27+02:00 [email protected] +0 -0
#   Rename: scripts/mkspec -> scripts/packages/mkspec
# 
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-06-14 22:25:51 +02:00
+++ b/Makefile	2004-06-14 22:25:51 +02:00
@@ -290,8 +290,6 @@
 OBJCOPY		= $(CROSS_COMPILE)objcopy
 OBJDUMP		= $(CROSS_COMPILE)objdump
 AWK		= awk
-RPM 		:= $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
-		    	else echo rpm; fi)
 GENKSYMS	= scripts/genksyms/genksyms
 DEPMOD		= /sbin/depmod
 KALLSYMS	= scripts/kallsyms
@@ -444,8 +442,8 @@

# Selected kernel image to build in .config, assuming vmlinux

 # if CONFIG_KERNEL_IMAGE is empty (not defined)
-KERNEL_IMAGE := $(if $(CONFIG_KERNEL_IMAGE), \
-                     $(subst ",,$(CONFIG_KERNEL_IMAGE)), vmlinux)
+export KERNEL_IMAGE := $(if $(CONFIG_KERNEL_IMAGE), \
+                            $(subst ",,$(CONFIG_KERNEL_IMAGE)), vmlinux)

# The all: target has the kernel selected in .config as prerequisite. # Hereby user only have to issue 'make' to build the kernel, including
@@ -798,7 +796,7 @@

# Directories & files removed with 'make clean' CLEAN_DIRS += $(MODVERDIR)
-CLEAN_FILES += vmlinux System.map kernel.spec \
+CLEAN_FILES += vmlinux System.map \
.tmp_kallsyms* .tmp_version .tmp_vmlinux*

# Directories & files removed with 'make mrproper'
@@ -851,37 +849,19 @@
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f

-# RPM target
-# --------------------------------------------------------------------------- -
-.PHONY: rpm

-# Remove hyphens since they have special meaning in RPM filenames -KERNELPATH=kernel-$(subst -,,$(KERNELRELEASE))
+# Packaging of the kernel to various formats
+# --------------------------------------------------------------------------- +# rpm target kept for backward compatibility
+package-dir := $(srctree)/scripts/package

-# If you do a make spec before packing the tarball you can rpm -ta it
+.PHONY: %-pkg rpm

-spec:
- $(CONFIG_SHELL) $(srctree)/scripts/mkspec > $(objtree)/kernel.spec
-
-# a) Build a tar ball
-# b) generate an rpm from it
-# c) and pack the result
-# - Use /. to avoid tar packing just the symlink
-
-rpm: clean spec
- set -e; \
- cd .. ; \
- ln -sf $(srctree) $(KERNELPATH) ; \
- tar -cvz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
- rm $(KERNELPATH)
-
- set -e; \
- $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version;\
- mv -f $(objtree)/.tmp_version $(objtree)/.version;
+%pkg: FORCE
+ $(Q)$(MAKE) -f $(package-dir)/Makefile $@
+rpm: FORCE
+ $(Q)$(MAKE) -f $(package-dir)/Makefile $@

- $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
- rm ../$(KERNELPATH).tar.gz

# Brief documentation of the typical targets used
# ---------------------------------------------------------------------------
@@ -908,6 +888,8 @@

 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
 	@echo  '  checkstack      - Generate a list of stack hogs'
+	@echo  'Kernel packaging:'

+ @$(MAKE) -f $(package-dir)/Makefile help
@echo ''
@echo 'Documentation targets:'
@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp

scripts/Makefile +1 -1
diff -Nru a/scripts/Makefile b/scripts/Makefile
@@ -13,7 +13,7 @@
 subdir-$(CONFIG_MODVERSIONS)	+= genksyms
 
 # Let clean descend into subdirs
-subdir-	+= basic lxdialog kconfig
+subdir-	+= basic lxdialog kconfig package
 
 # dependencies on generated files need to be listed explicitly
 
scripts/mkspec deleted +0 -72

72 lines not on this page · raw message

scripts/package/Makefile new file +55 -0

55 lines not on this page · raw message

scripts/package/mkspec new file +63 -0

63 lines not on this page · raw message

#12 lore raw

Re: [PATCH 3/5] kbuild: add deb-pkg target

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 21:44:27+02:00 [email protected]
# kbuild: Added deb target
#
# Script originally from Wichert Akkerman <[email protected]>
# Modified to support multiple architectures.
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/package/builddeb
#   2004/06/14 21:44:12+02:00 [email protected] +79 -0
# 
# scripts/package/builddeb
#   2004/06/14 21:44:12+02:00 [email protected] +0 -0
#   BitKeeper file /home/sam/bk/kbuild/scripts/package/builddeb
# 
# scripts/package/Makefile
#   2004/06/14 21:44:12+02:00 [email protected] +13 -1
#   Added deb-pkg target
# 
diff -Nru a/scripts/package/Makefile b/scripts/package/Makefile
--- a/scripts/package/Makefile	2004-06-14 22:25:41 +02:00
+++ b/scripts/package/Makefile	2004-06-14 22:25:41 +02:00
@@ -46,10 +46,22 @@
 	$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
 	rm ../$(KERNELPATH).tar.gz

-clean-rule += rm $(objtree)/kernel.spec
+clean-rule += rm -f $(objtree)/kernel.spec
+
+# Deb target
+# --------------------------------------------------------------------------- +#
+.PHONY: rpm-pkg rpm
+deb-pkg:
+ @$(MAKE)
+ @$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
+
+clean-rule += && rm -rf debian/
+

# Help text displayed when executing 'make help'
# --------------------------------------------------------------------------- help:

 	@echo  '  rpm-pkg         - Build the kernel as an RPM package'
+	@echo  '  deb-pkg         - Build the kernel as an deb package'
scripts/package/builddeb new file +79 -0
diff -Nru a/scripts/package/builddeb b/scripts/package/builddeb
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# builddeb 1.2
+# Copyright 2003 Wichert Akkerman <[email protected]>
+#
+# Simple script to generate a deb package for a Linux kernel. All the
+# complexity of what to do with a kernel after it is installer or removed
+# is left to other scripts and packages: they can install scripts in the
+# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on 
+# package install and removal.
+
+set -e
+
+# Some variables and settings used throughout the script
+version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+tmpdir="$(pwd)/debian/tmp"
+
+# Setup the directory structure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+
+# Build and install the kernel
+cp System.map "$tmpdir/boot/System.map-$version"
+cp .config "$tmpdir/boot/config-$version"
+cp $KERNEL_IMAGE "$tmpdir/boot/vmlinuz-$version"
+
+if grep -q '^CONFIG_MODULES=y' .config ; then
+	INSTALL_MOD_PATH="$tmpdir" make modules_install
+fi
+
+# Install the maintainer scripts
+for script in postinst postrm preinst prerm ; do
+	mkdir -p "$tmpdir/etc/kernel/$script.d"
+	cat <<EOF > "$tmpdir/DEBIAN/$script"
+#!/bin/sh
+
+set -e
+
+test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
+exit 0
+EOF
+	chmod 755 "$tmpdir/DEBIAN/$script"
+done
+
+name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+linux ($version) unstable; urgency=low
+
+  * A standard release
+
+ -- $name  $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: $name
+Standards-Version: 3.6.1
+
+Package: linux-$version
+Architecture: any
+Description: Linux kernel, version $version
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version.
+EOF
+
+# Fix some ownership and permissions
+chown -R root:root "$tmpdir"
+chmod -R go-w "$tmpdir"
+
+# Perform the final magic
+dpkg-gencontrol -isp
+dpkg --build "$tmpdir" ..
+
+exit 0
+
#13 lore raw

Re: [PATCH 3/5] kbuild: add deb-pkg target

Review

Quoted 5 lines · Previously Sam Ravnborg
(quoted diff) +5 -0
+# Deb target
+# ---------------------------------------------------------------------------
+# 
+.PHONY: rpm-pkg rpm
+deb-pkg:

Shouldn't that .PHONY reference deb-pkg instead?

Wichert.

Signature · 2 lines
Wichert Akkerman <[email protected]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.
#14 lore raw

Re: [PATCH 3/5] kbuild: add deb-pkg target

Quoted 8 lines · Wichert Akkerman

Review

Quoted 5 lines · Previously Sam Ravnborg
(quoted diff) +5 -0
+# Deb target
+# ---------------------------------------------------------------------------
+# 
+.PHONY: rpm-pkg rpm
+deb-pkg:

Shouldn't that .PHONY reference deb-pkg instead?

Obviously - thanks.
Fixed patch below.

Sam

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 21:44:27+02:00 [email protected]
# kbuild: Added deb target
#
# Script originally from Wichert Akkerman <[email protected]>
# Modified to support multiple architectures.
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

# scripts/package/builddeb
#   2004/06/14 21:44:12+02:00 [email protected] +79 -0
# 
# scripts/package/builddeb
#   2004/06/14 21:44:12+02:00 [email protected] +0 -0
#   BitKeeper file /home/sam/bk/kbuild/scripts/package/builddeb
# 
# scripts/package/Makefile
#   2004/06/14 21:44:12+02:00 [email protected] +13 -1
#   Added deb-pkg target
# 
diff -Nru a/scripts/package/Makefile b/scripts/package/Makefile
--- a/scripts/package/Makefile	2004-06-14 22:25:41 +02:00
+++ b/scripts/package/Makefile	2004-06-14 22:25:41 +02:00
@@ -46,10 +46,22 @@
 	$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
 	rm ../$(KERNELPATH).tar.gz

-clean-rule += rm $(objtree)/kernel.spec
+clean-rule += rm -f $(objtree)/kernel.spec
+
+# Deb target
+# --------------------------------------------------------------------------- +#
+.PHONY: deb-pkg
+deb-pkg:
+ @$(MAKE)
+ @$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
+
+clean-rule += && rm -rf debian/
+

# Help text displayed when executing 'make help'
# --------------------------------------------------------------------------- help:

 	@echo  '  rpm-pkg         - Build the kernel as an RPM package'
+	@echo  '  deb-pkg         - Build the kernel as an deb package'
scripts/package/builddeb new file +79 -0
diff -Nru a/scripts/package/builddeb b/scripts/package/builddeb
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# builddeb 1.2
+# Copyright 2003 Wichert Akkerman <[email protected]>
+#
+# Simple script to generate a deb package for a Linux kernel. All the
+# complexity of what to do with a kernel after it is installer or removed
+# is left to other scripts and packages: they can install scripts in the
+# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on 
+# package install and removal.
+
+set -e
+
+# Some variables and settings used throughout the script
+version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+tmpdir="$(pwd)/debian/tmp"
+
+# Setup the directory structure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+
+# Build and install the kernel
+cp System.map "$tmpdir/boot/System.map-$version"
+cp .config "$tmpdir/boot/config-$version"
+cp $KERNEL_IMAGE "$tmpdir/boot/vmlinuz-$version"
+
+if grep -q '^CONFIG_MODULES=y' .config ; then
+	INSTALL_MOD_PATH="$tmpdir" make modules_install
+fi
+
+# Install the maintainer scripts
+for script in postinst postrm preinst prerm ; do
+	mkdir -p "$tmpdir/etc/kernel/$script.d"
+	cat <<EOF > "$tmpdir/DEBIAN/$script"
+#!/bin/sh
+
+set -e
+
+test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
+exit 0
+EOF
+	chmod 755 "$tmpdir/DEBIAN/$script"
+done
+
+name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+linux ($version) unstable; urgency=low
+
+  * A standard release
+
+ -- $name  $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: $name
+Standards-Version: 3.6.1
+
+Package: linux-$version
+Architecture: any
+Description: Linux kernel, version $version
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version.
+EOF
+
+# Fix some ownership and permissions
+chown -R root:root "$tmpdir"
+chmod -R go-w "$tmpdir"
+
+# Perform the final magic
+dpkg-gencontrol -isp
+dpkg --build "$tmpdir" ..
+
+exit 0
+
#15 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 22:21:46+02:00 [email protected]
# kbuild: Add external module documentation
#

#   Add first version of a document describing how to build external modules.
#   This is not yet finished, but includes information that is nice to have
#   documented in the kernel even in a less complete form.

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# Documentation/kbuild/extmodules.txt
# 2004/06/14 22:21:32+02:00 [email protected] +168 -0
#
# Documentation/kbuild/extmodules.txt
# 2004/06/14 22:21:32+02:00 [email protected] +0 -0
# BitKeeper file /home/sam/bk/kbuild/Documentation/kbuild/extmodules.txt
#
# Documentation/kbuild/00-INDEX
# 2004/06/14 22:21:32+02:00 [email protected] +2 -0
# Added extmodules.txt
#

Documentation/kbuild/00-INDEX +2 -0
diff -Nru a/Documentation/kbuild/00-INDEX b/Documentation/kbuild/00-INDEX
@@ -6,3 +6,5 @@
 	- developer information for linux kernel makefiles
 modules.txt
 	- how to build modules and to install them
+extmodules.txt
+	- specific information about external modules
Documentation/kbuild/extmodules.txt new file +168 -0

168 lines not on this page · raw message

#16 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

Quoted 2 lines · Sam Ravnborg
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +0 -0

[snip]

Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00

Quoted 10 lines
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +10 -0
+A more advanced example
+- - - - - - - - - - - -
+This example shows a setup where a distribution has wisely decided
+to separate kernel source and output files:
+
+Kernel src:
+/usr/src/linux-<kernel-version>/
+
+Output from a kernel compile, including .config:
+/lib/modules/linux-<kernel-version>/build/
                                       ^^^^^

Wrong! The 'build' symlink has always pointed to kernel source dir in separate source and object directory case. Maybe you meant:

Output from a kernel compile, including .config:
/lib/modules/linux-<kernel-version>/object/

                                    ^^^^^^

Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00

Quoted 9 lines
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +9 -0
+External module to be compiled:
+/home/user/module/src/
+
+To compile the module located in the directory above use the
+following command:
+
+       cd /home/user/module/src
+       make -C /usr/src/linux-<kernel-version> \
+       O=/lib/modules/linux-<kernel-version>/build \
                                                ^^^^^
O=/lib/modules/linux-<kernel-version>/object
                                      ^^^^^^

Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00

Quoted 6 lines
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +6 -0
+       M=`pwd`
+
+Then to install the module use the following command:
+
+       make -C /usr/src/linux-<kernel-version> \
+               O=/lib/modules/linux-<kernel-version>/build \
                                                        ^^^^^
O=/lib/modules/linux-<kernel-version>/object
                                      ^^^^^^
Quoted 1 line

+ M='pwd` modules_install

[snip]

Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00

Quoted 12 lines
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +12 -0
+Prepare the kernel for building external modules
+------------------------------------------------
+When building external modules the kernel is expected to be prepared.
+This includes the precense of certain binaries, the kernel configuration
+and the symlink to include/asm.
+To do this a convinient target is made:
+
+       make modules_prepare
+
+For a typical distribution this would look like the follwoing:
+
+       make modules_prepare O=/lib/modules/linux-<kernel version>/build
                                                                     ^^^^^
make modules_prepare O=/lib/modules/linux-<kernel version>/object
                                                           ^^^^^^

Sam, You don't seem to have any idea how much breakage you introduce if you insist on redirecting the 'build' symlink from source tree to object tree.

Signature · 1 line
Jari Ruusu  1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9  DB 1D EB E3 24 0E A9 DD
#17 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

Quoted 15 lines · Jari Ruusu
Quoted 2 lines · Sam Ravnborg
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +0 -0

[snip]

Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00

Quoted 10 lines
Documentation/kbuild/extmodules.txt 2004-06-14 22:25:21 +02:00 renamed from dev/null Wed Dec 31 16:00:00 196900 +10 -0
+A more advanced example
+- - - - - - - - - - - -
+This example shows a setup where a distribution has wisely decided
+to separate kernel source and output files:
+
+Kernel src:
+/usr/src/linux-<kernel-version>/
+
+Output from a kernel compile, including .config:
+/lib/modules/linux-<kernel-version>/build/
                                       ^^^^^
Quoted 2 lines

Wrong! The 'build' symlink has always pointed to kernel source dir in separate source and object directory case.

This document was written before Andreas posted his patch - I just never came around updating it.

                                                            ^^^^^^
Quoted 2 lines

Sam, You don't seem to have any idea how much breakage you introduce if you insist on redirecting the 'build' symlink from source tree to object tree.

No - and I still do not see it. Please explain how we can be backward compatible when vendors start utilising separate directories for src and output.

Anyway, after I gave it some extra thoughs I concluded that /lib/modules/kernel-<version>/ was the wrong place to keep info about where to src for a given build is located. This information has to stay in the output directory.

So what I will implement is that during the kernel build process (not the install part) a symlink named 'source' is placed in the root of the output directory - and links to the root of the kernel src used for building the kernel.

Then /lib/modules/kernel-<version>/build/source will be where the source is located.
And /lib/modules/kernel-<version>/build will point to the output files.

If the vendor does not utilise separate src and output directories they will point to the same directory.
If the vendor utilises separate output and source directories then thay will point in two different places.

Comments?

Sam

#18 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

Quoted 16 lines · Sam Ravnborg
Quoted 2 lines

Sam, You don't seem to have any idea how much breakage you introduce if you insist on redirecting the 'build' symlink from source tree to object tree.

No - and I still do not see it. Please explain how we can be backward compatible when vendors start utilising separate directories for src and output.

Anyway, after I gave it some extra thoughs I concluded that /lib/modules/kernel-<version>/ was the wrong place to keep info about where to src for a given build is located. This information has to stay in the output directory.

So what I will implement is that during the kernel build process (not the install part) a symlink named 'source' is placed in the root of the output directory - and links to the root of the kernel src used for building the kernel.

Quoted 9 lines

Then /lib/modules/kernel-<version>/build/source will be where the source is located.
And /lib/modules/kernel-<version>/build will point to the output files.

If the vendor does not utilise separate src and output directories they will point to the same directory.
If the vendor utilises separate output and source directories then thay will point in two different places.

Please have a look at any package out there (or 99% of them) that need to figure out where the kernel _source_ is ... they all use something like:

KERNEL_SRC="/lib/modules/uname -r/build"

or

KERNEL_SRC="$(readlink /lib/modules/uname -r/build)"

If you now change it to /lib/modules/uname -r/build/source, many will break (depending if they might try things like looking if /usr/src/linux is around), and all will have to add _another_ kludge to figure things out.

Its a bad idea IMHO.

Cheers,

Signature · 1 line
Martin Schlemmer
#19 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg
Quoted 2 lines · Jari Ruusu

Sam, You don't seem to have any idea how much breakage you introduce if you insist on redirecting the 'build' symlink from source tree to object tree.

No - and I still do not see it.

If you don't understand how many external packages depend on the 'build' symlink pointing to directory where toplevel kernel Makefile is, then may I suggest that you do NOT touch that symlink all.

Quoted 2 lines

Please explain how we can be backward
compatible when vendors start utilising separate directories for src and output.

Most backward compatible way is to leave the 'build' symlink alone, and add another /lib/modules/uname -r/object symlink that points to the object tree.

Quoted 4 lines

Anyway, after I gave it some extra thoughs I concluded that /lib/modules/kernel-<version>/ was the wrong place to keep info about where to src for a given build is located. This information has to stay in the output directory.

Why can't there be two symlinks?

We have one now (the 'build' symlink) that points to the build machinery, and adding another (the 'object' symlink) that points to object tree is no big deal.

Quoted 6 lines

So what I will implement is that during the kernel build process (not the install part) a symlink named 'source' is placed in the root of the output directory - and links to the root of the kernel src used for building the kernel.

Then /lib/modules/kernel-<version>/build/source will be where

Nobody gave me a veto right, but I yell VETO now!

Quoted 2 lines

the source is located.
And /lib/modules/kernel-<version>/build will point to the output files.

Signature · 1 line
Jari Ruusu  1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9  DB 1D EB E3 24 0E A9 DD
#20 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

In reply to Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 22:09:53+02:00 [email protected]
# kbuild: make clean deletes a few more unneeded files
#

#   Make clean shall leave behind only what is needed to build
#   external modules. A few more files can be deleted and modules may still be
#   build successfully.
#   Originally noticed by Andreas Gruenbach

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# Makefile
# 2004/06/14 22:09:39+02:00 [email protected] +2 -2
# kbuild: make clean deletes a few more unneeded files
#

#   Make clean shall leave behind only what is needed to build
#   external modules. A few more files can be deleted and modules may still be
#   build successfully.
#   Originally noticed by Andreas Gruenbach

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

Makefile +2 -2
diff -Nru a/Makefile b/Makefile
@@ -796,12 +796,12 @@
 
 # Directories & files removed with 'make clean'
 CLEAN_DIRS  += $(MODVERDIR)
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .version .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2
-MRPROPER_FILES += .config .config.old include/asm .version \
+MRPROPER_FILES += .config include/asm \
                   include/linux/autoconf.h include/linux/version.h \
                   Module.symvers tags TAGS cscope*
 
#21 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

Makefile line 800

Quoted 5 lines · Sam Ravnborg

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)

Makefile +1 -1
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .version .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*

Why should 'make clean' remove the build version? Traditionally, this has been preserved until 'make mrproper'.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#22 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

Quoted 9 lines · Russell King

Makefile line 800

Quoted 5 lines · Sam Ravnborg

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)

Makefile +1 -1
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .version .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*

Why should 'make clean' remove the build version? Traditionally, this has been preserved until 'make mrproper'.

In the 2.4 days people had to do 'make clean' very often. For the 2.6 kernel this is no longer needed, so when cleaning up we want to be effective.

.version only really pays off when doing a lot of consecutive build on the _same_ kernel src.

And make clean is often used in combination with kernel patching, especially when renaming files: mv mm/slab.c.old mm/slab.c for example.

Here we start over with some new src, so it make sense to start over with the version?

Sam

#23 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

Quoted 15 lines · Sam Ravnborg
Quoted 9 lines · Russell King

Makefile line 800

Quoted 5 lines · Sam Ravnborg

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)

Makefile +1 -1
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .version .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*

Why should 'make clean' remove the build version? Traditionally, this has been preserved until 'make mrproper'.

In the 2.4 days people had to do 'make clean' very often. For the 2.6 kernel this is no longer needed, so when cleaning up we want to be effective.

Quoted 8 lines

.version only really pays off when doing a lot of consecutive build on the _same_ kernel src.

And make clean is often used in combination with kernel patching, especially when renaming files: mv mm/slab.c.old mm/slab.c for example.

Here we start over with some new src, so it make sense to start over with the version?

I'd agrue the exact opposite. If you're starting from scratch (new patchset, etc, where you might do something like mv mm/slab.c.old mm/slab.c) use 'distclean' or 'mrproper'. If you just want to do a 'make clean' because you can't be sure you trust the build system to get things right, you don't want the version being reset.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#24 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

Quoted 6 lines · Tom Rini

I'd agrue the exact opposite. If you're starting from scratch (new patchset, etc, where you might do something like mv mm/slab.c.old mm/slab.c) use 'distclean' or 'mrproper'. If you just want to do a 'make clean' because you can't be sure you trust the build system to get things right, you don't want the version being reset.

I follow both Russell's and your points.
So let's stick to the historic behaviour then.
Updated hand-edited patch below.

Sam

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 22:09:53+02:00 [email protected]
# kbuild: make clean deletes a few more unneeded files
#

#   Make clean shall leave behind only what is needed to build
#   external modules. A few more files can be deleted and modules may still be
#   build successfully.
#   Originally noticed by Andreas Gruenbach

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# Makefile
# 2004/06/14 22:09:39+02:00 [email protected] +2 -2
# kbuild: make clean deletes a few more unneeded files
#

#   Make clean shall leave behind only what is needed to build
#   external modules. A few more files can be deleted and modules may still be
#   build successfully.
#   Originally noticed by Andreas Gruenbach

#
# Signed-off-by: Sam Ravnborg <[email protected]>
#

Makefile +2 -2
diff -Nru a/Makefile b/Makefile
@@ -796,12 +796,12 @@
 
 # Directories & files removed with 'make clean'
 CLEAN_DIRS  += $(MODVERDIR)
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2
-MRPROPER_FILES += .config .config.old include/asm \
+MRPROPER_FILES += .config include/asm .version \
                   include/linux/autoconf.h include/linux/version.h \
                   Module.symvers tags TAGS cscope*
 
#25 lore raw

Re: [PATCH 4/5] kbuild: make clean improved

In reply to Russell King
Quoted 9 lines · Russell King

Makefile line 800

Quoted 5 lines · Sam Ravnborg

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)

Makefile +1 -1
-CLEAN_FILES +=	vmlinux System.map \
+CLEAN_FILES +=	vmlinux System.map .version .config.old \
                 .tmp_kallsyms* .tmp_version .tmp_vmlinux*

Why should 'make clean' remove the build version? Traditionally, this has been preserved until 'make mrproper'.

I believe that when removing .version you should remove .config too, so either it should include .config or it should not include .version.

<<V13>>

#26 lore raw
In reply to Sam Ravnborg
Quoted 5 lines · Sam Ravnborg

Above changes can be pulled from linux-sam.bkbits.net/kbuild:
bk pull bk://linux-sam.bkbits.net/kbuild
(Being updated as I type)

I've had some disk problems lately. And this seems to have hit my bk repo. So the patchtes are not pullable - sorry.

Sam

#27 lore raw
In reply to Sam Ravnborg
Quoted 6 lines · Sam Ravnborg

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.

external module build doc: Add documentation for building external modules

I like these two especially. Thanks much,

Jeff

#28 lore raw
In reply to Sam Ravnborg
Quoted 4 lines · Sam Ravnborg

Hi Andrew. Here follows a number of kbuild patches.

The first replaces kbuild-specify-default-target-during-configuration.patch

Quoted 8 lines

They have seen ligiht testing here, but on the other hand the do not touch any critical part of kbuild.

Patches:

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.

While I'd guess this is better than the patch it's replacing, given that most i386 kernels are 'bzImage', what's wrong with the current logic that picks out what to do for the all target now?

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#29 lore raw
Quoted 11 lines · Tom Rini
Quoted 9 lines · Sam Ravnborg

Hi Andrew. Here follows a number of kbuild patches.

The first replaces kbuild-specify-default-target-during-configuration.patch

They have seen ligiht testing here, but on the other hand the do not touch any critical part of kbuild.

Patches:

Quoted 7 lines
Quoted 3 lines

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.

While I'd guess this is better than the patch it's replacing, given that most i386 kernels are 'bzImage', what's wrong with the current logic that picks out what to do for the all target now?

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

- One has to select the default kernel image only once when configuring the kernel.
- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file
- Other programs now have access to what kernel image has been built. This is needed when creating kernel packages like rpm.

Where I see this really pay off is for architectures like MIPS with at least four different targets, depending on selected config. When one has selected to build a certain kernel, including a specific bootloader only the make command is needed.
No need to remember the 'make rom.bin' or whatever target.

But this trigger the discussion how much should actually be part of the kernel.
Building a kernel, storing it on target, and starting the kernel should be a simple process.

Quoted 1 line

From this the current behaviour seems good:

$ make
$ copy image
$ reset the board (reset PC whatever)

If we remove the current support for for example uboot we create an additional step in between the make and copy image.

What is the problem today is more the lack of infrastructure support for different kernel images.
And this is where we should concentrate.

Sam

#30 lore raw
Quoted 20 lines · Sam Ravnborg
Quoted 11 lines · Tom Rini
Quoted 9 lines · Sam Ravnborg

Hi Andrew. Here follows a number of kbuild patches.

The first replaces kbuild-specify-default-target-during-configuration.patch

They have seen ligiht testing here, but on the other hand the do not touch any critical part of kbuild.

Patches:

Quoted 7 lines
Quoted 3 lines

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.

While I'd guess this is better than the patch it's replacing, given that most i386 kernels are 'bzImage', what's wrong with the current logic that picks out what to do for the all target now?

Quoted 5 lines

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

- One has to select the default kernel image only once when configuring the kernel.

in the case where 'all' wasn't correct to start with. And i386 isn't the convincing case here.

Quoted 3 lines

- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file

Honestly, I'm indifferent to this. This problem is equally, if not better solved by documenting in the board-specific help "and use 'make fooImage for foo firmware"

Quoted 2 lines

- Other programs now have access to what kernel image has been built. This is needed when creating kernel packages like rpm.

I suppose this can clean up some of the globbing that might otherwise be done, but I know for a fact that there's been kernel rpms before this :)

Quoted 5 lines

Where I see this really pay off is for architectures like MIPS with at least four different targets, depending on selected config. When one has selected to build a certain kernel, including a specific bootloader only the make command is needed.
No need to remember the 'make rom.bin' or whatever target.

This is where I see it blowing up, quite badly. As Russell noted, you're going to have a horrible, unmaintainable list of boards and firmware supported, or not, on each. Even on PPC32 where we really only have "needs vmlinux, raw", "needs vmlinux, for U-Boot" and "can use arch/ppc/boot/", it'll still get ugly noting which boards can use U-Boot, which can use arch/ppc/boot/ and which can use both.

Quoted 2 lines

But this trigger the discussion how much should actually be part of the kernel.

Yes, there's that another discussion, which at least I'm not talking about right now. What I, and I think Russell as well, are noting is that doing this is will make what we have in the kernel much uglier / less maintainable.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#31 lore raw
Quoted 6 lines · Tom Rini
Quoted 3 lines

- One has to select the default kernel image only once when configuring the kernel.

in the case where 'all' wasn't correct to start with. And i386 isn't the convincing case here.

If all was correct in first place this patch does not change behaviour. For the embedded space all: is often not the right choice, but for i386 (as you note) all: is always OK (except some rare cases).

Quoted 7 lines
Quoted 3 lines

- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file

Honestly, I'm indifferent to this. This problem is equally, if not better solved by documenting in the board-specific help "and use 'make fooImage for foo firmware"

For ppc I see nowhere documented what znetboot, vmlinux.sm neither zimage is used for.
In total 5 different kernel targets that is un-documented. Adding this patch gives you a good way to document
them - and room for it.
For the uimage target, I would at least expect a reference to the relevant bootloader, and maybe a few notes about the format as well. But there is not room for it on half a line. If you know what uImage is, not problem. But for newcomers wondering what it is - this is relevant.

Quoted 6 lines
Quoted 3 lines

- Other programs now have access to what kernel image has been built. This is needed when creating kernel packages like rpm.

I suppose this can clean up some of the globbing that might otherwise be done, but I know for a fact that there's been kernel rpms before this :)

Did you actually take a look in the mkspec script?
If ARCH equals i386 select bzImage, otherwise select vmlinux. Not scalable at all - and this type of information should be part of the architecture specific files, not the mkspec script.

Quoted 7 lines
Quoted 6 lines

Where I see this really pay off is for architectures like MIPS with at least four different targets, depending on selected config. When one has selected to build a certain kernel, including a specific bootloader only the make command is needed.
No need to remember the 'make rom.bin' or whatever target.

Quoted 6 lines

This is where I see it blowing up, quite badly. As Russell noted, you're going to have a horrible, unmaintainable list of boards and firmware supported, or not, on each. Even on PPC32 where we really only have "needs vmlinux, raw", "needs vmlinux, for U-Boot" and "can use arch/ppc/boot/", it'll still get ugly noting which boards can use U-Boot, which can use arch/ppc/boot/ and which can use both.

What the patch does is to create a placeholder for
existing targets. No requirements exist for doing what you propose. But for a given board I would expect the defconfig to select the correct kernel image.
So when executing:
make ARCH=ppc FADS_defconfig && make ARCH=ppc CROSS...
Kbuild shall build a kernel that works with the selected board with a default bootloader.
This would be enabled by FADS_defconfig having CONFIG_KERNEL_IMAGE_ZNETBOOT selected.

In contrast the walnut board has a sane bootloader that accepts a vmlinux, so here CONFIG_KERNEL_IMAGE_VMLINUX is selected in defconfig. [Not knowing the baords in question, just as examples].

In this way the board specific config files select the target to be build, not the other way around.

Sam

#32 lore raw
Quoted 9 lines · Sam Ravnborg
Quoted 6 lines · Tom Rini
Quoted 3 lines

- One has to select the default kernel image only once when configuring the kernel.

in the case where 'all' wasn't correct to start with. And i386 isn't the convincing case here.

If all was correct in first place this patch does not change behaviour. For the embedded space all: is often not the right choice,

That's quite debatable. 'all' does do the right thing on ppc32.

Quoted 6 lines

but for i386 (as you note) all: is always OK (except some rare cases).

Quoted 4 lines
Quoted 3 lines

- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file

Quoted 6 lines
Quoted 3 lines

Honestly, I'm indifferent to this. This problem is equally, if not better solved by documenting in the board-specific help "and use 'make fooImage for foo firmware"

For ppc I see nowhere documented what znetboot, vmlinux.sm neither zimage is used for.

True. A patch to add that bit 'o help to the archhelp target would happily be reviewed.

Quoted 8 lines

In total 5 different kernel targets that is un-documented. Adding this patch gives you a good way to document them - and room for it.
For the uimage target, I would at least expect a reference to the relevant bootloader, and maybe a few notes about the format as well. But there is not room for it on half a line. If you know what uImage is, not problem. But for newcomers wondering what it is - this is relevant.

What I don't see is why:
'znetboot - Build a zImage and put into /tftpboot/
uImage - Build an image for U-Boot rom.img - Build an image to live on ROM srec - Build an SREC image'

etc, isn't sufficient, in the archhelp. Especially with a note added to the boards for the corner cases where all isn't correct (foo-board only supports U-Boot, so you should use uImage to get things working directly).

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

- Other programs now have access to what kernel image has been built. This is needed when creating kernel packages like rpm.

I suppose this can clean up some of the globbing that might otherwise be done, but I know for a fact that there's been kernel rpms before this :)

Did you actually take a look in the mkspec script?
If ARCH equals i386 select bzImage, otherwise select vmlinux. Not scalable at all - and this type of information should be part of the architecture specific files, not the mkspec script.

Without stepping too much into the what belongs in the kernel debate, you've already got lots of board-specific things to handle, so if it's already documented.

Quoted 13 lines
Quoted 6 lines
Quoted 5 lines

Where I see this really pay off is for architectures like MIPS with at least four different targets, depending on selected config. When one has selected to build a certain kernel, including a specific bootloader only the make command is needed.
No need to remember the 'make rom.bin' or whatever target.

Quoted 6 lines

This is where I see it blowing up, quite badly. As Russell noted, you're going to have a horrible, unmaintainable list of boards and firmware supported, or not, on each. Even on PPC32 where we really only have "needs vmlinux, raw", "needs vmlinux, for U-Boot" and "can use arch/ppc/boot/", it'll still get ugly noting which boards can use U-Boot, which can use arch/ppc/boot/ and which can use both.

Quoted 2 lines

What the patch does is to create a placeholder for existing targets. No requirements exist for doing what you propose.

Which gets back to one of Russells points. You can document the formats all you want, but that won't help the user pick one, unless they already know enough to not need this information to start with.

Or, you restrict their choices to what would work, which is a horrible mess. And you may need to restrict the choices, otherwise we'll get 'allyesconfig' doesn't build type messages again (yes, I've already had to re-arrange things once for allyesconfig on ppc32).

Quoted 2 lines

But for a given board I would expect the defconfig to select the correct kernel image.

<nit>'correct' is such an odd word here. Especially in the case where all of them are valid targets.</nit>

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#33 lore raw
Quoted 8 lines · Tom Rini

What I don't see is why:
'znetboot - Build a zImage and put into /tftpboot/
uImage - Build an image for U-Boot rom.img - Build an image to live on ROM srec - Build an SREC image'

etc, isn't sufficient, in the archhelp.

Two things.
1) You better remember to specify them each and every time. Otherwise uImage gets out of sync with the kernel.
2) I know the srec format, but that is no help to expaling me the actual content of the file.
Memory layout, start address or whatever. Where to find this info. Same goes for other targets. I you know your stuff no swaet. But for $random hacker it becomes another obstacle

Quoted 10 lines

Or, you restrict their choices to what would work, which is a horrible mess. And you may need to restrict the choices, otherwise we'll get 'allyesconfig' doesn't build type messages again (yes, I've already had to re-arrange things once for allyesconfig on ppc32).

Quoted 2 lines

But for a given board I would expect the defconfig to select the correct kernel image.

<nit>'correct' is such an odd word here. Especially in the case where all of them are valid targets.</nit>

Read 'type of'. In most case zImage I assume, but in some case with a bootloader added. The other options may vary (a lot).

Sam

#34 lore raw
Quoted 8 lines · Sam Ravnborg
Quoted 7 lines · Tom Rini

What I don't see is why:
'znetboot - Build a zImage and put into /tftpboot/
uImage - Build an image for U-Boot rom.img - Build an image to live on ROM srec - Build an SREC image'

Quoted 5 lines
Quoted 1 line

etc, isn't sufficient, in the archhelp.

Two things.
1) You better remember to specify them each and every time. Otherwise uImage gets out of sync with the kernel.

Yes, you better. If you want the kernel to do a little extra for you, you need to remember to tell it that.

Quoted 5 lines

2) I know the srec format, but that is no help to expaling me the actual content of the file.
Memory layout, start address or whatever. Where to find this info. Same goes for other targets. I you know your stuff no swaet. But for $random hacker it becomes another obstacle

Let me try this a different way. The only valid boot targets on ppc32 are:
- zImage (which is what all does)
- znetboot (zImage + copy to /tftpboot/)
- uImage (U-Boot'ify a kernel)

wrt the last one, I'm torn between making it something that always happens, since it's just so easy, and if it fails, we can just not care about it (||true it, or something) or just not worry about it, since if you're using U-Boot most likely you've already flashed it on, and know what you're doing).

The "pick the right target" mojo done to ppc32 is like doing it on i386, it's not a good example of what'll be cleaned up. Same, so it seems, with ARM. WRT MIPS, I've pointed Ralf at the thread, and he should speak up soon, I hope :)

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#35 lore raw
In reply to Sam Ravnborg
Quoted 16 lines · Sam Ravnborg
Quoted 15 lines · Tom Rini
Quoted 12 lines · Sam Ravnborg

Hi Andrew. Here follows a number of kbuild patches.

The first replaces kbuild-specify-default-target-during-configuration.patch

They have seen ligiht testing here, but on the other hand the do not touch any critical part of kbuild.

Patches:

default kernel image: Specify default target at config
time rather then hardcode it. Only enabled for i386 for now.

Quoted 6 lines
Quoted 3 lines

While I'd guess this is better than the patch it's replacing, given that most i386 kernels are 'bzImage', what's wrong with the current logic that picks out what to do for the all target now?

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

This isn't the case on ARM. I've always told people 'make zImage' or 'make Image'. I've never told people to use just 'make' on its own - in fact, I've never used 'make' on its own with the kernel.

Quoted 5 lines

- One has to select the default kernel image only once when configuring the kernel.
- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file

You can't fit details for 500 platforms into half a line of text.

Quoted 2 lines

If we remove the current support for for example uboot we create an additional step in between the make and copy image.

uboot support on ARM was only recently added, and only happened because I happened to misread the patch. Had I been more on the ball, the support would NOT have been merged. However, as it did get merged, I didn't want to create extra noise by taking it out.

Please don't take this as acceptance that throwing the uboot crap into the kernel for ARM was something I found agreeable. I still find it distasteful that boot loaders have to define their own image formats and the kernel has to conform to the boot loader authors whims.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#36 lore raw
Quoted 7 lines · Russell King
Quoted 3 lines

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

This isn't the case on ARM. I've always told people 'make zImage' or 'make Image'. I've never told people to use just 'make' on its own - in fact, I've never used 'make' on its own with the kernel.

Why not?
Letting the build system select a default target is often a better choice than some random choice by a developer.

Quoted 8 lines
Quoted 6 lines

- One has to select the default kernel image only once when configuring the kernel.
- There exist a possibility to add more than half a line of text describing individual targets. All relevant information can be specified in the help section in the Kconfig file

You can't fit details for 500 platforms into half a line of text.

Not discussing different platforms, only discussing kernel targets. For arm I see the following:
zImage, Image bootpImage uImage
And some test targets: zImg, Img, bp, i, zi

Not counting the test targets it is only 4 target of which 3 is documented in help today.

Quoted 9 lines
Quoted 3 lines

If we remove the current support for for example uboot we create an additional step in between the make and copy image.

uboot support on ARM was only recently added, and only happened because I happened to misread the patch. Had I been more on the ball, the support would NOT have been merged. However, as it did get merged, I didn't want to create extra noise by taking it out.

Quoted 5 lines

Please don't take this as acceptance that throwing the uboot crap into the kernel for ARM was something I found agreeable. I still find it distasteful that boot loaders have to define their own image formats and the kernel has to conform to the boot loader authors whims.

Maybe Wolgang can jump in here - I do not know why mkimage is needed. But I do like to have it present for convinience.
It is btw called mkuboot.sh in scripts/ to better say what it does.

Sam

#37 lore raw
Quoted 10 lines · Sam Ravnborg
Quoted 7 lines · Russell King
Quoted 3 lines

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

This isn't the case on ARM. I've always told people 'make zImage' or 'make Image'. I've never told people to use just 'make' on its own - in fact, I've never used 'make' on its own with the kernel.

Why not?

It's something we've never done - we've always traditionally told people to use 'make zImage' or whatever, because then they know what they're getting.

See: http://www.arm.linux.org.uk/docs/kerncomp.shtml

This works for no matter what kernel version you're building, whether its pre or post new kbuild.

Quoted 2 lines

Letting the build system select a default target is often a better choice than some random choice by a developer.

No. Only the developer knows what boot loader he's going to use on the board, he knows what modifications he's made, he knows how he's configured it. Therefore he knows full well what he needs from the kernel.

Quoted 4 lines

Not discussing different platforms, only discussing kernel targets. For arm I see the following:
zImage, Image bootpImage uImage
And some test targets: zImg, Img, bp, i, zi

For ARM, there are: zImage and Image. bootpImage is an add-on extra which requires extra parameters to be passed in order to use - and is our fix for the day that NFS requires external programs (though it seems to have been superseded by initramfs now, so will probably go away soon.)

I'm considering dropping the test targets - they were useful for me personally back in the days when I wasn't using a script-based kernel build system. Now that all my kernel builds are scripted, those targets aren't used anymore and can go.

That leaves uImage which I've discussed already in a previous mail, and various other targets which I've historically said I won't merge (as I detailed in a previous mail - srec, gzipped vmlinux, gzipped Image, etc.)

Quoted 3 lines

Maybe Wolgang can jump in here - I do not know why mkimage is needed. But I do like to have it present for convinience.
It is btw called mkuboot.sh in scripts/ to better say what it does.

I'll let you read mkuboot.sh - you'll find that it's just a wrapper script to moan if you use mkuboot.sh and you don't have mkimage installed.

I've no idea what mkimage actually does, but from the scant comments in mkuboot.sh, it seems to package up into a "U-Boot image".

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#38 lore raw
Quoted 11 lines · Russell King
Quoted 4 lines

Maybe Wolgang can jump in here - I do not know why mkimage is needed. But I do like to have it present for convinience.
It is btw called mkuboot.sh in scripts/ to better say what it does.

I'll let you read mkuboot.sh - you'll find that it's just a wrapper script to moan if you use mkuboot.sh and you don't have mkimage installed.

I've no idea what mkimage actually does, but from the scant comments in mkuboot.sh, it seems to package up into a "U-Boot image".

I know. I objected to the mkimage name in the past for a script in scripts/ for the same reasons as you outline.

Sam

#39 lore raw
In reply to Russell King
Quoted 12 lines · Russell King
Quoted 10 lines · Sam Ravnborg
Quoted 7 lines · Russell King
Quoted 3 lines

Compared to the original behaviour where the all: target picked the default target for a given architecture, this patch adds the following:

This isn't the case on ARM. I've always told people 'make zImage' or 'make Image'. I've never told people to use just 'make' on its own - in fact, I've never used 'make' on its own with the kernel.

Why not?

Quoted 8 lines

It's something we've never done - we've always traditionally told people to use 'make zImage' or whatever, because then they know what they're getting.

See: http://www.arm.linux.org.uk/docs/kerncomp.shtml

This works for no matter what kernel version you're building, whether its pre or post new kbuild.

Looks good. And for 2.6 no need for two steps "make zImage" and "make modules". 'make' alone will do the job and make sure zImage and modules are consistent.

Quoted 11 lines
Quoted 5 lines

Not discussing different platforms, only discussing kernel targets. For arm I see the following:
zImage, Image bootpImage uImage
And some test targets: zImg, Img, bp, i, zi

For ARM, there are: zImage and Image. bootpImage is an add-on extra which requires extra parameters to be passed in order to use - and is our fix for the day that NFS requires external programs (though it seems to have been superseded by initramfs now, so will probably go away soon.)

And here is my point. How to you put this info in less than one line? So I just see proff that we need to be able to give a bit more info about the possible targets.
"which requires extra parameters...." is also a sign that more info would be nice.
Now I have to read and understand a Makefile to find the info.

Quoted 5 lines

That leaves uImage which I've discussed already in a previous mail, and various other targets which I've historically said I won't merge (as I detailed in a previous mail - srec, gzipped vmlinux, gzipped Image, etc.)

For arm it looks simple, but for ppc the commandline to mkuboot.sh varies depending on configuration.
Better do this in the kernel.

Sam

#40 lore raw
Quoted 7 lines · Sam Ravnborg
Quoted 4 lines · Russell King

That leaves uImage which I've discussed already in a previous mail, and various other targets which I've historically said I won't merge (as I detailed in a previous mail - srec, gzipped vmlinux, gzipped Image, etc.)

For arm it looks simple, but for ppc the commandline to mkuboot.sh varies depending on configuration.

No it doesn't. CONFIG_SHELL doesn't count :)

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#41 lore raw
Quoted 10 lines · Tom Rini
Quoted 7 lines · Sam Ravnborg
Quoted 4 lines · Russell King

That leaves uImage which I've discussed already in a previous mail, and various other targets which I've historically said I won't merge (as I detailed in a previous mail - srec, gzipped vmlinux, gzipped Image, etc.)

For arm it looks simple, but for ppc the commandline to mkuboot.sh varies depending on configuration.

No it doesn't. CONFIG_SHELL doesn't count :)

It was the other way around.

Quoted 1 line

From arm:

      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
                   -C none -a $(ZRELADDR) -e $(ZRELADDR) \
                   -n 'Linux-$(KERNELRELEASE)' -d $< $@

And ZRELADDR varies with configuration, ~20 different values.

Sam

#42 lore raw
In reply to Sam Ravnborg
Quoted 2 lines · Sam Ravnborg

Looks good. And for 2.6 no need for two steps "make zImage" and "make modules". 'make' alone will do the job and make sure zImage and modules are consistent.

Correct, however the document is for 2.4 as well so in the interests of not making things more complex than they have to be, it's easier to tell people to use the old way.

Quoted 11 lines
Quoted 5 lines

For ARM, there are: zImage and Image. bootpImage is an add-on extra which requires extra parameters to be passed in order to use - and is our fix for the day that NFS requires external programs (though it seems to have been superseded by initramfs now, so will probably go away soon.)

And here is my point. How to you put this info in less than one line? So I just see proff that we need to be able to give a bit more info about the possible targets.
"which requires extra parameters...." is also a sign that more info would be nice.
Now I have to read and understand a Makefile to find the info.

If you don't supply INITRD= then the makefile will prompt you for it. Ok, the message can be improved, but it does still tell you what you did wrong. I also pointed out that this target is legacy and probably going away soon, so it can't be used to justify a point.

Quoted 7 lines
Quoted 4 lines

That leaves uImage which I've discussed already in a previous mail, and various other targets which I've historically said I won't merge (as I detailed in a previous mail - srec, gzipped vmlinux, gzipped Image, etc.)

For arm it looks simple, but for ppc the commandline to mkuboot.sh varies depending on configuration.
Better do this in the kernel.

You seem to have missed my point again, concentrating on uImage only. Also, I think you got PPC and ARM confused - PPC is simple, but ARM depends on the kernel configuration.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#43 lore raw

What about this much simpler approach?

One extra assignment for each architecture added to get access to the kernel image (at least the default one) for that architecture.

The sole purpose for this is to pass info what
kernel image should be included in a deb, rpm or tar.gz package.

Sam

===== arch/arm/Makefile 1.66 vs edited =====

arch/arm/Makefile +1 -0
@@ -130,6 +130,7 @@
 all: zImage
 
 boot := arch/arm/boot
+KERNEL_IMAGE := $(boot)/zImage
 
 #	Update machine arch and proc symlinks if something which affects
 #	them changed.  We use .arch to indicate when they were updated

===== arch/i386/Makefile 1.68 vs edited =====

arch/i386/Makefile +1 -0
@@ -120,6 +120,7 @@
 	zdisk bzdisk fdimage fdimage144 fdimage288 install
 
 all: bzImage
+KERNEL_IMAGE := $(boot)/bzImage
 
 BOOTIMAGE=arch/i386/boot/bzImage
 zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage

===== arch/ppc/Makefile 1.50 vs edited =====

arch/ppc/Makefile +1 -0
@@ -49,6 +49,7 @@
 .PHONY: $(BOOT_TARGETS)
 
 all: zImage
+KERNEL_IMAGE := arch/ppc/boot/images/zImage
 
 AFLAGS_vmlinux.lds.o	:= -Upowerpc
 
#44 lore raw
Quoted 4 lines · Sam Ravnborg

What about this much simpler approach?

One extra assignment for each architecture added to get access to the kernel image (at least the default one) for that architecture.

Will it also include the 'vmlinux' ? And would I be right in assuming that it will accept (a) globs and (b) can be defined inside of arch/ppc/boot/foo/Makefile ?

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#45 lore raw
Quoted 8 lines · Tom Rini
Quoted 4 lines · Sam Ravnborg

What about this much simpler approach?

One extra assignment for each architecture added to get access to the kernel image (at least the default one) for that architecture.

Will it also include the 'vmlinux' ?

Today the rpm does not include vmlinux - but thats a trivial thing to add. I assume the same is tru for .deb
tar.gz is not written yet...

Quoted 3 lines

And would I be right in assuming
that it will accept (a) globs and (b) can be defined inside of arch/ppc/boot/foo/Makefile ?

Yes, and yes.

Sam

#46 lore raw
Quoted 9 lines · Sam Ravnborg
Quoted 8 lines · Tom Rini
Quoted 4 lines · Sam Ravnborg

What about this much simpler approach?

One extra assignment for each architecture added to get access to the kernel image (at least the default one) for that architecture.

Will it also include the 'vmlinux' ?

Quoted 8 lines

Today the rpm does not include vmlinux - but thats a trivial thing to add. I assume the same is tru for .deb
tar.gz is not written yet...

Quoted 3 lines

And would I be right in assuming
that it will accept (a) globs and (b) can be defined inside of arch/ppc/boot/foo/Makefile ?

Yes, and yes.

Then I think I can live with it, and fix it up to be correct on PPC32 once it's in.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#47 lore raw
In reply to Sam Ravnborg

On Wed, 2004-06-16 22:54:16 +0200, Sam Ravnborg <[email protected]> wrote in message <[email protected]>:

Quoted 5 lines · Tom Rini
Quoted 1 line

Will it also include the 'vmlinux' ?

Today the rpm does not include vmlinux - but thats a trivial thing to add. I assume the same is tru for .deb
tar.gz is not written yet...

I'll take your patches and see how to make a .tar.gz from it.

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#48 lore raw
Quoted 9 lines · Jan-Benedict Glaw

On Wed, 2004-06-16 22:54:16 +0200, Sam Ravnborg <[email protected]> wrote in message <[email protected]>:

Quoted 5 lines · Tom Rini
Quoted 1 line

Will it also include the 'vmlinux' ?

Today the rpm does not include vmlinux - but thats a trivial thing to add. I assume the same is tru for .deb
tar.gz is not written yet...

I'll take your patches and see how to make a .tar.gz from it.

Great, thanks.
I will update my patch-set during the weekend if time permits..

Sam

A message that is not in the archive (sent off-list or not yet received): [email protected]

#50 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

Quoted 4 lines · Sam Ravnborg

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/06/14 22:21:46+02:00 [email protected]

[...]

Documentation/kbuild/extmodules.txt line 4

Quoted 7 lines
Documentation/kbuild/extmodules.txt new file +4 -0
@@ -0,0 +1,168 @@
+Building external modules
+=========================
+kbuild offers functionality to build external modules, with the
+prerequisite that there is a pre-built kernel avialable with full source.

No. It should be enough to have run "make modules_prepare".

Documentation/kbuild/extmodules.txt line 13

Quoted 9 lines
Documentation/kbuild/extmodules.txt new file +9 -0
+A subset of the targets available when building the kernel is available
+when building an external module.
+
+
+Building the module
+-------------------
+The command looks like his:
+
+	make -C <path to kernel src> M=`pwd`

For me, it works with:

make -C <path to kernel src> SUBDIRS=<path to module source> modules
# Builds
make -C <path to kernel src> SUBDIRS=<path to module source> modules_install
# Installs

Besides, IMHO this belongs in Documentation/kbuild/modules.txt.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#51 lore raw

Re: [PATCH 5/5] kbuild: external module build doc

Quoted 6 lines · Horst von Brand

Review

Quoted 4 lines
(quoted diff) +4 -0
+Building external modules
+=========================
+kbuild offers functionality to build external modules, with the
+prerequisite that there is a pre-built kernel avialable with full source.

No. It should be enough to have run "make modules_prepare".

Correct - it was written some time ago.
I will fix.

Quoted 12 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+A subset of the targets available when building the kernel is available
+when building an external module.
+
+
+Building the module
+-------------------
+The command looks like his:
+
+	make -C <path to kernel src> M=`pwd`

For me, it works with:

Quoted 2 lines

make -C <path to kernel src> SUBDIRS=<path to module source> modules
# Builds

Today the modules target is not needed, and SUBDIRS= is equivalent to M= The M= is more in line with other commandline specifiers, therefore documented. SUBDIRS= will stay for a long time.

Quoted 4 lines

make -C <path to kernel src> SUBDIRS=<path to module source> modules_install
# Installs

Besides, IMHO this belongs in Documentation/kbuild/modules.txt.

They will be merged when I'm in documentation mode - if noone beats me.

Sam

#52 lore raw

Re: kbuild: Simplify vmlinux generation

In reply to a message not in the archive

Sam Ravnborg <[email protected]> said:

[...]

Some comments interspersed.

Signed off by: Horst H. von Brand <[email protected]>

(Not too much intellect in here, and no property, but...)

Makefile line 548

Quoted 8 lines

diff -Nru a/Makefile b/Makefile

Makefile +1 -0
@@ -545,67 +545,91 @@
 
 # Build vmlinux
 # ---------------------------------------------------------------------------
+# vmlinux is build from the objects seleted by $(vmlinux-init) and

selected

Quoted 7 lines
Makefile +7 -0
+# $(vmlinux-main). Most are built-in.o files from top-level directories
+# in the kernel tree, others are specified in arch/$(ARCH)Makefile.
+# Ordering when linking is important, and $(vmlinux-init) must be first.
+#
+# vmlinux
+#   ^
+#   |

Makefile line 565

Quoted 10 lines
Makefile +10 -0
+#   +-< $(vmlinux-init)
+#   |   +--< init/version.o + more
+#   |
+#   +-< built-in.o
+#   |   +--< $(vmlinux-main)
+#   |        +--< driver/built-in.o mm/built-in.o + more
+#   |
+#   +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
+#
+# vmlinux version cannot be updated during normal descending-into-subdirs

The vmlinux version? Or some file?

Makefile line 568

Quoted 3 lines
Makefile +3 -0
+# phase since we do not yet know if we need to update vmlinux.
+# Therefore this step is delayed until just before final link of vmlinux -
+# except in kallsyms case where it is done just before adding the

in the kallsyms case

Quoted 97 lines
Makefile +40 -51
+# symbols to the kernel.
+#
+# System.map is generated to document addresses of all kernel symbols
 
-#	This is a bit tricky: If we need to relink vmlinux, we want
-#	the version number incremented, which means recompile init/version.o
-#	and relink init/init.o. However, we cannot do this during the
-#       normal descending-into-subdirs phase, since at that time
-#       we cannot yet know if we will need to relink vmlinux.
-#	So we descend into init/ inside the rule for vmlinux again.
-vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
-
-quiet_cmd_vmlinux__ = LD      $@
-define cmd_vmlinux__
-	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
-	--start-group \
-	$(core-y) \
-	$(libs-y) \
-	$(drivers-y) \
-	$(net-y) \
-	--end-group \
-	$(filter .tmp_kallsyms%,$^) \
-	-o $@
-endef
+vmlinux-init := $(head-y) $(init-y)
+vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
+vmlinux-all  := $(vmlinux-init) built-in.o
+vmlinux-lds  := arch/$(ARCH)/kernel/vmlinux.lds
+
+# Rule to link vmlinux - also used during CONFIG_KALLSYMS
+# May be overridden by arch/$(ARCH)/Makefile
+quiet_cmd_vmlinux__  = LD      $@
+      cmd_vmlinux__  = $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
+                           -T $(filter-out FORCE, $^) -o $@
+
+# Generate new vmlinux version
+quiet_cmd_vmlinux_version = GEN     .version
+      cmd_vmlinux_version = set -e;                     \
+	. $(srctree)/scripts/mkversion > .tmp_version;	\
+	mv -f .tmp_version .version;			\
+	$(MAKE) $(build)=init
+	
+# Generate System.map
+quiet_cmd_sysmap = SYSMAP 
+      cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
 
-#	set -e makes the rule exit immediately on error
+# Link of vmlinux
+# If CONFIG_KALLSYMS is set .version is already updated
+# Generate System.map and verify that the content is consistent
 
 define rule_vmlinux__
-	+set -e;							\
-	$(if $(filter .tmp_kallsyms%,$^),,				\
-	  echo '  GEN     .version';					\
-	  . $(srctree)/scripts/mkversion > .tmp_version;		\
-	  mv -f .tmp_version .version;					\
-	  $(MAKE) $(build)=init;					\
-	)								\
-	$(if $($(quiet)cmd_vmlinux__),					\
-	  echo '  $($(quiet)cmd_vmlinux__)' &&) 			\
-	$(cmd_vmlinux__);						\
-	echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
+	$(if $(CONFIG_KALLSYMS),,$(call cmd,vmlinux_version))
+	
+	$(call cmd,vmlinux__)
+	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
+	
+	$(Q)$(if $($(quiet)cmd_sysmap),                 \
+	  echo '  $($(quiet)cmd_sysmap) System.map' &&) \
+	$(cmd_sysmap) $@ System.map;                    \
+	if [ $$? -ne 0 ]; then                          \
+		rm -f $@;                               \
+		/bin/false;                             \
+	fi;
+	$(verify_kallsyms)
 endef
 
-quiet_cmd_sysmap = SYSMAP 
-      cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
-		   
-LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds
-
-#	Generate section listing all symbols and add it into vmlinux
-#	It's a three stage process:
-#	o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
-#	  empty
-#	  Running kallsyms on that gives us .tmp_kallsyms1.o with
-#	  the right size
-#	o .tmp_vmlinux2 now has a __kallsyms section of the right size,
-#	  but due to the added section, some addresses have shifted
-#	  From here, we generate a correct .tmp_kallsyms2.o
-#	o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
-#	o Verify that the System.map from vmlinux matches the map from
-#	  .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
-#	o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
-#	  .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a

Makefile line 622

Quoted 10 lines
Makefile +6 -2
-#	  temporary bypass to allow the kernel to be built while the
-#	  maintainers work out what went wrong with kallsyms.
 
 ifdef CONFIG_KALLSYMS
+# Generate section listing all symbols and add it into vmlinux $(kallsyms.o)
+# It's a three stage process:
+# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
+#   empty
+#   Running kallsyms on that gives us .tmp_kallsyms1.o with
+#   the right size - vmlinux version updated during this step

is updated

Quoted 14 lines
Makefile +10 -0
+# o .tmp_vmlinux2 now has a __kallsyms section of the right size,
+#   but due to the added section, some addresses have shifted.
+#   From here, we generate a correct .tmp_kallsyms2.o
+# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
+# o Verify that the System.map from vmlinux matches the map from
+#   .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
+# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
+#   .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
+#   temporary bypass to allow the kernel to be built while the
+#   maintainers work out what went wrong with kallsyms.
 
 ifdef CONFIG_KALLSYMS_EXTRA_PASS
 last_kallsyms := 3

Makefile line 642

Quoted 5 lines
Makefile +1 -1
@@ -615,16 +639,28 @@
 
 kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
 
-define rule_verify_kallsyms
+define verify_kallsyms

Why delete "rule_" here? Down you create a new rule with "rule_"

[No further comments, rest snipped]

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#53 lore raw

Re: kbuild: Simplify vmlinux generation

Quoted 9 lines · Horst von Brand

Sam Ravnborg <[email protected]> said:

[...]

Some comments interspersed.

Signed off by: Horst H. von Brand <[email protected]>

(Not too much intellect in here, and no property, but...)

If you could just tell me why akpm's x86_64 do not boot with this one :-( I will fix my wording as you suggest - thanks.

Quoted 4 lines

+#

Quoted 1 line

+# vmlinux version cannot be updated during normal descending-into-subdirs

The vmlinux version? Or some file?

uname -v (the number after #)

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-define rule_verify_kallsyms
+define verify_kallsyms

Why delete "rule_" here? Down you create a new rule with "rule_"

rule_ is used only for the defines used in $(call if_changed_rule ... verify_kallsyms are called direct.

rule_ksym_ld is called using $(if_changed_rule ...)

Sam

#54 lore raw

Re: kbuild: Simplify vmlinux generation

In reply to Horst von Brand
Quoted 5 lines · Horst von Brand

Sam Ravnborg <[email protected]> said:

[...]

Some comments interspersed.

To address the lock-up issue Andrew hit I dropped the built-in.o intermidiate step.
Will be pushed out if I receive a success report.

Sam

Following patch apply on top of the last posted:

===== Makefile 1.531 vs edited =====

Makefile +15 -23
@@ -545,7 +545,7 @@
 
 # Build vmlinux
 # ---------------------------------------------------------------------------
-# vmlinux is build from the objects seleted by $(vmlinux-init) and
+# vmlinux is build from the objects selected by $(vmlinux-init) and
 # $(vmlinux-main). Most are built-in.o files from top-level directories
 # in the kernel tree, others are specified in arch/$(ARCH)Makefile.
 # Ordering when linking is important, and $(vmlinux-init) must be first.
@@ -556,30 +556,33 @@
 #   +-< $(vmlinux-init)
 #   |   +--< init/version.o + more
 #   |
-#   +-< built-in.o
-#   |   +--< $(vmlinux-main)
-#   |        +--< driver/built-in.o mm/built-in.o + more
+#   +--< $(vmlinux-main)
+#   |    +--< driver/built-in.o mm/built-in.o + more
 #   |
 #   +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
 #
-# vmlinux version cannot be updated during normal descending-into-subdirs
-# phase since we do not yet know if we need to update vmlinux.
+# vmlinux version (uname -v) cannot be updated during normal
+# descending-into-subdirs phase since we do not yet know if we need to
+# update vmlinux.
 # Therefore this step is delayed until just before final link of vmlinux -
-# except in kallsyms case where it is done just before adding the
+# except in the kallsyms case where it is done just before adding the
 # symbols to the kernel.
 #
 # System.map is generated to document addresses of all kernel symbols
 
 vmlinux-init := $(head-y) $(init-y)
 vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
-vmlinux-all  := $(vmlinux-init) built-in.o
+vmlinux-all  := $(vmlinux-init) $(vmlinux-main)
 vmlinux-lds  := arch/$(ARCH)/kernel/vmlinux.lds
 
 # Rule to link vmlinux - also used during CONFIG_KALLSYMS
 # May be overridden by arch/$(ARCH)/Makefile
+# Require first prerequisite to be the lds file
 quiet_cmd_vmlinux__  = LD      $@
-      cmd_vmlinux__  = $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-                           -T $(filter-out FORCE, $^) -o $@
+      cmd_vmlinux__  = $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
+      -T $(vmlinux-lds) $(vmlinux-init)                          \
+      --start-group $(vmlinux-main) --end-group                  \
+      $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
 
 # Generate new vmlinux version
 quiet_cmd_vmlinux_version = GEN     .version
@@ -619,7 +622,7 @@
 # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
 #   empty
 #   Running kallsyms on that gives us .tmp_kallsyms1.o with
-#   the right size - vmlinux version updated during this step
+#   the right size - vmlinux version (uname -v) is updated during this step
 # o .tmp_vmlinux2 now has a __kallsyms section of the right size,
 #   but due to the added section, some addresses have shifted.
 #   From here, we generate a correct .tmp_kallsyms2.o
@@ -684,19 +687,8 @@
 endif # ifdef CONFIG_KALLSYMS
 
 # vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) built-in.o $(kallsyms.o) FORCE
+vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
 	$(call if_changed_rule,vmlinux__)
-
-# Link $(vmlinux-main) to speed up rest of build phase. No need to
-# relink this part too many times.
-# Use start/end-group to make sure to resolve all possible symbols
-quiet_rule_vmlinux_partial = LD      $@
-       cmd_vmlinux_partial = $(LD) $(LDFLAGS) $(LDFLAGS_$(*F)) -r \
-                                   --start-group $(filter-out FORCE, $^) \
-				   --end-group -o $@
-				   
-built-in.o: $(vmlinux-main) FORCE
-	$(call if_changed,vmlinux_partial)
 
 # The actual objects are generated when descending, 
 # make sure no implicit rule kicks in
#55 lore raw

PATCH v2 1/1 x86,vdso: Fix vdso_install

In reply to a message not in the archive

The filenames are different now. Inspired by a patch from Sam Ravnborg.

---
 arch/x86/vdso/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/vdso/Makefile +11 -11
index 9769df0..e3683d6 100644
@@ -9,11 +9,6 @@ VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
 VDSO32-$(CONFIG_X86_32)		:= y
 VDSO32-$(CONFIG_COMPAT)		:= y
 
-vdso-install-$(VDSO64-y)	+= vdso.so
-vdso-install-$(VDSOX32-y)	+= vdsox32.so
-vdso-install-$(VDSO32-y)	+= $(vdso32-images)
-
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
@@ -176,15 +171,20 @@ VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
 GCOV_PROFILE := n
 
 #
-# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+# Install the unstripped copies of vdso*.so.
 #
-quiet_cmd_vdso_install = INSTALL $@
-      cmd_vdso_install = cp $(obj)/[email protected] $(MODLIB)/vdso/$@
-$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
+quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
+      cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%)
+
+vdso_img_insttargets := $(vdso_img_sodbg:%=install_%)
+
+$(MODLIB)/vdso: FORCE
 	@mkdir -p $(MODLIB)/vdso
+
+$(vdso_img_insttargets): install_%: $(obj)/% $(MODLIB)/vdso FORCE
 	$(call cmd,vdso_install)
 
-PHONY += vdso_install $(vdso-install-y)
-vdso_install: $(vdso-install-y)
+PHONY += vdso_install $(vdso_img_insttargets)
+vdso_install: $(vdso_img_insttargets) FORCE
 
 clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*
Signature · 1 line
1.9.3
#57 lore raw

Re: [PATCH v2] x86,vdso: Fix vdso_install

In reply to Andy Lutomirski
Quoted 40 lines · Andy Lutomirski

The filenames are different now. Inspired by a patch from Sam Ravnborg.

---
 arch/x86/vdso/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/vdso/Makefile +6 -9
index 9769df0..e3683d6 100644
@@ -9,11 +9,6 @@ VDSOX32-$(CONFIG_X86_X32_ABI)  := y
 VDSO32-$(CONFIG_X86_32)                := y
 VDSO32-$(CONFIG_COMPAT)                := y
 
-vdso-install-$(VDSO64-y)       += vdso.so
-vdso-install-$(VDSOX32-y)      += vdsox32.so
-vdso-install-$(VDSO32-y)       += $(vdso32-images)
-
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
@@ -176,15 +171,20 @@ VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
 GCOV_PROFILE := n
 
 #
-# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+# Install the unstripped copies of vdso*.so.
 #
-quiet_cmd_vdso_install = INSTALL $@
-      cmd_vdso_install = cp $(obj)/[email protected] $(MODLIB)/vdso/$@
-$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
+quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
+      cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%)
+
+vdso_img_insttargets := $(vdso_img_sodbg:%=install_%)
+

arch/x86/vdso/Makefile VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ · line 188

Quoted 10 lines
arch/x86/vdso/Makefile +5 -2
+$(MODLIB)/vdso: FORCE
        @mkdir -p $(MODLIB)/vdso
+
+$(vdso_img_insttargets): install_%: $(obj)/% $(MODLIB)/vdso FORCE
        $(call cmd,vdso_install)
 
-PHONY += vdso_install $(vdso-install-y)
-vdso_install: $(vdso-install-y)
+PHONY += vdso_install $(vdso_img_insttargets)
+vdso_install: $(vdso_img_insttargets) FORCE

OK, so I can't tell from the changelog if this is intentional or not, but now this installs e.g. vdso64.so.dbg instead of vdso64.so.

[jwboyer@sb vdso]$ pwd /lib/modules/3.16.0-0.rc0.git3.1.fc21.x86_64/vdso [jwboyer@sb vdso]$ ls
vdso32-int80.so.dbg vdso32-syscall.so.dbg vdso32-sysenter.so.dbg vdso64.so.dbg
[jwboyer@sb vdso]$

If it's intentional, you might want to make the changelog a bit more verbose.

josh

#58 lore raw

PATCH v3 1/1 x86,vdso: Fix vdso_install

The filenames are different now. Inspired by a patch from Sam Ravnborg.

---

I kept Sam's ack from v2, since v3 has only a trivial change.

Changes from v1: Remove core kbuild change
Changes from v2: Name the result .so files again, not .so.dbg

 arch/x86/vdso/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/vdso/Makefile +11 -11
index 9769df0..845b45e 100644
@@ -9,11 +9,6 @@ VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
 VDSO32-$(CONFIG_X86_32)		:= y
 VDSO32-$(CONFIG_COMPAT)		:= y
 
-vdso-install-$(VDSO64-y)	+= vdso.so
-vdso-install-$(VDSOX32-y)	+= vdsox32.so
-vdso-install-$(VDSO32-y)	+= $(vdso32-images)
-
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
@@ -176,15 +171,20 @@ VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
 GCOV_PROFILE := n
 
 #
-# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+# Install the unstripped copies of vdso*.so.
 #
-quiet_cmd_vdso_install = INSTALL $@
-      cmd_vdso_install = cp $(obj)/[email protected] $(MODLIB)/vdso/$@
-$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
+quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
+      cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%)
+
+vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%)
+
+$(MODLIB)/vdso: FORCE
 	@mkdir -p $(MODLIB)/vdso
+
+$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE
 	$(call cmd,vdso_install)
 
-PHONY += vdso_install $(vdso-install-y)
-vdso_install: $(vdso-install-y)
+PHONY += vdso_install $(vdso_img_insttargets)
+vdso_install: $(vdso_img_insttargets) FORCE
 
 clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*
Signature · 1 line
1.9.3
Tested-by on v3 1/1
#59 lore raw

Re: [PATCH v3] x86,vdso: Fix vdso_install

Quoted 6 lines · Andy Lutomirski

The filenames are different now. Inspired by a patch from Sam Ravnborg.

Things look great with this version. Thanks much!

Quoted 56 lines

---

I kept Sam's ack from v2, since v3 has only a trivial change.

Changes from v1: Remove core kbuild change
Changes from v2: Name the result .so files again, not .so.dbg

 arch/x86/vdso/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/vdso/Makefile +11 -12
index 9769df0..845b45e 100644
@@ -9,11 +9,6 @@ VDSOX32-$(CONFIG_X86_X32_ABI)  := y
 VDSO32-$(CONFIG_X86_32)                := y
 VDSO32-$(CONFIG_COMPAT)                := y
 
-vdso-install-$(VDSO64-y)       += vdso.so
-vdso-install-$(VDSOX32-y)      += vdsox32.so
-vdso-install-$(VDSO32-y)       += $(vdso32-images)
-
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 
@@ -176,15 +171,20 @@ VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
 GCOV_PROFILE := n
 
 #
-# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+# Install the unstripped copies of vdso*.so.
 #
-quiet_cmd_vdso_install = INSTALL $@
-      cmd_vdso_install = cp $(obj)/[email protected] $(MODLIB)/vdso/$@
-$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
+quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
+      cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%)
+
+vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%)
+
+$(MODLIB)/vdso: FORCE
        @mkdir -p $(MODLIB)/vdso
+
+$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE
        $(call cmd,vdso_install)
 
-PHONY += vdso_install $(vdso-install-y)
-vdso_install: $(vdso-install-y)
+PHONY += vdso_install $(vdso_img_insttargets)
+vdso_install: $(vdso_img_insttargets) FORCE
 
 clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*
--

1.9.3

#60 lore raw

Re: [PATCH v3] x86,vdso: Fix vdso_install

Quoted 4 lines · Josh Boyer
Quoted 3 lines · Andy Lutomirski

The filenames are different now. Inspired by a patch from Sam Ravnborg.

Quoted 8 lines
Quoted 3 lines

Things look great with this version. Thanks much!

Are we okay with the 64-bit vdso now being installed as vdso64.so?

-hpa

#61 lore raw

Re: [PATCH v3] x86,vdso: Fix vdso_install

Quoted 9 lines · H. Peter Anvin
Quoted 8 lines · Josh Boyer
Quoted 6 lines · Andy Lutomirski

The filenames are different now. Inspired by a patch from Sam Ravnborg.

Quoted 6 lines
Quoted 4 lines

Things look great with this version. Thanks much!

Are we okay with the 64-bit vdso now being installed as vdso64.so?

Unless someone actually complains, I think so. Ideally, I think we'd have a symlink from the build id, but that's a separate issue.

AFAIK, the only thing that actually references these files is Fedora's gdb, which is finding them from Fedora's build-id symlinks, which should work fine regardless of what the thing is called.

How's this for a patch description:

make vdso_install has been broken since this commit:

commit 6f121e548f83674ab4920a4e60afb58d4f61b829

Author: Andy Lutomirski <[email protected]>
Date:   Mon May 5 12:19:34 2014 -0700

x86, vdso: Reimplement vdso.so preparation in build-time C

because the names of the files to be installed changed. This fixes
vdso_install to install the right files.

#62 lore raw

[tip:x86/vdso] x86/vdso: Fix vdso_install

In reply to Andy Lutomirski
x86/vdso: Fix vdso_install
Commit-ID:  a934fb5bc9cd1260be89272cfb7a6c9dc71974d7
Gitweb:     http://git.kernel.org/tip/a934fb5bc9cd1260be89272cfb7a6c9dc71974d7
Author:     Andy Lutomirski <[email protected]>
AuthorDate: Thu, 12 Jun 2014 08:28:10 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 13 Jun 2014 10:31:48 -0700

x86/vdso: Fix vdso_install

"make vdso_install" installs unstripped versions of the vdso objects for the benefit of the debugger. This was broken by checkin:

6f121e548f83 x86, vdso: Reimplement vdso.so preparation in build-time C

The filenames are different now, so update the Makefile to cope.

This still installs the 64-bit vdso as vdso64.so. We believe this will be okay, as the only known user is a patched gdb which is known to use build-ids, but if it turns out to be a problem we may have to add a link.

Inspired by a patch from Sam Ravnborg.

---
 arch/x86/vdso/Makefile | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/x86/vdso/Makefile +11 -11
index ba6fc27..3c0809a 100644
@@ -9,11 +9,6 @@ VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
 VDSO32-$(CONFIG_X86_32)		:= y
 VDSO32-$(CONFIG_COMPAT)		:= y
 
-vdso-install-$(VDSO64-y)	+= vdso.so
-vdso-install-$(VDSOX32-y)	+= vdsox32.so
-vdso-install-$(VDSO32-y)	+= $(vdso32-images)
-
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o
 vobjs-nox32 := vdso-fakesections.o
@@ -178,15 +173,20 @@ VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
 GCOV_PROFILE := n
 
 #
-# Install the unstripped copy of vdso*.so listed in $(vdso-install-y).
+# Install the unstripped copies of vdso*.so.
 #
-quiet_cmd_vdso_install = INSTALL $@
-      cmd_vdso_install = cp $(obj)/[email protected] $(MODLIB)/vdso/$@
-$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE
+quiet_cmd_vdso_install = INSTALL $(@:install_%=%)
+      cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%)
+
+vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%)
+
+$(MODLIB)/vdso: FORCE
 	@mkdir -p $(MODLIB)/vdso
+
+$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE
 	$(call cmd,vdso_install)
 
-PHONY += vdso_install $(vdso-install-y)
-vdso_install: $(vdso-install-y)
+PHONY += vdso_install $(vdso_img_insttargets)
+vdso_install: $(vdso_img_insttargets) FORCE
 
 clean-files := vdso32-syscall* vdso32-sysenter* vdso32-int80*
#63 lore raw

kbuild: Simplify vmlinux generation

Several new changes pushed out to:
bk://linux-sam.bkbits.net/kbuild

Already posted to lkml:
o Remove last sign of LDFALGS_BLOB (raisorblade)
o Set cflags before including arch Makefile (raisorblade)
o use KERNELREALSE consistently (Brian Gerst)
o Support LOCALVERSION (ianw)

Included as patch in this mail:
o Simplified vmlinux generation

Generating vmlinux in top-level Makefile were getting a bit messy after kallsyms support were added. Also the full link of all the .o files were duplicaed a number of times. This patch does the following:
- Introduce built-in.o which is a prelink of most .o files
- Make the build process a bit more verbose telling when linking .tmpvmlinux*
- Use less magic when determing when to generate a new version
- Allow architectures to override the defineition of cmd_vmlinux__
- Add more comments to the MAkefile and clean up soem other comments
- Display more commends during V=1 builds

The resulting kernel boots and run here.

This clear the queue of kbuild modifications to support um. I expect to see wiedespread use of LOCALVERSION :-)

In my in-queue is mainly pkg patches now.
Current slew of kconfig related patches will go in via Andrew.

Sam

Makefile +130 -89
diff -Nru a/Makefile b/Makefile
@@ -545,67 +545,91 @@
 
 # Build vmlinux
 # ---------------------------------------------------------------------------
+# vmlinux is build from the objects seleted by $(vmlinux-init) and
+# $(vmlinux-main). Most are built-in.o files from top-level directories
+# in the kernel tree, others are specified in arch/$(ARCH)Makefile.
+# Ordering when linking is important, and $(vmlinux-init) must be first.
+#
+# vmlinux
+#   ^
+#   |
+#   +-< $(vmlinux-init)
+#   |   +--< init/version.o + more
+#   |
+#   +-< built-in.o
+#   |   +--< $(vmlinux-main)
+#   |        +--< driver/built-in.o mm/built-in.o + more
+#   |
+#   +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
+#
+# vmlinux version cannot be updated during normal descending-into-subdirs
+# phase since we do not yet know if we need to update vmlinux.
+# Therefore this step is delayed until just before final link of vmlinux -
+# except in kallsyms case where it is done just before adding the
+# symbols to the kernel.
+#
+# System.map is generated to document addresses of all kernel symbols
 
-#	This is a bit tricky: If we need to relink vmlinux, we want
-#	the version number incremented, which means recompile init/version.o
-#	and relink init/init.o. However, we cannot do this during the
-#       normal descending-into-subdirs phase, since at that time
-#       we cannot yet know if we will need to relink vmlinux.
-#	So we descend into init/ inside the rule for vmlinux again.
-vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
-
-quiet_cmd_vmlinux__ = LD      $@
-define cmd_vmlinux__
-	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) $(head-y) $(init-y) \
-	--start-group \
-	$(core-y) \
-	$(libs-y) \
-	$(drivers-y) \
-	$(net-y) \
-	--end-group \
-	$(filter .tmp_kallsyms%,$^) \
-	-o $@
-endef
+vmlinux-init := $(head-y) $(init-y)
+vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
+vmlinux-all  := $(vmlinux-init) built-in.o
+vmlinux-lds  := arch/$(ARCH)/kernel/vmlinux.lds
+
+# Rule to link vmlinux - also used during CONFIG_KALLSYMS
+# May be overridden by arch/$(ARCH)/Makefile
+quiet_cmd_vmlinux__  = LD      $@
+      cmd_vmlinux__  = $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
+                           -T $(filter-out FORCE, $^) -o $@
+
+# Generate new vmlinux version
+quiet_cmd_vmlinux_version = GEN     .version
+      cmd_vmlinux_version = set -e;                     \
+	. $(srctree)/scripts/mkversion > .tmp_version;	\
+	mv -f .tmp_version .version;			\
+	$(MAKE) $(build)=init
+	
+# Generate System.map
+quiet_cmd_sysmap = SYSMAP 
+      cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
 
-#	set -e makes the rule exit immediately on error
+# Link of vmlinux
+# If CONFIG_KALLSYMS is set .version is already updated
+# Generate System.map and verify that the content is consistent
 
 define rule_vmlinux__
-	+set -e;							\
-	$(if $(filter .tmp_kallsyms%,$^),,				\
-	  echo '  GEN     .version';					\
-	  . $(srctree)/scripts/mkversion > .tmp_version;		\
-	  mv -f .tmp_version .version;					\
-	  $(MAKE) $(build)=init;					\
-	)								\
-	$(if $($(quiet)cmd_vmlinux__),					\
-	  echo '  $($(quiet)cmd_vmlinux__)' &&) 			\
-	$(cmd_vmlinux__);						\
-	echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
+	$(if $(CONFIG_KALLSYMS),,$(call cmd,vmlinux_version))
+	
+	$(call cmd,vmlinux__)
+	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
+	
+	$(Q)$(if $($(quiet)cmd_sysmap),                 \
+	  echo '  $($(quiet)cmd_sysmap) System.map' &&) \
+	$(cmd_sysmap) $@ System.map;                    \
+	if [ $$? -ne 0 ]; then                          \
+		rm -f $@;                               \
+		/bin/false;                             \
+	fi;
+	$(verify_kallsyms)
 endef
 
-quiet_cmd_sysmap = SYSMAP 
-      cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
-		   
-LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds
-
-#	Generate section listing all symbols and add it into vmlinux
-#	It's a three stage process:
-#	o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
-#	  empty
-#	  Running kallsyms on that gives us .tmp_kallsyms1.o with
-#	  the right size
-#	o .tmp_vmlinux2 now has a __kallsyms section of the right size,
-#	  but due to the added section, some addresses have shifted
-#	  From here, we generate a correct .tmp_kallsyms2.o
-#	o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
-#	o Verify that the System.map from vmlinux matches the map from
-#	  .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
-#	o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
-#	  .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
-#	  temporary bypass to allow the kernel to be built while the
-#	  maintainers work out what went wrong with kallsyms.
 
 ifdef CONFIG_KALLSYMS
+# Generate section listing all symbols and add it into vmlinux $(kallsyms.o)
+# It's a three stage process:
+# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
+#   empty
+#   Running kallsyms on that gives us .tmp_kallsyms1.o with
+#   the right size - vmlinux version updated during this step
+# o .tmp_vmlinux2 now has a __kallsyms section of the right size,
+#   but due to the added section, some addresses have shifted.
+#   From here, we generate a correct .tmp_kallsyms2.o
+# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
+# o Verify that the System.map from vmlinux matches the map from
+#   .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
+# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
+#   .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
+#   temporary bypass to allow the kernel to be built while the
+#   maintainers work out what went wrong with kallsyms.
 
 ifdef CONFIG_KALLSYMS_EXTRA_PASS
 last_kallsyms := 3
@@ -615,16 +639,28 @@
 
 kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
 
-define rule_verify_kallsyms
+define verify_kallsyms
 	$(Q)$(if $($(quiet)cmd_sysmap),                       \
 	  echo '  $($(quiet)cmd_sysmap) .tmp_System.map' &&)  \
 	  $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
-	$(Q)cmp -s System.map .tmp_System.map || \
-		(echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
+	$(Q)cmp -s System.map .tmp_System.map ||              \
+		(echo Inconsistent kallsyms data;             \
+		 echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \
+		 rm .tmp_kallsyms* ; /bin/false )
+endef
+
+# Update vmlinux version before link
+cmd_ksym_ld = $(cmd_vmlinux__)
+define rule_ksym_ld
+	$(call cmd,vmlinux_version)
+	$(call cmd,vmlinux__)
+	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
 endef
 
+# Generate .S file with all kernel symbols
 quiet_cmd_kallsyms = KSYM    $@
-cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
+      cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
+                     $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
 
 .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
 	$(call if_changed_dep,as_o_S)
@@ -632,43 +668,39 @@
 .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
 	$(call cmd,kallsyms)
 
-.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds FORCE
-	$(call if_changed_rule,vmlinux__)
+# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
+.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE
+	$(call if_changed_rule,ksym_ld)
 
-.tmp_vmlinux2: $(vmlinux-objs) .tmp_kallsyms1.o arch/$(ARCH)/kernel/vmlinux.lds FORCE
-	$(call if_changed_rule,vmlinux__)
+.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE
+	$(call if_changed,vmlinux__)
 
-.tmp_vmlinux3: $(vmlinux-objs) .tmp_kallsyms2.o arch/$(ARCH)/kernel/vmlinux.lds FORCE
-	$(call if_changed_rule,vmlinux__)
+.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE
+	$(call if_changed,vmlinux__)
 
 # Needs to visit scripts/ before $(KALLSYMS) can be used.
 $(KALLSYMS): scripts ;
 
-endif
-
-# Finally the vmlinux rule
-# This rule is also used to generate System.map
-# and to verify that the content of kallsyms are consistent
-
-define rule_vmlinux
-	$(rule_vmlinux__);
-	$(Q)$(if $($(quiet)cmd_sysmap),                  \
-	  echo '  $($(quiet)cmd_sysmap) System.map' &&)  \
-	$(cmd_sysmap) $@ System.map;                     \
-	if [ $$? -ne 0 ]; then                           \
-		rm -f $@;                                \
-		/bin/false;                              \
-	fi;
-	$(rule_verify_kallsyms)
-endef
+endif # ifdef CONFIG_KALLSYMS
 
-vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds FORCE
-	$(call if_changed_rule,vmlinux)
-
-#	The actual objects are generated when descending, 
-#	make sure no implicit rule kicks in
+# vmlinux image - including updated kernel symbols
+vmlinux: $(vmlinux-lds) $(vmlinux-init) built-in.o $(kallsyms.o) FORCE
+	$(call if_changed_rule,vmlinux__)
 
-$(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds: $(vmlinux-dirs) ;
+# Link $(vmlinux-main) to speed up rest of build phase. No need to
+# relink this part too many times.
+# Use start/end-group to make sure to resolve all possible symbols
+quiet_rule_vmlinux_partial = LD      $@
+       cmd_vmlinux_partial = $(LD) $(LDFLAGS) $(LDFLAGS_$(*F)) -r \
+                                   --start-group $(filter-out FORCE, $^) \
+				   --end-group -o $@
+				   
+built-in.o: $(vmlinux-main) FORCE
+	$(call if_changed,vmlinux_partial)
+
+# The actual objects are generated when descending, 
+# make sure no implicit rule kicks in
+$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
 
 # Handle descending into subdirectories listed in $(vmlinux-dirs)
 # Preset locale variables to speed up the build process. Limit locale
@@ -1188,13 +1220,22 @@
   include $(cmd_files)
 endif
 
+# Execute command and generate cmd file
+if_changed = $(if $(strip $? \
+		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
+			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
+	@set -e; \
+	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
+	$(cmd_$(1)); \
+	echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
+
+
 # execute the command and also postprocess generated .d dependencies
 # file
-
 if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
 		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
 			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
-	@set -e; \
+	$(Q)set -e; \
 	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
 	$(cmd_$(1)); \
 	scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
@@ -1208,7 +1249,7 @@
 if_changed_rule = $(if $(strip $? \
 		               $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
 			       $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
-	               @$(rule_$(1)))
+	               $(Q)$(rule_$(1)))
 
 # If quiet is set, only print short version of command
 
#64 lore raw

Re: kbuild: Simplify vmlinux generation

Not posted to lkml:
o Update ver_linux to include current reiserfsprogs (Steven Cole)

scripts/ver_linux renamed from scripts/ver_linux.orig +5 -2
@@ -37,8 +37,11 @@
 fsck.jfs -V 2>&1 | grep version | sed 's/,//' |  awk \
 'NR==1 {print "jfsutils              ", $3}'
 
-reiserfsck -V 2>&1 | grep reiserfsprogs | awk \
-'NR==1{print "reiserfsprogs         ", $NF}'
+reiserfsck -V 2>&1 | grep reiserfsck | awk \
+'NR==1{print "reiserfsprogs         ", $2}'
+
+fsck.reiser4 -V 2>&1 | grep fsck.reiser4 | awk \
+'NR==1{print "reiser4progs          ", $2}'
 
 xfs_db -V 2>&1 | grep version | awk \
 'NR==1{print "xfsprogs              ", $3}'