Home arrow Forums
OSDEV Forums  


spider
User

Fresh Osdever
Posts: 2
graphgraph
Karma: 0  
Grub MultiBoot - 2006/08/14 22:30 im trying to load my kernel with grub, i have the multi kernel headers inside my asm file, but when ever i try to link the asm file with my c code grub says the file isnt supported. But it works if i dont link to the c file

The code i have is

kernel.asm
Code:

  [BITS 32] global start start:       extern YaOS_main       call YaOS_main     cli;     hlt; ALIGN 4 mboot:     MULTIBOOT_PAGE_ALIGN   equ 1<<0     MULTIBOOT_MEMORY_INFO   equ 1<<1     MULTIBOOT_AOUT_KLUDGE   equ 1<<16     MULTIBOOT_HEADER_MAGIC   equ 0x1BADB002     MULTIBOOT_HEADER_FLAGS   equ MULTIBOOT_PAGE_ALIGN MULTIBOOT_MEMORY_INFO MULTIBOOT_AOUT_KLUDGE     MULTIBOOT_CHECKSUM   equ -(MULTIBOOT_HEADER_MAGIC MULTIBOOT_HEADER_FLAGS)     EXTERN codebssend     dd MULTIBOOT_HEADER_MAGIC     dd MULTIBOOT_HEADER_FLAGS     dd MULTIBOOT_CHECKSUM          dd mboot     dd code     dd bss     dd end     dd start



kernel.c
Code:

  #define TEXT 0x07 void YaOS_clearScreen(); void YaOS_updateCursor(int rowint col); unsigned int YaOS_printf(char *msgunsigned int line); //Entry point for the OS (like main in a normal program) YaOS_main() {    YaOS_clearScreen();    YaOS_printf("Welcome to YaOS (Yet another Operating System)nVersion:0.1"0); }; void YaOS_clearScreen() {    char *vid =(char *) 0xb8000;    unsigned int i =0;        while(<(80*25*2)) {       vid[i] =' ';       i++;       vid[i] =TEXT;       i++;    }; }; unsigned int YaOS_printf(char *msgunsigned int line) {    char *vid =(char *) 0x8000;        unsigned int i =(line*80*2);        while(*msg !=0) {       if(*msg ='n') {          line++;          =(line*80*2);          *msg++;       } else {          vid[i] =*msg;          i++;          vid[i] =TEXT;          i++;       };    }; };



link.ld
Code:

  OUTPUT_FORMAT("binary") ENTRY(start) phys 0x00100000; SECTIONS {   .text phys AT(phys) {     code = .;     *(.text)     . = ALIGN(4096);   }   .data AT(phys + (data code))   {     data = .;     *(.data)     . = ALIGN(4096);   }   .bss AT(phys + (bss code))   {     bss = .;     *(.bss)     . = ALIGN(4096);   }   end = .; }



I should also note that im using a linux system to develop this.


Edit: I ended up working it out, after looking through just about every post in another forum i came across someone else's linker script i noticed i didnt have *(.rodata) I added that compiled it all together and it works fine now, well kind of. I just have to work out why it isnt actually printing to the screen.

Post edited by: spider, at: 2006/08/15 01:28
  | | The administrator has disabled public write access.
OSDEV
Community
Advertisement
   
davidragazzi
User

Fresh Osdever
Posts: 1
graphgraph
Karma: 0  
Re:Grub MultiBoot - 2007/02/08 10:30 missing underscore in YaOS_main function:

Code:

  Extern _YaOS_main Call _YaOS_main



GCC add a underscore in name of functions..

test it..
  | | The administrator has disabled public write access.

A WebArticles site. Sponsored by Evoleto. Motorola V525 / Business Directory / Delaware Incorporation / Home Made Bazaar