Page 1 of 1

Can I use Grub as my OS bootloader with my own filesystem?

Posted: Tue Dec 11, 2007 9:40 am
by xyb
Hello everyone,

I meet some troubles, could you help me?

I want do use grub as my OS bootloader. But I design my own filesystem not fat or ext2. Could grub find my kernel image under my own filesystem? If yes, what else need I do? If not, does it means if I decide to implement my own filesystem, I can't use grub?

Expect your response. Thanks all. :D

Posted: Tue Dec 11, 2007 9:56 am
by JamesM
GRUB only supports the filesystems it supports. If you make one up, it seems obvious that it won't be able to use it.

Either:

1) Make a small partition made only for loading the kernel. Make this ext2/fat.
2) Don't use GRUB
3) Download the grub source code, and add a new filesystem to it.

Posted: Tue Dec 11, 2007 10:00 am
by xyb
I see. Thank you very much!

Posted: Tue Dec 11, 2007 6:08 pm
by Assembler

Re: Can I use Grub as my OS bootloader with my own filesyste

Posted: Wed Dec 12, 2007 8:10 am
by jal
xyb wrote:I want do use grub as my OS bootloader. But I design my own filesystem not fat or ext2. Could grub find my kernel image under my own filesystem? If yes, what else need I do? If not, does it means if I decide to implement my own filesystem, I can't use grub?
Like JamesM said, you could have an ext2 or fat boot partition, and after booting access your own partition. I'd advise that at least until you have a fill OS up and running. Creating a grub module for your own FS is possible, but I'd advise you to wait with that. I'd consider devoting a considerable amount of time for something not directly related to your OS a waste. Writing your own multiboot compliant bootloader taylored for your OS is probably faster.


JAL

Posted: Mon Dec 17, 2007 9:16 am
by urxae
I know this thread is a bit old, but I just wanted to add that you can also specify files as blocklists instead of filenames. That way GRUB doesn't need to understand the filesystem, but you do have to make sure the blocklist is kept up-to-date (either by never moving or extending the files, or by updating the blocklists every time one of those things happens). You should probably also make sure there's no junk at the end of the last sector, and that the extra bytes are ignored.
You can specify kernel images, modules and even the config file itself this way (the location of the config file is hardcoded into stage2, so you may have to hex-edit it).

This isn't the best option I'll grant you, but it could at least be useful as a temporary measure, until you have GRUB support for your filesystem, partition support [1] in your OS, (insert popular FS) support in your OS, or switch to a different bootloader.

[1] (So a separate boot partition can be used, with a GRUB-supported FS)

Posted: Mon Dec 17, 2007 5:06 pm
by AndrewAPrice
Why not use ext2/FAT or one of the FS's already supported?

Posted: Mon Dec 17, 2007 8:53 pm
by bewing
MessiahAndrw wrote:Why not use ext2/FAT or one of the FS's already supported?
Either for the pride of doing it your own way, and having it be yours, or because you think you have an idea for a better way to build a filesystem than those other crappy ones. Or both, of course.

Posted: Mon Dec 17, 2007 9:22 pm
by elfenix
One thing not mentioned (at least that I saw), if you don't want to have multiple partitions, you could incorporate FreeBSD disklabels, and have your kernel image and grub readable filesystem on one label, and your filesystem on another.

I haven't tried it that way, but I believe it should work.