OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Nov 30, 2021 2:43 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Help using grub-mkrescue in Windows 10
PostPosted: Tue Oct 26, 2021 8:33 pm 
Offline

Joined: Tue Oct 26, 2021 8:21 pm
Posts: 5
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/58886611/os-dev-undefined-reference-kernel-main-and-undefined-operator-newunsigned-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.


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Tue Oct 26, 2021 8:36 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 514
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)

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Tue Oct 26, 2021 9:39 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 3486
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".)


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Wed Oct 27, 2021 7:29 am 
Offline

Joined: Tue Oct 26, 2021 8:21 pm
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Wed Oct 27, 2021 9:15 am 
Offline

Joined: Tue Oct 26, 2021 8:21 pm
Posts: 5
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.


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Wed Oct 27, 2021 9:50 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 3486
I'm pretty sure grub-mkimage only creates the core GRUB image, not a complete bootable disk image.

Have you tried WSL yet?


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Wed Oct 27, 2021 4:39 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 456
Location: North Dakota, United States
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.


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Thu Oct 28, 2021 12:38 pm 
Offline

Joined: Tue Oct 26, 2021 8:21 pm
Posts: 5
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-Compiler#Why_cross-compilers_are_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.


Top
 Profile  
 
 Post subject: Re: Help using grub-mkrescue in Windows 10
PostPosted: Thu Oct 28, 2021 8:12 pm 
Offline

Joined: Tue Oct 26, 2021 8:21 pm
Posts: 5
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group