LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-04-2008, 11:25 PM   #1
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Rep: Reputation: 30
extraversion localversion or both


I wish to recompile the 2.6.21.5 kernel on my new
Slackware 12 installation where I have already
set up to boot hugesmp, genericsmp, and generic
kernels.

Before recompiling, I want to give the kernel a
different name and make sure that I create a separate
/lib/modules directory for it so I don't blow away
/lib/modules/2.6.21.5.

The Kernel Compile README says:

Quote:
Alternatively, before compiling, use the kernel config option "LOCALVERSION" to append a unique suffix to the
regular kernel version. LOCALVERSION can be set in the "General Setup" menu.
In addition, a Kernel Rebuild guide suggests altering the Makefile:

Quote:
Note that there is an additional EXTRAVERSION field. To prevent overwriting any existing kernel modules on the system we will change this EXTRAVERSION to something unique. When the final installation steps are run, kernel module files will then get written to /lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL-$EXTRAVERSION.
Do I need to use one or the other or both techniques to separately identify the kernel and /lib/modules or do they only affect the /lib/modules versioning since I can name the actual kernel anything I want when I copy bzImage to /boot?
 
Old 05-05-2008, 12:33 AM   #2
mike_mck2
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Slackware
Posts: 41

Rep: Reputation: 1
I edit the makefile. It's easy to remember and easy to find.
 
Old 05-05-2008, 12:34 AM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
When you build the kernel you will read:
Code:
Local version - append to kernel release (LOCALVERSION)

Append an extra string to the end of your kernel version.
This will show up when you type uname, for example.
The string you set here will be appended after the contents of
any files with a filename matching localversion* in your
object and source tree, in that order. Your total string can
be a maximum of 64 characters.
Using xconfig you just select the line that reads
Code:
Local version - append to kernel release:
and press Enter. Then you type the name you want to give it, and press Enter
again. It will then give you a separate kernel name and /lib/modules/ such as:
Code:
mingdao@silas:~/kernel/linux-2.6.25$ ls -l /lib/modules/
total 48
drwxr-xr-x 3 root root 4096 2008-03-28 11:54 2.6.24.4/
drwxr-xr-x 3 root root 4096 2008-04-16 14:39 2.6.24.4-libata/
drwxr-xr-x 3 root root 4096 2008-04-17 23:15 2.6.24.4-smp/
drwxr-xr-x 3 root root 4096 2008-04-11 14:31 2.6.24.4-thomer/
drwxr-xr-x 3 root root 4096 2008-04-21 20:50 2.6.25-libata/
drwxr-xr-x 3 root root 4096 2008-05-02 08:38 2.6.25.1-libata/
When you copy your kernel to /boot and edit /etc/lilo.conf you must then
manually give it the name you desire, such as:
Code:
# Linux bootable partition config begins
image = /boot/vmlinuz-2.6.25.1
  initrd = /boot/2.6.25.1-initrd.gz
  root = /dev/vg/root
  label = Slack-2.6.25.1
  read-only
image = /boot/vmlinuz-2.6.25-libata
  initrd = /boot/2.6.25-libata-initrd.gz
  root = /dev/vg/root
  label = Slack-2.6.25
  read-only
image = /boot/vmlinuz-generic-smp-2.6.24.4-smp
  initrd = /boot/initrd.gz
  root = /dev/vg/root
  label = Slackware
  read-only  # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
and
Code:
mingdao@silas:~/kernel/linux-2.6.25$ ls -l /boot/
total 26916
-rw-r--r--  1 root root 1585700 2008-04-21 05:48 2.6.25-libata-initrd.gz
-rw-r--r--  1 root root 1585709 2008-05-02 07:58 2.6.25.1-initrd.gz
lrwxrwxrwx  1 root root      37 2008-04-06 15:45 README.initrd -> /usr/doc/mkinitrd-1.3.2/README.initrd
lrwxrwxrwx  1 root root      25 2008-05-02 07:40 System.map -> /boot/System.map-2.6.25.1
-rw-r--r--  1 root root  770752 2008-04-21 05:45 System.map-2.6.25
-rw-r--r--  1 root root  873293 2008-05-02 07:40 System.map-2.6.25.1
-rw-r--r--  1 root root  844145 2008-03-27 00:00 System.map-generic-2.6.24.4
-rw-r--r--  1 root root  880308 2008-03-26 23:15 System.map-generic-smp-2.6.24.4-smp
-rw-r--r--  1 root root 1282638 2008-03-27 13:24 System.map-huge-2.6.24.4
-rw-r--r--  1 root root 1320418 2008-03-26 23:38 System.map-huge-smp-2.6.24.4-smp
-rw-r--r--  1 root root     512 2008-04-06 15:56 boot.0800
-rw-r--r--  1 root root     137 2008-04-06 15:55 boot_message.txt
lrwxrwxrwx  1 root root      28 2008-04-06 15:54 config -> config-huge-smp-2.6.24.4-smp
-rw-r--r--  1 root root   82369 2008-03-27 00:00 config-generic-2.6.24.4
-rw-r--r--  1 root root   82657 2008-03-26 23:15 config-generic-smp-2.6.24.4-smp
-rw-r--r--  1 root root   82208 2008-03-27 13:24 config-huge-2.6.24.4
-rw-r--r--  1 root root   82606 2008-03-26 23:35 config-huge-smp-2.6.24.4-smp
-rw-r--r--  1 root root    5040 2008-04-01 15:39 diag1.img
drwxr-xr-x 10 root root    4096 2008-05-02 07:58 initrd-tree/
-rw-r--r--  1 root root 1736187 2008-04-06 16:01 initrd.gz
-rw-------  1 root root   38912 2008-05-02 08:01 map
-rw-r--r--  1 root root   15754 2008-02-22 08:08 slack.bmp
lrwxrwxrwx  1 root root      29 2008-04-06 15:54 vmlinuz -> vmlinuz-huge-smp-2.6.24.4-smp
-rw-r--r--  1 root root 1575068 2008-04-21 05:49 vmlinuz-2.6.25-libata
-rw-r--r--  1 root root 1840508 2008-05-02 07:42 vmlinuz-2.6.25.1
-rw-r--r--  1 root root 2056440 2008-03-27 00:00 vmlinuz-generic-2.6.24.4
-rw-r--r--  1 root root 2167352 2008-03-26 23:15 vmlinuz-generic-smp-2.6.24.4-smp
-rw-r--r--  1 root root 4205176 2008-03-27 13:24 vmlinuz-huge-2.6.24.4
-rw-r--r--  1 root root 4370584 2008-03-26 23:38 vmlinuz-huge-smp-2.6.24.4-smp
The kernel will append the localversion to /lib/modules/<kernel-version> but you
must manually name the image, the kernel in /boot, and the initrd (if you use one).
 
