過去2回に渡ってPlamo Linux 7.
ソースコードのダウンロードと展開
まずはビルドしたいカーネルのソースコードをwww.
このバージョン番号が3ケタのメンテナンス版は、
今回は最新の安定版である5.
$ mkdir ~/Linux ; cd ~/Linux $ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.9.tar.xz --2019-08-25 22:58:10-- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.9.tar.xz .... linux-5.2.9.tar.xz 100%[=======================================================>] 102.11M 8.19MB/s 時間 12s 2019-08-25 22:58:23 (8.32 MB/s) - `linux-5.2.9.tar.xz' へ保存完了 [107065760/107065760] $ tar xvf linux-5.2.9.tar.xz linux-5.2.9/ linux-5.2.9/.clang-format linux-5.2.9/.cocciconfig .... linux-5.2.9/virt/lib/Makefile linux-5.2.9/virt/lib/irqbypass.c $
カーネルの各種機能の設定
次にビルドする機能やドライバを設定します。その際、
$ cd linux-5.2.9 $ zcat /proc/config.gz > .config
この状態でmake oldconfigを実行すると、
$ make oldconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o ... Cputime accounting > 1. Full dynticks CPU time accounting (VIRT_CPU_ACCOUNTING_GEN) choice[1]: 1 Fine granularity task level IRQ time accounting (IRQ_TIME_ACCOUNTING) [Y/n/?] y BSD Process Accounting (BSD_PROCESS_ACCT) [Y/n/?] y BSD Process Accounting version 3 file format (BSD_PROCESS_ACCT_V3) [Y/n/?] y Export task/process statistics through netlink (TASKSTATS) [Y/?] y Enable per-task delay accounting (TASK_DELAY_ACCT) [Y/?] y Enable extended accounting over taskstats (TASK_XACCT) [Y/n/?] y Enable per-task storage I/O accounting (TASK_IO_ACCOUNTING) [Y/n/?] y Pressure stall information tracking (PSI) [N/y/?] (NEW)
ここで"(NEW)"と表示されているのが既存の.configには無い設定項目です。選択肢は"[N/
Pressure stall information tracking (PSI) [N/y/?] (NEW) ? CONFIG_PSI: Collect metrics that indicate how overcommitted the CPU, memory, and IO capacity are in the system. If you say Y here, the kernel will create /proc/pressure/ with the pressure statistics files cpu, memory, and io. These will indicate the share of walltime in which some or all tasks in the system are delayed due to contention of the respective resource. In kernels with cgroup support, cgroups (cgroup2 only) will have cpu.pressure, memory.pressure, and io.pressure files, which aggregate pressure stalls for the grouped tasks only. For more details see Documentation/accounting/psi.txt. Say N if unsure.
この説明によると、
ちょっと面白そうな機能ではあるものの、
このように、
新しいカーネルのビルドとドライバ・モジュールのインストール
make oldconfigが最後まで進むと.configが更新されます。これでカーネルがビルド可能になったので、
choice[1-3?]: 1 # # configuration written to .config # $ make -j6 SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h SYSTBL arch/x86/include/generated/asm/syscalls_32.h SYSTBL arch/x86/include/generated/asm/syscalls_64.h .... LD [M] sound/x86/snd-hdmi-lpe-audio.ko LD [M] sound/xen/snd_xen_front.ko LD [M] virt/lib/irqbypass.ko $
次にmake modules_
$ sudo make modules_install [sudo] kojima のパスワード: **** INSTALL arch/x86/crypto/aegis128-aesni.ko INSTALL arch/x86/crypto/aegis128l-aesni.ko INSTALL arch/x86/crypto/aegis256-aesni.ko ... INSTALL virt/lib/irqbypass.ko DEPMOD 5.2.9-plamo64
/lib/
$ find /lib/modules/5.2.9-plamo64 -type f -name "*ko.xz" | wc -l 5216
initrdイメージの作成とインストール
mkinitramfsコマンドで新しくインストールしたドライバ・
$ sudo mkinitramfs 5.2.9-plamo64 [sudo] kojima のパスワード: **** Creating initrd.img-5.2.9-plamo64... . ... done. $ ls -lh initrd.img-5.2.9-plamo64 rw-r--r-- 1 root root 20M 8月 27日 13:35 initrd.img-5.2.9-plamo64
新しく作成したカーネルイメージとinitrdイメージを/bootディレクトリに移します。x86_
$ ls -lh arch/x86/boot/bzImage -rw-r--r-- 1 kojima users 6.3M 8月 27日 11:42 arch/x86/boot/bzImage $ sudo cp arch/x86/boot/bzImage /boot/vmlinuz-5.2.9-plamo64 $ sudo cp initrd.img-5.2.9-plamo64 /boot $ ls /boot/*5.2.9* /boot/initrd.img-5.2.9-plamo64 /boot/vmlinuz-5.2.9-plamo64
grub.cfgの作成
grub-mkconfigコマンドで、
$ sudo grub-mkconfig -o new_grub.cfg [sudo] kojima のパスワード: **** Generating grub configuration file ... Linux イメージを見つけました: /boot/vmlinuz-5.2.9-plamo64 Found initrd image: /boot/initrd.img-5.2.9-plamo64 Linux イメージを見つけました: /boot/vmlinuz-4.19.35_plamo64 Found initrd image: /boot/initrd.img-4.19.35_plamo64 Adding boot menu entry for EFI firmware configuration 完了 $
grub-mkconfigは/boot/に用意した新しいカーネルとinitrdイメージを見つけ、
$ cat -n new_grub.cfg ... 115 echo 'Linux 5.2.9-plamo64 をロード中...' 116 linux /boot/vmlinuz-5.2.9-plamo64 root=UUID=f7fe5914-6986-4d89-9a2a-8ba152dbfacd ro net.ifnames=0 quiet 117 echo '初期 RAM ディスクをロード中...' 118 initrd /boot/initrd.img-5.2.9-plamo64 ...
新しい設定ファイル
$ sudo mount /dev/sda2 /boot/efi [sudo] kojima のパスワード: **** $ sudo mv /boot/efi/grub/grub.cfg{,.org} $ sudo mv new_grub.cfg /boot/efi/grub/grub.cfg $ ls -lh /boot/efi/grub ... -rwxr-xr-x 1 root root 9.5K 8月 27日 14:13 grub.cfg* -rwxr-xr-x 1 root root 9.1K 8月 23日 15:36 grub.cfg.org* ...
新しいカーネルでのブート
以上の手順で新しくビルド、
新しいカーネルが動作しているかはunameコマンドで確認できます。
$ uname -a Linux ryzen 5.2.9-plamo64 #1 SMP PREEMPT Tue Aug 27 11:05:28 JST 2019 x86_64 GNU/Linux
また、
$ dmesg | head [ 0.000000] Linux version 5.2.9-plamo64 (kojima@ryzen) (gcc version 9.1.0 (GCC)) #1 SMP PREEMPT Tue Aug 27 11:05:28 JST 2019 [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.2.9-plamo64 root=UUID=f7fe5914-6986-4d89-9a2a-8ba152dbfacd ro net.ifnames=0 quiet [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] Hygon HygonGenuine ...
これで新しいカーネルを起動できたので、
今回紹介したカーネルとinitrdを更新する手順は
しかしながらPlamo Linuxでは、
ご自身の環境が該当すると思われる方は、
なお、