How to Compile 2.6 kernel for RedHat
Mike Chirico
Last Updated: Mon Feb 23 14:47:55 EST 2004
The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_26.txt?download
For configs ref:
http://sourceforge.net/project/showfiles.php?group_id=79320&package_id=1...
STEP 1:
Download the latest version of the kernel and any patches. This documentation
is done with linux-2.6.3, but look for later versions.
http://www.kernel.org/pub/linux/kernel/v2.6/
Also take a look at http://www.codemonkey.org.uk/post-halloween-2.5.txt
This has some useful hints on some of the changes needed.
STEP 2:
Download the latest version of module-init-tools
[module-init-tools-3.0-pre10.tar.gz] and modutils-2.4.21-2x.src.rpm
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/
STEP 3:
Install module-init-tools. This will replace depmod [/sbin/depmod] and
other tools.
tar -zxvf module-init-tools-3.0-pre10.tar.gz cd
module-init-tools-3.0-pre10 ./configure --prefix=/sbin
make
make install
./generate-modprobe.conf /etc/modprobe.conf
STEP 4:
Install modutils-2.4.21-23.src.rpm. You'll may get warnings about user
rusty and group rusty not existing. Also, yes, you'll have to force the
install. If you don't do these steps for both Redhat 9 and Redhat 8, you'll
have problems with the make modules_install.
rpm -i modutils-2.4.21-23.src.rpm
rpmbuild -bb /usr/src/redhat/SPECS/modutils.spec
rpm -Fi /usr/src/redhat/RPMS/i386/modutils-2.4.21-23.i386.rpm
STEP 5:
Install and configure the kernel. Do NOT use the /usr/src/linux area!
Reference the README. I put my files in /home/src/kernel/
gunzip linux-2.6.3.tar.gz tar -xvf linux-2.6.3.tar cd linux-2.6.3
If you have patches install these now:
bzip2 -dc ../patch-2.6.xx.bz2 | patch -p1
STEP 6:
Copy the appropiate /usr/src/linux-2.4/configs [kernel-2.4.20-i686.config,
kernel-2.4.20-i686-smp.config] to .config in /home/src/kernel/linux-2.6.3
cp /usr/src/linux-2.4/configs/kernel-2.4.20-i686.config
/home/src/kernel/linux-2.6.3/.config
If you don't have the source configs, you can download them from here:
https://sourceforge.net/project/showfiles.php?group_id=79320&package_id=...
I've also included a file config2.6-chirico which was a 2.6 version for some
of my systems. This isn't a bad reference if you run into trouble.
STEP 7:
Assuming you copied the appropriate kernel-2.4 config to .config, run the
following which will run through necessary questions for the 2.6 kernel. Or,
you might want to use the config2.6-chirico...this has already been run
through make oldconfig on my system, and I've answered the necessary questions
for a general system.
make oldconfig
STEP 8:
This is very important. Make sure you're .config has the following in it
CONFIG_EXT3_FS=y You'll run into the following error if you leave this =m
instead of =y:
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed
This is because Redhat 9.0 and 8.0 user the ext3 filesystem for /boot ...
STEP 9:
Edit the Makefile and add changes to the Extraversion is needed. Patches will
update these values as well.
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 3
EXTRAVERSION = -skim-ch6
STEP 10:
make bzImage
STEP 11:
make modules
STEP 12:
make modules_install
STEP 13:
make install
If you come across errors here, what version of "depmod" is being picked
up in your path?
Also, if you get a module not found, say the following:
No module aic7xxx found for kernel 2.6.x
Then, in /lib/modules/2.6.x/kernel/drivers/scsi/aic7xxx/
cp aic7xxx.ko aic7xxx.o
insmod should look for aic7xxx.ko ;but, it looks for aic7xxx.o
If you still have touble, make the following change in the .config
CONFIG_BLK_DEV_SD=y
and go back to STEP 10.
You also may want to ref
kernel-2.6.3-i686-smp-chirico-aic7xxx.config
STEP 14:
mkdir /sys
STEP 15:
/etc/rc.sysinit needs to be modified. Look for the following line
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
and after this line enter the following:
action $"Mounting sysfs filesystem: " mount -n -t sysfs /sys /sys
Here's my /etc/rc.sysinit for reference:
http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
Be very careful at this step. Backup the /etc/rc.sysinit file. I didn't
need any USB support, but your configuation may need it.
Thomer [http://thomer.com/linux/migrate-to-2.6.html ] also added changes
to /etc/fstab. I did NOT have to do this. No harm in addding; you'll just
get errors when booting that it can't be mounted twice.
STEP 16:
Check the following:
a. The new image file should be installed on boot and there should be sym
link to it. My latest kernel is 2.6.3-skim-ch6, and I got the "-skim-ch6"
from the values I put in the Makefile, so I see the following:
/boot
vmlinuz -> vmlinuz-2.6.3-skim-ch6
System.map -> System.map-2.6.3-skim-ch6
/boot/grub/grub.conf Should have been automatically updated from make
install and look something like the the following:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,2)
# kernel /vmlinuz-version ro root=/dev/hda6
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,2)/grub/splash.xpm.gz
title Red Hat Linux (2.6.3-skim-ch6)
root (hd0,2)
kernel /vmlinuz-2.6.3-skim-ch6 ro root=LABEL=/
initrd /initrd-2.6.3-skim-ch6.img
b. The directory /sys exists
c. You added the mount command for sys
d. CONFIG_EXT3_FS=y was used in the .config
REFERENCES:
http://www.codemonkey.org.uk/post-halloween-2.5.txt
http://kerneltrap.org/node/view/799 http://thomer.com/linux/migrate-to-2.6.html
http://www.kernel.org/
http://bugzilla.kernel.org/
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&group=linux....
http://prdownloads.sourceforge.net/souptonuts/README_26.txt?download
http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
http://prdownloads.sourceforge.net/souptonuts/configs-0.3.tar.gz?download
https://sourceforge.net/forum/forum.php?forum_id=353715
upgrading from redhat 9 to kernel 2.6.3
Hello I followed all the steps mentioned above but keep getting the same error
"No module /bin/true found for kernel 2.6.3"
Can anyone help?
No module /bin/true found for kernel 2.6
I get the same error. Have you find solution?
I recomplie the kernel many times, and it's ok. But after the last change i get the error.
Tanks!
kernel panic-help me
hai everybody,
iam a bignner in kernel programming and i compile the kernel linux 2.6.20 but while booting i got a message kernel panic - not syncing ! attempt to kill init.
before this message the message shown on the screen is like this
switch root mount failed
umount/initrd/dev failed:2
how can i overcome this problem, pls help me anyone
thankyou
ok there is a forgoten peice in the steps above
you see there should be a stepbefore step 6 and after step 5 which should get you to run a process to clean up all resident modules this is:
make mrproper
after this you copy your config file over. then do not run make oldconfig because what that does is change some bits and bobs in the config file for you due to autoconfig. if you had the aic79xxx module error and you changed the CONFIG_BLK_DEV=Y then the make oldconfig just changes it back to a module for you.
run instead of this the make gconfig after copying the .config file and go to device drivers section click the dimond next to it then look for scsi device support then look for scsi disk support make sure a tick is in the box and not a blue line. blue line means module tick means kernel embeded and empty well it just aint there lol.
save and exit follow the rest of process if you want use:
make all
then use:
make modules_install
then use:
make install
if you use grub then make install should auto modify your boot loader but if not follow the above instruction to add it to the grub.conf file located in /boot/grub/
Unable to install patch
I am new to Linux. Please HELP ME!
when i execute the Step 5 command
bzip2 patch-.2.6.5.bz2 | patch -p1
this throws an error
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
the text leading up to this was"
-----------------------------
|diff -Nru a/CREDITS b/CREDITS
|--- a/CREDITS sat Apr 3 19:38:54 2004
|+++ b/CREDITS sat Apr 3 19:38:54 2004
----------------------------------
File to patch:
why do you want to compile such an old kernel?
why do you want to compile such an old kernel?
2.6.5 is ancient, I'd suggest using something newer.
more modules have to be renamed!!
hello,
I´ve followed your HOWTO in Compiling 2.6.3 on redhat 9
in adittion of renaming ai7xxx.ko > ai7xxx.o I renamed ccssi_mod.ko, scsi_mod.ko and sd_mod.ko to *.o. It seems that a module looks up for a module with same extension that the calling module
Step 6:
Im Really New To This And Need To Update My Kernel To Use A Driver For My Modem Under RH9, But Im Having A Problem. At Step 6, When I Try To Copy The Files To The New Directory ( Im Using The Same As You ) It Tells Me There Is No Directory Or File With The Name .config. If I Make The Directory It Will Let Me Copy But At The Make Oldconfig Part I Get A Message Saying Something About Error 2. Anyone Tell Me What Im Doing Wrong? I Assume Its Something Kind Of Obvious But I Cant Figure It Out
your not getting the correct directory i think
hallo you say it will not copy you get an error cant copy no directory or file. sounds like you are copying the wrong thing or to the wrong place. what he has done in the step above to copy a premade config file. get the config file you want from the config directory or download them from the URL. in the directory where they have just been downloaded and saved that will be the first line of the command cp /suchsuch/directory/leadingto/the/configfile
after that you must put where it is going in my case as i have symbolic linked things so dont worry about src directory dont you go using src directory if something goes wrong you in trouble and src directory has diffrent permisions to the system.
so for me i saved the files to /root/kerfiles and the location of my kernel source is /usr/src/linux-2.6 NOTE this is my symbolic link it is not a directory anyway it acts like one dont worry about it.
so cp is to copy file from e.g /root/kerfiles/kernel-2.6.7-i686.config to the source fist directory /usr/src/linux-2.6/.config now i have writen .config into destination because on copy it will rename e.g. kernel-2.6.7-i686.config to .config in one single process these filenames other than .config are all examples use your file structure. i.e file location to file end up location
in the your kernel directory that .config should be in is called something like Linux-2.6.x (x) being the number and or version .config should be placed there along with a few other files like the MAKEFILE MAINTAINERS and readme files.
QM_MODULES: Function Not Implemented
Good job on the upgrade notes.
But, how do you solve the QM_MODULES error when using modprobe or depmod? Many posts online say to install a new version of Rusty's module-init-tools, which I have done. And yet the errors continue.
Any ideas?
it seems that you don't have
it seems that you don't have corectly install de module-init-tools.
check again the readme file within the archive and be sure that you use the latest module-init-tools ( i think is around version 3).
regards
I Double installed and double checked...
I went back and reinstalled module-init-tools-3.0, as well as the newest modutils (which i think is 2.4.22). I am not sure what else to do, or how to check that either of those packages are in fact installed (no errors have occured during the different installs). modprobe -V and insmod -V both return 2.4.22, but the QM_MODULES error persists.
It seems that I am missing something... Could the kernel have had the module options turned off before compile??
module
try installing the new module-init-tools BEFORE compile.
And make sure you UPGRADE the existing module tools. It may even be easier if you remove the old ones completely before installing the new.
rune
error while running 'make install' command!
hi, i m facing the following problem in the 13th step, need help regarding this!
CHK include/linux/version.h
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
CHK include/linux/compile.h
GEN .version
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o(.text+0x87e01): In function `dst_packsize':
drivers/media/dvb/frontends/dst.c:142: undefined reference to `bt878_device_control'
drivers/built-in.o(.text+0x87e3f): In function `dst_gpio_outb':
drivers/media/dvb/frontends/dst.c:153: undefined reference to `bt878_device_control'
drivers/built-in.o(.text+0x87e78):drivers/media/dvb/frontends/dst.c:166: undefined reference to `bt878_device_control'
drivers/built-in.o(.text+0x87ef9): In function `dst_gpio_inb':
drivers/media/dvb/frontends/dst.c:180: undefined reference to `bt878_device_control'
drivers/built-in.o(.text+0x8950b): In function `dst_attach':
drivers/media/dvb/frontends/dst.c:1134: undefined reference to `bt878_find_by_dvb_adap'
make: *** [.tmp_vmlinux1]
thanks,
ajay
Error while running 'make install' command!
I'm also having the same problem in the same step,Please help for me and ajay.
Regards,
shankar.
... depmod: *** Unresolved symbols
I was getting lots of unresolved symbols errors when I ran make modules_install. Here's how I compiled mod-init-tools-3.0 to get rid of them (maybe stuff has changed since the pre10 days):
Using --prefix=/sbin will force everything into directories below /sbin (ie /sbin/sbin/depmod). Second, unless you 'make moveold', 'make install' will refuse to copy over your old utils.
Hope it helps someone.
Matt
Error while trying to load an LKM!
I was unable to load an LKM into the 2.6.5 kernel.
i got the following error:
“insmod: error inserting 'mod.o': -1 Invalid module format”
I have installed the latest module-init tools rpm.
Any suggestions?
regards
ajay
No driver for fdomain (FUTURE_DOMAIN scsi) with 2.6 ??
# make install O=/home/linux-2.6.6/
Using /home/src/kernel/linux-2.6.6 as source for kernel
make[2]: `arch/i386/kernel/asm-offsets.s' is up to date.
CHK include/linux/compile.h
Kernel: arch/i386/boot/bzImage is ready
sh /home/src/kernel/linux-2.6.6/arch/i386/boot/install.sh 2.6.6-arrow1-ch1 arch/i386/boot/bzImage System.map ""
No module fdomain found for kernel 2.6.6-arrow1-ch1
mkinitrd failed
make[2]: *** [install] Fout 1
make[1]: *** [install] Fout 2
make: *** [install] Fout 2
I had no error messages with the other MAKE instructions.
---
Leo
Error Step 12
Hi there,
everything works fine... until step 12
when i execute
make modules_install
the following error occured:
rm: unrecognized option '--s'
Try 'rm --help' for more information
make: *** [_modinst_] Error 1
Any suggestions?
regards Sven
Reboot when new kernel is loading
Hi! I followed your article to compile a Kernel 2.6.4 in my Redhat 8, i haven´t errors till step 16, but when the system starts with the new kernel, appears the message " Loading nuevo(my new kernel name) ................ " and after some seconds, the system reboots. I´m using Lilo, not grub like the article. This is my lilo.conf:
prompt
timeout=50
default=DOS
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear
image=/boot/vmlinuz-2.4.18-14
label=linux
initrd=/boot/initrd-2.4.18-14.img
read-only
append="root=LABEL=/"
image=/boot/vmlinuz-2.6.4
label=nuevo
initrd=/boot/initrd-2.6.4-skim-ch6.img
read-only
# append="root=LABEL=/"
other=/dev/hda1
optional
label=DOS
in /boot vmlinuz-2.6.4 -> vmlinux-2.6.4
System.map -> System.map-2.4.18-14 (I linked System.map to System.map-2.4.6-skim-ch6, but when I execute "lilo -v -v" the link points to the older System.map (?) ) Why ???
Here is a fragment of my /etc/rc.sysinit:
# Fix console loglevel
/bin/dmesg -n $LOGLEVEL
# Mount /proc (done here so volume labels can work with fsck)
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
action $"Mounting sysfs filesystem: " mount -n -t sysfs /sys /sys
# Unmount the initrd, if necessary
if grep -q /initrd /proc/mounts && ! grep -q /initrd/loopfs /proc/mounts ; then
if [ -e /initrd/dev/.devfsd ]; then
umount /initrd/dev
fi
action $"Unmounting initrd: " umount /initrd
/sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
If somebody can help me. i´ll be very thankful !
Sorry by my english ...
My email is impalagfunk@yahoo.com
Leo
i tryed this too
yea i had a go at patching my redhat 9 2.4.2 kernel and it told me it could not patch a sub version so i got the main 2.4.2 sorce from www.kernel.org
unpacked it the run the procedure all went well but as i tried to finish insatall with the make install command it errored on the scsi aic79xxx module also the modules istall went ape at me.
i sifted through all the depedancys but it still wanted more as it told me version difrence errors. so i checked physically on disk and they were seeming all correct why i dont know. i feel it had somthing to do with the symlinks somewhere.
so i run:
make include/linux/version.h
make include/asm
mkdir /tools/glibc-kernheaders
cp -RH include/asm /tools/glibc-kernheaders
cp -R include/asm-generic /tools/glibc-kernheaders
cp -R include/linux /tools/glibc-kernheaders
and my kernel finally compiled then kernel panic on the EIP process stages. at which point i gave up and started to brake down the 2.6 kernel in fedora core for more info.
just a quick question as to the aic79xxx module
how does that work then in redhat 9 because in fedora core 2 the module is not at all in question so why does it require it to be y instead of m. it is a module in fedora core 2 so why is shold it be in the bzImage for redhat 9.
i am confused with that one works embeded in kernel on redhat 9 and works as module in fedora core 2 say what.????
as you can see i can profosise hair loss by 30-35 doomed.
info above is excelent thank you by the way worked spot on. cheers.
Kernel Panic
I followed these instructions to update the Fedora Core 2 (2.6.5 kernel), installed on VMWARE 4.5.1, with the 2.8.1 kernel (with the latest patch). Everything during the compilation was perfectly fine (no errors).
On booting into new kernel: kernel panic, VFS could not mount !!
Any suggestions on what has messed up (already tried it twice ... got the same error) ?
Thanks
No module /bin/true found for kernel
Hai,
I followed the step given but I end up with this error.i am compiling kernel-2.6.12 from redhat9 and I face some problem after this error my network driver fails and now I am not eblr see eth0.
Can some one help me to bring kernel-2.6 up.
Thanks
Balaji R M
No module /bin/true found for kernel 2.6.12.2
Hi all,
The ethernet problem have been solved .I found that module has been removed.But still I am not able to make the kernel 2.6.12.2 up and move further.Can anyone help me I struck up at this point.
sh /usr/src/linux-2.6.12.2/arch/i386/boot/install.sh 2.6.12.2 arch/i386/boot/bzImage System.map "/boot"
No module /bin/true found for kernel 2.6.12.2
mkinitrd failed
make[1]: *** [install] Error 1
make: *** [install] Error 2
regarding .config
i cant find my .config file, i want to upgrade from 2.4.x.x to 2.6.x.x
i ticked the Show Hidden Files but i still cant see it anywhere......
could someone help please?
2.6 kernel compilation in 2.4 redhat
Hi guys,
I got a problem when i was trying to compile a 2.6 kernel in a system which which is 2.4 version......
The error occurred for me is shown below .....
plz help me out.......
BFD: Warning: Writing section `.bss' to huge (ie negative) file offset 0xc027100
objcopy: arch/i386/boot/compressed/vmlinux.bin: File truncated
make[2]: *** [arch/i386/boot/compressed/vmlinux.bin] Error 1
make[1]: *** [arch/i386/boot/compressed/vmlinux] Error 2
make: *** [bzImage] Error 2
thanks and regards,
k.venkat ramana rao
Check the GCC version may help
I also met the same problem you described.
Anyway, maybe troublesome but I recommend that you can get the
newer-version GCC tool and it may fix. For I know, it's GCC 4.1.2 recently.
i am also getting the same
i am also getting the same error. i think we have to change the image type. Instead of 'make bzImage' type some other image types like 'make zimage'. since i am having a very slower processor i cannot do it. really it takes a whole day for a one time compiling
I encountered the same
I encountered the same problem too. make bzImage and make zImage gives me the same error.
I've found a workaround for
I've found a workaround for this message. I've successfully compiled the 2.6.21 kernel on my RH9 with that.
using the following OBJCOPYFLAGS in arch/i386/Makefile.
OBJCOPYFLAGS := -O binary --change-section-lma .bss-0xc0000000 -R .note -R .comment -S
And then compile
check on http://www.uwsg.iu.edu/hypermail/linux/kernel/0410.3/0205.html
Thanks, it works :-)
Thanks, it works :-)