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

Commit

Permalink
add support for windows (aio) iso
Browse files Browse the repository at this point in the history
  • Loading branch information
a1ive committed Nov 11, 2019
1 parent d47eee5 commit ba77a80
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 56 deletions.
Binary file modified arch/ia32/install.gz
Binary file not shown.
Binary file modified arch/legacy/install.gz
Binary file not shown.
Binary file modified arch/x64/install.gz
Binary file not shown.
53 changes: 53 additions & 0 deletions boot/grub/distro/windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
set icon="nt6";
function win_isoboot {
set lang=en_US;
set installiso="${linux_extra}";
if [ "$grub_platform" = "pc" ]; then
terminal_output console;
set enable_progress_indicator=1;
loopback wimboot /wimboot;
loopback install /install.gz;
save_env -f (memdisk)/null.cfg installiso;
linux16 (wimboot)/wimboot;
initrd16 newc:bootmgr:(loop)/bootmgr \
newc:bcd:(wimboot)/bcd \
newc:boot.sdi:(loop)/boot/boot.sdi \
newc:null.cfg:(memdisk)/null.cfg \
newc:mount_x64.exe:(install)/mount_x64.exe \
newc:mount_x86.exe:(install)/mount_x86.exe \
newc:start.bat:(install)/start.bat \
newc:winpeshl.ini:(install)/winpeshl.ini \
newc:boot.wim:"${1}";
cat (memdisk)/null.cfg;
boot;
else
loopback wimboot ${prefix}/wimboot.gz;
loopback install ${prefix}/install.gz;
save_env -f ${prefix}/null.cfg installiso;
cat ${prefix}/null.cfg;
wimboot @:bootmgfw.efi:(wimboot)/bootmgfw.efi \
@:bcd:(wimboot)/bcd \
@:boot.sdi:(wimboot)/boot.sdi \
@:null.cfg:${prefix}/null.cfg \
@:mount_x64.exe:(install)/mount_x64.exe \
@:mount_x86.exe:(install)/mount_x86.exe \
@:start.bat:(install)/start.bat \
@:winpeshl.ini:(install)/winpeshl.ini \
@:boot.wim:"${1}";
fi;
}

if test -f (loop)/sources/install.wim; then
win_isoboot "(loop)/sources/boot.wim";
else
if test -f (loop)/x64/sources/boot.wim; then
menuentry "Install Windows (x64)" --class ${icon} {
win_isoboot "(loop)/x64/sources/boot.wim";
}
fi;
if test -f (loop)/x86/sources/boot.wim; then
menuentry "Install Windows (x86)" --class ${icon} {
win_isoboot "(loop)/x86/sources/boot.wim";
}
fi;
fi;
47 changes: 7 additions & 40 deletions boot/grub/open.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
name = grub.gettext ("Boot ISO (Loopback)")
grub.add_icon_menu (icon, command, name)
end

function enum_loop (loop_path)
-- enum_loop path_without_(loop)
-- return table
Expand All @@ -99,7 +99,7 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
grub.enum_file (enum_loop_func, "(loop)" .. loop_path)
return f_table
end

function check_distro ()
-- return icon, script, name, linux_extra
-- default
Expand Down Expand Up @@ -262,7 +262,11 @@ function isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
if grub.file_exist ("(loop)/platform/i86pc/kernel/amd64/unix") then
return "solaris", "smartos", "SmartOS", ""
end

