搭建测试环境
使用deepinLinux维护盘 :https://www.deepin.org/en/download/,选择下载deepin live
使用virtualbox安装deepin linux live,vmware貌似不支持EFI,开启后直接中断。
在virtualbox中新建虚拟机
名称:grub2
固定大小:2G(自己分配)
内存:1024M
创建完选择grub2,选择设置\系统\启用EFI
确定完运行虚拟机,iso选择深度维护光盘。
在选择菜单按
c进入grub shell
grub>
右边的
ctrl退出虚拟机对鼠标键盘的控制
使用grub shell
grub shell与Linux Shell类似,tab补全命令,help查看帮助。
查看win10磁盘分区情况
grub> ls
(hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) (hd1) (hd1,gpt2) (hd1,gpt1)
hd0为物理C盘,hd1为物理D盘。用DiskGenius可以查看分区内容。
(hd0,gpt1)为C盘第一分区:ESP分区
(hd0,gpt2)为C盘第二分区:MSR分区
(hd0,gpt3)为C盘第三分区:Primary分区
grub> set root=(hd0,gpt1)
grub> ls /
efi/
grub> chainloader /efi/linuxmint/grubx64.efi
用chainloader手动引导系统,Linux下为linux(旧版为kernel)
grub> insmod video
grub> halt
grub> reboot
安装模块,关机,开机。
grub manual https://www.gnu.org/software/grub/manual/grub/grub.html
grub配置文件
文件位置:/boot/grub/grub.cfg
一些实例
Linux Mint Cindy
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
menuentry "Start LMDE 3 Cinnamon 64-bit" {
set gfxpayload=keep
linux /live/vmlinuz boot=live live-config live-media-path=/live quiet splash --
initrd /live/initrd.lz
}
Ubuntu 18.04
menuentry "Try Ubuntu without installing" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
initrd /casper/initrd
}
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd
}
PhoenixOS
set timeout=5
set gfxmode=1024x768
#terminal_output gfxterm
set default=Windows
if [ -s /EFI/Boot/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ]; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set timeout=0
fi
menuentry 'Windows' {
search --file --no-floppy --set=root /EFI/Microsoft/Boot/bootmgfw.efi
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry "Phoenix OS" {
search --file --set=root /EFI/PhoenixOS/kernel
linux /EFI/PhoenixOS/kernel quiet root=/dev/ram0 androidboot.hardware=android_x86 SRC=/PhoenixOS vga=788
initrd /EFI/PhoenixOS/initrd.img
}
这篇博客介绍了如何在虚拟机中搭建测试环境,利用Linux维护盘创建虚拟机,并详细讲解了如何在Grub2 Shell中查看磁盘分区及手动引导系统。还提到了Grub2的配置文件位置,并给出了Linux Mint Cindy、Ubuntu 18.04及PhoenixOS的配置实例。
773

被折叠的 条评论
为什么被折叠?



