Page 1 of 1
Grub - loading more files
Posted: Mon Jul 04, 2005 11:43 pm
by Code
Hello, is it possible that grub loads the kernel and some other files, like drivers ?
And another question: IS grub able to change into vesa ?
If yes, how ?
Re:Grub - loading more files
Posted: Mon Jul 04, 2005 11:51 pm
by AR
GRUB has a section in the Multiboot header for requesting graphical modes, I don't know whether it actually works though.
Use the module command to load additional files:
Code: Select all
title My Operating System
kernel /MyOS/Kernel.elf
module /MyOS/Config.gzip
module /MyOS/Drivers.img.gzip
module /MyOS/Boot.ini
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 1:12 am
by Code
Hello, if i use the module command where are the files loaded ?
Is it possible to say that Boot.ini will be loaded at 0x200000 ?
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 1:51 am
by AR
The files are loaded directly after the kernel (you can set a multiboot flag to align them to the 4KB Physical Pages if you need), unfortunately the locations are not configurable, you will have to relocate them manually.
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 2:57 am
by Pype.Clicker
the thing is that GRUB loads *files*, not *modules* in the sense of Linux Kernel Modules. It doesn't know anything of what you might want to do with those files. It might be a splash screen, a "setup" program, a device driver, or whatever.
It will be up to your kernel to browse the multiboot information structure passed by GRUB and learn where those files have been placed, then do whatever you want with them (like reading symbols, relocating code, resolving dependencies, calling init functions and the like)
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 3:35 am
by AR
I should probably mention, since few people seem to know, that GRUB automatically decompresses GZIPed modules, you are welcome to compress modules (you can compress the kernel image as well) and GRUB will decompress them in memory [so the GZIPed files in my example would be autoexpanded for you].
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 3:44 am
by mystran
Personally, I use the "modules" to load the first few "userspace" programs. Since I have a microkernel, which has no means to load anything itself, multiboot modules provide a nice, simple way to load enough stuff to get the system up and running.
My current plan is actually to load each module as a userspace process. Normally one will need just two: the initial ramdisk, with the relevant code to startup other services, and a device manager. But you could startup several "independent" systems, by using two ramdisks (although you still want only one device manager, because having two sets of device drivers won't result in anything sane).
Other systems use other solutions. I believe some version of Hurd (the L4 port?) actually loads a special startup-program as it's "kernel" image, and has the real kernel as a module.
Or you could have a plain-text configuration file of what drivers to load, and what programs to start. I believe QNX has something like this (although I can't remember whether it supports multiboot).
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 10:27 am
by Tora OS
an alternate question relating to the GZIP thing:
Is it possible to compress your kernel too or just the modules?
Re:Grub - loading more files
Posted: Tue Jul 05, 2005 10:45 am
by pini
The kernel can be compressed too.