关于嵌入式设备上的Linux 系统开发

[11-20 15:52:47]   来源:http://www.88dzw.com  arm嵌入式   阅读:8998

文章摘要:output_ARCH(<arch>) /* <arch> includes architecture type */ENTRY(stext) /* stext is the kernel entry point */SECTIONS /* SECTIONS command describes the layoutof the output file */{. = TEXTADDR; /* TEXTADDR is LMA for the kernel */.init : {

关于嵌入式设备上的Linux 系统开发,标签:arm嵌入式系统,arm系统,http://www.88dzw.com

  output_ARCH(<arch>)      /* <arch> includes architecture type */

  ENTRY(stext)               /* stext is the kernel entry point */

  SECTIONS                   /* SECTIONS command describes the layout

  of the output file */

  {

  .  = TEXTADDR;         /* TEXTADDR is LMA for the kernel */

  .init : {          /* Init code and data*/

  _stext = .;       /* First section is stext followed

  by __init data section */

  __init_begin = .;

  *(.text.init)

  __init_end = .;

  }

  .text : {          /* Real text segment follows __init_data section */

  _text = .;

  *(.text)

  _etext = .;       /* End of text section*/

  }

  .data :{

  _data=.;          /* Data section comes after text section */

  *(.data)

  _edata=.;

  }                  /* Data section ends here */

  .bss : {                   /* BSS section follows symbol table section */

  __bss_start = .;

  *(.bss)

  _end = . ;        /* BSS section ends here */

  }

  }

  LMA 是装入模块地址;它表示将要装入内核的目标虚拟内存中的地址。 TEXTADDR 是内核的虚拟起始地址,并且在 arch/<target>/ 下的 Makefile 中指定它的值。这个地址必须与引导装载程序使用的地址相匹配。

  一旦引导装载程序将内核复制到闪存或 DRAM 中,内核就被重新定位到 TEXTADDR — 它通常在 DRAM 中。然后,引导装载程序将控制转给这个地址,以便内核能开始执行。

  参数传递和内核引导

  stext 是内核入口点,这意味着在内核引导时将首先执行这一节下的代码。它通常用汇编语言编写,并且通常它在 arch/<target>/ 内核目录下。这个代码设置内核页面目录、创建身份内核映射、标识体系结构和处理器以及执行分支 start_kernel (初始化系统的主例程)。

  start_kernel 调用 setup_arch 作为执行的第一步,在其中完成特定于体系结构的设置。这包括初始化硬件寄存器、标识根设备和系统中可用的 DRAM 和闪存的数量、指定系统中可用页面的数目、文件系统大小等等。所有这些信息都以参数形式从引导装载程序传递到内核。

  将参数从引导装载程序传递到内核有两种方法:parameter_structure 和标记列表。在这两种方法中,不赞成使用参数结构,因为它强加了限制:指定在内存中,每个参数必须位于 param_struct 中的特定偏移量处。最新的内核期望参数作为标记列表的格式来传递,并将参数转化为已标记格式。 param_struct 定义在 include/asm/setup.h 中。它的一些重要字段是:

  清单 3. 样本参数结构

  struct param_struct  {

  unsigned long page_size;     /* 0:  Size of the page  */

  unsigned long nr_pages;      /* 4:  Number of pages in the System */

  unsigned long ramdisk        /* 8: ramdisk size */

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  下一页


Tag:arm嵌入式arm嵌入式系统,arm系统arm嵌入式

《关于嵌入式设备上的Linux 系统开发》相关文章

分类导航
最新更新
热门排行