I was able to cross compile binaries for RISCV ie., for Andes tech,
I have kernel Image file, fw_dynamic.elf and u-boot.img and initramfs.devnodes files.
I followed the instruction provided by Andestech to get these binaries.
Steps I followed :
-
I cross compile opensbl and was able to generate fw-dynamic.elf and .bin in path ~opensbi/build/platform/andes/ae350/firmware/
-
Compiled Rootfs (inc busybox) and generated initramfs.devnodes file at ~/rootfs/disk/dev/ , There was a .sh script, I just had to execute that to generate this.
-
Edit .config in linux path with
CONFIG_INITRAMFS_SOURCE="~/rootfs/disk/dev/initramfs.devnodes"
and Build linux by make. This gave me Image.gz and Image files in path ~/linux5.4/arch/riscv/boot/
-
Compiled u-boot by copying fw_dynamic.* files and linux Image files into u-boot path and then by make ae350_rv64_fastboot_defconfig & make ARCH_FLAGS=”-march=rv64v5″. This gave me u-boot.img
-
Now trying to use these files to boot using QEMU. Installed Qemu using text
When I execute below command:
$ ./qemu-system-riscv64 -nographic -M andes_ae350 -cpu andes-ax45 -m 2G
-kernel ~/linux-5.4/arch/riscv/boot/Image
-bios ~/opensbi/build/platform/andes/ae350/firmware/fw_dynamic.elf
-initrd ~/rootfs/disk/dev/initramfs.devnodes
-append "root=/dev/vda rw console=ttyS0"
Not sure if the root device name is /dev/vda, correct me otherwise.
I’m getting below error :
[ 0.223322] Segment Routing with IPv6
[ 0.224621] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 0.227011] NET: Registered protocol family 17
[ 0.227576] NET: Registered protocol family 15
[ 0.231335] ALSA device list:
[ 0.231823] No soundcards found.
[ 0.232985] Warning: unable to open an initial console.
[ 0.234276] Failed to create /dev/root: -2
[ 0.234868] VFS: Cannot open root device "vda" or unknown-block(0,0): error -2
[ 0.234994] Please append a correct "root=" boot option; here are the available partitions:
[ 0.235251] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 0.235527] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.220-21054-gf1d0d3f65278 #4
[ 0.235702] Call Trace:
[ 0.236096] [<ffffffe00003537c>] walk_stackframe+0x0/0xa8
[ 0.236217] [<ffffffe00049e910>] show_stack+0x30/0x3c
[ 0.236302] [<ffffffe0004a44ec>] dump_stack+0x6c/0x88
[ 0.236385] [<ffffffe00049ebf8>] panic+0xe8/0x290
[ 0.236531] [<ffffffe0000020bc>] 0xffffffe0000020bc
[ 0.236612] [<ffffffe000002208>] 0xffffffe000002208
[ 0.236691] [<ffffffe000002354>] 0xffffffe000002354
[ 0.236772] [<ffffffe000001cfc>] 0xffffffe000001cfc
[ 0.236857] [<ffffffe0004a46cc>] kernel_init+0x14/0xdc
[ 0.236941] [<ffffffe000033e46>] ret_from_exception+0x0/0xc
[ 0.237382] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
I was expecting linux to boot from qemu.
Can someone help me out here, been stuck for a while and was trying the informartion that i found online aswell but of no progress.
Thanks in advance. Any pointers would be help me learn.