目标:从 USB 上的工作安装中使用 dd 创建的 .img 运行 Batorcera。btc.img 是我电脑上存储的文件,我想使用 Grub 启动操作系统。
我已尝试过这两个 Grub 条目,但都出现相同的错误。
error: unknown filesystem.
error: you need to load the kernel first
这是 Grub 菜单项。
menuentry "btc.img" {
insmod ext2
set isofile="/home/lex/share/isos/btc.img"
loopback loop (hd0,msdos5)$isofile
linux (loop)/vmlinuz label=BATOCERA console=tty3 quiet loglevel=0 vt.global_cursor_default=0 mitigations=off
initrd (loop)/initrd.img
}
menuentry "btc.img" {
insmod ext2
set isofile="/home/lex/share/isos/btc.img"
loopback loop (hd0,5)$isofile
linux (loop)/boot/linux label=BATOCERA console=tty3 quiet loglevel=0 vt.global_cursor_default=0 mitigations=off
initrd (loop)/boot/initrd.gz
}
收集的信息:
fdisk -l btc.img
Disk btc.img: 14.65 GiB, 15728640000 bytes, 30720000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1CD01666-ACAC-44F8-8AD2-CE446E954FE2
Device Start End Sectors Size Type
btc.img1 34 14680097 14680064 7G Microsoft basic data
btc.img2 14680098 30719966 16039869 7.6G Linux filesystem
kpartx-l batocera.img
loop0p1 : 0 14680064 /dev/loop0 34
loop0p2 : 0 16039869 /dev/loop0 14680098
这是 Grub 所认为的文件系统的照片。 https://mo-de.net/d/grub.JPG
parted /home/lex/share/isos/btc.img UNIT b 打印
Model: (file)
Disk /home/lex/share/isos/btc.img: 15728640000B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17408B 7516210175B 7516192768B fat32 vfat legacy_boot, msftdata
2 7516210176B 15728623103B 8212412928B ext4 userdata