You have a Linux computer that boots using GRUB2.
You need to flash your BIOS, and the flashing program is provided as a Windows program.
You are researching how to find a way to install Windows
on a USB stick and to boot from it.
You will need the following software:
- wimtools, which adds support for Microsoft’s WIM-type disk images.
- grub-imageboot, which adds support for memdisk images in GRUB2.
- wine, for running an installer, once.
Acquire ISO image
- Download Active@ Boot Disk 9.4 Demo from here: http://download.lsoft.net/BootDiskDemo9-Setup.exe
- Use Wine to run this program. It installs the software. You can uninstall Wine after that, if you like.
You now have a ISO image file called BootDisk.ISO
in: ~/.wine/dosdevices/c:/Program Files (x86)/LSoft Technologies/Active@ Boot Disk
Copy that file to safety:
cp ~/'.wine/dosdevices/c:/Program Files (x86)/LSoft Technologies/Active@ Boot Disk'/BootDisk.ISO test.iso
You can now delete ~/.wine
if you like.
Now, if you try to boot using that ISO image (for example, qemu-system-x86_64 -cdrom test.iso -m 256
you will quickly find out that the ISO image is not very useful,
because it gets stuck on a license check screen.
Since we are not interested in the Active@ software at all,
we will edit the ISO image to skip that software
and just directly start a command prompt.
Modifying the ISO image
You need to install wimtools
first. Follow these steps to edit the image:
- Mount the ISO image on some path of your choosing. For example, mkdir ~/t;sudo mount test.iso -o loop ~/t
- Copy the files from the mountpoint, making a read-write copy. cp -a ~/t ~/t1; chmod u+w -R ~/t1
- You can now unmount the ISO image. sudo umount ~/t; rmdir ~/t
- Inside the mountpoint, there is a filesystem image. Mount this image: mkdir ~/t2;wimmountrw ~/t1/sources/boot.wim ~/t2
- Modify the Windows startup script inside that image. editor ~/t2/Windows/System32/startnet.cmd
- Delete all lines that contain .exe. This includes cfg_winpe.exe and initBD.exe.
- Save your changes.
- Save changes to the filesystem image, unmounting it: wimunmount ~/t2 --commit --rebuild
- The --rebuild option is important. Without it, the resulting WIM file will be larger than the original, and it will not work.
- If the resulting WIM file is larger than the original anyway, mount the WIM again, delete some unused exe files from ~/t2/Program\ Files/BOOTDISK/, and try again.
- Identify the start offset of the wim file within the ISO file: grep -aob 'MSWIM' test.iso
- Take the second line it printed, which looks something like: 3942400:MSWIM
- Write the modified filesystem image into the ISO file at that position: dd if=t1/sources/boot.wim bs=3942400 seek=1 conv=notrunc of=test.iso
- Naturally, replace the 3942400 with the number printed by grep.
- I was not able to find any other find to rebuild the ISO image using e.g. xorriso and still have it boot. I spent quite some time trying. But this solution, while crude, works.
Installing the ISO image
- Copy the ISO image to GRUB’s image directory: sudo cp test.iso /boot/images/
- Update GRUB configuration: update-grub
You are now ready to reboot the machine.
You will have a new boot option in GRUB menu,
which starts a RAMdisk that contains a loader for Microsoft Windows v6.1,
and starts up a command prompt, CMD
You can plug in a USB stick containing your Windows-requiring tools,
and run them from that command prompt.
(For the USB stick, remember to use a filesystem supported by Windows, such as VFAT or NTFS.)
If you need a DOS boot disk instead of Windows boot disk,
follow the same steps, except
take ~/.wine/dosdevices/c:/Program Files (x86)/LSoft Technologies/Active@ Boot Disk/DOS/BootDiskDos.ISO
and skip modifying the ISO image.
This produces a native FreeDOS boot.