湖濱散記部落格的樹心幽徑[login][主頁]
325:20160107-11 make linux-3.9.5 kernel

(1)
download linux kernel linux-3.9.5.tar.gz
[root@localhost ~]# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.5.tar.gz
--2016-01-06 17:18:27--  https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.5.tar.gz
:
linux-3.9.5.tar.gz     100%[=============================>] 103.68M   357KB/s   in 10m 56ss
2016-01-06 17:29:24 (162 KB/s) - ‘linux-3.9.5.tar.gz’ saved [108711952/108711952]

[root@localhost ~]# pwd
/root
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.9.5-301.fc19.i686.PAE #1 SMP Tue Jun 11 19:46:44 UTC 2013 i686 i686 i386 GNU/Linux
[root@localhost ~]# date
Thu Jan  7 07:29:36 CST 2016
[root@localhost ~]#

(2)
[root@localhost ~]# tar xvzf linux-3.9.5.tar.gz

(3)
[root@localhost ~]# ln -s /root/linux-3.9.5 /usr/src/linux

[root@localhost ~]# ls /usr/src
debug  kernels  linux
[root@localhost ~]# cd /usr/src/linux/
[root@localhost linux]# ls
arch     crypto         fs       Kbuild   linux        net             scripts   usr
block    Documentation  include  Kconfig  MAINTAINERS  README          security  virt
COPYING  drivers        init     kernel   Makefile     REPORTING-BUGS  sound
CREDITS  firmware       ipc      lib      mm           samples         tools
[root@localhost linux]# make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2

(4)
[root@localhost linux]# yum install ncurses-devel

(5)
[root@localhost linux]# make menuconfig
:
  │ │     [ ] 64-bit kernel                                                          │ │
  │ │         General setup  --->                                                    │ │
  │ │     [*] Enable loadable module support  --->                                   │ │
  │ │     -*- Enable the block layer  --->                                           │ │
  │ │         Processor type and features  --->                                      │ │
  │ │         Power management and ACPI options  --->                                │ │
  │ │         Bus options (PCI etc.)  --->                                           │ │
  │ │         Executable file formats / Emulations  --->                             │ │
  │ │     -*- Networking support  --->                                               │ │
  │ │         Device Drivers  --->                                                   │ │
  │ │         Firmware Drivers  --->                                                 │ │
  │ │         File systems  --->                                                     │ │
  │ │         Kernel hacking  --->                                                   │ │
  │ │         Security options  --->                                                 │ │
  │ │     -*- Cryptographic API  --->                                                │ │
  │ │     -*- Virtualization  --->                                                   │ │
  │ │         Library routines  --->   

:
     Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon)

  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in /boot/config-3.9.5-301.fc19.i686.PAE
#
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[root@localhost linux]#


(4)
[root@localhost linux]# cat README |more



(5)
[root@localhost linux]# make mrproper
  CLEAN   .
  CLEAN   arch/x86/kernel/cpu
  CLEAN   arch/x86/kernel
  CLEAN   arch/x86/realmode/rm
  CLEAN   arch/x86/vdso
  CLEAN   arch/x86/lib
  CLEAN   crypto/asymmetric_keys
  CLEAN   drivers/gpu/drm/radeon
  CLEAN   drivers/scsi/aic7xxx
  CLEAN   drivers/tty/vt
  CLEAN   drivers/video/logo
  CLEAN   firmware
  CLEAN   kernel/debug/kdb
  CLEAN   kernel
  CLEAN   lib/raid6
  CLEAN   lib
  CLEAN   security/selinux
  CLEAN   usr
  CLEAN   Documentation/accounting
  CLEAN   Documentation/auxdisplay
  CLEAN   Documentation/connector
  CLEAN   Documentation/filesystems
  CLEAN   Documentation/ia64
  CLEAN   Documentation/laptops
  CLEAN   Documentation/misc-devices/mei
  CLEAN   Documentation/networking/timestamping
  CLEAN   Documentation/networking
  CLEAN   Documentation/pcmcia
  CLEAN   Documentation/spi
  CLEAN   Documentation/timers
  CLEAN   Documentation/watchdog/src
  CLEAN   arch/x86/boot/compressed
  CLEAN   arch/x86/boot
  CLEAN   arch/x86/tools
  CLEAN   .tmp_versions
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts/selinux/genheaders
  CLEAN   scripts/selinux/mdp
  CLEAN   scripts
  CLEAN   include/config usr/include include/generated arch/x86/include/generated
  CLEAN   .config .version include/generated/uapi/linux/version.h Module.symvers signing_key.priv signing_key.x509

