QEMUでカスタムビルドカーネル(変更されたkconfigカーネル)を起動できません。

QEMUでカスタムビルドカーネル(変更されたkconfigカーネル)を起動できません。

defconfigでカーネルを構築し、QEMUで起動しましたが、うまくいきます。ただし、QEMUでカスタムカーネルを実行しようとすると、いくつかのエラーが発生します。

[    1.039137] /dev/root: Can't open blockdev
[    1.039498] VFS: Cannot open root device "UUID=64ca6276-cee4-4339-9b83-3867a5c50a6e" or unknown-block(0,0): error -6
[    1.040393] Please append a correct "root=" boot option; here are the available partitions:
[    1.041109] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.041933] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.19-zos-v4 #6.1.19
[    1.042523] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[    1.043227] Call Trace:
[    1.043449]  <TASK>
[    1.043637]  dump_stack_lvl+0x34/0x48
[    1.043961]  panic+0x102/0x274
[    1.044234]  mount_block_root+0x15e/0x1f8
[    1.044582]  prepare_namespace+0x136/0x165
[    1.044933]  kernel_init_freeable+0x1e9/0x1f4
[    1.045309]  ? rest_init+0xc0/0xc0
[    1.045603]  kernel_init+0x11/0x120
[    1.045976]  ret_from_fork+0x22/0x30
[    1.046288]  </TASK>
[    1.046610] Kernel Offset: 0x1ca00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[    1.047579] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

最初はカーネル構成の問題があると思いましたが、必要なファイルシステムがアクティブで、私が実行したQEMUコマンドがdefconfigビルドカーネルと完全に機能していたため、問題ではないと判断しました。

QEMUコマンド(defconfigおよびカスタムカーネルの実行に使用されます):

このコマンドはdefconfigカーネルを正しく起動しますが、カスタムカーネルでは機能しません。

sudo qemu-system-x86_64 -enable-kvm -m 1024 -kernel /home/motti/Downloads/kernel-6.1.19/boot/vmlinuz-6.1.19 -drive file=/home/motti/Documents/bullseye.img,format=raw -append "root=/dev/sda console=ttyS0" -nographic

そのため、mkinitramfsを使用してinitrdファイルを生成し、それをQEMUコマンドに追加してクロスチェックを試みて確認しました。

sudo qemu-system-x86_64 -enable-kvm -m 1024 -kernel /home/motti/Downloads/kernel-6.1.19/boot/vmlinuz-6.1.19-zos-v4 -initrd /home/motti/Downloads/kernel-6.1.19/boot/initrd.img-6.1.19 -drive file=/home/motti/Documents/bullseye.img,format=raw -append "root=UUID=64ca6276-cee4-4339-9b83-3867a5c50a6e console=ttyS0" -nographic

ルートパラメータにはBullseye.imgに対応するUUIDがあり(最初はUUIDの代わりに/ dev / sdaを使用してみましたが動作しませんでした)、-initrdフラグにはmkinitramfsで生成されたinitrdファイルがあります。

起動時に次のエラーが発生します。

[    1.179948] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.181050] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.181853] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.182942] cfg80211: failed to load regulatory.db
[    1.184226] Freeing unused kernel image (initmem) memory: 1400K
[    1.187600] Write protecting the kernel read-only data: 22528k
[    1.189014] Freeing unused kernel image (text/rodata gap) memory: 2044K
[    1.189640] Freeing unused kernel image (rodata/data gap) memory: 44K
[    1.227933] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    1.228515] x86/mm: Checking user space page tables
[    1.264742] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    1.265336] Run /init as init process
Loading, please wait...
Starting version 249.11-0ubuntu3.7
[    1.413971] tsc: Refined TSC clocksource calibration: 2591.510 MHz
[    1.415249] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x255ae81315d, max_idle_ns: 440795291724 ns
[    1.418906] clocksource: Switched to clocksource tsc
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
[    1.767632] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ... done.
done.
Gave up waiting for root file system device.  Common problems:
 - Boot args (cat /proc/cmdline)
   - Check rootdelay= (did the system wait long enough?)
 - Missing modules (cat /proc/modules; ls /dev)
ALERT!  UUID=64ca6276-cee4-4339-9b83-3867a5c50a6e does not exist.  Dropping to a shell!


BusyBox v1.30.1 (Ubuntu 1:1.30.1-7ubuntu3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) 

この問題を解決するのに役立ちますか?

ベストアンサー1

おすすめ記事