Port-hpcarm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

evbarm ldscript vs. KERNEL_BASE_PHYS != KERNEL_BASE_VIRT



If I build a kernel where KERNEL_BASE_PHYS != KERNEL_BASE_VIRT, the BSS
ends up having it's (ELF) physaddr set to one based at KERNEL_BASE_VIRT
instead of KERNEL_BASE_PHYS.  This seems like a bug to me and it makes
it hard for me to correctly load such a kernel, since my loader tries
to zero memory that's likely unmapped at the time.

Diff that fixes it for me is below; I thought I'd pass this by the list
for feedback since I'm far from an ARM gooroo.

Thanks,
--rafal

(For the people on the hpcarm list, this is related to the hpcboot fix
 I sent there -- hpcboot needs to understand to load at physaddr vs.
 at virtaddr)

Index: conf/ldscript.evbarm
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/ldscript.evbarm,v
retrieving revision 1.3
diff -u -p -r1.3 ldscript.evbarm
--- conf/ldscript.evbarm        23 May 2003 00:57:27 -0000      1.3
+++ conf/ldscript.evbarm        10 Mar 2008 19:26:03 -0000
@@ -47,6 +47,7 @@ SECTIONS
   __bss_start = .;
   __bss_start__ = .;
   .sbss      :
+  AT (LOADADDR(.sdata) + (ADDR(.sbss) - ADDR(.sdata)))
   {
     PROVIDE (__sbss_start = .);
     PROVIDE (___sbss_start = .);
@@ -58,6 +59,7 @@ SECTIONS
     PROVIDE (___sbss_end = .);
   }
   .bss       :
+  AT (LOADADDR(.sbss) + (ADDR(.bss) - ADDR(.sbss)))
   {
    *(.dynbss)
    *(.bss)

-- 
  Time is an illusion; lunchtime, doubly so.     |/\/\|           Rafal Boni
                   -- Ford Prefect               |\/\/|      
rafal%pobox.com@localhost


Home | Main Index | Thread Index | Old Index