After building QEMU, Linux, Busybox, I ran the following command to boot QEMU RISC-V with Ubuntu.
$ sudo qemu-system-riscv64 -nographic -machine virt \
-kernel linux/arch/riscv/boot/Image -append "root=/dev/vda ro console=ttyS0" \
-drive file=busybox/busybox,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0
But I faced the following warnings and see no other messages.
qemu-system-riscv64: warning: No -bios option specified. Not loading a firmware.
qemu-system-riscv64: warning: This default will change in a future QEMU release. Please use the -bios option to avoid breakages when this happens.
qemu-system-riscv64: warning: See QEMU's deprecation documentation for details.
$ sudo qemu-system-riscv64 -nographic -machine virt \
-kernel linux/arch/riscv/boot/Image -append "root=/dev/vda ro console=ttyS0" \
-drive file=busybox/busybox,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 -bios default
OpenSBI v0.6
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs : 8
Current Hart : 0
Firmware Base : 0x80000000
Firmware Size : 120 KB
Runtime SBI Version : 0.2
MIDELEG : 0x0000000000000222
MEDELEG : 0x000000000000b109
PMP0 : 0x0000000080000000-0x000000008001ffff (A)
PMP1 : 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 5.4.0 (takahiro@takahiro-VirtualBox) (gcc version 10.1.0 (GCC)) #1 SMP Tue Sep 1 10:34:30 PDT 2020
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] software IO TLB: mapped [mem 0x83e3a000-0x87e3a000] (64MB)
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] percpu: Embedded 17 pages/cpu s30680 r8192 d30760 u69632
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 31815
[ 0.000000] Kernel command line: root=/dev/vda ro console=ttyS0
[ 0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 0.000000] Sorting __ex_table...
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 51968K/129024K available (6166K kernel code, 387K rwdata, 1962K rodata, 213K init, 305K bss, 77056K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] plic: mapped 53 interrupts with 1 handlers for 2 contexts.
[ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000125] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.005020] Console: colour dummy device 80x25
[ 0.010186] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[ 0.010365] pid_max: default: 32768 minimum: 301
[ 0.011845] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.011882] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.050872] rcu: Hierarchical SRCU implementation.
[ 0.053564] smp: Bringing up secondary CPUs ...
[ 0.053647] smp: Brought up 1 node, 1 CPU
[ 0.066191] devtmpfs: initialized
[ 0.074566] random: get_random_u32 called from bucket_table_alloc.isra.0+0x4e/0x154 with crng_init=0
[ 0.077193] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.077550] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.082457] NET: Registered protocol family 16
[ 0.145915] vgaarb: loaded
[ 0.147398] SCSI subsystem initialized
[ 0.149305] usbcore: registered new interface driver usbfs
[ 0.149656] usbcore: registered new interface driver hub
[ 0.149818] usbcore: registered new device driver usb
[ 0.162399] clocksource: Switched to clocksource riscv_clocksource
[ 0.188781] NET: Registered protocol family 2
[ 0.196592] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.196850] TCP established hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.197156] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
[ 0.197395] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.200620] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.201112] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.203875] NET: Registered protocol family 1
[ 0.208520] RPC: Registered named UNIX socket transport module.
[ 0.208629] RPC: Registered udp transport module.
[ 0.208658] RPC: Registered tcp transport module.
[ 0.208684] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.208925] PCI: CLS 0 bytes, default 64
[ 0.220011] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[ 0.237291] NFS: Registering the id_resolver key type
[ 0.238422] Key type id_resolver registered
[ 0.238471] Key type id_legacy registered
[ 0.238607] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.239371] 9p: Installing v9fs 9p2000 file system support
[ 0.241016] NET: Registered protocol family 38
[ 0.241576] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.241747] io scheduler mq-deadline registered
[ 0.242013] io scheduler kyber registered
[ 0.245290] pci-host-generic 30000000.pci: host bridge /soc/pci@30000000 ranges:
[ 0.246223] pci-host-generic 30000000.pci: IO 0x03000000..0x0300ffff -> 0x00000000
[ 0.247150] pci-host-generic 30000000.pci: MEM 0x40000000..0x7fffffff -> 0x40000000
[ 0.250176] pci-host-generic 30000000.pci: ECAM at [mem 0x30000000-0x3fffffff] for [bus 00-ff]
[ 0.251579] pci-host-generic 30000000.pci: PCI host bridge to bus 0000:00
[ 0.251902] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.252057] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
[ 0.252077] pci_bus 0000:00: root bus resource [mem 0x40000000-0x7fffffff]
[ 0.253324] pci 0000:00:00.0: [1b36:0008] type 00 class 0x060000
[ 0.325890] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.335978] printk: console [ttyS0] disabled
[ 0.337057] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 10, base_baud = 230400) is a 16550A
[ 0.474052] printk: console [ttyS0] enabled
[ 0.477304] [drm] radeon kernel modesetting enabled.
[ 0.522895] loop: module loaded
[ 0.553166] virtio_blk virtio0: [vda] 1869 512-byte logical blocks (957 kB/935 KiB)
[ 0.628744] libphy: Fixed MDIO Bus: probed
[ 0.632066] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[ 0.633691] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[ 0.637151] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.641902] ehci-pci: EHCI PCI platform driver
[ 0.646206] ehci-platform: EHCI generic platform driver
[ 0.647905] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.649146] ohci-pci: OHCI PCI platform driver
[ 0.652005] ohci-platform: OHCI generic platform driver
[ 0.654601] usbcore: registered new interface driver uas
[ 0.659067] usbcore: registered new interface driver usb-storage
[ 0.662377] mousedev: PS/2 mouse device common for all mice
[ 0.667578] usbcore: registered new interface driver usbhid
[ 0.669186] usbhid: USB HID core driver
[ 0.680722] NET: Registered protocol family 10
[ 0.695196] Segment Routing with IPv6
[ 0.697284] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 0.714403] NET: Registered protocol family 17
[ 0.717662] 9pnet: Installing 9P2000 support
[ 0.730306] Key type dns_resolver registered
[ 0.791312] List of all partitions:
[ 0.792612] fe00 934 vda
[ 0.792667] driver: virtio_blk
[ 0.794799] No filesystem could mount root, tried:
[ 0.794817] ext3
[ 0.804603] ext2
[ 0.805518] ext4
[ 0.806190] vfat
[ 0.806785] msdos
[ 0.807208]
[ 0.808590] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,0)
[ 0.814049] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.0 #1
[ 0.815836] Call Trace:
[ 0.816993] [<ffffffe000037ac4>] walk_stackframe+0x0/0xa6
[ 0.818928] [<ffffffe000037c3a>] show_stack+0x2a/0x34
[ 0.820095] [<ffffffe000621ab6>] dump_stack+0x6e/0x88
[ 0.820438] [<ffffffe00003cb86>] panic+0xdc/0x246
[ 0.824519] [<ffffffe000000ff4>] mount_block_root+0x1fe/0x218
[ 0.825814] [<ffffffe00000111c>] mount_root+0x10e/0x124
[ 0.826750] [<ffffffe000001244>] prepare_namespace+0x112/0x15c
[ 0.828045] [<ffffffe000000c10>] kernel_init_freeable+0x188/0x1a4
[ 0.832528] [<ffffffe000636392>] kernel_init+0x12/0xf0
[ 0.833898] [<ffffffe000036818>] ret_from_exception+0x0/0xc
[ 0.836435] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,0) ]---
Do I need to pass a certain bios file to QEMU? Or am I missing something? Does anyone succeeded in booting Ubuntu/Debian on QEMU RISC-V with the guideline?