Anyway I'll post what i think are the most important stuffs:
linker script:
Code: Select all
OUTPUT_FORMAT(elf64-x86-64)
ENTRY(_start)
SECTIONS
{
KERNEL_VMA = 0x00301000;
. = KERNEL_VMA;
.text : ALIGN(0x1000)
{
*(.start)
*(.text)
}
.data : ALIGN(0x1000)
{
*(.data)
}
.rodata : ALIGN(0x1000)
{
*(.rodata)
}
.idt BLOCK(0x1000) : ALIGN(0x1000)
{
_idt = .;
. = . + 0x1000;
}
.bss : ALIGN(0x1000)
{
_BSS_START = ABSOLUTE(.);
*(COMMON)
*(.bss)
}
_BSS_SIZE = ABSOLUTE(.) - _BSS_START;
}
(with BonsOS.img being the output img, loader.bin the second stage bootloader, kernel.sys the kernel file generated wit the linker script above, boot.bin the first stage bootloader)
Code: Select all
dd if=/dev/zero of=BonsOS.img bs=1024 count=1440
/sbin/mkfs.msdos BonsOS.img
mcopy -i BonsOS.img ./bin/boot/loader.bin ::/
mcopy -i BonsOS.img ./bin/kernel/kernel.sys ::/
dd if=./bin/boot/boot.bin of=BonsOS.img seek=0 count=1 conv=notrunc
PS: If you need help navigating the repository to find a file feel free to ask