Linux-2.4.20-8升级内核到Linux-2.6.13实战:
首先,在编译之前,要做以下几个准备工作:
1、 下载module-init-tools-3.1.tar.bz2,
下载地址:http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/
下载完后进行如下操作:
tar –zxvf module-init-tools-3.1.tar.bz2
./configure --prefix=/
make moveold
make all install
./generate-modprobe.conf /etc/modprobe.conf
2、 下载mkinitrd-4.1.18-2.i386.rpm,
下载地址:http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/mkinitrd-4.1.18-2.i386.rpm
3、 下载lvm2-2.00.25-1.01.i386.rpm和device-mapper-1.00.19-2.i386.rpm
下载地址:http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/lvm2-2.00.25-1.01.i386.rpm
http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/device-mapper-1.00.19-2.i386.rpm
4、 删除旧的软件,方法如下
rpm –e (旧的软件名,这里是软件名,不是软件包,如mkinitrd-4.1.18-2) --nodeps
接下来两步和上面一样,把旧的lvm和device-mapper删掉,记住,这里要加――nodeps参数,不然是删不掉的[*浏览了很多的资料,发现都是没有提及这一步的,都说使用――nodeps强制安装就可以,可我装的时候却出现了错误,所以大家可以先省略这一步,先做第五步,出了问题再做一下第4步]
5、 如果已执行了第四步,直接使用rpm –ivh package-name
如果未执行第四步,使用rpm –ivh package-name ――nodeps
6、OK,编译前的准备工作做好了,如果不更新以上几个包在make install时会提示以下错误:mkinitrd failed
make[1]: *** [install] Error 1
make: *** [install] Error 2
7、现在可以编译了吧!!NO,还得去下内核呢!http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.tar.gz
8、把下载的tar包CP到/usr/src目录下,并使用tar –zxvf linux-2.6.13.tar.gz
9、cd /usr/src/linux-2.6.13
10、好了,万事俱备!!哦,对了,忘了提醒一点了,请确保你有足够的磁盘空间,具体要求多少空间我不知道,记得大一点的好,有一次编译到最后就提示空间不足
11、OK,接下来就正式开始make了:
#make menuconfig
使用这个命令后会打开一个编译对话框,以后的事就你自己慢慢去发挥吧,我也是新手,对那里面的东西也不是很熟悉,大家可以到网上去找一下关于那方面的资料,但是针对于在vmware5.0中做的朋友来说,以下几点是要特别注意的
A:Device Drivers --->SCSI device support ---><*> SCSI disk support
Device Drivers --->SCSI device support --->SCSI low-level drivers --->
<*> BusLogic SCSI support,如果这几项不选,等编译完成后重启后会发现系统会提示:No module BusLogic found for kernel的错误,然后死掉
B:Device Drivers ---> Fusion MPT device support ---><M> Fusion MPT (base + ScsiHost) drivers和<M> Fusion MPT misc device (ioctl) driver(这个要不要,不确定)
注意:只能选模块方式,直接编译进内核,就出错,不知道为什么,这个浪费了我好多时间才找到,编译了几十次的成果。
出错信息如下:No module mptbase found for kernel vmware(*我使用默认方式并没有出现这个提示,这一段是一个网友所述,不知为何!)
C:Device Drivers ---> USB support ---><*> USB Mass Storage support
Device Drivers ---> Networking support --->Ethernet (10 or 100Mbit) ---> <*> AMD PCnet32 PCI support(*这两段也是从那位网友那CP来的,不知这个USB不设会不会启不来,第二段是设置网卡的,VMWARE是使用AMD PCnet32的)
D:还有一点切记,把所有的有关ext3(Ext3 journalling file system support, Ext3 Security Labels和JBD (ext3) debugging support等等)的选项都编译到内核里面去,记住,是内核<*>不是模块<M>,否则重启系统后会提示:Mount: error 19 mounting ext3
E:差不多了,还有其它的一些什么自己看看吧,或者上网搜一下,介绍一个不错的网站http://www.chinaunix.net/jh/4/484867.html。
12、make modules_install
13、make install
14、OK,这样就行了,init 6你的系统,会发现在重启后,在引导的时候会有两个不同内核的系统可选,我们当然要选刚编译的系统啦。
15、哈哈,好了,不管这个刚编译的系统有哪些不足或是缺陷的地方,但确实是成功了啊,当然,在编译对话框里面还有很多的东东要我们去学习,
16、没什么了,呵呵,如果按以上方法不成功,那就是你人品问题了-_-呵呵,开个玩笑,成功是要付出代价的,永不放弃的人才会成功。
======================================================================
How to Compile 2.6 kernel for RedHat 9/8
How to Compile 2.6 kernel for RedHat 9/8
Mike Chirico
Last Updated: Wed Mar 24 09:12:06 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.tar.gz" and
"modutils-2.4.21-23.src.rpm"
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-...
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/modutils-2.4...
STEP 3:
Install module-init-tools. This will replace depmod
[/sbin/depmod] and other tools.
tar -zxvf module-init-tools-3.0.tar.gz
cd module-init-tools-3.0
./configure --prefix=/sbin
make
make install
./generate-modprobe.conf /etc/modprobe.conf
STEP 4:
Install modutils-2.4.21-23.src.rpm. You 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 appropriate /usr/src/linux-2.4/configs
[kernel-2.4.20-i686.config, kernel-2.4.20-i686-smp.config]
to .config in whatever directory you are installing. In my
case it's /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 use 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 trouble, 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
in
http://prdownloads.sourceforge.net/souptonuts/configs-0.3.tar.gz?downloa...
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 -t sysfs none /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.
Thomer [http://thomer.com/linux/migrate-to-2.6.html ] also added
changes to /etc/fstab. I only had to do STEP 16 below.
STEP 16:
Add the following to /etc/fstab for usb support.
/proc/bus/usb /proc/bus/usb usbdevfs defaults 0 0
STEP 17 (CHECKING EVERYTHING):
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.
In /boot/grub/grub.conf change "default=0" to boot
with the new kernel. Here's an example of my
grub.conf:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to
# 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 in /etc/rc.sysinit
d. CONFIG_EXT3_FS=y was used in the .config
e. Run /sbin/lsmod or cat /proc/modules to make
sure a 2.4 kernel module wasn't forgotten. Also
look at "$cat /proc/iomem"
STEP 18 (DEVELOP YOUR OWN 2.6 MODULES):
You're done with the 2.6 build. So learn how to develop
2.6 kernel modules. First, checkout the following article
http://lwn.net/Articles/driver-porting/
Then, take a look at the following sample code, which shows how
to create /proc entries for communicating with the kernel and writing
out to any available tty device.
http://prdownloads.sourceforge.net/souptonuts/procreadwrite.0.0.1a.tar.g...
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://linuxdevices.com/articles/AT3855888078.html
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?downloa...
https://sourceforge.net/forum/forum.php?forum_id=353715
http://www.redhat.com/software/rhel/kernel26/
http://www.tldp.org/HOWTO/KernelAnalysis-HOWTO.html
http://www-124.ibm.com/linux/projects/?topic_id=2
KERNEL DRIVER DEVELOPMENT IN 2.6:
Excellent (series of articles):
http://lwn.net/Articles/driver-porting/
Here's my sample program:
http://prdownloads.sourceforge.net/cpearls/procreadwrite.0.0.1a.tar.gz?d...
Good but dated for 2.4 kernel:
http://www.oreilly.com/catalog/linuxdrive2/
http://linuxdevices.com/articles/AT4389927951.html
http://linuxdevices.com/articles/AT5793467888.html
文章评论(0条评论)
登录后参与讨论