I want to boot a custom kernel (non-multiboot) with GRUB2, I've read that I need grub.cfg
like this:
menuentry "custom kernel" {
set root=(hd0,0)
chainloader +1
}
So, I have some questions:
kernel /boot/kernel.bin
)(hd0,0)
is hard drive partition and what I must put if I use CD? Maybe (cdrom0,0)
?linux
command, can I use it to boot my custom kernel (with some changes)?Protected mode
or not?See the documentation:
Multiboot (see Multiboot Specification) is the native format supported by GRUB. For the sake of convenience, there is also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to boot other operating systems, you will have to chain-load them (see Chain-loading).
So for your non-multiboot kernel you'll have to use the chain-loader feature. Chain-loading means GRUB will load the first sector (512 bytes) of the specified harddisk partition and boots it like the BIOS would boot a MBR. This means the CPU is in real mode and your boot sector is loaded at 0x7C00.
And yes, you could boot your kernel using the linux
command, by making it compatible with the Linux boot process, but that would be more complex than simply making your kernel multiboot-compliant.