Loading Kernel with GRUB.
Loading Kernel with GRUB.
I'm currently in the making of an OS. I've loaded my Kernel with GRUB. Currnetly i've setup paging,can perform multitasking,etc.. My problem is that form the start i linked my kernel to be loaded at 1MB mark. Now i'm thinking about making a kernel level memory allocator. I want to load my kernel at a virtual address say 3GB mark and located at 1MB physical memory. How can we accomplish it usnig grub. GRUB is refused to load kernel linked to address 0xC0000000. I'ii be really thankful if someone helps me...
RE:Loading Kernel with GRUB.
You have to create a linker script for the kernel like this one (which should work with your code):
OUTPUT_FORMAT("elf32-i386")
ENTRY(_start)
_phys_base = 0x100000;
_virt_base = 0xC0000000;
SECTIONS
{
. = _phys_base;
. = _virt_base;
.text _virt_base : AT (_phys_base)
{ code = .;
*(.text);
}
.rodata : AT (_phys_base + (rodata - code))
{ rodata = .;
*(.rodata*);
}
.data : AT (_phys_base + (data - code))
{ data = .;
*(.data);
}
.bss : AT (_phys_base + (bss - code))
{ bss = .;
. = ALIGN(4096);
*(.bss)
*(COMMON);
}
_end = .;
}
I use this for my kernel and it does work great!
OUTPUT_FORMAT("elf32-i386")
ENTRY(_start)
_phys_base = 0x100000;
_virt_base = 0xC0000000;
SECTIONS
{
. = _phys_base;
. = _virt_base;
.text _virt_base : AT (_phys_base)
{ code = .;
*(.text);
}
.rodata : AT (_phys_base + (rodata - code))
{ rodata = .;
*(.rodata*);
}
.data : AT (_phys_base + (data - code))
{ data = .;
*(.data);
}
.bss : AT (_phys_base + (bss - code))
{ bss = .;
. = ALIGN(4096);
*(.bss)
*(COMMON);
}
_end = .;
}
I use this for my kernel and it does work great!
RE:Loading Kernel with GRUB.
I'm greatly thankful to the reply to the question. It was the first time i visited this site, and it looks great.