x509.genkey extra_certificates
[root@localhost linux]#



(6)
[root@localhost linux]# make menuconfig

 │         Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon)  │
:
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in /boot/config-3.9.5-301.fc19.i686.PAE
#
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[root@localhost linux]#


(7)
[root@localhost linux]# make


(8)
[root@localhost linux]# date
Thu Jan  7 14:27:07 CST 2016

[root@localhost linux]# ls arch/x86/boot/bzImage -l
-rw-r--r-- 1 root root 5013728 Jan  7 13:12 arch/x86/boot/bzImage
[root@localhost linux]#

[root@localhost linux]# ls /boot -l
total 85903
-rw-r--r--  1 root root   142005 Dec 18  2014 config-3.14.27-100.fc19.i686.PAE
-rw-r--r--  1 root root   130928 Jun 12  2013 config-3.9.5-301.fc19.i686
-rw-r--r--. 1 root root   128562 Jun 12  2013 config-3.9.5-301.fc19.i686.PAE
drwxr-xr-x. 6 root root     1024 Jan  6 16:03 grub2
-rw-------. 1 root root 25509635 Dec 23 12:26 initramfs-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8.img
-rw-------  1 root root  9162360 Jan  5 17:34 initramfs-3.14.27-100.fc19.i686.PAE.img
-rw-------  1 root root  8745331 Jan  6 16:03 initramfs-3.9.5-301.fc19.i686.img
-rw-------. 1 root root 16779573 Dec 23 12:26 initramfs-3.9.5-301.fc19.i686.PAE.img
-rw-r--r--. 1 root root   557284 Jan  5 17:34 initrd-plymouth.img
drwx------. 2 root root    12288 Dec 23 12:05 lost+found
-rw-------  1 root root  2244508 Dec 18  2014 System.map-3.14.27-100.fc19.i686.PAE
-rw-------  1 root root  2017641 Jun 12  2013 System.map-3.9.5-301.fc19.i686
-rw-------. 1 root root  2055042 Jun 12  2013 System.map-3.9.5-301.fc19.i686.PAE
-rwxr-xr-x. 1 root root  5025072 Dec 23 12:26 vmlinuz-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8
-rwxr-xr-x  1 root root  5471888 Dec 18  2014 vmlinuz-3.14.27-100.fc19.i686.PAE
-rwxr-xr-x  1 root root  4939088 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686
-rwxr-xr-x. 1 root root  5025072 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686.PAE
[root@localhost linux]#

(9)

