wintoflash 发表于 2021-1-31 16:08:47

NTloader: BIOS/UEFI 下用 GRUB4DOS 启动 VHD/WIM

本帖最后由 wintoflash 于 2023-6-19 20:30 编辑

适用范围:
BIOS, x64 UEFI, ia32 UEFI 均可使用。
支持 MBR 分区表主分区、GPT 分区表任意分区 (不支持 MBR 分区表逻辑分区)
支持 FAT, NTFS, exFAT 文件系统 (VHD 不能位于 FAT 分区,老版本 Windows VHD 只能位于 NTFS 分区)
文件路径最好是不带空格的英文字母/数字。带空格的话传递参数时用冒号":"代替空格。
命令行长度不得超过 511。
使用方法:
启动 Windows WIM/VHD
假设 WIM 或 VHD 位于 (hdx,y),路径为 /path/to/winpe.wim
title Boot Windows NT6+ PE
uuid (hdx,y)
kernel /ntloader uuid=%?_UUID% file=/path/to/winpe.wim
initrd /initrd.lz1
title Boot Windows NT6+ PE
uuid (hdx,y)
chainloader /ntloader initrd=/initrd.lz1 uuid=%?_UUID% file=/path/to/winpe.wim
启动 Windows 系统
假设系统文件夹位于 (hdx,y)
title Boot Windows NT6+ PE
uuid (hdx,y)
kernel /ntloader uuid=%?_UUID%
initrd /initrd.lz1
title Boot Windows NT6+ PE
uuid (hdx,y)
chainloader /ntloader initrd=/initrd.lz1 uuid=%?_UUID%
命令行选项:
uuid=%?_UUID%
指定 文件所在分区文件系统 UUID。
file=/xxx.vhd
指定 VHD / WIM 文件路径。空格用冒号 ":" 代替。
testmode=1
启用测试模式。
hires=1
强制使用最高分辨率。
pae=Enable|Disable|Default
配置 PAE。
nx=OptIn|OptOut|AlwaysOff|AlwaysOn
配置 DEP。
loadopt=XXX
设置 Windows 加载选项。
winload=/Windows/System32/winload.efi
指定 winload.exe/winload.efi 的路径。
sysroot=/Windows
指定 Windows 系统根目录。
quite
不显示调试信息。
pause
启动过程中暂停,以便记录调试信息。
下载:

源码:
https://github.com/grub4dos/ntloader (许可证:GPLv2+)
参考:
ipxe wimboot https://github.com/ipxe/wimboot
lznt1 压缩 https://github.com/you0708/lznt1
Linux/x86 Boot Protocol https://www.kernel.org/doc/html/latest/x86/boot.html
GRUB https://github.com/a1ive/grub

sairen139 发表于 2021-1-31 16:19:58

非常好,支持W大!

menhm 发表于 2021-1-31 16:22:21

正在找BIOS下用 GRUB4DOS 启动 WIM 。。。。。太好了。。。。

2011yaya2007777 发表于 2021-1-31 16:39:56

强大

oym2016 发表于 2021-1-31 16:57:18

1月27日版 在Grub2 中正常引导 WIM和VHDx
menuentry "Windows 10 PE ntloader"    --class recovery {
   probe -s a -u (hd0,gpt1)
   linuxefi /ntloader uuid=$a file=/Sources/boot.wim
   initrdefi /initrd.lz
}   
用今天的替换后 均引导失败
menuentry "Windows 10 PE ntloader"    --class recovery {
   probe -s a -u (hd0,gpt1)
   linuxefi /ntloader uuid=$a file=/Sources/boot.wim
   initrdefi /initrd.lz1
}   

wintoflash 发表于 2021-1-31 17:00:37

