lfs-uefi: fix efivar-37 FTBFS
[linux_from_scratch_hints.git] / multi-kernel-versions.txt
blob17652192a1a3ec49b1a29820f16379341844f7b7
1 AUTHOR: Bruce Dubbs <bdubbs at linuxfromscratch dot org>
3 DATE: 2003-10-26
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: Manage multiple kernels in an LFS system.
9 DESCRIPTION:
10 The instructions in LFS provide for a single kernel.  This hint provides
11 a way to manage multiple kernels for different objectives.
13 PREREQUISITES:
14 This hint is applicable for anyone building multiple kernels in an 
15 LFS system.
17 HINT:
18 When building the kernel, there is a method of tagging it to make
19 configuration of different versions easier.  This method uses the 
20 EXTRAVERSION parameter to tag the kernel.  The build process looks like:
22 DATE=`date +-%Y%m%d`
23 VERSION=2.4.22
25 make mrproper
26 make EXTRAVERSION=$DATE menuconfig
27 make CC=/opt/gcc-2.95.3/bin/gcc EXTRAVERSION=$DATE dep
28 make CC=/opt/gcc-2.95.3/bin/gcc EXTRAVERSION=$DATE bzImage
29 make CC=/opt/gcc-2.95.3/bin/gcc EXTRAVERSION=$DATE modules
30 make CC=/opt/gcc-2.95.3/bin/gcc EXTRAVERSION=$DATE modules_install
31 make mandocs 
32 cp -a Documentation/man /usr/share/man/man9 
33 cp arch/i386/boot/bzImage /boot/linux-${VERSION}${DATE}
34 cp System.map /boot/System.map-${VERSION}${DATE}
36 At this point, you need to edit /boot/grub/grub.conf to
37 add your new kernel and then reboot.
39 What this does
40 ==============
42 First we set a DATE variable in the current shell in the form 20031026. We
43 also set the VERSION variable to the version of the kernel we are creating.
45 We then build the configuration.  make menuconfig will create a .config
46 file in the linux source directory and the include/linux/version.h file
47 where the version resides.  If you want to upgrade an existing 
48 configuration, after you run make mrproper, you can copy a saved copy of 
49 your .config file to the top kernel source directory and use:
51 yes "" | make  EXTRAVERSION=$DATE oldconfig
53 This will reuse your old configuration and use the defaults for any changed
54 configuration parameters in an updated kernel.
56 The EXTRAVERSION variable will embed a string into the kernel version.  This 
57 will create a response to the `uname -r` command which will look something
58 like "2.4.22-20030915".  It will also insert any modules you make into the 
59 directory /lib/modules/<version number>.  For example:
60   
61    /lib/modules/2.4.22-20030915/
63 Copying the kernel image, bzImage, to /boot/linux-${VERSION}${DATE} will
64 identify the kernel version and date compiled for future reference.
66 Copying System.map to /boot/System.map-${VERSION}${DATE} will allow the
67 kernel to always find the proper System.map without any symbolic links
68 because it always looks for the map in this form before it looks for
69 a plain System.map file.
71 There are several variations you can use by merely changing the DATE variable.
72 For instance if you want to add a time (hours and minutes) to the kernel 
73 version, you can use:
75 DATE=`date +-%Y%m%d%H%M`
77 or you can use a simple version number (-1, -2, -3, etc.) that you might want
78 to set manually:
80 DATE=-2
82 In all cases, the method above will properly match up your System.map file to 
83 the kernel when booting.  I recommend always starting the EXTRAVERSION with a 
84 dash (-).
86 Alternative Method
87 ==================
89 Instead of adding the EXTRAVERSION to each make file, you can just change it
90 in the Makefile with:
92 sed -i -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $DATE/" Makefile 
94 then:
96 make menuconfig
97 make CC=/opt/gcc-2.95.3/bin/gcc dep
98 make CC=/opt/gcc-2.95.3/bin/gcc bzImage
99 make CC=/opt/gcc-2.95.3/bin/gcc modules
100 make CC=/opt/gcc-2.95.3/bin/gcc modules_install
102 and continue as above.
104 CHANGELOG:
105 [2003-10-28]
106   * Add EXTRAVERSION to make oldconfig
107 [2003-10-27]
108   * Add EXTRAVERSION to make menuconfig
109   * Add alternative sed method
110 [2003-10-26]
111   * Initial hint.