linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: Kernel Not booting on RISC-V QEMU
       [not found] <CA+NPzNJGc+oUYVYMA1Ca0vG+4H7Q4z+nJZ-te9naq0sU=D7r1Q@mail.gmail.com>
@ 2021-03-23 14:29 ` Michael Opdenacker
  2021-03-23 20:50 ` Michael Opdenacker
  1 sibling, 0 replies; 2+ messages in thread
From: Michael Opdenacker @ 2021-03-23 14:29 UTC (permalink / raw)
  To: Pratik farkase; +Cc: michael.opdenacker, linux-riscv

Hi Pratik,

On 3/23/21 3:21 PM, Pratik farkase wrote:
> Hi Michael, i was referring your session on "Embedded Linux from
> scratch in 45 minutes (on RISC-V)" pdf and session recording. I have
> followed all your steps to build kernel and opensbi. Through opensbi i
> was able to generate "fw_payload.elf" for generic platform. But when i
> try to run qemu using the given parameters in pdf i am stuck at the
> boot as seen in the attached screenshot. The opensbi boots up
> correctly and remains stuck there but kernel does not boot. My QEMU
> parameters are "qemu-system-riscv64 -nographic -machine virt -m 128M
> kernel ../opensbi/build/platform/generic/firmware/fw_payload.elf 
> -append "console=ttyS0". It is stuck at this and kernel would not boot
> at all :


Thanks for testing my instructions.

I believe you forgot the "-" character before the "kernel" option. Could
you try again?

Cheers,

Michael.

-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Kernel Not booting on RISC-V QEMU
       [not found] <CA+NPzNJGc+oUYVYMA1Ca0vG+4H7Q4z+nJZ-te9naq0sU=D7r1Q@mail.gmail.com>
  2021-03-23 14:29 ` Kernel Not booting on RISC-V QEMU Michael Opdenacker
@ 2021-03-23 20:50 ` Michael Opdenacker
  1 sibling, 0 replies; 2+ messages in thread
From: Michael Opdenacker @ 2021-03-23 20:50 UTC (permalink / raw)
  To: Pratik farkase; +Cc: linux-riscv

Hi Pratik,

On 3/23/21 3:21 PM, Pratik farkase wrote:
> Hi Michael, i was referring your session on "Embedded Linux from
> scratch in 45 minutes (on RISC-V)" pdf and session recording. I have
> followed all your steps to build kernel and opensbi. Through opensbi i
> was able to generate "fw_payload.elf" for generic platform. But when i
> try to run qemu using the given parameters in pdf i am stuck at the
> boot as seen in the attached screenshot. The opensbi boots up
> correctly and remains stuck there but kernel does not boot. My QEMU
> parameters are "qemu-system-riscv64 -nographic -machine virt -m 128M
> kernel ../opensbi/build/platform/generic/firmware/fw_payload.elf 
> -append "console=ttyS0". It is stuck at this and kernel would not boot
> at all : 
>
> OpenSBI v0.9-12-g50d4fde
>    ____                    _____ ____ _____
>   / __ \                  / ____|  _ \_   _|
>  | |  | |_ __   ___ _ __ | (___ | |_) || |
>  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
>  | |__| | |_) |  __/ | | |____) | |_) || |_
>   \____/| .__/ \___|_| |_|_____/|____/_____|
>         | |
>         |_|
>
> Platform Name             : riscv-virtio,qemu
> Platform Features         : timer,mfdeleg
> Platform HART Count       : 1
> Firmware Base             : 0x80000000
> Firmware Size             : 100 KB
> Runtime SBI Version       : 0.3
>
> Domain0 Name              : root
> Domain0 Boot HART         : 0
> Domain0 HARTs             : 0*
> Domain0 Region00          : 0x0000000080000000-0x000000008001ffff ()
> Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
> Domain0 Next Address      : 0x0000000080200000
> Domain0 Next Arg1         : 0x0000000082200000
> Domain0 Next Mode         : S-mode
> Domain0 SysReset          : yes
>
> Boot HART ID              : 0
> Boot HART Domain          : root
> Boot HART ISA             : rv64imafdcsu
> Boot HART Features        : scounteren,mcounteren
> Boot HART PMP Count       : 16
> Boot HART PMP Granularity : 4
> Boot HART PMP Address Bits: 54
> Boot HART MHPM Count      : 0
> Boot HART MHPM Count      : 0
> Boot HART MIDELEG         : 0x0000000000000222
> Boot HART MEDELEG         : 0x000000000000b109


Actually, on my side, the below command works just fine:

