Booting CLFS with qemu-system-riscv64
| Newsgroups | gmane.linux.lfs.support |
|---|---|
| Message-ID | <TYWPR01MB10630254E7A5D15BEFACCDB36AC452@TYWPR01MB10630.jpnprd01.prod.outlook.com> |
So I was working on cross compiling LFS from x86_64 to RISC-V these days, and everything seems to work out for me except when I was trying to boot the system with qemu-system-riscv64. This is the command I used to start QEMU: qemu-system-riscv64 -nographic -machine virt \ -drive if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd \ -drive if=pflash,unit=1,format=raw,file=/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd \ -drive file=/dev/loop0,format=raw where the UEFI firmware I used was installed direclty from the debian package qemu-efi-riscv64. Then I was stuck at the GRUB stage where GRUB was unable to load the kernel image like this: grub> boot script/lexer.c:336:lexer: token 288 text [boot] script/script.c:50:scripting: malloc 0x831e5de0 script/script.c:50:scripting: malloc 0x831e5da0 script/script.c:163:scripting: arglist script/script.c:50:scripting: malloc 0x831e5d40 script/lexer.c:336:lexer: token 259 text [ ] script/script.c:50:scripting: malloc 0x831e5ce0 script/script.c:50:scripting: malloc 0x831e5ca0 script/script.c:198:scripting: cmdline script/script.c:50:scripting: malloc 0x831e5c40 script/lexer.c:336:lexer: token 0 text [] script/script.c:50:scripting: malloc 0x831e5ec0 script/script.c:50:scripting: malloc 0x831e5c00 script/script.c:294:scripting: append command script/script.c:50:scripting: malloc 0x831e5bc0 kern/verifiers.c:212:verify: string: boot, type: 2 error: cannot load image. However, I can boot the system WITHOUT GRUB with the following command: qemu-system-riscv64 -nographic -machine virt -kernel /mnt/temp/boot/vmlinuz -append "root=/dev/vda ro console=ttyS0" -drive file=/dev/loop0p3,format=raw I think either the GRUB is broken or the UEFI firmware I used for QEMU is broken, or both are incompatible. I don't know if this is a common issue or I made some silly mistakes, could anyone please take a look if encounter similar issue? Thank you! BTW this is the command I used to configure GRUB: ./configure --prefix=$LFS/tools \ --build=$(build-aux/config.guess) \ --host=$(build-aux/config.guess) \ --sysconfdir=$LFS/etc \ --disable-efiemu \ --with-platform=efi \ --program-prefix=lfs- \ --target=$LFS_TGT \ --disable-werror the command I used to grub-install the disk: $LFS/tools/sbin/lfs-grub-install \ --target=riscv64-efi \ --efi-directory=/mnt/temp/boot/efi \ --boot-directory=/mnt/temp/boot \ --bootloader-id=GRUB \ --removable \ /dev/loop0 -- http://lists.linuxfromscratch.org/sympa/info/lfs-support Unsubscribe: See the above information page