SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
(a) compiled the new kernel [N] and associated modules
(b) copied the kernel file [N] to the boot directory
(c) inserted a new stanza in lilo.conf pointing to the new kernel [N]
(d) run lilo
On reboot I'd like to be able to choose between the old kernel [O]
and the new kernel [N].
Q1: How to associate the module directory tree /lib/modules/[*]
with the appropriate kernel (*=N,O)?
Q2: Ditto for /boot/config and /boot/System.map
Up till now I've chosen to rename the relevant files and directories
prior to rebooting but this is not very convenient or practical.
Some people have mentioned the configuration option LOCAL_VERSION
but I'm not sure how to set this up.
Your comments please.
Last edited by wootletootle; 10-24-2011 at 11:54 PM.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
well, actually you don't copy the kernel to /boot, you run 'make install' and perhaps 'make modules-install' (or something like that)
which will put the modules in /lib/modules/{kernel version} automatically (do that as root of course), this should also automatically add the line in lilo.conf and run lilo
well, actually you don't copy the kernel to /boot, you run 'make install' and perhaps 'make modules-install' (or something like that) which will put the modules in /lib/modules/{kernel version} automatically (do that as root of course), this should also automatically add the line in lilo.conf and run lilo
Yes, but will this allow me to properly choose between the old and new kernels at boot time?
My experience has usually been "kernel panic". In principal I think there needs to
be old [O] and new [N] versions of: the kernel, the module tree, config and System.map.
In choosing the [O] or [N] kernel at boot time how can I associated with it the
[O] or {N] version of the module tree, config and System.map?
Q1: How to associate the module directory tree /lib/modules/[*]
with the appropriate kernel (*=N,O)?
Like you said, use Local version setting. If you make xconfig, it's the third setting in General setup. D-click it and put something there, like "-foo". Then make and install as usual. ls /lib/modules to make sure it worked.
well, actually you don't copy the kernel to /boot, you run 'make install' and perhaps 'make modules-install' (or something like that)
which will put the modules in /lib/modules/{kernel version} automatically (do that as root of course), this should also automatically add the line in lilo.conf and run lilo
Well, actually some of us prefer to copy the kernel to /boot with a -custom name or similar, this stops it overwriting the stock slackware kernel/link.
Nothing will be put in lilo.conf automatically; this must be added manually.
It's far easier to copy the kernel bzImage, system.map, and .config to /boot and then create symlinks and/or rename files as needed if you need to use multiple kernels.
The "install" option should only be used really on the modules as "make modules_install".
It's far easier to copy the kernel bzImage, system.map, and .config to /boot and then create symlinks and/or rename files as needed if you need to use multiple kernels.
Yes, that's more or less what I have been doing. So here I am with modules, config, System map all configured
for kernel [N]. I reboot, select [N] in the boot loader and get "kernel panic". How do I then go about resetting
symlinks so that I can boot to the old kernel [O]? Only way I know of is to boot to the Slackware CD, chroot, and do it from
there. I was/am hoping for another method whereby if [N] doesn't work ("kernel panic") I can reboot and select [O]
and so return to my old kernel...
Thanks everyone for comments, I am still digesting them
Last edited by wootletootle; 10-24-2011 at 08:59 PM.
If the new kernel version number is the same as the old kernel, then when you do a make modules-install the the old kernel modules will be replaced with the new kernel modules. If you don't have all the needed modules installed then booting problems result. It is best to do as qweasd says and to add a version extension to the end of the kernel version number so as not to overwrite the old kernel modules. To add the new kernel version to lilo will need to edit /etc/lilo.conf and add the new kernel version entry and then run lilo at the command prompt. If your upgrading to a newer kernel version number then this isn't usually a problem since the old kernel version number and the new kernel version number will be different.
Thanks colorpurple. There's clearly something I have not understood. I selected LOCAL_VERSION
in menuconfig with ext=25.10.11 (todays date). After make; make modules; make modules_install;
there is a module tree /lib/modules/2.6.29.6-smp-25.10.11. The kernel binary is bzImage and I assume
that the local version extension is coded into it. I copied this [N] to /boot. The old kernel [O]
is vmlinuz (symlink). I didn't bother about changing config or System.map in /boot at this stage.
The lilo entries are
# Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/sda5
label = Slack
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
#
# Linux bootable partition config begins
image = /boot/bzImage
root = /dev/sda5
label = Slack32
read-only # Partitions should be mounted read-only for checking
#
When I select Slack32 in the loader the boot process terminates with
"No filesystem could mount root, tried: romfs
Kernel panic"
Is the kernel panic because of some error in my compile/install procedure
(something to do with initrd?) or is it something else?
it is best to copy the bzImage with the version number as such; /boot/bzImage-2.6.29.6-smp-25.10.11 and will also need to copy System.map to /boot/System.map-2.6.29.6-smp-25.10.11 also. this helps prevents confusion. If you don't have the file system and driver modules needed for your disk hardware compiled into the kernel you will need to make an initrd for that kernel in order for it to boot correctly. If you have all the items needed to boot compiled into the kernel instead of as modules then you won't need an /boot/initd.
edit: if your using an initrd will need to add a initrd line to your lilo.conf file
Last edited by colorpurple21859; 10-24-2011 at 10:17 PM.
Good information, colorpurple. The problem almost certainly is with
the initrd, anyway I'll proceed under that assumption. So it appears
that it's not a simple matter to boot alternative kernels contained
in the same partition: kernel, module tree, config, System.map
and initrd-tree all have to be defined and then symlinked. It would
be neat to find a way to do it without the hand configuration.
There's a real need for it, I would say, especially when building
and testing a custom kernel...
Since I build kernel whenever bored, I tried to streamline the install process as much as possible. Like the OP, I tried to make all the names (and module locations) distinct for each build, even for the same kernel version. Here's what I do whenever I have an itch to update:
Code:
git pull
make oldconfig
make xconfig # tweak settings, change local version
make
kinstall mainline
# copy and paste the output into lilo.conf, change labels as needed.
lilo
where kinstall is just a more fail-safe way to name everything correctly (review and edit variables in the front before use):
Code:
#!/bin/bash
LINUX_SOURCE_PATH=/usr/src/linux
IMAGE_PATH=arch/x86_64/boot/bzImage # relative OK
INSTALL_PATH=/boot
LILO_ROOT=/dev/sdb1 # partition where image is located
LILO_LABEL=Slackware
# Exit on most errors.
set -e
# Customize the name of the installed image.
b=$( for w in $1 ; do echo $w ; break ; done )
if [ -n "$b" ] && [ "$b" = "$1" ] ; then
BRANCH_NAME=$1
else
echo "Supply a one-word image name, like mainline or stable." >&2
exit 1
fi
cd $LINUX_SOURCE_PATH
# Extract kernel version.
KERNEL_RELEASE=$(cat include/config/kernel.release)
# Install modules and the image, build initrd.
make modules_install
cp -v $IMAGE_PATH $INSTALL_PATH/vmlinuz-$BRANCH_NAME-"$KERNEL_RELEASE"
cp -v System.map $INSTALL_PATH/System.map-"$KERNEL_RELEASE"
cd $INSTALL_PATH
mkinitrd -o initrd-$BRANCH_NAME-"$KERNEL_RELEASE" -k "$KERNEL_RELEASE"
# Report
echo "Your shiny new kernel:"
echo '# Linux bootable partition config begins'
echo 'image = '$INSTALL_PATH/vmlinuz-$BRANCH_NAME-"$KERNEL_RELEASE"
echo ' initrd = '$INSTALL_PATH/initrd-$BRANCH_NAME-"$KERNEL_RELEASE"
echo ' root = '$LILO_ROOT
echo ' label = '$LILO_LABEL
echo ' read-only # Partitions should be mounted read-only for checking'
echo '# Linux bootable partition config ends'
You can still get a panic if your initrd can't recognize your filesystem. My solution was to compile ext? into the kernel. I really see no point doing otherwise.
If you work from the /usr/src/linux directory you can fairly use these commands to move things into your system:
make prepare make xconfig (I prefer xconfig as you can scan for settings from the console prompt that may have changed and need reseting) make bzImage modules make modules_install cp arch/x86/boot/bzImage /boot/vmlinuz-custom-3.0.7 cp System.map /boot/System.map-custom-3.0.7 cp .config /boot/config-custom-3.0.7 cd /boot rm System.map ln -s System.map-custom-3.0.7 System.map ln -s vmlinuz-custom-3.0.7 vmlinuz
Afterwards you simply execute "lilo" from any command prompt and then reboot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.