oym2016 发表于 2021-1-31 16:57
1月27日版 在Grub2 中正常引导 WIM和VHDx
menuentry "Windows 10 PE ntloader"    --class recovery {
...

grub2没必要用这个。直接用ntboot命令就行了。

liuzhaoyzz 发表于 2021-1-31 17:14:35

wintoflash 发表于 2021-1-31 17:00
grub2没必要用这个。直接用ntboot命令就行了。

      看意思现在是推荐采用kernel语句?与chainloader语句有没有区别?

acerken 发表于 2021-1-31 18:18:33

感谢分享,研究研究

wintoflash 发表于 2021-1-31 18:31:35

oym2016 发表于 2021-1-31 16:57
1月27日版 在Grub2 中正常引导 WIM和VHDx
menuentry "Windows 10 PE ntloader"    --class recovery {
...

重新上传了文件,应该修复了这个问题,请重新下载测试。

hilsonma 发表于 2021-1-31 19:11:24

liuzhaoyzz 发表于 2021-1-31 17:14
看意思现在是推荐采用kernel语句?与chainloader语句有没有区别?

我想是这样的:ntloader虽然叫loader,但其实是一个core.img,所以用kernel,如果这个core.img前面再加一个boot.img,那样才是用chainloader.

wintoflash 发表于 2021-1-31 19:17:04

本帖最后由 wintoflash 于 2021-1-31 19:18 编辑

liuzhaoyzz 发表于 2021-1-31 17:14
看意思现在是推荐采用kernel语句?与chainloader语句有没有区别?
它有两个入口,既可以把它当作linux内核,也可以把它当作efi应用程序。
正常玩法就是从前面的口进 (linuxefi),initrd 是由启动管理器加载好的。
非得从后面的口进(chainloader)也行,只不过需要把initrd的路径告诉它,让它自己加载 initrd。

linuxefi 的另一好处是同时支持 x64 EFI 和 ia32 EFI。

14928806 发表于 2021-1-31 19:35:10

感谢分享

叮叮咚咚 发表于 2021-1-31 19:43:39

wintoflash 发表于 2021-1-31 19:17
它有两个入口,既可以把它当作linux内核,也可以把它当作efi应用程序。
正常玩法就是从前面的口进 (linu ...

也就是说,使用linuxefi可以启动ia32 efi的Linux系统?32位Windows可以启动吗?

wintoflash 发表于 2021-1-31 20:14:17

叮叮咚咚 发表于 2021-1-31 19:43
也就是说,使用linuxefi可以启动ia32 efi的Linux系统?32位Windows可以启动吗?

不是

18958925900 发表于 2021-1-31 20:17:28

学习了。谢谢

liuzhaoyzz 发表于 2021-1-31 22:00:24

本帖最后由 liuzhaoyzz 于 2021-1-31 22:22 编辑

用刚才下载的ntloader两个文件,搭配2021-1-22日的g4e,kernel ntloader启动基于svbus启动的vhd-ramos失败啊。
title WIN7X64-SVBUS (/VHD/SX70211.vhd)-kernel ntloader-1
debug 3
find --ignore-floppies --ignore-cd /EFI/grub/ntloader | set x=
echo x=%x%
find --ignore-floppies --ignore-cd --set-root /VHD/SX70211.vhd
map --mem --top /VHD/SX70211.vhd (hd)
uuid (hd-1,0)
kernel %x%/EFI/grub/ntloader uuid=%?_UUID%
initrd %x%/EFI/grub/initrd.lz1
pause pause1


等我用手机上传截图

liuzhaoyzz 发表于 2021-1-31 22:21:00

本帖最后由 liuzhaoyzz 于 2021-1-31 22:22 编辑

我尝试直接启动vhd也失败,菜单如下,菜单有没有问题?
title WIN7X64-SVBUS (/VHD/SX70211.vhd)-kernel ntloader-3
debug 3
find --ignore-floppies --ignore-cd /EFI/grub/ntloader | set x=
echo x=%x%
find --ignore-floppies --ignore-cd --set-root /VHD/SX70211.vhd
uuid ()
kernel %x%/EFI/grub/ntloader uuid=%?_UUID% file=/VHD/SX70211.vhd
initrd %x%/EFI/grub/initrd.lz1
pause pause1


等我上传截图。

wintoflash 发表于 2021-2-1 09:01:20

liuzhaoyzz 发表于 2021-1-31 22:21
我尝试直接启动vhd也失败,菜单如下,菜单有没有问题?
title WIN7X64-SVBUS (/VHD/SX70211.vhd)-kernel n ...

GRUB2 下linuxefi 启动试试。

liuzhaoyzz 发表于 2021-2-1 09:57:37

本帖最后由 liuzhaoyzz 于 2021-2-1 09:59 编辑

wintoflash 发表于 2021-2-1 09:01
GRUB2 下linuxefi 启动试试。
刚才用uefi-grub2试了,结果一样。
uefi-grub2我只尝试了直接启动sx70211.vhd,没有尝试map --mem --rt这种,因为grub2好像是直接启动vd0的,能用probe -u (vd0,1) -s uuid获取仿真内存盘的uuid吗?我不知道。

menuentry "SX70211.vhd-svbus-ntloader" "/VHD/SX70211.vhd" {
search -n -s x -f /EFI/grub/ntloader
search --no-floppy --set --file $2
probe -u ($root) -s uuid
linuxefi ($x)/EFI/grub/ntloader uuid=$uuid file=/VHD/SX70211.vhd
initrdefi ($x)/EFI/grub/initrd.lz1
}

上面的菜单写的对吗?

liuzhaoyzz 发表于 2021-2-1 10:02:46

哦,另外说下,g4e搭配chainloader ntloader 启动vhd、仿真磁盘,vdf都可以成功。

18958925900 发表于 2021-2-1 12:39:12

这个很好-不用管设么efi了。

liuzhaoyzz 发表于 2021-2-1 17:15:29

本帖最后由 liuzhaoyzz 于 2021-2-1 17:16 编辑

wintoflash 发表于 2021-2-1 16:11
试试:

title WIN7X64-SVBUS (/VHD/SX70211.vhd)-kernel ntloader-1
debug 3
find --ignore-floppies --ignore-cd /EFI/grub/ntloader | set x=
echo x=%x%
find --ignore-floppies --ignore-cd --set-root /VHD/SX70211.vhd
map --mem --top /VHD/SX70211.vhd (hd)
uuid (hd-1,0)
kernel %x%/EFI/grub/ntloader uuid=%?_UUID%
initrd %x%/EFI/grub/initrd.lz1
pause pause1

启动vhd-ramos失败,等我上传截图

liuzhaoyzz 发表于 2021-2-1 17:15:55

本帖最后由 liuzhaoyzz 于 2021-2-1 17:17 编辑

wintoflash 发表于 2021-2-1 16:11
试试:

title WIN7X64-SVBUS (/VHD/SX70211.vhd)-kernel ntloader-3
debug 3
find --ignore-floppies --ignore-cd /EFI/grub/ntloader | set x=
echo x=%x%
find --ignore-floppies --ignore-cd --set-root /VHD/SX70211.vhd
uuid ()
kernel %x%/EFI/grub/ntloader uuid=%?_UUID% file=/VHD/SX70211.vhd
initrd %x%/EFI/grub/initrd.lz1
pause pause1

直接启动vhd失败,等我上传截图

2011whp 发表于 2021-2-1 18:43:07

@liuzhaoyzz
为什么,我复现不了你的问题呢
我这边能启动啊


wintoflash 发表于 2021-2-1 18:48:05

2011whp 发表于 2021-2-1 18:43
@liuzhaoyzz
为什么,我复现不了你的问题呢
我这边能启动啊

是的,他这个现象非常离谱,我到现在还没有想出来可能的原因。

gnuxwy 发表于 2021-2-1 18:49:08

W大牛比,又出好货了。。。
下载回来抽空试玩下。。。

chenall 发表于 2021-2-1 19:34:37

这个强,应该ipxe也能用吧

liuzhaoyzz 发表于 2021-2-1 19:40:34

wintoflash 发表于 2021-2-1 18:48
是的,他这个现象非常离谱,我到现在还没有想出来可能的原因。

      用2021-1-31的g4e搭配这个最新版,直接启动vhd还是不行

2011whp 发表于 2021-2-1 19:49:39

是奇怪@liuzhaoyzz

调调 g4e 分辨率,比如 1024(分辨率 经常成迷)
我的这边启动时,ntloader把屏幕 清的干净

记得,g4e刚发布时,我这机器,800分辨率 启动不了shell,

liuzhaoyzz 发表于 2021-2-1 22:20:19

2011whp 发表于 2021-2-1 19:49
是奇怪@liuzhaoyzz

调调 g4e 分辨率,比如 1024(分辨率 经常成迷)


跟分辨率没什么关系吧。。。如果分辨率不对,g4e早就报错了。我的分辨率一直没动,没有关注过那些语句。
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: NTloader: BIOS/UEFI 下用 GRUB4DOS 启动 VHD/WIM