Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit ba77a80

Browse files
committed
add support for windows (aio) iso
1 parent d47eee5 commit ba77a80

File tree

6 files changed

+65
-56
lines changed

6 files changed

+65
-56
lines changed

arch/ia32/install.gz

182 Bytes
Binary file not shown.

arch/legacy/install.gz

182 Bytes
Binary file not shown.

arch/x64/install.gz

182 Bytes
Binary file not shown.

boot/grub/distro/windows.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
set icon="nt6";
2+
function win_isoboot {
3+
set lang=en_US;
4+
set installiso="${linux_extra}";
5+
if [ "$grub_platform" = "pc" ]; then
6+
terminal_output console;
7+
set enable_progress_indicator=1;
8+
loopback wimboot /wimboot;
9+
loopback install /install.gz;
10+
save_env -f (memdisk)/null.cfg installiso;
11+
linux16 (wimboot)/wimboot;
12+
initrd16 newc:bootmgr:(loop)/bootmgr \
13+
newc:bcd:(wimboot)/bcd \
14+
newc:boot.sdi:(loop)/boot/boot.sdi \
15+
newc:null.cfg:(memdisk)/null.cfg \
16+
newc:mount_x64.exe:(install)/mount_x64.exe \
17+
newc:mount_x86.exe:(install)/mount_x86.exe \
18+
newc:start.bat:(install)/start.bat \
19+
newc:winpeshl.ini:(install)/winpeshl.ini \
20+
newc:boot.wim:"${1}";
21+
cat (memdisk)/null.cfg;
22+
boot;
23+
else
24+
loopback wimboot ${prefix}/wimboot.gz;
25+
loopback install ${prefix}/install.gz;
26+
save_env -f ${prefix}/null.cfg installiso;
27+
cat ${prefix}/null.cfg;
28+
wimboot @:bootmgfw.efi:(wimboot)/bootmgfw.efi \
29+
@:bcd:(wimboot)/bcd \
30+
@:boot.sdi:(wimboot)/boot.sdi \
31+
@:null.cfg:${prefix}/null.cfg \
32+
@:mount_x64.exe:(install)/mount_x64.exe \
33+
@:mount_x86.exe:(install)/mount_x86.exe \
34+
@:start.bat:(install)/start.bat \
35+
@:winpeshl.ini:(install)/winpeshl.ini \
36+
@:boot.wim:"${1}";
37+
fi;
38+
}
39+
40+
if test -f (loop)/sources/install.wim; then
41+
win_isoboot "(loop)/sources/boot.wim";
42+
else
43+
if test -f (loop)/x64/sources/boot.wim; then
44+
menuentry "Install Windows (x64)" --class ${icon} {
45+
win_isoboot "(loop)/x64/sources/boot.wim";
46+
}
47+
fi;
48+
if test -f (loop)/x86/sources/boot.wim; then
49+
menuentry "Install Windows (x86)" --class ${icon} {
50+
win_isoboot "(loop)/x86/sources/boot.wim";
51+
}
52+
fi;
53+
fi;

