6. Compilation d'un noyau Linux

6.1. Application

  1. Vérification de la version du noyau et de la liste des modules chargés :

    vanvincq@Debian-Laptop ~ $ uname -r
    
    2.6.32-5-686
    
    vanvincq@Debian-Laptop ~ $ lsmod
    
    Module                  Size  Used by
    nls_utf8                 920  1 
    nls_cp437               4501  1 
    vfat                    6545  1 
    fat                    34433  1 vfat
    usb_storage            30739  1 
    cpufreq_stats           1995  0 
    cpufreq_conservative     3523  0 
    cpufreq_userspace       1392  0 
    acpi_cpufreq            4381  1 
    mperf                    887  1 acpi_cpufreq
    cpufreq_powersave        614  0 
    speedstep_lib           2471  0 
    i915                  298658  2 
    drm_kms_helper         18182  1 i915
    drm                   125313  3 i915,drm_kms_helper
    i2c_algo_bit            3530  1 i915
    parport_pc             14383  1 
    ppdev                   4049  0 
    lp                      5586  0 
    parport                20750  3 parport_pc,ppdev,lp
    bluetooth              61299  2 
    rfkill                 10290  3 bluetooth
    [...]
    
  2. Vérification de la configuration matérielle :

    vanvincq@Debian-Laptop ~ $ lscpi
    
    00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 03)
    00:02.0 VGA compatible controller: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
    00:02.1 Display controller: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)
    00:03.0 Communication controller: Intel Corporation 4 Series Chipset HECI Controller (rev 03)
    00:03.2 IDE interface: Intel Corporation 4 Series Chipset PT IDER Controller (rev 03)
    00:03.3 Serial controller: Intel Corporation 4 Series Chipset Serial KT Controller (rev 03)
    00:19.0 Ethernet controller: Intel Corporation 82567LM-3 Gigabit Network Connection (rev 02)
    00:1a.0 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #4 (rev 02)
    00:1a.1 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #5 (rev 02)
    00:1a.2 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #6 (rev 02)
    00:1a.7 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #2 (rev 02)
    00:1b.0 Audio device: Intel Corporation 82801JD/DO (ICH10 Family) HD Audio Controller (rev 02)
    00:1d.0 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #1 (rev 02)
    00:1d.1 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #2 (rev 02)
    00:1d.2 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #3 (rev 02)
    00:1d.7 USB Controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #1 (rev 02)
    00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a2)
    00:1f.0 ISA bridge: Intel Corporation 82801JDO (ICH10DO) LPC Interface Controller (rev 02)
    00:1f.2 IDE interface: Intel Corporation 82801JD/DO (ICH10 Family) 4-port SATA IDE Controller (rev 02)
    00:1f.3 SMBus: Intel Corporation 82801JD/DO (ICH10 Family) SMBus Controller (rev 02)
    00:1f.5 IDE interface: Intel Corporation 82801JD/DO (ICH10 Family) 2-port SATA IDE Controller (rev 02)
    01:01.0 FireWire (IEEE 1394): Agere Systems FW322/323 (rev 70)
    
  3. Compilation et installation du noyau :

    # Récupération des sources du noyau
    vanvincq@Debian-Laptop ~ $ cd /usr/src && wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.2.tar.bz2
    
    # Décompression
    vanvincq@Debian-Laptop /usr/src $ tar jxf linux-3.2.2.tar.bz2
    
    # Création d'un lien standard sur les sources
    vanvincq@Debian-Laptop /usr/src $ ln -s /usr/src/linux-3.2.2 linux
    
    # Copie de l'ancienne configuration comme base 
    vanvincq@Debian-Laptop /usr/src $ cp -i /boot/config-2.6.32-5-686 /usr/src/linux/.config
    vanvincq@Debian-Laptop /usr/src $ cd /usr/src/linux
    
    # Configuration du noyau
    vanvincq@Debian-Laptop /usr/src/linux $ make menuconfig # ou make xconfig || make gconfig
    
    # Edition du Makefile pour remplacer EXTRAVERSION par EXTRAVERSION=-cp2lmain
    vanvincq@Debian-Laptop /usr/src/linux $ vim ./Makefile
    
    # Compilation du noyau et installation des modules (dans /lib/modules/3.2.2-cp2lmain)
    vanvincq@Debian-Laptop /usr/src/linux $ make && make modules_install # ici, on peut aller se boire un café tranquillement
    
    # Copie des fichiers générés par la compilation
    vanvincq@Debian-Laptop /usr/src/linux $ cp -i arch/x86/boot/bzImage /boot/vmlinuz-3.2.2-cp2lmain
    vanvincq@Debian-Laptop /usr/src/linux $ cp -i System.map /boot/System.map-3.2.2-cp2lmain
    vanvincq@Debian-Laptop /usr/src/linux $ cp -i .config /boot/config-3.2.2-cp2lmain
    
    # Création de l'image RamDisk (sans cette dernière, j'ai eu le droit à mon premier Kernel Panic!)
    vanvincq@Debian-Laptop /usr/src/linux $ mkinitramfs -o /boot/initrd.img-3.2.2-cp2lmain /lib/modules/3.2.2-cp2lmain/
    
    # Modification de l'armorçage de façon automatique
    vanvincq@Debian-Laptop /usr/src/linux $ update-grub
    
    # Reboot de la machine pour l'ultime test
    vanvincq@Debian-Laptop /usr/src/linux $ reboot
    
    # Test de la version du noyau
    vanvincq@Debian-Laptop ~ $  uname -r
    3.2.2-cp2lmain