RedHat 9/8에서 2.6 kernel 컴파일하기
Mike Chirico 의 작품을 번역한(중?) 것입니다.
Last Updated: Tue May 11 18:59:04 EDT 2004
출처는 http://www.linuxquestions.org/questions/history/180486 입니다.
각 최종 버젼에 대한 정보는 아래에서 보실 수 있습니다.
http://prdownloads.sourceforge.net/souptonuts/README_26.txt?download
설정에대한 최종적인 내용은 아래에서 확인하실 수 있습니다.
http://sourceforge.net/project/showfiles.php?group_id=79320&package_id=109944
STEP 1:
커널의 최종 버젼과 모든 패치들을 다운로드 받습니다.
이 문서는 linux-2.6.3 을 기준으로 되었습니다.
최종버젼은 아래에서 찾을 수 있습니다.
http://www.kernel.org/pub/linux/kernel/v2.6/
또한 아래에서 정보를 찾아보실 수 있습니다.
http://www.codemonkey.org.uk/post-halloween-2.5.txt
그 안에 내용들은 각종 변화에서 필요한 것들과 유용한 힌트등을 알아 보실 수 있습니다.
STEP 2:
module-init-tools 의 최종 버젼을 다운 받습니다.
"module-init-tools-3.0.tar.gz"과 "modutils-2.4.21-23.src.rpm" 입니다.
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-tools-3.0.tar.gz
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/modutils-2.4.21-23.src.rpm
STEP 3:
module-init-tools을 설치합니다. depmod [/sbin/depmod] 및 각종 다른 tool들도 덮어쓰게 됩니다.
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:
modutils-2.4.21-23.src.rpm을 설치합니다.
만일 rusty 라는 user와 group이 없으면 몇가지 경고를 발생합니다.
이럴때는 그냥 yes 처리해서 강제로 설치할 수 있습니다. 만일 이 유틸을 설치하지 않으면
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:
kernel을 설정하고 설치합니다. 절대 /usr/src/linux 영역을 사용하지 마세요!!!
README를 한번 읽고 확인해 보세요. 현재 저같은 경우 /home/src/kernel/ 안에 파일을 풀어 놓고 작업했습니다.
STEP 6:
현재 과거의 설정파일등이 있는 곳( 보통 /usr/src/linux-2.4/configs
[kernel-2.4.20-i686.config, kernel-2.4.20-i686-smp.config] 을 말합니다.)
에서 .config 현재 자신이 컴파일 하고 있는 소스 디렉토리에 복사해오세요.
저같은 경우에는 /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
만약 원본 설정을 가지고 있지 않다면 아래에서 적당히 가져 올 수 있습니다.
https://sourceforge.net/project/showfiles.php?group_id=79320&package_id=109944
제 시스템의 중요하게 2.6 지원이 되는 설정이 포함된 config2.6-chirico라는 파일이 있습니다.
물론 여러분들이 실제로 돌리기엔 몇가지 문제점이 있으므로 무조건 적용은 하지 마세요.
STEP 7:
원하는 kernel-2.4의 설정을 보사해 왔다면 그 내용을 2.6 kernel에 맞게 설정해 주어야
적절히 작동합니다. 또는 config2.6-chirico를 사용하셔도 됩니다.
물론 그것은 제 시스템의 이전 설정으로 만들어 진것이지만, 보통 일반적인 시스템에서
필수적인 문제들을 해결한 내용입니다.
일단 기존 설정을 적용하시려면 아래와 같이 해주시면 됩니다.
make oldconfig
STEP 8:
이 부분이 가장 중요합니다. .config 파일을 만든 후에 그 내용을 여신 후 CONFIG_EXT3_FS=y 부분이
되어 있는지 확인하시기 바랍니다. 만일 그 부분이 =m 가 되었다면 =y로 변경해주세요. 그렇지 않으면
아래의 에러가 발생합니다.
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed
이 이유는 Redhat 9.0 과 8.0 은 ext3 filesystem을 사용하면서 /boot를 맨먼저 참조하고 있기 때문입니다.
STEP 9:
Makefile 과 몇가지 변화된 내용을 설정하셨다면 이젠 Extraversion 부분도 변경해 주시기 바랍니다.
Patches들은 이런 값들의 수정이 꼭 필요합니다.
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
만약 여기서 문제가 발생했다면 "depmod" 의 버젼 문제나 혹은 설정된 path의 문제일 것입니다.
당연히 해당하는 모듈을 찾지 못하면 아래와 같은 에러를 발생합니다.
No module aic7xxx found for kernel 2.6.x
그때에는 /lib/modules/2.6.x/kernel/drivers/scsi/aic7xxx/에다
cp aic7xxx.ko aic7xxx.o
하고 난뒤
만약 aic7xxx.o를 계속 찾는다면 insmod 로 aic7xxx.ko 처리하면 됩니다.
만약 계속 문제가 발생한다면 .config안의 몇가지를 변경해 주면 됩니다.
CONFIG_BLK_DEV_SD=y
and go back to STEP 10.
더 자세한 내용을 원하시면 http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
안에 nel-2.6.3-i686-smp-chirico-aic7xxx.config을 참조하시기 바랍니다.
STEP 14:
mkdir /sys
STEP 15:
/etc/rc.sysinit 는 추가 변경시에 필요합니다. 다음과 같은 줄을 찾아보시기 바랍니다.
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
찾았으면 해당하는 내용을 아래와 같이 변경하세요.
action $"Mounting sysfs filesystem: " mount -t sysfs none /sys
/etc/rc.sysinit은 아래의 링크에서 참조하실 수 있습니다.
http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
단! 이 처리 과정은 굉장히 중요한 부분으로 반드시 /etc/rc.sysinit 파일을 백업하시기 바랍니다.
Thomer [http://thomer.com/linux/migrate-to-2.6.html ]는 간혹/etc/fstab에 변경된 내용을
계속 추가 합니다. 이 때 저같은 경우 STEP 16 밑에서 부터 해당 내용을 수행합니다.
STEP 16:
usb 장비를 지원하려면 /etc/fstab에 다음과 같은 줄을 넣습니다.
/proc/bus/usb /proc/bus/usb usbdevfs defaults 0 0
STEP 17 (전/체/점/검):
다음과 같은 부분을 점검해 보세요:
a. 새로운 이미지 파일은 boot에 설치하곤 합니다. 이를 sym link 로 처리할 수 있습니다.
저의 최근 커널인 2.6.3-skim-ch6에 -skim-ch6과 같은 값을 Makefile에 다음과 같이 값을 넣어 처리해
줄 수 있습니다.
/boot
vmlinuz -> vmlinuz-2.6.3-skim-ch6
System.map -> System.map-2.6.3-skim-ch6
/boot/grub/grub.conf 가 make만으로 자동적으로 업데이트 됩니다.
/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 (GETTING UPDATES: YUM):
Yum works with RPM based systems to update packages
automatically. Yum is an officially supported update
mechanism for Fedora, and Fedora mirrors are set up
as Yum repositories.
Download:
http://linux.duke.edu/projects/yum/download.ptml
Before installing Yum, or any RPM package, you'll need
to do the following:
export LD_ASSUME_KERNEL=2.4.19
Next, install Yum
rpm -ivh yum-2.0.7-1.noarch.rpm
The "/etc/yum.conf" may need to be updated. Here is an
example file with the values for redhat 9 entered in
directly
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
[fedora-stable-9]
name=Fedora Project Stable RPMS for RHL 9
baseurl=http: //download.fedora.us/fedora/redhat/9/i386/yum/stable/
gpgcheck=1
[fedora-updates-9]
name=Fedora Project update RPMS for RHL 9
baseurl=http: //download.fedora.us/fedora/redhat/9/i386/yum/updates/
gpgcheck=1
NOTE: If you're using Redhat 8, replace 9 with "8.0"
The following will download a lot of "HEADER" files, but WILL NOT update
anything. Yes, I too thought my system was being updated with old files,
but IT IS NOT.
yum check-update
After this runs, which takes awhile. You can then update selected packages.
Here is an example of the "libpng10" package being updated.
yum -y update libpng10
Also, subsequent calls to "yum check-update" shows what needs to be updated.
To update every currently installed package
yum -y update
STEP 19 (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/...tar.gz?download
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=...up=linux.kernel
http://linuxdevices.com/articles/AT3855888078.html
http://prdownloads.sourceforge.net/...26.txt?download
http://prdownloads.sourceforge.net/...it.txt?download
http://prdownloads.sourceforge.net/...tar.gz?download
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/...tar.gz?download
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
Mike Chirico 의 작품을 번역한(중?) 것입니다.
Last Updated: Tue May 11 18:59:04 EDT 2004
출처는 http://www.linuxquestions.org/questions/history/180486 입니다.
각 최종 버젼에 대한 정보는 아래에서 보실 수 있습니다.
http://prdownloads.sourceforge.net/souptonuts/README_26.txt?download
설정에대한 최종적인 내용은 아래에서 확인하실 수 있습니다.
http://sourceforge.net/project/showfiles.php?group_id=79320&package_id=109944
STEP 1:
커널의 최종 버젼과 모든 패치들을 다운로드 받습니다.
이 문서는 linux-2.6.3 을 기준으로 되었습니다.
최종버젼은 아래에서 찾을 수 있습니다.
http://www.kernel.org/pub/linux/kernel/v2.6/
또한 아래에서 정보를 찾아보실 수 있습니다.
http://www.codemonkey.org.uk/post-halloween-2.5.txt
그 안에 내용들은 각종 변화에서 필요한 것들과 유용한 힌트등을 알아 보실 수 있습니다.
STEP 2:
module-init-tools 의 최종 버젼을 다운 받습니다.
"module-init-tools-3.0.tar.gz"과 "modutils-2.4.21-23.src.rpm" 입니다.
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-tools-3.0.tar.gz
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/modutils-2.4.21-23.src.rpm
STEP 3:
module-init-tools을 설치합니다. depmod [/sbin/depmod] 및 각종 다른 tool들도 덮어쓰게 됩니다.
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:
modutils-2.4.21-23.src.rpm을 설치합니다.
만일 rusty 라는 user와 group이 없으면 몇가지 경고를 발생합니다.
이럴때는 그냥 yes 처리해서 강제로 설치할 수 있습니다. 만일 이 유틸을 설치하지 않으면
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:
kernel을 설정하고 설치합니다. 절대 /usr/src/linux 영역을 사용하지 마세요!!!
README를 한번 읽고 확인해 보세요. 현재 저같은 경우 /home/src/kernel/ 안에 파일을 풀어 놓고 작업했습니다.
STEP 6:
현재 과거의 설정파일등이 있는 곳( 보통 /usr/src/linux-2.4/configs
[kernel-2.4.20-i686.config, kernel-2.4.20-i686-smp.config] 을 말합니다.)
에서 .config 현재 자신이 컴파일 하고 있는 소스 디렉토리에 복사해오세요.
저같은 경우에는 /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
만약 원본 설정을 가지고 있지 않다면 아래에서 적당히 가져 올 수 있습니다.
https://sourceforge.net/project/showfiles.php?group_id=79320&package_id=109944
제 시스템의 중요하게 2.6 지원이 되는 설정이 포함된 config2.6-chirico라는 파일이 있습니다.
물론 여러분들이 실제로 돌리기엔 몇가지 문제점이 있으므로 무조건 적용은 하지 마세요.
STEP 7:
원하는 kernel-2.4의 설정을 보사해 왔다면 그 내용을 2.6 kernel에 맞게 설정해 주어야
적절히 작동합니다. 또는 config2.6-chirico를 사용하셔도 됩니다.
물론 그것은 제 시스템의 이전 설정으로 만들어 진것이지만, 보통 일반적인 시스템에서
필수적인 문제들을 해결한 내용입니다.
일단 기존 설정을 적용하시려면 아래와 같이 해주시면 됩니다.
make oldconfig
STEP 8:
이 부분이 가장 중요합니다. .config 파일을 만든 후에 그 내용을 여신 후 CONFIG_EXT3_FS=y 부분이
되어 있는지 확인하시기 바랍니다. 만일 그 부분이 =m 가 되었다면 =y로 변경해주세요. 그렇지 않으면
아래의 에러가 발생합니다.
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed
이 이유는 Redhat 9.0 과 8.0 은 ext3 filesystem을 사용하면서 /boot를 맨먼저 참조하고 있기 때문입니다.
STEP 9:
Makefile 과 몇가지 변화된 내용을 설정하셨다면 이젠 Extraversion 부분도 변경해 주시기 바랍니다.
Patches들은 이런 값들의 수정이 꼭 필요합니다.
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
만약 여기서 문제가 발생했다면 "depmod" 의 버젼 문제나 혹은 설정된 path의 문제일 것입니다.
당연히 해당하는 모듈을 찾지 못하면 아래와 같은 에러를 발생합니다.
No module aic7xxx found for kernel 2.6.x
그때에는 /lib/modules/2.6.x/kernel/drivers/scsi/aic7xxx/에다
cp aic7xxx.ko aic7xxx.o
하고 난뒤
만약 aic7xxx.o를 계속 찾는다면 insmod 로 aic7xxx.ko 처리하면 됩니다.
만약 계속 문제가 발생한다면 .config안의 몇가지를 변경해 주면 됩니다.
CONFIG_BLK_DEV_SD=y
and go back to STEP 10.
더 자세한 내용을 원하시면 http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
안에 nel-2.6.3-i686-smp-chirico-aic7xxx.config을 참조하시기 바랍니다.
STEP 14:
mkdir /sys
STEP 15:
/etc/rc.sysinit 는 추가 변경시에 필요합니다. 다음과 같은 줄을 찾아보시기 바랍니다.
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
찾았으면 해당하는 내용을 아래와 같이 변경하세요.
action $"Mounting sysfs filesystem: " mount -t sysfs none /sys
/etc/rc.sysinit은 아래의 링크에서 참조하실 수 있습니다.
http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download
단! 이 처리 과정은 굉장히 중요한 부분으로 반드시 /etc/rc.sysinit 파일을 백업하시기 바랍니다.
Thomer [http://thomer.com/linux/migrate-to-2.6.html ]는 간혹/etc/fstab에 변경된 내용을
계속 추가 합니다. 이 때 저같은 경우 STEP 16 밑에서 부터 해당 내용을 수행합니다.
STEP 16:
usb 장비를 지원하려면 /etc/fstab에 다음과 같은 줄을 넣습니다.
/proc/bus/usb /proc/bus/usb usbdevfs defaults 0 0
STEP 17 (전/체/점/검):
다음과 같은 부분을 점검해 보세요:
a. 새로운 이미지 파일은 boot에 설치하곤 합니다. 이를 sym link 로 처리할 수 있습니다.
저의 최근 커널인 2.6.3-skim-ch6에 -skim-ch6과 같은 값을 Makefile에 다음과 같이 값을 넣어 처리해
줄 수 있습니다.
/boot
vmlinuz -> vmlinuz-2.6.3-skim-ch6
System.map -> System.map-2.6.3-skim-ch6
/boot/grub/grub.conf 가 make만으로 자동적으로 업데이트 됩니다.
/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 (GETTING UPDATES: YUM):
Yum works with RPM based systems to update packages
automatically. Yum is an officially supported update
mechanism for Fedora, and Fedora mirrors are set up
as Yum repositories.
Download:
http://linux.duke.edu/projects/yum/download.ptml
Before installing Yum, or any RPM package, you'll need
to do the following:
export LD_ASSUME_KERNEL=2.4.19
Next, install Yum
rpm -ivh yum-2.0.7-1.noarch.rpm
The "/etc/yum.conf" may need to be updated. Here is an
example file with the values for redhat 9 entered in
directly
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
[fedora-stable-9]
name=Fedora Project Stable RPMS for RHL 9
baseurl=http: //download.fedora.us/fedora/redhat/9/i386/yum/stable/
gpgcheck=1
[fedora-updates-9]
name=Fedora Project update RPMS for RHL 9
baseurl=http: //download.fedora.us/fedora/redhat/9/i386/yum/updates/
gpgcheck=1
NOTE: If you're using Redhat 8, replace 9 with "8.0"
The following will download a lot of "HEADER" files, but WILL NOT update
anything. Yes, I too thought my system was being updated with old files,
but IT IS NOT.
yum check-update
After this runs, which takes awhile. You can then update selected packages.
Here is an example of the "libpng10" package being updated.
yum -y update libpng10
Also, subsequent calls to "yum check-update" shows what needs to be updated.
To update every currently installed package
yum -y update
STEP 19 (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/...tar.gz?download
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=...up=linux.kernel
http://linuxdevices.com/articles/AT3855888078.html
http://prdownloads.sourceforge.net/...26.txt?download
http://prdownloads.sourceforge.net/...it.txt?download
http://prdownloads.sourceforge.net/...tar.gz?download
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/...tar.gz?download
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
728x90