qemu-system-riscv64 -nographic -machine virt -m 128M -kernel
opensbi/build/platform/generic/firmware/fw_payload.elf --append
"console=ttyS0"

I'm building fw_payload.elf as follows:

cd opensbi
make PLATFORM=generic FW_PAYLOAD_PATH=../linux-5.11-rc3/arch/riscv/boot/Image
cd ..

I'm using Linux 5.11-rc3, and I tested with opensbi v0.8, v0.9 and
latest master. Here's what I'm getting (see below). The failure at the
end is expected because I'm not providing any root filesystem at this
stage...

What's your QEMU version? Could you share a download link to your
fw_payload.elf file so that I could test it too? Are you using the
kernel Image file to generate the fw_payload.elf file?

By the way, testing this allowed me to find an issue in my FOSDEM slides
(https://bootlin.com/pub/conferences/2021/fosdem/opdenacker-embedded-linux-45minutes-riscv/opdenacker-embedded-linux-45minutes-riscv.pdf).
With QEMU, you cannot use "-append" with "-bios".

I hope this helps,

Michael.

---

mike@build1:~/riscv$ qemu-system-riscv64 -nographic -machine virt -m 128M -kernel opensbi/build/platform/generic/firmware/fw_payload.elf --append "console=ttyS0"
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.

OpenSBI v0.9-17-gbfc85c7
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : riscv-virtio,qemu
Platform Features         : timer,mfdeleg
Platform HART Count       : 1
Firmware Base             : 0x80000000
Firmware Size             : 100 KB
Runtime SBI Version       : 0.3

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*
Domain0 Region00          : 0x0000000080000000-0x000000008001ffff ()
Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000080200000
Domain0 Next Arg1         : 0x0000000082200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART ISA             : rv64imafdcsu
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109
[    0.000000] Linux version 5.11.0-rc3 (mike@build1) (riscv64-linux-gcc.br_real (Buildroot 2020.11.1) 9.3.0, GNU ld (GNU Binutils) 2.34) #1 SMP Thu Jan 14 10:05:48 CET 2021
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] efi: UEFI not found.
[    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] SBI specification v0.3 detected
[    0.000000] SBI implementation ID=0x1 Version=0x9
[    0.000000] SBI v0.2 TIME extension detected
[    0.000000] SBI v0.2 IPI extension detected
[    0.000000] SBI v0.2 RFENCE extension detected
[    0.000000] software IO TLB: mapped [mem 0x0000000083e3a000-0x0000000087e3a000] (64MB)
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] riscv: ISA extensions acdfimsu
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 17 pages/cpu s32488 r8192 d28952 u69632
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 31815
[    0.000000] Kernel command line: 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: 41368K/129024K available (6902K kernel code, 4904K rwdata, 4096K rodata, 2147K init, 305K bss, 87656K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]       fixmap : 0xffffffcefee00000 - 0xffffffceff000000   (2048 kB)
[    0.000000]       pci io : 0xffffffceff000000 - 0xffffffcf00000000   (  16 MB)
[    0.000000]      vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff   (4095 MB)
[    0.000000]      vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff   (65535 MB)
[    0.000000]       lowmem : 0xffffffe000000000 - 0xffffffe007e00000   ( 126 MB)
[    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 debug extended QS entry/exit.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    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: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: interrupt-controller@c000000: mapped 53 interrupts with 1 handlers for 2 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x3ae/0x580 with crng_init=0
[    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.000074] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[    0.002327] Console: colour dummy device 80x25
[    0.003674] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[    0.003822] pid_max: default: 32768 minimum: 301
[    0.004539] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.004598] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.025353] rcu: Hierarchical SRCU implementation.
[    0.027084] EFI services will not be available.
[    0.029053] smp: Bringing up secondary CPUs ...
[    0.029146] smp: Brought up 1 node, 1 CPU
[    0.035315] devtmpfs: initialized
[    0.040358] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.040574] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.043919] NET: Registered protocol family 16
[    0.082804] vgaarb: loaded
[    0.083674] SCSI subsystem initialized
[    0.085658] usbcore: registered new interface driver usbfs
[    0.085900] usbcore: registered new interface driver hub
[    0.086058] usbcore: registered new device driver usb
[    0.093450] clocksource: Switched to clocksource riscv_clocksource
[    0.113733] NET: Registered protocol family 2
[    0.116623] tcp_listen_portaddr_hash hash table entries: 128 (order: 0, 5120 bytes, linear)
[    0.116737] TCP established hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.116898] TCP bind hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.117203] TCP: Hash tables configured (established 1024 bind 1024)
[    0.117967] UDP hash table entries: 256 (order: 2, 24576 bytes, linear)
[    0.118191] UDP-Lite hash table entries: 256 (order: 2, 24576 bytes, linear)
[    0.119266] NET: Registered protocol family 1
[    0.122268] RPC: Registered named UNIX socket transport module.
[    0.122332] RPC: Registered udp transport module.
[    0.122370] RPC: Registered tcp transport module.
[    0.122405] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.122505] PCI: CLS 0 bytes, default 64
[    0.125952] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[    0.135298] NFS: Registering the id_resolver key type
[    0.135842] Key type id_resolver registered
[    0.135900] Key type id_legacy registered
[    0.136176] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.136712] 9p: Installing v9fs 9p2000 file system support
[    0.137845] NET: Registered protocol family 38
[    0.138066] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.138173] io scheduler mq-deadline registered
[    0.138302] io scheduler kyber registered
[    0.144584] pci-host-generic 30000000.pci: host bridge /soc/pci@30000000 ranges:
[    0.145341] pci-host-generic 30000000.pci:       IO 0x0003000000..0x000300ffff -> 0x0000000000
[    0.145650] pci-host-generic 30000000.pci:      MEM 0x0040000000..0x007fffffff -> 0x0040000000
[    0.146836] pci-host-generic 30000000.pci: ECAM at [mem 0x30000000-0x3fffffff] for [bus 00-ff]
[    0.147548] pci-host-generic 30000000.pci: PCI host bridge to bus 0000:00
[    0.147703] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.147791] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    0.147844] pci_bus 0000:00: root bus resource [mem 0x40000000-0x7fffffff]
[    0.148683] pci 0000:00:00.0: [1b36:0008] type 00 class 0x060000
[    0.256457] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.261570] printk: console [ttyS0] disabled
[    0.262176] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 230400) is a 16550A
[    0.277344] printk: console [ttyS0] enabled
[    0.278994] [drm] radeon kernel modesetting enabled.
[    0.291461] loop: module loaded
[    0.293662] libphy: Fixed MDIO Bus: probed
[    0.294683] e1000e: Intel(R) PRO/1000 Network Driver
[    0.294849] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.295249] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.295471] ehci-pci: EHCI PCI platform driver
[    0.295773] ehci-platform: EHCI generic platform driver
[    0.296053] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.296306] ohci-pci: OHCI PCI platform driver
[    0.296592] ohci-platform: OHCI generic platform driver
[    0.297760] usbcore: registered new interface driver uas
[    0.298072] usbcore: registered new interface driver usb-storage
[    0.298852] mousedev: PS/2 mouse device common for all mice
[    0.300163] usbcore: registered new interface driver usbhid
[    0.300351] usbhid: USB HID core driver
[    0.301765] NET: Registered protocol family 10
[    0.307283] Segment Routing with IPv6
[    0.307706] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.309953] NET: Registered protocol family 17
[    0.311017] 9pnet: Installing 9P2000 support
[    0.311411] Key type dns_resolver registered
[    0.311976] debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
[    0.320728] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.321251] Please append a correct "root=" boot option; here are the available partitions:
[    0.321650] DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify explicit textual name for "root=" boot option.
[    0.322076] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.322425] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.11.0-rc3 #1
[    0.322744] Call Trace:
[    0.322941] [<ffffffe000004614>] walk_stackframe+0x0/0xaa
[    0.323212] [<ffffffe0006aec96>] show_stack+0x32/0x3e
[    0.323421] [<ffffffe0006b14da>] dump_stack+0x74/0x8e
[    0.323601] [<ffffffe0006aee2c>] panic+0xfc/0x2b2
[    0.323761] [<ffffffe00080124c>] mount_block_root+0x1c6/0x262
[    0.323948] [<ffffffe0008013fc>] mount_root+0x114/0x13e
[    0.324106] [<ffffffe00080156a>] prepare_namespace+0x144/0x186
[    0.324273] [<ffffffe000800e22>] kernel_init_freeable+0x1ce/0x1ea
[    0.324445] [<ffffffe0006b8a3a>] kernel_init+0x12/0xf8
[    0.324598] [<ffffffe0000032be>] ret_from_exception+0x0/0xc
[    0.325098] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---


-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-23 20:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA+NPzNJGc+oUYVYMA1Ca0vG+4H7Q4z+nJZ-te9naq0sU=D7r1Q@mail.gmail.com>
2021-03-23 14:29 ` Kernel Not booting on RISC-V QEMU Michael Opdenacker
2021-03-23 20:50 ` Michael Opdenacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).