Fedora現已發佈到第29版了,目前最新版V4.x核心(24-Dec-2018 07:52 154M)如下:
https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.20.tar.gz
REF: https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
(1)機器現況
# uname -a Linux www.kmvs.km.edu.tw 3.9.10-100.fc17.i686.PAE #1 SMP Sun Jul 14 01:34:14 UTC 2013 i686 i686 i386 GNU/Linux
(2)下載
# wget https://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/linux-3.19.8.tar.gz
:
2019-01-05 08:26:47 (864 KB/s) - `linux-3.19.8.tar.gz' saved [123146642/123146642]
(3)解開核心 # tar xvzf linux-3.19.8.tar.gz
(4)建立符號連結
# ln -s /root/linux-3.19.8 /usr/src/linux
# ls /usr/src -l 總計 8 drwxr-xr-x. 2 root root 4096 2月 3 2012 debug drwxr-xr-x. 4 root root 4096 7月 5 2016 kernels lrwxrwxrwx 1 root root 18 1月 5 08:31 linux -> /root/linux-3.19.8 #
(5)用現有的組態為預設值建立核心組態
# ls /boot -l 總計 47555 -rw-r--r--. 1 root root 116892 5月 8 2012 config-3.3.4-5.fc17.i686.PAE -rw-r--r-- 1 root root 128015 7月 14 2013 config-3.9.10-100.fc17.i686.PAE drwxr-xr-x. 2 root root 1024 7月 5 2016 grub drwxr-xr-x. 6 root root 1024 7月 5 2016 grub2 -rw-r--r--. 1 root root 16573231 9月 11 2012 initramfs-3.3.4-5.fc17.i686.PAE.img -rw------- 1 root root 18169079 7月 5 2016 initramfs-3.9.10-100.fc17.i686.PAE.img drwx------. 2 root root 12288 9月 11 2012 lost+found -rw-------. 1 root root 1914110 5月 8 2012 System.map-3.3.4-5.fc17.i686.PAE -rw------- 1 root root 2049031 7月 14 2013 System.map-3.9.10-100.fc17.i686.PAE -rwxr-xr-x. 1 root root 4696896 5月 8 2012 vmlinuz-3.3.4-5.fc17.i686.PAE -rwxr-xr-x 1 root root 5022672 7月 14 2013 vmlinuz-3.9.10-100.fc17.i686.PAE
cp /boot/config-3.9.10-100.fc17.i686.PAE /usr/src/linux/config
(6) 調整為64bit OS並重新組態
# make menuconfig
(7)編譯失敗:
#make
:
kernel/bounds.c:1:0: 錯誤:程式碼模式 「kernel」 在 32 位模式下不受支援 kernel/bounds.c:1:0: 對不起,尚未實作:未編譯入對 64 位模式的支援 make[1]: *** [kernel/bounds.s] Error 1 make: *** [prepare0] Error 2
(8)調回原樣並重新組態:
make menuconfig
(9) 編譯核心成功 # make
(10)列出剛編譯完成的核心
# ls arch/x86/boot/bzImage -l -rw-r--r-- 1 root root 5325280 1月 5 10:09 arch/x86/boot/bzImage
(11)將新編的核心 及 組態檔 及System.map 拷至/boot目錄分別為vmlinuz-3.19.8及config-3.19.8 及 System.map-3.19.8
# cp arch/x86/boot/bzImage /boot/vmlinuz-3.19.8
# cp .config /boot/config-3.19.8
# cp System.map /boot/System.map-3.19.8
(12)安裝新的核心模組至/lib/modules/3.19.8成功
# make modules_install
# ls -l /lib/modules/
總計 12 drwxr-xr-x 3 root root 4096 1月 5 10:39 3.19.8 drwxr-xr-x. 5 root root 4096 9月 11 2012 3.3.4-5.fc17.i686.PAE drwxr-xr-x 5 root root 4096 7月 5 2016 3.9.10-100.fc17.i686.PAE
(13)建立initramfs成功 [root@localhost linux]# dracut -v /boot/initramfs-3.19.8.img 3.19.8 :
I: *** Including modules done *** I: *** Creating image file *** I: Wrote /boot/initramfs-3.19.8.img: I: -rw------- 1 root root 156995075 Jan 5 10:44 /boot/initramfs-3.19.8.img
(14) # ls /boot -l 總計 208373 -rw-r--r-- 1 root root 139218 1月 5 10:35 config-3.19.8 -rw-r--r--. 1 root root 116892 5月 8 2012 config-3.3.4-5.fc17.i686.PAE -rw-r--r-- 1 root root 128015 7月 14 2013 config-3.9.10-100.fc17.i686.PAE drwxr-xr-x. 2 root root 1024 7月 5 2016 grub drwxr-xr-x. 6 root root 1024 7月 5 2016 grub2 -rw------- 1 root root 156995075 1月 5 10:44 initramfs-3.19.8.img -rw-r--r--. 1 root root 16573231 9月 11 2012 initramfs-3.3.4-5.fc17.i686.PAE.img -rw------- 1 root root 18169079 7月 5 2016 initramfs-3.9.10-100.fc17.i686.PAE.img drwx------. 2 root root 12288 9月 11 2012 lost+found -rw-r--r-- 1 root root 2215762 1月 5 10:35 System.map-3.19.8 -rw-------. 1 root root 1914110 5月 8 2012 System.map-3.3.4-5.fc17.i686.PAE -rw------- 1 root root 2049031 7月 14 2013 System.map-3.9.10-100.fc17.i686.PAE -rw-r--r-- 1 root root 5325280 1月 5 10:34 vmlinuz-3.19.8 -rwxr-xr-x. 1 root root 4696896 5月 8 2012 vmlinuz-3.3.4-5.fc17.i686.PAE -rwxr-xr-x 1 root root 5022672 7月 14 2013 vmlinuz-3.9.10-100.fc17.i686.PAE
(15)建立核心開機選單,最新編譯者為第1選項(預設選項)
#grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.19.8 Found initrd image: /boot/initramfs-3.19.8.img Found linux image: /boot/vmlinuz-3.9.10-100.fc17.i686.PAE Found initrd image: /boot/initramfs-3.9.10-100.fc17.i686.PAE.img Found linux image: /boot/vmlinuz-3.3.4-5.fc17.i686.PAE Found initrd image: /boot/initramfs-3.3.4-5.fc17.i686.PAE.img done
(16)遠端重開機查看
#reboot
(17)新核心運作中:
[root@www ~]# uname -a Linux www.kmvs.km.edu.tw 3.19.8 #1 SMP Sat Jan 5 10:07:54 CST 2019 i686 i686 i386 GNU/Linux
[root@www ~]# ls /boot -l 總計 208373 -rw-r--r-- 1 root root 139218 1月 5 10:35 config-3.19.8 -rw-r--r--. 1 root root 116892 5月 8 2012 config-3.3.4-5.fc17.i686.PAE -rw-r--r-- 1 root root 128015 7月 14 2013 config-3.9.10-100.fc17.i686.PAE drwxr-xr-x. 2 root root 1024 7月 5 2016 grub drwxr-xr-x. 6 root root 1024 1月 5 10:51 grub2 -rw------- 1 root root 156995075 1月 5 10:44 initramfs-3.19.8.img -rw-r--r--. 1 root root 16573231 9月 11 2012 initramfs-3.3.4-5.fc17.i686.PAE.img -rw------- 1 root root 18169079 7月 5 2016 initramfs-3.9.10-100.fc17.i686.PAE.img drwx------. 2 root root 12288 9月 11 2012 lost+found -rw-r--r-- 1 root root 2215762 1月 5 10:35 System.map-3.19.8 -rw-------. 1 root root 1914110 5月 8 2012 System.map-3.3.4-5.fc17.i686.PAE -rw------- 1 root root 2049031 7月 14 2013 System.map-3.9.10-100.fc17.i686.PAE -rw-r--r-- 1 root root 5325280 1月 5 10:34 vmlinuz-3.19.8 -rwxr-xr-x. 1 root root 4696896 5月 8 2012 vmlinuz-3.3.4-5.fc17.i686.PAE -rwxr-xr-x 1 root root 5022672 7月 14 2013 vmlinuz-3.9.10-100.fc17.i686.PAE
|