-
Notifications
You must be signed in to change notification settings - Fork 10
/
grub.conf
56 lines (53 loc) · 2.56 KB
/
grub.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
# If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.
# 将某个硬盘分区格式化成 fat32 (不要 exfat),然后解压 iso 文件到这个分区
# 同时 iso 文件也放到这个分区下,gentoo 会自动寻找到此分区并以此分区为 root
# 引导硬盘上的 gentoo.iso 文件
# 比如将 放到硬盘某个格式为 exfat 的分区的根目录下
# 则 1. 告知 grub iso 文件在哪
# 可以使用 ls (hd0,gpt4)/ tab 键 来补全,查看有哪些(hd0,及分区 及分区下的文件等
# loopback loop (hd0,gpt4)/gentoo.iso
# 2. 将 loop 指定为根目录,后面的/boot/gentoo 等文件就是以 root 为根
# set root=loop
#
# 3. 下面的命令 唯一要注意的是 iso-scan/filename 来告知 linux kernel 去哪找 iso 文件(但感觉 iso-scan/filename 似乎并没用)
# 其他的参数 可在虚拟机中从光驱引导 iso 时 进入 grub 界面后 按 e 进行查看
# linux /boot/gentoo dokeymap looptype=squashfs loop=/image.squashfs cdroot iso-scan/filename=/gentoo.iso
# initrd /boot/gentoo.igz
# 所以从硬盘中的 iso 文件进行引导 核心就 2 步,1是告知 grub iso 文件在哪,2是告知 kernal iso 文件在哪
menuentry 'gentoo livecd from disk partition' {
loopback loop (hd0,gpt6)/gentoo.iso
set root=loop
iso_path=/gentoo.iso
export iso_path
linux /boot/gentoo dokeymap looptype=squashfs loop=/image.squashfs cdroot iso-scan/filename=/gentoo.iso
initrd /boot/gentoo.igz
}
# https://www.system-rescue.org/ 提供的 iso 支持从硬盘加载
menuentry 'Systemrescue' {
loopback loop (hd0,gpt6)/s.iso
set root=loop
iso_path=/s.iso
export iso_path
configfile /boot/grub/loopback.cfg
}
menuentry 'Gentoo Demo' {
set root=(hd0,gpt1)
linux /boot/vmlinuz dolvm root=/dev/lvm/root
initrd /boot/initramfs
boot
}
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5cde0496-f611-432e-b5c6-f3f8f39aa804' {
load_video
insmod gzio
insmod part_gpt
insmod fat
search --no-floppy --fs-uuid --set=root 5F66-17ED
echo '加载 Linux 6.5.6-t2gentoo ...'
linux /vmlinuz-6.5.6-t2gentoo root=/dev/mapper/lvm-root ro intel_iommu=on iommu=pt pcie_ports=compat dolvm
echo '加载初始化内存盘...'
initrd /initramfs-6.5.6-t2gentoo.img
}