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)
이 문제를 해결하는 데 도움을 주실 수 있나요?