Subject: RE: KERNEL_BASE_VIRT & KERNEL_BASE_PHYS
To: , <port-arm@NetBSD.org>
From: None <Lin.Colin@iac.com.tw>
List: port-arm
Date: 04/28/2004 10:02:54
Hi Jason,
Could you please teach me how to set up my linker script correctly?

Thanks and regards,
Colin

-------------------------------------------------------------------------=
-----------------------------
The content of ldscript.evbarm:

OUTPUT_ARCH(arm)
ENTRY(KERNEL_BASE_phys)
SECTIONS
{
  KERNEL_BASE_phys =3D @KERNEL_BASE_PHYS@;
  KERNEL_BASE_virt =3D @KERNEL_BASE_VIRT@;
                                                                         =
      =20
  /* Kernel start: */
  .start (KERNEL_BASE_phys) :
  {
    *(.start)
  } =3D0
                                                                         =
      =20
  /* Read-only sections, merged into text segment: */
  .text (KERNEL_BASE_virt + SIZEOF(.start)) :
  AT (LOADADDR(.start) + SIZEOF(.start))
  {
    *(.text)
    *(.text.*)
    *(.stub)
    *(.glue_7t) *(.glue_7)
    *(.rodata) *(.rodata.*)
  } =3D0
  PROVIDE (__etext =3D .);
  PROVIDE (_etext =3D .);
  PROVIDE (etext =3D .);
  /* Adjust the address for the data segment to start on the next page
     boundary.  */
  . =3D ALIGN(0x8000);
  .data    :
  AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
  {
    __data_start =3D . ;
    *(.data)
    *(.data.*)
  }
  .sdata     :
  AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
  {
    *(.sdata)
    *(.sdata.*)
  }
  _edata =3D .;
  PROVIDE (edata =3D .);
  __bss_start =3D .;
  __bss_start__ =3D .;
  .sbss      :
  {
    PROVIDE (__sbss_start =3D .);
    PROVIDE (___sbss_start =3D .);
    *(.dynsbss)
    *(.sbss)
    *(.sbss.*)
    *(.scommon)
    PROVIDE (__sbss_end =3D .);
    PROVIDE (___sbss_end =3D .);
  }
  .bss       :
  {
   *(.dynbss)
   *(.bss)
   *(.bss.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.  */
   . =3D ALIGN(32 / 8);
  }
  . =3D ALIGN(32 / 8);
  _end =3D .;
  _bss_end__ =3D . ; __bss_end__ =3D . ; __end__ =3D . ;
  PROVIDE (end =3D .);

}


-----Original Message-----
From: Jason Thorpe [mailto:thorpej@wasabisystems.com]=20
Sent: Wednesday, April 28, 2004 4:53 AM
To: Lin, Colin(=D7=F9=CB=EF=E4=CC IAC)
Cc: port-arm@netbsd.org
Subject: Re: KERNEL_BASE_VIRT & KERNEL_BASE_PHYS


On Apr 26, 2004, at 6:55 PM, <Lin.Colin@iac.com.tw> wrote:

> When the compiled kernel, which is of ELF format, is loaded by ICE,=20
> ICE tries to put it to 0xc0200000 and then it produces an error=20
> because dram isn=A2=AE|t there.
>
> What=A2=AE|s wrong with my KERNEL_BASE_PHYS & KERNEL_BASE_VIRT =
setting?

Nothing is wrong with them.  You need to adjust your linker script to=20
provide explicit LMAs so that the ICE will load them at the physical=20
address, rather than trying to load them at the VMA (virtual address).

         -- Jason R. Thorpe <thorpej@wasabisystems.com>