A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

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.
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

I ran into a boat load of issues, so I spaced out some monkeying about over two weeks to figure out a fully functional setup for basic OSDev on Windows that gives no headaches.

http://stackoverflow.com/questions/1980 ... on-windows

UPDATED!
-The link broke BUT Scroll down a few posts to see how to get grub rolling. I'm running off memory so if you'd like to help give me feedback here and I'll update
Last edited by Zz on Fri Nov 22, 2013 2:34 pm, edited 1 time in total.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by sortie »

Hmm, I believe --disable-werror is only relevant for binutils. GCC certainly doesn't enable it by default and most packages don't (and shouldn't!). GRUB 1.98 is entirely obsoleted by GRUB 2.00? Why don't you build that version instead?

GRUB is known to be a bit problematic - does it really enable werror by default? It's a bit worrying that it doesn't respect the --prefix variable, but here's a neat trick that doesn't involving changing the makefile. Decide that you want to stage the installation temporarily at the directory /tmp/staging. This will act as the root for the purpose of installation. When you finally do the installation, instead do:

Code: Select all

make DESTDIR=/tmp/staging install
And it prefixes everything with DESTDIR - if the package respects that - otherwise GRUB is a pile of junk that needs serious fixing. You can then delete anything from /tmp/staging you don't want in your cygwin root and then you can do the final installation by merging /tmp/staging into your actual root directory. But really, use a newer GRUB package, and this might all go away.

But really, easier GRUB availability and installation is an advantage of Unix-like systems compared to Windows.
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

Thanks! I'll keep these things in mind when I go home and have my home pc to test these changes on.

Werror was definitely defaulted on all grub's I attempted and version 2.00/1.99 ran into serious issues building. I maybe hacked away at 2.00/1.99 for an entire day fixing one error and getting slammed with another (at the time I was trying cyg64 :/). I just tried to get as close to home as possible with the time I've had between classes. Also, I thought maybe I ran into a gcc werror but couldn't recall so that's good clarification!

I'd love to use a UNIX environment, but really I'm so entangled with Windows in so many ways (especially my summer work) that it's a real inconvenience to boot between two OS's or spend the time (that I don't have until summer comes by) to start from scratch on Linux. Don't get me wrong I love playing around with Linux, but if you can fix what you have to use right?
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by sortie »

I'd recommend toying around with osdev develop in a virtual machine. It is certainly possible to osdev under Windows, but if you desire to use Unix tools, they are a heap easier to use under Unix systems, especially if your package management solution provides them for you (such as GRUB).
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by jnc100 »

Grub 1.98 is provided as a Cygwin package.

Regards,
John
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

@Sortie - Eh, I know I can but that just seemed clunky. IDEEEEA!!! I think I'll slap a 2.5 in my docking bay an run me some Ubuntu!

@JNC - Wait. I searched high and low and did not see this. I thought that GRUB's integration was not continued. Please do tell...

All in all, hurray development kit on windows =D>
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by jnc100 »

http://cygwin.com/cgi-bin2/package-cat. ... &grep=grub

However it doesn't appear to be available for the 64 bit version.

Regards,
John
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

Huh.. That did not install for me nor appear on threw download list. I'll definitely check that out at home building again, thanks! I've dug more information out of this forum than the internet combined in two days you all rock.. To think I avoided asking here this whole time.
bimboxX
Posts: 4
Joined: Wed Nov 20, 2013 1:03 am

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by bimboxX »

sortie wrote: Decide that you want to stage the installation temporarily at the directory /tmp/staging.
@sortie Hi, can you provide exactly what needs to be typed here before the "make install" part? Thank you!
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by sortie »

@bimboxX: Uh? Read this guy's guide.
bimboxX
Posts: 4
Joined: Wed Nov 20, 2013 1:03 am

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by bimboxX »

@sortie sorry I didn't read the SO link. lol. The said link got removed in Stack Overflow so I just assumed the error on the "make" command isn't resolved yet. My pingback from here is a thread with an unresolved error, that's why.

@Zz can you please bring the post back or give me the new link rather. I can't install grub too, no.

Thank you!
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

Errrrm, I don't seeeeeeem to have the guide saved like I thought so...

If you find yourself savvy enough this should work for grub, take a look see and confirm if my memory serves me

make sure you have these items
GCC
Make
Bison
Flex
GMP
MPFR
MPC

>Extract grub 1.98 to src (under the cygwin folder, it's proper, we like)
>Make a build folder (build-ilikefancynames) in src
>enter cygwin
>go into the build folder
>type
>>export PREFIX="/cygdrive/c/.....(go to wherever)...../opt/cross"
>>export TARGET=i586-elf
>>export PATH="$PREFIX/bin:$PATH"
>>../grub-1.98/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-werror
>>make
===NOW HERE IS WHERE THINGS SHOULD GET HAIRY===
>do make install and you should error a good chunk into it
>It should be a path issue
>You know makefiles! Right? Fix it! If not, O_O
>If you can't fix it no matter and you want to get back on the horse send me the error and the makeFile and we will get this on the road!
bimboxX
Posts: 4
Joined: Wed Nov 20, 2013 1:03 am

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by bimboxX »

TARGET_OBJ2ELF=../grub-pe2elf sh genmod.sh moddep.lst iorw.module.exe iorw.mod
TARGET_OBJ2ELF=../grub-pe2elf sh genmod.sh moddep.lst regexp.module.exe regexp.mod
./../grub-pe2elf: error: invalid symbol.
Makefile:81315: recipe for target 'regexp.mod' failed
make[3]: *** [regexp.mod] Error 1
make[3]: Leaving directory '/cygdrive/c/posix/cygwin86/src/build-grub/grub-core'
Makefile:58403: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/cygdrive/c/posix/cygwin86/src/build-grub/grub-core'
Makefile:20313: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/posix/cygwin86/src/build-grub'
Makefile:15981: recipe for target 'all' failed
make: *** [all] Error 2

Hi, thank you for trying to recall. That above is the error. It looks more to me like an issue in grub-pe2elf. What do you think?
Zz
Posts: 17
Joined: Mon Nov 04, 2013 7:54 pm

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by Zz »

Ok, that's an issue between cygwin, pe2elf, and the regex file(s). I would recommend finding an older cygwin because that error could mean a lovely lot. I mean you could dig up that regex file and we could peruse it, and maybe a patch file exists somewhere. That error is usually where I pack up and try another build because like said, lots of fun to deal with.

OR post up your computer specs.. Perhaps my toolchain might suffice for grub. I was able to manage this with my home and school computer so hey, mayyyybe.
bimboxX
Posts: 4
Joined: Wed Nov 20, 2013 1:03 am

Re: A simple guide to GRUB 1.98 on Cygwin + Cross Compiler

Post by bimboxX »

Hi dude, problem solved. I just used the obsoleted binary version available. Thanks again!
Post Reply