changing local version requires full rebuild
Subsystems (9)
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?
If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and make modules_install to put things in a separate directory.
Any ideas on why is that and whether its possible to fix it?
mst
Quoted 11 lines · Michael S. Tsirkin
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and makemodules_installto put things in a separate directory.
Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
o oiu.c in ieee directory - because it dependson the shell script
o A number of drivers that include version.h
- This should be changed so local version does not affect the reast of version.h.
o Other stuff that is always build if kernel has changed
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 21 lines · Michael S. Tsirkin
Quoted 11 lines
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and makemodules_installto put things in a separate directory.Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
ooiu.cin ieee directory - because it dependson the shell script
o A number of drivers that includeversion.h
- This should be changed so local version does not affect the reast ofversion.h.
o Other stuff that is always build if kernel has changed
Quoted 3 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
No, I do makemenuconfig to edit the version. Is that right?
mst
Quoted 6 lines
Quoted 4 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
No, I do makemenuconfig to edit the version. Is that right?
That is fine too.
When building - do you use separate output dir?
Sam
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
No, I do makemenuconfig to edit the version. Is that right?
That is fine too.
When building - do you use separate output dir?Sam
nope, just make
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
No, I do makemenuconfig to edit the version. Is that right?
That is fine too.
When building - do you use separate output dir?Sam
First, by design any module includes the full kernel release name as part of the VERMAGIC_STRING. So at least one file will have to be rebuilt for each module, and all modules have to be relinked, if localversion changes.
MST
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 21 lines · Michael S. Tsirkin
Quoted 11 lines
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and makemodules_installto put things in a separate directory.Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
ooiu.cin ieee directory - because it dependson the shell script
o A number of drivers that includeversion.h
- This should be changed so local version does not affect the reast ofversion.h.
o Other stuff that is always build if kernel has changed
Quoted 3 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
Just tried this with the same effect.
Could it be your version was already -mylocalver?
Please note that you have to actually *change* the local version, otherwise almost nothing is recompiled. Just a touch does nothing.
Actually, the directory kernel/ is not recompiled (so the subject is a bit misleading) , but a huge number of files in drivers, filesystems, sound, lib and net directory - are.
MST
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 13 lines · Michael S. Tsirkin
Quoted 11 lines
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and makemodules_installto put things in a separate directory.
Quoted 6 lines
Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
ooiu.cin ieee directory - because it dependson the shell script
o A number of drivers that includeversion.h
- This should be changed so local version does not affect the reast ofversion.h.
We now have:
swlab155:/usr/src/linux-2.6.10-gold # grep version.h -rI . | wc -l 2143
swlab155:/usr/src/linux-2.6.10-gold # grep UTS_RELEASE -rIi .| wc -l 47
So it appears that its much simpler to change all users of UTS_RELEASE to use some other file, say local_version.h, and have localversion not affect version.h
Opinions?
mst
PATCH 1/1 split UTS_RELEASE to a separate header.
In reply to Sam RavnborgHello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":
Quoted 21 lines · Michael S. Tsirkin
Quoted 11 lines
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of a crash.
Its important to change the local version to force
make install and makemodules_installto put things in a separate directory.Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
ooiu.cin ieee directory - because it dependson the shell script
o A number of drivers that includeversion.h
- This should be changed so local version does not affect the reast ofversion.h.
o Other stuff that is always build if kernel has changed
Quoted 3 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
Well, we have/usr/src/linux-2.6.10-gold # grep -l UTS_RELEASE -rI . | wc -l
29
grep -l version.h -rI . | fgrep -v .cmd | fgrep -v '.mod' | fgrep -e '.c' -e '.h' | wc -l 354
This means that about 300 files are compiled each time localversion changes, which do not actually use the local version.
So, let us split UTS_RELEASE to a separate header: release.h The following patch over 2.6.10 does that, and fixed the in-tree files that really need to include it.
Works for me, and helps me cut down compilation time. Comments?
arch/alpha/boot/bootp.c +1 -0
@@ -9,6 +9,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/mm.h>
arch/alpha/boot/bootpz.c +1 -0
@@ -11,6 +11,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/mm.h>
arch/alpha/boot/main.c +1 -0
@@ -7,6 +7,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/mm.h>
arch/i386/boot/setup.S +1 -0
@@ -48,6 +48,7 @@ #include <linux/config.h> #include <asm/segment.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/compile.h> #include <asm/boot.h>
arch/ppc/platforms/chrp_setup.c +1 -0
@@ -27,6 +27,7 @@#include <linux/reboot.h> #include <linux/init.h> #include <linux/pci.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/adb.h> #include <linux/module.h>
arch/ppc/syslib/btext.c +1 -0
@@ -7,6 +7,7 @@#include <linux/kernel.h> #include <linux/string.h> #include <linux/init.h> +#include <linux/release.h> #include <linux/version.h> #include <asm/sections.h>
arch/ppc64/kernel/process.c +1 -0
@@ -35,6 +35,7 @@#include <linux/ptrace.h> #include <linux/kallsyms.h> #include <linux/interrupt.h> +#include <linux/release.h> #include <linux/version.h> #include <asm/pgtable.h>
arch/ppc64/kernel/pSeries_setup.c +1 -0
@@ -36,6 +36,7 @@#include <linux/ioport.h> #include <linux/console.h> #include <linux/pci.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/adb.h> #include <linux/module.h>
arch/ppc64/kernel/setup.c +1 -0
@@ -24,6 +24,7 @@#include <linux/seq_file.h> #include <linux/ioport.h> #include <linux/console.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/tty.h> #include <linux/root_dev.h>
arch/x86_64/boot/setup.S +1 -0
@@ -47,6 +47,7 @@ #include <linux/config.h> #include <asm/segment.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/compile.h> #include <asm/boot.h>
arch/x86_64/kernel/process.c +1 -0
@@ -32,6 +32,7 @@#include <linux/delay.h> #include <linux/irq.h> #include <linux/ptrace.h> +#include <linux/release.h> #include <linux/version.h> #include <asm/uaccess.h>
drivers/block/floppy.c +1 -0
@@ -155,6 +155,7 @@#include <linux/kernel.h> #include <linux/timer.h> #include <linux/workqueue.h> +#include <linux/release.h> #include <linux/version.h> #define FDPATCHES #include <linux/fdreg.h>
drivers/cdrom/aztcd.c +1 -0
@@ -165,6 +165,7 @@Torben Mathiasen <[email protected]> */ +#include <linux/release.h> #include <linux/version.h> #include <linux/blkdev.h> #include "aztcd.h"
drivers/cdrom/mcdx.c +1 -0
@@ -56,6 +56,7 @@ = "$Id: mcdx.c,v 1.21 1997/01/26 07:12:59 davem Exp $";#endif +#include <linux/release.h> #include <linux/version.h> #include <linux/module.h>
drivers/char/ftape/compressor/zftape-compress.c +1 -0
@@ -31,6 +31,7 @@char zftc_rev[] ="$Revision: 1.1.6.1 $" ;char zftc_dat[] ="$Date: 1997/11/16 15:15:56 $" ; +#include <linux/release.h> #include <linux/version.h> #include <linux/errno.h> #include <linux/mm.h>
drivers/char/ftape/lowlevel/ftape-init.c +1 -0
@@ -23,6 +23,7 @@#include <linux/config.h> #include <linux/module.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/errno.h> #include <linux/fs.h>
drivers/char/ftape/zftape/zftape-init.c +1 -0
@@ -23,6 +23,7 @@#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/fs.h> #include <linux/kernel.h>
drivers/parisc/led.c +1 -0
@@ -26,6 +26,7 @@#include <linux/init.h> #include <linux/types.h> #include <linux/ioport.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/delay.h> #include <linux/netdevice.h>
drivers/scsi/aic7xxx_old.c +1 -0
@@ -224,6 +224,7 @@#include <asm/io.h> #include <asm/irq.h> #include <asm/byteorder.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/string.h> #include <linux/errno.h>
drivers/usb/core/hcd.c +1 -0
@@ -29,6 +29,7 @@#endif #include <linux/module.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/kernel.h> #include <linux/slab.h>
drivers/usb/gadget/ether.c +1 -0
@@ -37,6 +37,7 @@#include <linux/list.h> #include <linux/interrupt.h> #include <linux/uts.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/device.h> #include <linux/moduleparam.h>
drivers/usb/gadget/file_storage.c +1 -0
@@ -237,6 +237,7 @@#include <linux/string.h> #include <linux/suspend.h> #include <linux/uts.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/wait.h>
drivers/usb/gadget/serial.c +1 -0
@@ -31,6 +31,7 @@#include <linux/list.h> #include <linux/interrupt.h> #include <linux/uts.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/wait.h> #include <linux/proc_fs.h>
drivers/usb/gadget/zero.c +1 -0
@@ -76,6 +76,7 @@#include <linux/list.h> #include <linux/interrupt.h> #include <linux/uts.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/device.h> #include <linux/moduleparam.h>
fs/cifs/connect.c +1 -0
@@ -23,6 +23,7 @@#include <linux/string.h> #include <linux/list.h> #include <linux/wait.h> +#include <linux/release.h> #include <linux/version.h> #include <linux/ipv6.h> #include <linux/pagemap.h>
include/linux/vermagic.h +1 -0
@@ -1,3 +1,4 @@ +#include <linux/release.h> #include <linux/version.h> #include <linux/module.h>
include/linux/version.h +0 -1
@@ -1,3 +1,2 @@ -#define UTS_RELEASE "2.6.10-orig"#define LINUX_VERSION_CODE 132618#define KERNEL_VERSION (a,b,c) (((a) << 16) + ((b) << 8) + (c))
init/version.c +1 -0
@@ -10,6 +10,7 @@#include <linux/module.h> #include <linux/uts.h> #include <linux/utsname.h> +#include <linux/release.h> #include <linux/version.h> #define version (a) Version_ ## a
Makefile +12 -5
@@ -763,7 +763,8 @@ # prepare1 creates a makefile if using a separate output directory prepare1: prepare2 outputmakefile -prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER +prepare0: prepare1 include/linux/version.h include/linux/release.h \ + include/asm include/config/MARKER ifneq ($(KBUILD_MODULES),) $(Q)rm -rf $(MODVERDIR) $(Q)mkdir -p $(MODVERDIR)
@@ -820,18 +821,23 @@ uts_len := 64 define filechk_version.h + ( echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ + echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ + ) +endef + +define filechk_release.h if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \ fi; \ - (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ - echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ - echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ - ) + ( echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" ) endef include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) +include/linux/release.h: $(srctree)/Makefile FORCE + $(call filechk,release.h) # ---------------------------------------------------------------------------
@@ -946,6 +952,7 @@ MRPROPER_DIRS += include/config include2 MRPROPER_FILES += .config .config.old include/asm .version \ include/linux/autoconf.h include/linux/version.h \ + include/linux/release.h \ Module.symvers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules
scripts/checkversion.pl +4 -5
@@ -1,7 +1,7 @@ #! /usr/bin/perl # -# checkversion find uses of LINUX_VERSION_CODE, KERNEL_VERSION, or -# UTS_RELEASE without including <linux/version.h>, or cases of +# checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION +# without including <linux/version.h>, or cases of # including <linux/version.h> that don't need it. # Copyright (C) 2003, Randy Dunlap <[email protected]>
@@ -40,9 +40,8 @@ $iLinuxVersion = $. if m/^\s*#\s*include\s*<linux\/version\.h>/o; } - # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE - if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) || - ($_ =~ /UTS_RELEASE/)) { + # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION + if ( ($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) ) { $fUseVersion = 1; last LINE if $iLinuxVersion; }
Re: [PATCH] split UTS_RELEASE to a separate header.
Quoted 35 lines · Michael S. Tsirkin
Hello!
Quoting r. Sam Ravnborg ([email protected]) "Re: changing local version requires full rebuild":Quoted 21 lines · Michael S. Tsirkin
Quoted 11 lines
Hi!
Is it just me, or does changing the local version always require a full kernel rebuild?If so, I'd like to fix it, since I like copying
my kernel source with --preserve and changing the
local version, then going back to the old version in case of
a crash.
Its important to change the local version to force make install and makemodules_installto put things in a separate directory.Just tried it out here.
After cp -Ra only a limited part of the kernel rebuilds.
ooiu.cin ieee directory - because it dependson the shell script
o A number of drivers that includeversion.h
- This should be changed so local version does not affect the reast ofversion.h.
o Other stuff that is always build if kernel has changedQuoted 3 lines
Do you use "echo -mylocalver > localversion" to change the local version?
Sam
Well, we have
/usr/src/linux-2.6.10-gold# grep -lUTS_RELEASE-rI . | wc -l
29
grep -lversion.h-rI . | fgrep -v .cmd | fgrep -v '.mod' | fgrep -e '.c' -e '.h' | wc -l 354
Quoted 8 lines
This means that about 300 files are compiled each time localversion changes, which do not actually use the local version.
So, let us split
UTS_RELEASEto a separate header:release.hThe following patch over 2.6.10 does that, and fixed the in-tree files that really need to include it.
Works for me, and helps me cut down compilation time. Comments?
Most of the stuff using UTS_RELEASE can use system_utsname.release instead (except boot code). Most cases in drivers/ can simply be removed.
--
Brian Gerst