I found a soloution for myself.
I sent the linker script and my asm startup file to hell.
Now I'm linking with:
Code:
ld --oformat elf32-i386 --entry 0x100000 -Ttext 0x100000 -Map kernel.map -O 1 -o kernel.bin [*.o files]
And my new startup code is:
Code:
[includes]
void start(); //Entry point
void k_main(const struct multiboot_info *mbi); //Kernel main
void start() { // Before header
__asm__ __volatile__("pushl %ebx"); //Push multiboot information
__asm__ __volatile__("call k_main");
while(1);
}
const unsigned MultibootHeader[12] __attribute__ ((section(".text"))) = { //........ u grub!
MULTIBOOT_HEADER_MAGIC, // der magische Wert
MULTIBOOT_HEADER_FLAGS, // die Flags
-(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS), //-MULTIBOOT_HEADER_MAGIC - FLAGS = CHECKSUM
(unsigned) MultibootHeader, // Offset des Headers
(unsigned) start, // Offset von main() als Beginn des Code Segments
0x00000000, // Data Segment, da scheißen wir drauf
0x00000000, // BSS Segment, wer braucht`n sowas?
(unsigned) start, // nochmal main(), diesmal als Entry Point
0x00000000, // Grafik? Nein, danke!
0x00000050, // 80 Spalten
0x00000019, // 25 Zeilen
0x00000000 // 0 BPP, wir sind im Text-Modus
};
void k_main(const struct multiboot_info *mbi) {
k_set_color(D_COLOR_WHITE,D_COLOR_BLUE);
k_cls();
k_printf(welcomeMsg);
gdt_install();
idt_install();
init_mm(mbi);
irq_install();
init_timer();
init_keyboard();
(...)
}