Page 1 of 1

problem to load my kernel

Posted: Sat May 12, 2007 10:21 am
by jtlb
i get this error message when i emulate:

Code: Select all

, bss=0x3860, symtab=0x2, strtab=0x203a4033f(bad)Starting up ...
:?
from grub

when i boot from a real computer i only get a message from my page fault handler.
i suspect an error in the linking process.

my makefile:

Code: Select all

CC  = gcc
CXX = g++
LD= ld
CFLAGS   = -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./Sources/include -Is./Sources
CPPFLAGS = -nostdlib -fno-builtin -fno-rtti -fno-exceptions  -I./Sources/include -Is./Sources
LDFLAGS  = -T ./scripts/link.ld -I./Sources
PROJDIRS =/home/jtlb/os
SRCC   = $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.c")
OBJC   = $(SRCC:.c=.oc)
SRCCPP = $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.cpp")
OBJCPP = $(SRCCPP:.cpp=.ocpp)
SRCASM = $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.asm")
OBJASM = $(SRCASM:.asm=.oasm)
TARGET = kernel.os

all: debug release
release: first $(TARGET)
debug:   first $(TARGET)

first:
	@cd $(PROJDIRS)

kernel.os: $(OBJC) $(OBJCPP) $(OBJASM)
	$(LD) $(LDFLAGS) -o $@ $^
	@cp $@ /media/backup/os/$@

%.oc: %.c
	@$(CC)  -o $@ -c $^ $(CFLAGS)

%.ocpp: %.cpp
	@$(CXX) -o $@ -c $^ $(CPPFLAGS)

%.oasm: %.asm
	@nasm -f elf -o $@ $^

.PHONY: clean mrproper

clean:
	@for file in $(OBJC) $(OBJCPP) $(OBJASM); do if [ -f $$file ]; then rm $$file; fi; done
	@rm -fr *~ ./Sources/*~ ./Sources/include/*~ ./scripts/*~

mrproper: clean
	rm -rf $(TARGET)
and my linker script:

Code: Select all

OUTPUT_FORMAT("elf32-little")

ENTRY(start)

SECTIONS

{

  .text 0x100000 :
  {

    code = .;_code = .;__code = .;

    *(.text)


    . = ALIGN(4096);

  }

  .data :

  {

    __CTOR_LIST__ = .; LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) *(.ctors)   LONG(0) __CTOR_END__ = .;  

    __DTOR_LIST__ = .; LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) __DTOR_END__ = .; 

    data = .;_data = .;__data = .;

    *(.data)

    . = ALIGN(4096);

  }

  .bss :

  {

    bss = .;_bss = .;__bss = .;

    *(.bss)

    . = ALIGN(4096);

  }

  end = .; _end = .; __end = .;

}
thanks for your help