Help using grub-mkrescue in Windows 10

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
RadPoseidon
Posts: 8
Joined: Tue Oct 26, 2021 8:21 pm

Help using grub-mkrescue in Windows 10

Post by RadPoseidon »

I think that I am writing this to the write forum section. I'm new to OS development and I've been following this (http://www.cplusplus.com/articles/zv07M4Gy/) admittedly rather vague article. I had to change some things as per this SO post (https://stackoverflow.com/questions/588 ... nsigned-lo) but I did get both the Assembly Code and C++ code to compile and link, but the thing I'm not sure how to do is build the ISO, the guide says to use grub-mkrescue, but being a Windows user, I've been unable to find a way to download these tools. I've also tried building them myself via the instructions in grub Install file, but I've had no success even when opening a bash shell to try and build it. I've definitely seen posts about people using grub on Windows, although this may have been before Cygwin dropped support for grub.

If anyone else has managed to do this on Windows, or has a good alternative they can recommend it would be much appreciated.
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: Help using grub-mkrescue in Windows 10

Post by klange »

GNU provides pre-compiled Grub utilities for Windows: https://ftp.gnu.org/gnu/grub/grub-2.06-for-windows.zip

You'll want to use grub-mkimage rather than grub-mkrescue. They have different argument formats, but ultimately can do the same basic things.

(grub-mkrescue itself is just a wrapper that combines mkimage with xorriso: https://github.com/rhboot/grub2/blob/ma ... mkrescue.c - I'm not really sure why they don't include it in the Windows builds)
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help using grub-mkrescue in Windows 10

Post by Octocontrabass »

RadPoseidon wrote:If anyone else has managed to do this on Windows, or has a good alternative they can recommend it would be much appreciated.
Install WSL. (If you're not sure which distro to choose, Ubuntu is a good starting point.)

Inside WSL, install grub-common, xorriso, grub-pc-bin, and grub-efi-amd64-bin. This will give you an ISO that supports both legacy BIOS and x64 UEFI. (If you chose Ubuntu, the command for that will be "sudo apt install grub-common xorriso grub-pc-bin grub-efi-amd64-bin".)
RadPoseidon
Posts: 8
Joined: Tue Oct 26, 2021 8:21 pm

Re: Help using grub-mkrescue in Windows 10

Post by RadPoseidon »

klange wrote:GNU provides pre-compiled Grub utilities for Windows: https://ftp.gnu.org/gnu/grub/grub-2.06-for-windows.zip

You'll want to use grub-mkimage rather than grub-mkrescue. They have different argument formats, but ultimately can do the same basic things.

(grub-mkrescue itself is just a wrapper that combines mkimage with xorriso: https://github.com/rhboot/grub2/blob/ma ... mkrescue.c - I'm not really sure why they don't include it in the Windows builds)
Thank you! I'm not sure how I missed the Precompiled Win Utils in all of my Google searches but for better or worse I now have an ISO.
RadPoseidon
Posts: 8
Joined: Tue Oct 26, 2021 8:21 pm

Re: Help using grub-mkrescue in Windows 10

Post by RadPoseidon »

What options should I use with grub-mkimage? grub-mkrescue has much simpler inputs and --help/--usage don't really explain too much, and so far all of the ISOs I've built are unbootable.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help using grub-mkrescue in Windows 10

Post by Octocontrabass »

I'm pretty sure grub-mkimage only creates the core GRUB image, not a complete bootable disk image.

Have you tried WSL yet?
Ethin
Member
Member
Posts: 625
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: Help using grub-mkrescue in Windows 10

Post by Ethin »

Why are you following a tutorial? This tutorial does not cover crucial details, like building a cross-compiler. So that is most likely also contributing to your problem. (It says that you need a "cross-compiler" but misuses the term, or uses it in a different context. It uses the host compiler and does not take you through the process of actually building GCC for OS development.) Perhaps you did this part on your own though.
RadPoseidon
Posts: 8
Joined: Tue Oct 26, 2021 8:21 pm

Re: Help using grub-mkrescue in Windows 10

Post by RadPoseidon »

Sorry for the late reply. I've gotten WSL installed which has gotten me closer, and https://wiki.osdev.org/User:Tjmonk15/WSL_Notes is proving useful. ( It pointed me towards another resource about Cross Compilers ( https://wiki.osdev.org/GCC_Cross-Compil ... _necessary ) ) so hopefully maybe soon I should be able to compile a bootable image. I'll give an update then, and thank you for all the help thus far.
RadPoseidon
Posts: 8
Joined: Tue Oct 26, 2021 8:21 pm

Re: Help using grub-mkrescue in Windows 10

Post by RadPoseidon »

Ok, after lots of trial and error, and just as much waiting on the Cross Compiler to build, I have a bootable ISO, although it definitely still needs work it's certainly a start. Thanks for all of your help with my sudden desire to build an OS.
Post Reply