
Ubuntu 21.10。
私は以下の文書に従ってカーネルを構築しています。https://help.ubuntu.com/community/Kernel/コンパイルそしてhttps://wiki.ubuntu.com/Kernel/BuildYourOwnKernel。
DEB_BUILD_OPTIONS=parallel=$(getconf _NPROCESSORS_ONLN) AUTOBUILD=1 NOEXTRAS=1 \
fakeroot debian/rules binary-arch
このコンパイル コマンドは同じ結果になります。
make --jobs=$(getconf _NPROCESSORS_ONLN) bindeb-pkg \
LOCALVERSION=-custom-$(git describe | tr '[:upper:]' '[:lower:]')
これにより、いくつかの.deb
パッケージが作成されます。
$ ls -hal ../*.deb
-rw-r--r-- 1 amedee amedee 8,2M feb 26 02:17 ../linux-headers-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
-rw-r--r-- 1 amedee amedee 70M feb 26 02:18 ../linux-image-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
-rw-r--r-- 1 amedee amedee 1,2M feb 26 02:17 ../linux-libc-dev_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
次のようにインストールします。
sudo dpkg --install \
../linux-headers-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb \
../linux-image-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
内容は次のようになります/boot
:
$ ls -hal /boot/*5.13*
-rw-r--r-- 1 root root 252K nov 5 10:21 /boot/config-5.13.0-22-generic
-rw-r--r-- 1 root root 251K feb 26 02:15 /boot/config-5.13.19-ubuntu-5.13.0-22.22
-rw-r--r-- 1 root root 40M feb 22 16:21 /boot/initrd.img-5.13.0-22-generic
-rw-r--r-- 1 root root 37M feb 26 02:20 /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
-rw------- 1 root root 5,7M nov 5 10:21 /boot/System.map-5.13.0-22-generic
-rw-r--r-- 1 root root 5,6M feb 26 02:15 /boot/System.map-5.13.19-ubuntu-5.13.0-22.22
-rw------- 1 root root 9,8M nov 5 13:51 /boot/vmlinuz-5.13.0-22-generic
-rw-r--r-- 1 root root 8,5M feb 26 02:15 /boot/vmlinuz-5.13.19-ubuntu-5.13.0-22.22
initramfs を更新します (厳密に言えば、すでに実行されているため必要ありませんが、念のため)。
$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
update-initramfs: Generating /boot/initrd.img-5.13.0-22-generic
次に実行しますupdate-grub
:
amedee@kerbol:~/repos/ubuntu-impish$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Adding boot menu entry for UEFI Firmware Settings
done
コンパイルしたカーネルは、5.13.19-ubuntu-5.13.0-22.22
では Grub メニューに追加されませんupdate-grub
。手動で追加できることはわかっていますが、タイプミスのリスクがあります。また、 を使用してバグの可能性を見つけようとしているため、多くのカーネルをコンパイルする必要がありますgit bisect
。トラブルシューティングしているカーネルの問題は、最近のメインライン カーネルでは発生せず、Ubuntu 21.10 カーネル (すべてではありません) でのみ発生するため、何かを学び、好奇心を満たすためだけにこれを行っています。
update-grub
ディレクトリからコンパイルしたカーネルを/boot
Grub メニューに追加するには、何をする必要がありますか?
答え1
次の 3 つのコマンドは、 のテキストに従って、の実行可能ビットをオフにし09_lowlatency
、 のビットをオンにすることで、この問題を解決します。10_linux
/etc/grub.d/README.lowlatency
# chmod -x /etc/grub.d/09_lowlatency
# chmod +x /etc/grub.d/10_linux
# update-grub
解決策は以下で見つかりましたhttps://askubuntu.com/a/1228269/149519。
期待どおりに動作することを確認するには:
$ ls -hal /boot ; echo ; sudo update-grub
total 107M
drwxr-xr-x 4 root root 4,0K feb 28 04:42 .
drwxr-xr-x 20 root root 4,0K feb 26 01:13 ..
-rw-r--r-- 1 root root 252K nov 5 10:21 config-5.13.0-22-generic
-rw-r--r-- 1 root root 251K feb 26 02:15 config-5.13.19-ubuntu-5.13.0-22.22
drwx------ 4 root root 4,0K jan 1 1970 efi
drwxr-xr-x 5 root root 4,0K feb 28 04:42 grub
lrwxrwxrwx 1 root root 28 feb 28 04:26 initrd.img -> initrd.img-5.13.0-22-generic
-rw-r--r-- 1 root root 40M feb 26 13:55 initrd.img-5.13.0-22-generic
-rw-r--r-- 1 root root 37M feb 26 13:54 initrd.img-5.13.19-ubuntu-5.13.0-22.22
-rw------- 1 root root 5,7M nov 5 10:21 System.map-5.13.0-22-generic
-rw-r--r-- 1 root root 5,6M feb 26 02:15 System.map-5.13.19-ubuntu-5.13.0-22.22
lrwxrwxrwx 1 root root 25 feb 28 04:27 vmlinuz -> vmlinuz-5.13.0-22-generic
-rw------- 1 root root 9,8M nov 5 13:51 vmlinuz-5.13.0-22-generic
-rw-r--r-- 1 root root 8,5M feb 26 02:15 vmlinuz-5.13.19-ubuntu-5.13.0-22.22
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.19-ubuntu-5.13.0-22.22
Found initrd image: /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Adding boot menu entry for UEFI Firmware Settings
done