Re: Booting CLFS with qemu-system-riscv64

"NakanoMiku" ([email protected] via lfs-support Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.support
Message-ID <TYWPR01MB106306090311C379CA392BA95AC452@TYWPR01MB10630.jpnprd01.prod.outlook.com>
On 2024/10/15 15:10, Xi Ruoyao ([email protected] via lfs-support 
Mailing List) wrote:
> On Tue, 2024-10-15 at 14:17 +0800, NakanoMiku wrote:
>
> /* snip */
>
>> error: cannot load image.
> I can see two possibilities here:
>
> 1. The grub.cfg file is not correctly written.  I cannot verify because
> you didn't send the content of the file and the partitioning scheme of
> your virtual disk.
>
> [Personally I don't like a separate /boot and I don't use it in the
> recent years, but it's still how the book's grub.cfg is assuming.  If
> you don't have a separate /boot you'll need to use "linux /boot/vmlinuz-
> ..." instead of "linux /vmlinuz-...".]
>
> 2. You've copied a wrong kernel file.  On UEFI grub needs a kernel with
> EFI stub, i.e. the bootable image should be a PE executable:
>
> $ file /boot/vmlinuz-6.10.2
> /boot/vmlinuz-6.10.2: PE32+ executable (EFI application) Aarch64
> (stripped to external PDB), for MS Windows, 2 sections
>
> [This is a kernel for AArch64 instead of RISC-V, as I (or maybe the
> world) don't have an RISC-V UEFI board and I hate developing things
> solely depending on an emulator.]
>
> Instead of:
>
> $ file ~/git-repos/linux/vmlinux
> /home/xry111/git-repos/linux/vmlinux: ELF 64-bit LSB pie executable, ARM
> aarch64, version 1 (SYSV), statically linked,
> BuildID[sha1]=597d3d1ed221ac095c5a1539c19242fd537ddbf3, not stripped
>
>
I'm pasting my grub.cfg below(I commented out initrd since it reported a 
FDT update failure):

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod part_gpt
insmod ext2
set root=(hd0,2)

insmod efi_gop
insmod efi_uga
if loadfont /boot/grub/fonts/unicode.pf2; then
   terminal_output gfxterm
   fi

menuentry "GNU/Linux, Linux 6.10.5-lfs-12.2" {
   linux   /vmlinuz root=/dev/loop0p3 ro
   # initrd /initrd.img-no-kmods
   }

menuentry "Firmware Setup" {
   fwsetup
}


I had my kernel file in following format:

file /mnt/temp/boot/vmlinuz
/mnt/temp/boot/vmlinuz: PE32+ executable (EFI application) RISC-V 64-bit 
(stripped to external PDB), for MS Windows, 2 sections


These are my partitions:

/dev/loop0p3     38G   27G  9.5G  74% /mnt/temp
/dev/loop0p2    459M   51M  379M  12% /mnt/temp/boot
/dev/loop0p1     99M  997K   98M   1% /mnt/temp/boot/efi

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-support
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.