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

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
xyb
Posts: 2
Joined: Fri Apr 27, 2007 6:27 am

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

Post 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
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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.
xyb
Posts: 2
Joined: Fri Apr 27, 2007 6:27 am

Post by xyb »

I see. Thank you very much!
User avatar
Assembler
Member
Member
Posts: 30
Joined: Fri Oct 27, 2006 5:26 am
Contact:

Post by Assembler »

Systems and Computer Engineering Researcher
"Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?" -- Linus Torvalds
http://sce.carleton.ca/~maslan
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

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

Post 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
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Post 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)
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Why not use ext2/FAT or one of the FS's already supported?
My OS is Perception.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post 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.
elfenix
Member
Member
Posts: 50
Joined: Sun Dec 02, 2007 1:24 pm
Libera.chat IRC: elfenix
Location: United States
Contact:

Post 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.
Post Reply