boot/grub/open.lua

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
8080
name = grub.gettext ("Boot ISO (Loopback)")
8181
grub.add_icon_menu (icon, command, name)
8282
end
83-
83+
8484
function enum_loop (loop_path)
8585
-- enum_loop path_without_(loop)
8686
-- return table
@@ -99,7 +99,7 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
9999
grub.enum_file (enum_loop_func, "(loop)" .. loop_path)
100100
return f_table
101101
end
102-
102+
103103
function check_distro ()
104104
-- return icon, script, name, linux_extra
105105
-- default
@@ -262,7 +262,11 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
262262
if grub.file_exist ("(loop)/platform/i86pc/kernel/amd64/unix") then
263263
return "solaris", "smartos", "SmartOS", ""
264264
end
265-
265+
--check /sources/install.wim /x64/sources/install.esd
266+
if grub.file_exist ("(loop)/sources/install.wim") or grub.file_exist ("(loop)/x86/sources/install.esd") or grub.file_exist ("(loop)/x64/sources/install.esd") then
267+
linux_extra = string.gsub (iso_path, "/", "\\\\")
268+
return "nt6", "windows", "Windows", linux_extra
269+
end
266270
return "iso", "unknown", "Linux", ""
267271
end
268272
icon, distro, name, linux_extra = check_distro ()
@@ -321,23 +325,6 @@ function open (file, file_type, device, device_type, arch, platform)
321325
isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
322326
end
323327
if platform == "pc" then
324-
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") and grub.file_exist ("/install.gz") then
325-
-- windows install iso
326-
icon = "nt6"
327-
towinpath (file)
328-
command = "set lang=en_US; terminal_output console; "
329-
.. "enable_progress_indicator=1; loopback wimboot /wimboot; loopback install /install.gz; "
330-
.. "set installiso=" .. win_path .. "; save_env -f (memdisk)/null.cfg installiso; "
331-
.. "linux16 (wimboot)/wimboot; initrd16 newc:bootmgr:(loop)/bootmgr "
332-
.. "newc:bcd:(loop)/boot/bcd newc:boot.sdi:(loop)/boot/boot.sdi "
333-
.. "newc:null.cfg:(memdisk)/null.cfg "
334-
.. "newc:mount_x64.exe:(install)/mount_x64.exe newc:mount_x86.exe:(install)/mount_x86.exe "
335-
.. "newc:start.bat:(install)/start.bat newc:winpeshl.ini:(install)/winpeshl.ini "
336-
.. "newc:boot.wim:(loop)/sources/boot.wim; "
337-
.. "cat (memdisk)/null.cfg "
338-
name = grub.gettext("Install Windows from ISO")
339-
grub.add_icon_menu (icon, command, name)
340-
end
341328
-- memdisk iso
342329
icon = "iso"
343330
command = "linux16 $prefix/memdisk iso raw; enable_progress_indicator=1; initrd16 " .. file
@@ -370,26 +357,6 @@ function open (file, file_type, device, device_type, arch, platform)
370357
grub.add_icon_menu (icon, command, name)
371358
end
372359
elseif platform == "efi" then
373-
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") then
374-
-- windows install iso
375-
icon = "nt6"
376-
towinpath (file)
377-
command = "set lang=en_US; loopback wimboot ${prefix}/wimboot.gz; "
378-
.. "loopback install ${prefix}/install.gz; "
379-
.. "set installiso=" .. win_path .. "; save_env -f ${prefix}/null.cfg installiso; "
380-
.. "cat ${prefix}/null.cfg; "
381-
.. "wimboot @:bootmgfw.efi:(wimboot)/bootmgfw.efi "
382-
.. "@:bcd:(wimboot)/bcd "
383-
.. "@:boot.sdi:(wimboot)/boot.sdi "
384-
.. "@:null.cfg:${prefix}/null.cfg "
385-
.. "@:mount_x64.exe:(install)/mount_x64.exe "
386-
.. "@:mount_x86.exe:(install)/mount_x86.exe "
387-
.. "@:start.bat:(install)/start.bat "
388-
.. "@:winpeshl.ini:(install)/winpeshl.ini "
389-
.. "@:boot.wim:(loop)/sources/boot.wim; "
390-
name = grub.gettext("Install Windows from ISO")
391-
grub.add_icon_menu (icon, command, name)
392-
end
393360
if arch == "x86_64" then
394361
-- map iso
395362
icon = "iso"

build.sh

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,10 @@ grub-mkimage -d ./grub/i386-pc -m arch/legacy/null.cpio -p "(fm)/boot/grub" -c a
151151
cat grub/i386-pc/cdboot.img build/core.img > build/fmldr
152152
rm build/core.img
153153
cp arch/legacy/MAP build/
154-
if [ -e "legacy/ntboot/NTBOOT.MOD/NTBOOT.NT6" -o -e "legacy/ntboot/NTBOOT.MOD/NTBOOT.PE1" ]
155-
then
156-
cp -r arch/legacy/ntboot/* build/
157-
fi
158-
if [ -e "legacy/wimboot" ]
159-
then
160-
cp arch/legacy/wimboot build/
161-
fi
162-
if [ -e "legacy/vbootldr" ]
163-
then
164-
cp arch/legacy/vbootldr build/
165-
fi
166-
if [ -e "legacy/install.gz" ]
167-
then
168-
cp arch/legacy/install.gz build/
169-
fi
154+
cp -r arch/legacy/ntboot/* build/
155+
cp arch/legacy/wimboot build/
156+
cp arch/legacy/vbootldr build/
157+
cp arch/legacy/install.gz build/
158+
170159
$geniso -R -hide-joliet boot.catalog -b fmldr -no-emul-boot -allow-lowercase -boot-load-size 4 -boot-info-table -o grubfm.iso build
171160
rm -r build

0 commit comments

Comments
 (0)