Booting Linux from UEFI on QEMU for U540 board

Hi,

I am trying to boot Linux OS on QEMU for U540 board.
I have built EDK2 firmware for U540 board.
I am getting UEFI Shell prompt when I run qemu.
I would like to know how to boot the Linux directly from UEFI.
I have built vmlinux with initramfs statically linked.
Any help is appreciated.

Regards
Palanivel

Isn’t it covered here?

Hi Tommy,
Thanks for the link provided.
I followed the steps/commands given.

mkfs.msdos -C linux.iso 64000
sudo losetup /dev/loop20 linux.iso
sudo mount /dev/loop20 /mnt

sudo cp linux-riscv64.efi /mnt
sudo umount /mnt
sudo losetup -d /dev/loop20

Copy ramdisk and DTB into your clone of edk2-platforms

cp linux.iso edk2-platforms/Silicon/RISC-V/ProcessorPkg/Universal/EspRamdisk/linux.iso
cp U540.dtb edk2-platforms/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/U540.dtb

source edk2/edksetup.sh
make -C edk2/BaseTools clean
make -C edk2/BaseTools
source edk2/edksetup.sh BaseTools

build -a RISCV64 -p Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc -t GCC5
cp -v ./Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/U540.fd .

qemu-system-riscv64 -cpu sifive-u54 -machine sifive_u -bios U540.fd -m 4096 -nographic -smp cpus=5,maxcpus=5

On uefi shell:
embeddedramdisk 4f2f3d7b-35ef-411b-9d26-e76ecacbaf8b
map -r
fs0:
linux-riscv64.efi root=/dev/ram rootwait console=ttySIF0 earlycon

I am getting error when I run embeddedramdisk command on UEFI shell.

Shell> embeddedramdisk 4f2f3d7b-35ef-411b-9d26-e76ecacbaf8b
‘embeddedramdisk’ is not recognized as an internal or external command, operable program, or script file.
Shell> map -r
map: Status: Not Found
Shell>
Shell> fs0:
‘fs0:’ is not a valid mapping.

Downloaded EDK2 from the following repos:

Any patch needs to be applied?

any help on this issue?

This sounds like a question for QEMU and/or EDK2 support venues, not SiFive, given this is neither SiFive’s emulator nor SiFive’s firmware.

1 Like