|
From: | ckim |
Subject: | RE: end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1, 0) while booting linux on qemu |
Date: | Fri, 19 Feb 2021 19:28:10 +0900 |
Hello all, I figured out what was wrong in this case. I found several lines above this error message, there was another error saying something like it doesn’t have ram block device. So I checked the kernel configuration and found BLK_DEV_RAM was set to =n. Using menucnofig, under device drivers -> block devices, I changed RAM block device support(CONFIG_BLK_DEV_RAM) to =y and added associated configs (Default number of RAM disks (CONFIG_BLK_DEV_RAM_COUNT) to 1, and Default RAM disk size (kbytes) (CONFIG_BLK_DEV_SIZE) to 131072. (=128MB). I had to set the size big because I made ‘myinitrd.img’ bigger than 64MB. (unnecesarrily). After this change, I built the kernel and ran as before, ../build/aarch64-softmmu/qemu-system-aarch64 -M virt -cpu cortex-a72 -kernel ../../../LinuxDevDrv/linux-5.4.21/arch/arm64/boot/Image -initrd testinitrd/myinitrd.img --append "root=/dev/ram init=/init nokaslr" -m 2048M -nographic And saw the right result. Hope this helps someone later. [ 3.886104] uart-pl011 9000000.pl011: no DMA platform data [ 3.904219] RAMDISK: ext2 filesystem found at block 0 [ 3.906344] RAMDISK: Loading 65536KiB [1 disk] into ram disk... / [ 4.496400] / [ 5.114023] / [ 5.731097] / [ 6.349303] / [ 6.966083] / [ 7.583881] / [ 8.202495] / [ 8.823923] done. [ 11.530393] EXT4-fs (ram0): mounting ext3 file system using the ext4 subsystem [ 11.629543] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null) [ 11.631033] VFS: Mounted root (ext3 filesystem) readonly on device 1:0. [ 11.651897] devtmpfs: mounted [ 11.759683] Freeing unused kernel memory: 5120K [ 11.768919] Run /init as init process Hello Hello Hello Hello Hello Hello Hello Hello Thanks! Chan Kim From: ckim@etri.re.kr <ckim@etri.re.kr> Hello, I have found a good reference today (https://ibug.io/blog/2019/04/os-lab-1/ ) which shows how to build kernel and run it on qemu. I followed it (but with aarch64-none-elf- for kernel build and aarch64-linux-gcc- for fake init process build) including making the example myinitrd.img file. Myinitrd.img is a ramdisk image containing fake init program which repeatedly prints “Hello” every 1 second.. And myinitrd.img also contains device files that were made by these commands ( given inside the mounted image ) mkdir dev sudo mknod dev/ram b 1 0 sudo mknod dev/console c 5 1 and when I tried qemu-system-aarch64 -M virt -cpu cortex-a72 -kernel arch/arm64/boot/Image -initrd myinitrd.img --append "root=/dev/ram init=/init" -m 2048M -nographic It started booting but at the end failed to mount myinitrd.img on ram device. …. [ 3.010354] Kernel Offset: 0x2d87d6c00000 from 0xffff800010000000 [ 3.010844] PHYS_OFFSET: 0xfffff9ce00000000 [ 3.011668] CPU features: 0x0002,20806000 [ 3.012076] Memory Limit: none [ 3.013702] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) ]--- Could anyone tell me what can be wrong? (I tried changing ram device number and file name in vain). Thanks! Chan Kim |
[Prev in Thread] | Current Thread | [Next in Thread] |