A New method to bootloader your OS using a extended GRUB2
A New method to bootloader your OS using a extended GRUB2
This method just added a command to grub2 (safe to replace the current version of grub2)
* Your kernel file can be located in any existing filesystem(because Grub can find it out).
* The bootloader read the specified kernel(a single file) into memory at a specified location and start to run it from the first byte.
* You don't need to break your harddisk structure by making new partitions.
* You probably don't need to break your current boot method if you develop on linux, because grub2 is the default bootloader for most of Linux distro.
example grub.cfg
menuentry "YourOS" {
insmod part_msdos
insmod ext2
set root='hd0,msdos7'
osimg /boot/youros.bin 0x7c00
}
It is open sourced, check it out from:
https://github.com/neoedmund/grub-2.0.0/tree/osimg
Feel free to leave a comment.
* Your kernel file can be located in any existing filesystem(because Grub can find it out).
* The bootloader read the specified kernel(a single file) into memory at a specified location and start to run it from the first byte.
* You don't need to break your harddisk structure by making new partitions.
* You probably don't need to break your current boot method if you develop on linux, because grub2 is the default bootloader for most of Linux distro.
example grub.cfg
menuentry "YourOS" {
insmod part_msdos
insmod ext2
set root='hd0,msdos7'
osimg /boot/youros.bin 0x7c00
}
It is open sourced, check it out from:
https://github.com/neoedmund/grub-2.0.0/tree/osimg
Feel free to leave a comment.
Re: A New method to bootloader your OS using a extended GRUB
What is the advantage compared to Multiboot?
Re: A New method to bootloader your OS using a extended GRUB
OSDeving on Windows just became a hell of a lot easier. Darn you PE-only GCC which refuses to compile for ELF as target and TCC not having ELF support on Windows.
Thank you, sir.
Thank you, sir.
My post is up there, not down here.
Re: A New method to bootloader your OS using a extended GRUB
Does it emulate a disk like memdisk from syslinux?neoe wrote:This method just added a command to grub2 (safe to replace the current version of grub2)
* Your kernel file can be located in any existing filesystem(because Grub can find it out).
* The bootloader read the specified kernel(a single file) into memory at a specified location and start to run it from the first byte.
* You don't need to break your harddisk structure by making new partitions.
* You probably don't need to break your current boot method if you develop on linux, because grub2 is the default bootloader for most of Linux distro.
example grub.cfg
menuentry "YourOS" {
insmod part_msdos
insmod ext2
set root='hd0,msdos7'
osimg /boot/youros.bin 0x7c00
}
It is open sourced, check it out from:
https://github.com/neoedmund/grub-2.0.0/tree/osimg
Feel free to leave a comment.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
- Alan Kay
Re: A New method to bootloader your OS using a extended GRUB
They both make things easy by load kernel by file in filesystem instead of raw sectors on disk.Kevin wrote:What is the advantage compared to Multiboot?
The difference is, Multiboot, has a header format to fill and an information structure to read. To use it you must read and implements the spec which has about 64k letters.
Using "osimg", you don't bother to know there is a Multiboot on the earth.
But of course you should know bootsector, because it is the really thing works, you cannot pass it.
If you know bootsector, you know "osimg", no more concept, just variable changed, not 1 sector but 1 file, not 0x7c00 but anywhere you specify.
In one word, save your brain.
Re: A New method to bootloader your OS using a extended GRUB
Why not to create a small partition and use GRUB's chainloader?neoe wrote:They both make things easy by load kernel by file in filesystem instead of raw sectors on disk.Kevin wrote:What is the advantage compared to Multiboot?
The difference is, Multiboot, has a header format to fill and an information structure to read. To use it you must read and implements the spec which has about 64k letters.
Using "osimg", you don't bother to know there is a Multiboot on the earth.
But of course you should know bootsector, because it is the really thing works, you cannot pass it.
If you know bootsector, you know "osimg", no more concept, just variable changed, not 1 sector but 1 file, not 0x7c00 but anywhere you specify.
In one word, save your brain.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
- Alan Kay
Re: A New method to bootloader your OS using a extended GRUB
It's Not. I don't know it until read your post , memdisk from syslinux hooks INT 13h and INT 15h to emulate a disk as if it really exists.Roman wrote:Does it emulate a disk like memdisk from syslinux?neoe wrote:This method just added a command to grub2 (safe to replace the current version of grub2)
* Your kernel file can be located in any existing filesystem(because Grub can find it out).
* The bootloader read the specified kernel(a single file) into memory at a specified location and start to run it from the first byte.
* You don't need to break your harddisk structure by making new partitions.
* You probably don't need to break your current boot method if you develop on linux, because grub2 is the default bootloader for most of Linux distro.
example grub.cfg
menuentry "YourOS" {
insmod part_msdos
insmod ext2
set root='hd0,msdos7'
osimg /boot/youros.bin 0x7c00
}
It is open sourced, check it out from:
https://github.com/neoedmund/grub-2.0.0/tree/osimg
Feel free to leave a comment.
"osimg" use grub2 to read file to memory location and execute from there.
Different approach, should be used in different conditions, see which works, which fit your needs better.
Re: A New method to bootloader your OS using a extended GRUB
Roman wrote:Why not to create a small partition and use GRUB's chainloader?neoe wrote:They both make things easy by load kernel by file in filesystem instead of raw sectors on disk.Kevin wrote:What is the advantage compared to Multiboot?
The difference is, Multiboot, has a header format to fill and an information structure to read. To use it you must read and implements the spec which has about 64k letters.
Using "osimg", you don't bother to know there is a Multiboot on the earth.
But of course you should know bootsector, because it is the really thing works, you cannot pass it.
If you know bootsector, you know "osimg", no more concept, just variable changed, not 1 sector but 1 file, not 0x7c00 but anywhere you specify.
In one word, save your brain.
* Chainloader only read 512 bytes(as far as I read the grub code) and verifies a 55AA signature. You need to load next stages using INT13 or something.
* If the partition is not the beginning of a disk, you need to find out where is it.
* When you use partition, you need to use "dd" or something, which is a little dangerous, if used it wrong, may destroy an existing filesystem.
Instead, using "osimg", It's done when the kernel image is generated on your develop environment. you don't need further steps to copy it around or "dd" it to somewhere.
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: A New method to bootloader your OS using a extended GRUB
It sounds like you're not using a cross-compiler. If you install MSYS, you can use the MSYS shell and follow the wiki's instructions to build your cross-compiler.SoLDMG wrote:PE-only GCC which refuses to compile for ELF as target
(For my toolchain, I installed MSYS/GCC using the instructions here.)
Re: A New method to bootloader your OS using a extended GRUB
That's not what I meant. I tried to compile GCC with ELF as the target (a crosscompiler) but for some reason it errors some random error. I use a VM with Debian for ELF compiling and then sync the ELF file with Dropbox and use that for testing with GRUB.Octocontrabass wrote:It sounds like you're not using a cross-compiler. If you install MSYS, you can use the MSYS shell and follow the wiki's instructions to build your cross-compiler.SoLDMG wrote:PE-only GCC which refuses to compile for ELF as target
(For my toolchain, I installed MSYS/GCC using the instructions here.)
My post is up there, not down here.
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: A New method to bootloader your OS using a extended GRUB
If you followed the wiki's instructions and still got an error, please make a thread about it. If the wiki is wrong, I'd like to fix it.SoLDMG wrote:but for some reason it errors some random error.
Re: A New method to bootloader your OS using a extended GRUB
I don't know what error it is anymore. I'm working on a different project right now. I'll try it again soon though, and see if I can get it working then.Octocontrabass wrote:If you followed the wiki's instructions and still got an error, please make a thread about it. If the wiki is wrong, I'd like to fix it.SoLDMG wrote:but for some reason it errors some random error.
My post is up there, not down here.