[root@localhost ~]# cd /usr/src/linux/
[root@localhost linux]# ls
arch                firmware  lib              net               sound
block               fs        linux            README            System.map
COPYING             include   MAINTAINERS      REPORTING-BUGS    tools
CREDITS             init      Makefile         samples           usr
crypto              ipc       mm               scripts           virt
Documentation       Kbuild    modules.builtin  security          vmlinux
drivers             Kconfig   modules.order    signing_key.priv  vmlinux.o
extra_certificates  kernel    Module.symvers   signing_key.x509  x509.genkey
[root@localhost linux]# ls arch/x86/boot/bzImage -l
-rw-r--r-- 1 root root 5013728 Jan  7 13:12 arch/x86/boot/bzImage
[root@localhost linux]# cp arch/x86/boot/bzImage /boot/vmlinuz-3.9.5-treehrt
[root@localhost linux]# cp .config /boot/config-3.9.5-treehrt
[root@localhost linux]# cp System.map /boot/System.map-3.9.5-treehrt
[root@localhost linux]# ll /boot
total 92931
-rw-r--r--  1 root root   142005 Dec 18  2014 config-3.14.27-100.fc19.i686.PAE
-rw-r--r--  1 root root   130928 Jun 12  2013 config-3.9.5-301.fc19.i686
-rw-r--r--. 1 root root   128562 Jun 12  2013 config-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root   128296 Jan 11 07:34 config-3.9.5-treehrt
drwxr-xr-x. 6 root root     1024 Jan  6 16:03 grub2
-rw-------. 1 root root 25509635 Dec 23 12:26 initramfs-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8.img
-rw-------  1 root root  9162360 Jan  5 17:34 initramfs-3.14.27-100.fc19.i686.PAE.img
-rw-------  1 root root  8745331 Jan  6 16:03 initramfs-3.9.5-301.fc19.i686.img
-rw-------. 1 root root 16779573 Dec 23 12:26 initramfs-3.9.5-301.fc19.i686.PAE.img
-rw-r--r--. 1 root root   557284 Jan  5 17:34 initrd-plymouth.img
drwx------. 2 root root    12288 Dec 23 12:05 lost+found
-rw-------  1 root root  2244508 Dec 18  2014 System.map-3.14.27-100.fc19.i686.PAE
-rw-------  1 root root  2017641 Jun 12  2013 System.map-3.9.5-301.fc19.i686
-rw-------. 1 root root  2055042 Jun 12  2013 System.map-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root  2052858 Jan 11 07:35 System.map-3.9.5-treehrt
-rwxr-xr-x. 1 root root  5025072 Dec 23 12:26 vmlinuz-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8
-rwxr-xr-x  1 root root  5471888 Dec 18  2014 vmlinuz-3.14.27-100.fc19.i686.PAE
-rwxr-xr-x  1 root root  4939088 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686
-rwxr-xr-x. 1 root root  5025072 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root  5013728 Jan 11 07:33 vmlinuz-3.9.5-treehrt
[root@localhost linux]#

(10)
[root@localhost linux]# make modules_install
:
  INSTALL /lib/firmware/yam/1200.bin
  INSTALL /lib/firmware/yam/9600.bin
  DEPMOD  3.9.5

[root@localhost linux]#  ll /lib/modules/
total 16
drwxr-xr-x  6 root root 4096 Jan  5 17:34 3.14.27-100.fc19.i686.PAE
drwxr-xr-x  3 root root 4096 Jan 11 07:39 3.9.5
drwxr-xr-x  6 root root 4096 Jan  6 16:03 3.9.5-301.fc19.i686
drwxr-xr-x. 6 root root 4096 Jan  6 12:46 3.9.5-301.fc19.i686.PAE
[root@localhost linux]#



(11)

[root@localhost linux]# dracut -v /boot/initramfs-3.9.5.img 3.9.5
:
I: *** Creating image file done ***
I: Wrote /boot/initramfs-3.9.5.img:
I: -rw------- 1 root root 17736016 Jan 11 07:42 /boot/initramfs-3.9.5.img

(12)
[root@localhost linux]#  ll /boot
total 110253
-rw-r--r--  1 root root   142005 Dec 18  2014 config-3.14.27-100.fc19.i686.PAE
-rw-r--r--  1 root root   130928 Jun 12  2013 config-3.9.5-301.fc19.i686
-rw-r--r--. 1 root root   128562 Jun 12  2013 config-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root   128296 Jan 11 07:34 config-3.9.5-treehrt
drwxr-xr-x. 6 root root     1024 Jan  6 16:03 grub2
-rw-------. 1 root root 25509635 Dec 23 12:26 initramfs-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8.img
-rw-------  1 root root  9162360 Jan  5 17:34 initramfs-3.14.27-100.fc19.i686.PAE.img
-rw-------  1 root root  8745331 Jan  6 16:03 initramfs-3.9.5-301.fc19.i686.img
-rw-------. 1 root root 16779573 Dec 23 12:26 initramfs-3.9.5-301.fc19.i686.PAE.img
-rw-------  1 root root 17736016 Jan 11 07:42 initramfs-3.9.5.img
-rw-r--r--. 1 root root   557284 Jan  5 17:34 initrd-plymouth.img
drwx------. 2 root root    12288 Dec 23 12:05 lost+found
-rw-------  1 root root  2244508 Dec 18  2014 System.map-3.14.27-100.fc19.i686.PAE
-rw-------  1 root root  2017641 Jun 12  2013 System.map-3.9.5-301.fc19.i686
-rw-------. 1 root root  2055042 Jun 12  2013 System.map-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root  2052858 Jan 11 07:35 System.map-3.9.5-treehrt
-rwxr-xr-x. 1 root root  5025072 Dec 23 12:26 vmlinuz-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8
-rwxr-xr-x  1 root root  5471888 Dec 18  2014 vmlinuz-3.14.27-100.fc19.i686.PAE
-rwxr-xr-x  1 root root  4939088 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686
-rwxr-xr-x. 1 root root  5025072 Jun 12  2013 vmlinuz-3.9.5-301.fc19.i686.PAE
-rw-r--r--  1 root root  5013728 Jan 11 07:33 vmlinuz-3.9.5-treehrt
[root@localhost linux]#