Old 05-05-2008, 08:21 AM   #4
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
Bruce Hill quotes comments:

Quote:
Local version - append to kernel release (LOCALVERSION)

Append an extra string to the end of your kernel version.
This will show up when you type uname, for example.
The string you set here will be appended after the
contents of any files with a filename matching
localversion* in your object and source tree, in that
order. Your total string can be a maximum of 64
characters.
I don't understand this; "will be appended after the
contents of any file with a filename matching
localversion in your object and source tree"

"contents of any file" is misleading if not downright
unintelligible. Does this mean that all files in your
object/source tree will have the localversion appended or
does it simply mean that object or final executable
files will have localversion appended?

What does this do to the source tree if I am compiling
from /usr/src/linux-2.6.21.5?

Is this suffix appended to the kernal bzImage or just
to the directory /lib/modules/2.6.21.5-xx?

Maybe I'm just not reading this right but I am totally
perplexed by this.

Can you elaborate?
 
Old 05-05-2008, 08:42 AM   #5
mike_mck2
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Slackware
Posts: 41

Rep: Reputation: 1
That's part of the reason I just edit my makefile, and add it there.

Nice & simple. No fuss, no muss.

I also use the 'installkernel' script, so eleminate typo's and forgotten steps.

Nothing wrong with automating and taking out the guesswork.
 
Old 05-06-2008, 01:29 PM   #6
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
Since no helpful replies, I went ahead and tried
"LOCALVERSION" in the config setup:

Code:
make mrproper

make menuconfig --> General setup --> append
The rest of the configuration went OK but I had to read
a little bit more and acquaint myself with the new menu arrangement plus all the new items.

Apparently, make dep is not needed anymore as dependencies
are handled in make bzImage, so I continued without it:

Code:
make clean

make bzImage ( a few errors; nothing of consequence)

make modules

make modules_install
Renamed and copied bzImage, System.map and config to /boot
Edited lilo.conf and reran LILO w/o errors and rebooted
into the new kernel:

Code:
Welcome to Linux 2.6.21.5-(my suffix appended)
BTW: if you want a dash, you have to include it in the
suffix; it literally tacks on whatever is contained
in append.

/lib/modules contained the new modules from this build
in a directory with the suffix appended; other module
directories remained intact.

/usr/src/linux-2.6.21.5 source tree didn't seem to be
disturbed with any suffix appended to any files.

Makefile EXTRAVERSION contained a -1 before compile which
was changed to .5 afterwards. I seem to recall adding
something to EXTRAVERSION before when I wanted to create
a separate kernel from the same source files and I suppose
I could have appended my suffix here and left LOCALVERSION
blank, but its nice to know that it works too.

I suppose if I added the suffix to both places I would
get a double suffix appended to /lib/modules/2.6.21.5
and in any $(uname -r) command.

Simple exercise. Glad it worked the way I would have
expected.
 
Old 05-06-2008, 06:08 PM   #7
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
For 2.6 kernels you do not need "make bzImage" and "make modules"
for compiling the kernel, only "make" and "make modules_install".
The "make" command handles making the bzImage and the modules.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Local version - append to kernel release (LOCALVERSION) [] (NEW) dr_zayus69 Linux - Software 2 05-06-2008 05:49 PM
Assigning "unique name" to "Extraversion" when upgrading Kernal MatthewASmith79 Linux - Newbie 5 08-26-2004 08:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration