Subject: Re: kernel symbols
To: Frank Wille <frank@phoenix.owl.de>
From: Jachym Holecek <freza@dspfpga.com>
List: port-powerpc
Date: 01/14/2007 00:55:43
# Frank Wille 2007-01-14:
> Jachym Holecek wrote:
> 
> >> I understand that ksyms_init() is called during system startup with the
> >> start- and end-address of the ELF file, containing the symbols. But
> >> making the loader transfer the whole ELF file into memory can't be the
> >> solution, because I have to clear the BSS space, which overwrites the
> >> symbols at the end of the file.
> >> 
> >> How is it done on other PPC ports?
> > 
> > Well, either the bootloader gives you the ELF image and ksyms_init() will
> > pick up the .symtab and .strtab sections, or you use
> 
> Then the bootloader, which I have to write, loads the ELF image twice? First
> at the target address, to be able to start the kernel, and a second time just
> to pass it to ksyms_init()?

Nope, that would indeed be terrible waste :-). Load it just once and pass
the kernel enough info to lookup the symbol table (and make sure to advance
"end of kernel" pointer past it).

At a glance it seems

  sys/arch/landisk/stand/boot/boot2.c 	Bootloader
  sys/arch/landisk/landisk/machdep.c 	Kernel startup
  [ sys/lib/libsa/loadfile_elf32.c 	How's the ELF loaded ]

give an example of what you want to do, though I'm not familiar with
that code so no warranties...

	-- Jachym