(13)
[root@localhost linux]# dracut -v /boot/initramfs-3.9.5-treehrt.img 3.9.5-treehrt
:
I: Wrote /boot/initramfs-3.9.5-treehrt.img:
I: -rw------- 1 root root 8236814 Jan 11 07:47 /boot/initramfs-3.9.5-treehrt.img

(14)
[root@localhost linux]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.14.27-100.fc19.i686.PAE
Found initrd image: /boot/initramfs-3.14.27-100.fc19.i686.PAE.img
Found linux image: /boot/vmlinuz-3.9.5-treehrt
Found initrd image: /boot/initramfs-3.9.5-treehrt.img
Found linux image: /boot/vmlinuz-3.9.5-301.fc19.i686.PAE
Found initrd image: /boot/initramfs-3.9.5-301.fc19.i686.PAE.img
Found linux image: /boot/vmlinuz-3.9.5-301.fc19.i686
Found initrd image: /boot/initramfs-3.9.5-301.fc19.i686.img
Found linux image: /boot/vmlinuz-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8
Found initrd image: /boot/initramfs-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8.img
done
[root@localhost linux]#

(15)
[root@localhost linux]# mv /boot/vmlinuz-3.14.27-100.fc19.i686.PAE /boot/old.vmlinuz-3.14.27-100.fc19.i686.PAE
[root@localhost linux]# mv /boot/initramfs-3.14.27-100.fc19.i686.PAE.img /boot/old.initramfs-3.14.27-

100.fc19.i686.PAE.img
[root@localhost linux]#

[root@localhost linux]# grub2-mkconfig -o /boot/grub2/grub.cfg                             Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.9.5-treehrt
Found initrd image: /boot/initramfs-3.9.5-treehrt.img
Found linux image: /boot/vmlinuz-3.9.5-301.fc19.i686.PAE
Found initrd image: /boot/initramfs-3.9.5-301.fc19.i686.PAE.img
Found linux image: /boot/vmlinuz-3.9.5-301.fc19.i686
Found initrd image: /boot/initramfs-3.9.5-301.fc19.i686.img
Found linux image: /boot/vmlinuz-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8
Found initrd image: /boot/initramfs-0-rescue-fe190f81d1ab45818aafd3f4c1c5edd8.img
done

(16)
[root@localhost linux]# reboot


[root@localhost ~]# uname -a
Linux localhost.localdomain 3.9.5 #1 SMP Thu Jan 7 13:12:24 CST 2016 i686 i686 i386 GNU/Linux

[root@localhost ~]# date
Mon Jan 11 07:54:09 CST 2016

[root@localhost ~]#  iptables -L -nvx
Chain INPUT (policy ACCEPT 726 packets, 84523 bytes)
    pkts      bytes target     prot opt in     out     source               destination   

Chain FORWARD (policy ACCEPT 14229 packets, 6534383 bytes)
    pkts      bytes target     prot opt in     out     source               destination   

Chain OUTPUT (policy ACCEPT 186 packets, 23787 bytes)
    pkts      bytes target     prot opt in     out     source               destination   
[root@localhost ~]#

REF 1:http://linux.vbird.org/linux_basic/0540kernel.php
REF 2:http://linux.vbird.org/linux_basic/redhat6.1/linux_10kernel.php


select id,article_id,topic,text from lt_articles_text where article_id =325; ok. update lt_articles set num_reads=num_reads +1 where id=325; ok.