--check /sources/install.wim /x64/sources/install.esd
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
linux_extra = string.gsub (iso_path, "/", "\\\\")
return "nt6", "windows", "Windows", linux_extra
end
return "iso", "unknown", "Linux", ""
end
icon, distro, name, linux_extra = check_distro ()
Expand Down Expand Up @@ -321,23 +325,6 @@ function open (file, file_type, device, device_type, arch, platform)
isoboot (iso_path, iso_label, iso_uuid, dev_uuid)
end
if platform == "pc" then
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") and grub.file_exist ("/install.gz") then
-- windows install iso
icon = "nt6"
towinpath (file)
command = "set lang=en_US; terminal_output console; "
.. "enable_progress_indicator=1; loopback wimboot /wimboot; loopback install /install.gz; "
.. "set installiso=" .. win_path .. "; save_env -f (memdisk)/null.cfg installiso; "
.. "linux16 (wimboot)/wimboot; initrd16 newc:bootmgr:(loop)/bootmgr "
.. "newc:bcd:(loop)/boot/bcd newc:boot.sdi:(loop)/boot/boot.sdi "
.. "newc:null.cfg:(memdisk)/null.cfg "
.. "newc:mount_x64.exe:(install)/mount_x64.exe newc:mount_x86.exe:(install)/mount_x86.exe "
.. "newc:start.bat:(install)/start.bat newc:winpeshl.ini:(install)/winpeshl.ini "
.. "newc:boot.wim:(loop)/sources/boot.wim; "
.. "cat (memdisk)/null.cfg "
name = grub.gettext("Install Windows from ISO")
grub.add_icon_menu (icon, command, name)
end
-- memdisk iso
icon = "iso"
command = "linux16 $prefix/memdisk iso raw; enable_progress_indicator=1; initrd16 " .. file
Expand Down Expand Up @@ -370,26 +357,6 @@ function open (file, file_type, device, device_type, arch, platform)
grub.add_icon_menu (icon, command, name)
end
elseif platform == "efi" then
if device_type == "1" and grub.file_exist ("(loop)/sources/install.wim") then
-- windows install iso
icon = "nt6"
towinpath (file)
command = "set lang=en_US; loopback wimboot ${prefix}/wimboot.gz; "
.. "loopback install ${prefix}/install.gz; "
.. "set installiso=" .. win_path .. "; save_env -f ${prefix}/null.cfg installiso; "
.. "cat ${prefix}/null.cfg; "
.. "wimboot @:bootmgfw.efi:(wimboot)/bootmgfw.efi "
.. "@:bcd:(wimboot)/bcd "
.. "@:boot.sdi:(wimboot)/boot.sdi "
.. "@:null.cfg:${prefix}/null.cfg "
.. "@:mount_x64.exe:(install)/mount_x64.exe "
.. "@:mount_x86.exe:(install)/mount_x86.exe "
.. "@:start.bat:(install)/start.bat "
.. "@:winpeshl.ini:(install)/winpeshl.ini "
.. "@:boot.wim:(loop)/sources/boot.wim; "
name = grub.gettext("Install Windows from ISO")
grub.add_icon_menu (icon, command, name)
end
if arch == "x86_64" then
-- map iso
icon = "iso"
Expand Down
21 changes: 5 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,10 @@ grub-mkimage -d ./grub/i386-pc -m arch/legacy/null.cpio -p "(fm)/boot/grub" -c a
cat grub/i386-pc/cdboot.img build/core.img > build/fmldr
rm build/core.img
cp arch/legacy/MAP build/
if [ -e "legacy/ntboot/NTBOOT.MOD/NTBOOT.NT6" -o -e "legacy/ntboot/NTBOOT.MOD/NTBOOT.PE1" ]
then
cp -r arch/legacy/ntboot/* build/
fi
if [ -e "legacy/wimboot" ]
then
cp arch/legacy/wimboot build/
fi
if [ -e "legacy/vbootldr" ]
then
cp arch/legacy/vbootldr build/
fi
if [ -e "legacy/install.gz" ]
then
cp arch/legacy/install.gz build/
fi
cp -r arch/legacy/ntboot/* build/
cp arch/legacy/wimboot build/
cp arch/legacy/vbootldr build/
cp arch/legacy/install.gz build/

$geniso -R -hide-joliet boot.catalog -b fmldr -no-emul-boot -allow-lowercase -boot-load-size 4 -boot-info-table -o grubfm.iso build
rm -r build

0 comments on commit ba77a80

Please sign in to comment.