日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux内核配置与编译,LINUX内核的配置与编译、安装

發布時間:2023/12/15 linux 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux内核配置与编译,LINUX内核的配置与编译、安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

LINUX內核的配置與編譯、安裝

平臺為VM RHEL 5.1 SERVER,所用的內核為linux-2.6.25。

可以到上下載相應的內核版本。

解壓壓縮包,并進入內核目錄。下面是具體的步驟:

1、找到你要參考的配置文件,如:/boot/config-2.6.18-53.e15

[root@localhost linux-2.6.25]# cp /boot/config-2.6.18-53.el5 /home/suruiqin/linux-2.6.25/.config

也可使用默認的配置文件

2、配置內核

[root@localhost linux-2.6.25]#make menuconfig

3、編譯內核

[root@localhost linux-2.6.25]# make bzImage

或者:make zImage

區別:在X86平臺,zImage只能用于小于512K的內核

如需獲取詳細的編譯信息,可使用:

make zImage V=1

make bzImage V=1

編譯好的內核位于arch//boot/目錄下

4、編譯內核模塊

[root@localhost linux-2.6.25]# make modules

5、安裝內核模塊

[root@localhost linux-2.6.25]#make modules_install

執行這個命令后,將編譯好的內核模塊從內核源代碼目錄copy至/lib/modules下

6、制作init ramdisk

注:要進入要編譯的內核文件目錄下

mkinitrd initrd-$version $version

例:

[root@localhost linux-2.6.25]# cd /home/suruiqin/linux-2.6.25

[root@localhost linux-2.6.25]# mkinitrd initrd-2.6.25 2.6.25

*** $version可以通過查詢/lib/modules下的目錄得到

7、內核安裝(X86平臺)

1)cp arch/x86/boot/bzImage /boot/vmlinuz-$version

如:

[root@localhost linux-2.6.25]# cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.25

***$version為所編譯的內核版本號

2)cp $initrd /boot/

如:

[root@localhost linux-2.6.25]# cp initrd-2.6.25 /boot

3)修改 /etc/grub.conf或 /etc/lilo.conf

如:

[root@localhost ~]# gedit /etc/grub.conf

# 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,0)

#kernel /vmlinuz-version ro root=/dev/sda2

#initrd /initrd-version.img

#boot=/dev/sda

default=0

timeout=5

splashp_w_picpath=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title Red Hat Enterprise Linux Server (2.6.18-53.el5)

root (hd0,0)

kernel /vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.18-53.el5.img

title Red Hat Enterprise Linux Server (2.6.25)

root (hd0,0)

kernel /vmlinuz-2.6.25 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.25

注:紅色部分就是為啟動剛才自己做的內核而加上的

到這步時按回車,出現下面的選項:

選擇第二個啟動,即剛才做的內核。

新建一個終端:

[root@localhost ~]# uname -a

Linux localhost.localdomain2.6.25 #1 SMP Mon Jun 4 05:26:03 PDT 2012 i686 i686 i386 GNU/Linux

OK。

總結

以上是生活随笔為你收集整理的linux内核配置与编译,LINUX内核的配置与编译、安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。