Page 1 of 1
Bootable CD
Posted: Thu Jan 08, 2009 1:29 pm
by thegamefreak0134
I'm just starting out (hello there, n00b here) and I've just finished integrating memory functions into my OS. So naturally, at this point, I want to start throwing it at real hardware to see what I get, and what typical results to expect on modern systems.
I started this project with a friend following an older barebones tutorial. Currently, it has me compiling the kernel itself down to an image, upon which it throws some other things to make a floppy that boots with GRUB. There are two issues with this technique.
First of all, in order to boot my kernel, I must first type "kernel 200+<somenumber>" which loads it, and then "boot" which runs it. I'm fairly certain this is because I'm creating the floppy image directly and not using a file system, but I can't be sure.
The second main issue with this is that it's a floppy. I don't actually have a floppy drive on this or any of my computers, so I can't test it out on real hardware without getting it to boot from something else. I'd ideally like to use a CD.
So the question becomes simple enough: Using GRUB, how can I have my OS boot from a CD instead of a floppy? And is there a way to generate the filesystem needed for GRUB to auto-boot the kernel during the make step?
Thanks for any help, I look forward to figuring this all out.
-Nicholas
Re: Bootable CD
Posted: Thu Jan 08, 2009 2:56 pm
by xDDunce
hello there, and welcome!
i had the exact same problem as you at one point, so i shall impart some wisdom.
which OS are you using as your development environment? linux? windows?
if you are using windows then i advise getting a program called mkisofs.exe as this can generate pre-formatted iso images from a simple folder on you computer (nifty, eh?). just search google for it and you should find it. if you are not on windows then someone else will be able to provide you with an alternative.
secondly, to make the CD bootable you will need GRUB and for CD it comes in a special way. [url="http://jamesjohns.ashtonpark.co.uk/cd.zip"]download this zip folder[/url] and unzip it to anywhere (say, C:\ ) and then run the command:
Code: Select all
mkisofs -R -b grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o OS.iso cd
and it will produce a file called OS.iso. burn it to a disk and boot it and you will see GRUB. (the kernel i have on there atm is buggy. i uploaded it for a friend to test)
if you wish more elaboratoion on how this actually works then just ask.
Re: Bootable CD
Posted: Thu Jan 08, 2009 6:06 pm
by thegamefreak0134
Using the command you typed, I get the following error:
mkisofs: No such file or directory. Invalid node - cd
I tried all sorts of things to fix it, to no avail. I'm sure that the file I'm using exists, 100%.
any suggestions? Is there perhaps an error in that command? I'm still trying other things of course, maybe I'll figure it out.
-Nick
Re: Bootable CD
Posted: Thu Jan 08, 2009 6:20 pm
by thegamefreak0134
Nevermind, I didn't realize that the "cd" directory was (a) so important, and (b) needed to be in the same place as mkisofs. That made it work, and I now have a bootable CD running my kernel. w00t, thanks a million!
-Nick
*EDIT* You know, this is a common question I'm sure. Does a Wiki page exist for this? If not, I'll gladly do my best to write one, since I finally got it all figured out.
Re: Bootable CD
Posted: Fri Jan 09, 2009 8:43 am
by Craze Frog
Nevermind, I didn't realize that the "cd" directory was (a) so important
You're the type of person to just use the M key instead of the N key because the N key is broken, and then expect the same result, right?
Re: Bootable CD
Posted: Fri Jan 09, 2009 9:48 am
by quok
Craze Frog wrote:Nevermind, I didn't realize that the "cd" directory was (a) so important
You're the type of person to just use the M key instead of the N key because the N key is broken, and then expect the same result, right?
To be fair, since "cd" is also a command, it was a bad choice to be used for a directory name, and I can see why a newbie would be confused.
Re: Bootable CD
Posted: Fri Jan 09, 2009 9:57 am
by Craze Frog
Didn't know we had to be fair.
Re: Bootable CD
Posted: Fri Jan 09, 2009 10:03 am
by thegamefreak0134
Craze Frog wrote:Nevermind, I didn't realize that the "cd" directory was (a) so important
You're the type of person to just use the M key instead of the N key because the N key is broken, and then expect the same result, right?
Um, what? I was confused about the command line procedure for mkisofs, what does this have anything to do with my keyboard? I may be new to OS design/implementation, but I certainly don't expect programs to work properly when I make a mistake using them.
And I realize now that my explanation was a bit off. I didn't realize that "cd" at the end was referencing a directory. I knew it wouldn't be parsed as a command since it was being passed in as an argument, but I thought initially that it was supposed to be a switch for mkisofs to use or something of the sort. I didn't catch that it was supposed to be the path to the directory that became the filesystem on the new ISO. Of course, in my defense, the error returned for mkisofs doesn't really make sense, the "correct" error comes from omitting cd entirely, where mkisofs complains about the directory not being specified. That was when I was able to google for the proper documentation (read linux users: I read the man pages) and figure out that it was missing the most important part. [/rant]
Re: Bootable CD
Posted: Fri Jan 09, 2009 10:33 am
by xDDunce
yeah, sorry. im the kinda person that assumes too much lol. but im glad you worked it out on your own. that is a valuable skill in OSDEV.
have fun, and GOOD LUCK!!!