カーネルパラメータによってですが、ABSでコンパイルすると、
header周りでイランもんをmodulesにコピーしようとしてエラーこく時があります。
PKGBUILDを見るとわかりますが、もう修正する気も起きません。。。
DVDやらMedia周りが特に。。。。
もう、Arch LinuxはABSでKernelは再構築しないほうがよさそうです。。。
公式もなんか中途半端な説明だし。。
今回はABSを使わない、通常のカーネル再構築をしてみます。
新Kernel・・・3.2.9-custom「EXTRAVERSION=で変更」
# uname -r 3.2.9-custom
となります。
1)下準備
さくっとやってしまいましょう
「/proc/config.gz」が現在のカーネルパラメータになります。
# cd /usr/src/ # wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2 # tar xfv linux-3.2.9.tar.bz2 # cd linux-3.2.9 # zcat /proc/config.gz >./.config # vi Makefile VERSION = 3 PATCHLEVEL = 2 SUBLEVEL = 9 EXTRAVERSION = -custom NAME = Saber-toothed Squirrel
カーネルパラメータを変更したりします。
# make mrproper # make oldconfig # make menuconfig
下準備完了
2)コンパイルする
-jN・・・N=CPUコア数+1
# make clean # make -j3
1時間ほどかかります。
コーヒーでも飲んでゆっくりしましょう
3)モジュールをインストール
出来たものをインストールしましょう。
# make modules_install # make headers_instal # ls -lha /lib/modules/ total 28K drwxr-xr-x 7 root root 4.0K Mar 2 16:51 . drwxr-xr-x 11 root root 4.0K Mar 1 10:18 .. drwxr-xr-x 3 root root 4.0K Mar 1 20:43 3.2.8-1-ARCH drwxr-xr-x 3 root root 4.0K Mar 2 16:51 3.2.9-custom drwxr-xr-x 2 root root 4.0K Mar 1 20:43 extramodules-3.2-ARCH
「3.2.9-custom」が出来ています。
中身を見てみる。
# ls -lha /lib/modules/3.2.9-custom total 368K drwxr-xr-x 3 root root 4.0K Mar 2 17:34 . drwxr-xr-x 7 root root 4.0K Mar 2 16:51 .. lrwxrwxrwx 1 root root 21 Mar 2 17:34 build -> /usr/src/linux-3.2.9/ drwxr-xr-x 8 root root 4.0K Mar 2 16:51 kernel -rw-r--r-- 1 root root 23K Mar 2 16:51 modules.alias -rw-r--r-- 1 root root 26K Mar 2 16:51 modules.alias.bin -rw-r--r-- 1 root root 3.0K Mar 2 16:51 modules.builtin -rw-r--r-- 1 root root 4.4K Mar 2 16:51 modules.builtin.bin -rw-r--r-- 1 root root 37K Mar 2 16:51 modules.dep -rw-r--r-- 1 root root 59K Mar 2 16:51 modules.dep.bin -rw-r--r-- 1 root root 107 Mar 2 16:51 modules.devname -rw-r--r-- 1 root root 19K Mar 2 16:51 modules.order -rw-r--r-- 1 root root 131 Mar 2 16:51 modules.softdep -rw-r--r-- 1 root root 65K Mar 2 16:51 modules.symbols -rw-r--r-- 1 root root 81K Mar 2 16:51 modules.symbols.bin lrwxrwxrwx 1 root root 20 Mar 2 17:34 source -> /usr/src/linux-3.2.9
こんな感じ
4)カーネル配置&initrdの作成
出来上がったKernelをコピーします。
何でも良いです。(今回は「vmlinuz-linux-3.2.9-custom」としました)
# cp arch/x86_64/boot/bzImage /boot/vmlinuz-linux-3.2.9-custom
initrdを作成します。
# mkinitcpio -k 3.2.9-custom -g /boot/initramfs-linux-3.2.9-custom.img ==> Starting build: 3.2.9-custom -> Parsing hook: [base] -> Parsing hook: [udev] -> Parsing hook: [autodetect] -> Parsing hook: [pata] -> Parsing hook: [scsi] -> Parsing hook: [sata] -> Parsing hook: [filesystems] -> Parsing hook: [usbinput] ==> WARNING: No modules were added to the image. This is probably not what you want. ==> Creating gzip initcpio image: /boot/initramfs-linux-custom.img ==> Image generation successful
initrdが出来ました。
確認してみる。
# ls -lha /boot total 35M drwxr-xr-x 4 root root 4.0K Mar 2 17:18 . drwxr-xr-x 22 root root 4.0K Feb 25 20:06 .. drwxr-xr-x 2 root root 4.0K Mar 2 17:19 grub -rw-r--r-- 1 root root 1.6M Mar 2 17:18 initramfs-3.2.9-custom.img -rw-r--r-- 1 root root 9.6M Mar 1 21:49 initramfs-linux-custom-fallback.img -rw-r--r-- 1 root root 11M Mar 1 20:44 initramfs-linux-fallback.img -rw-r--r-- 1 root root 2.6M Mar 1 20:44 initramfs-linux.img drwx------ 2 root root 16K Feb 25 20:02 lost+found -rw-r--r-- 1 root root 2.7M Mar 2 17:04 vmlinuz-3.2.9-custom -rw-r--r-- 1 root root 3.2M Feb 28 05:54 vmlinuz-linux
「initramfs-3.2.9-custom.img」、「vmlinuz-3.2.9-custom」があります。
5)grubの編集
menu.listを編集します。
# vi /boot/grub/menu.lst # (0) Arch Linux Custom title Arch Linux Custom root (hd0,0) kernel /vmlinuz-linux-3.2.9-custom root=/dev/disk/by-uuid/2765fd25-20cd-47e6-aefd-d22b1d0506ec ro initrd /initramfs-linux-3.2.9-custom.img # (1) Arch Linux title Arch Linux root (hd0,0) kernel /vmlinuz-linux root=/dev/disk/by-uuid/2765fd25-20cd-47e6-aefd-d22b1d0506ec ro initrd /initramfs-linux.img # (2) Arch Linux title Arch Linux Fallback root (hd0,0) kernel /vmlinuz-linux root=/dev/disk/by-uuid/2765fd25-20cd-47e6-aefd-d22b1d0506ec ro initrd /initramfs-linux-fallback.img
できました〜
# reboot $ uname -r 3.2.9-custom
上がって来ました。
問題無いですね。
[tegaki]まぁこんな感じw[/tegaki]