Linux TAGS分析

來源:互聯網
上載者:User

Linux TAGS分析

1. "./arch/arm/kernel/vmlinux.lds.S" 192 行


 

 

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

 33                         INIT_TEXT

 34                 _einittext = .;

 35                 __proc_info_begin = .;

 36                         *(.proc.info.init)

 37                 __proc_info_end = .;

 38                 __arch_info_begin = .;

 39                         *(.arch.info.init)

 40                 __arch_info_end = .;

 41                    __tagtable_begin = .;

 42                         *(.taglist.init)               /*核心定義的Tags分析函數所在段*/

 43                    __tagtable_end = .;

 44                 . = ALIGN(16);

 45                 __setup_start = .;

 46                         *(.init.setup)

 47                 __setup_end = .;

 48                 __early_begin = .;

 49                         *(.early_param.init)

 50                 __early_end = .;

 51                 __initcall_start = .;

 52                         INITCALLS

 53                 __initcall_end = .;

 54                 __con_initcall_start = .;

 55                         *(.con_initcall.init)

 56                 __con_initcall_end = .;

 57                 __security_initcall_start = .;


2.__tagtable(tag, fn)的定義

./arch/arm/include/asm/setup.h


 

struct tagtable {

__u32 tag;

int (*parse)(const struct tag *);

};


#define tag_member_present(tag,member) /

((unsigned long)(&((struct tag *)0L)->member + 1) /

<= (tag)->hdr.size * 4)


#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size))

#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)


#define for_each_tag(t,base) /

for (t = base; t->hdr.size; t = tag_next(t))


#ifdef __KERNEL__


#define __tag __used __attribute__((__section__(".taglist.init")))

#define __tagtable(tag, fn) /

static struct tagtable __tagtable_##fn __tag = { tag, fn }

3.分析tags的函數 arch/arm/kernel/setup.c void __init setup_arch(char **cmdline_p)->parse_tags

 

static int __init parse_tag(const struct tag *tag)

{

extern struct tagtable __tagtable_begin, __tagtable_end;

struct tagtable *t;


for (t = &__tagtable_begin; t < &__tagtable_end; t++)

if (tag->hdr.tag == t->tag) {

t->parse(tag);

break;

}


return t < &__tagtable_end;

}

 

4.Bootloader中通常有如下函數:

 

setup_start_tag();

setup_memory_tags();

setup_commandline_tag(argc, argv);

setup_initrd_tag();

setup_end_tag();


5.Board參數定義

 

 

MACHINE_START(QT2410, "QT2410")

.phys_io = S3C2410_PA_UART,

.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,

.boot_params = S3C2410_SDRAM_PA + 0x100,

.map_io = qt2410_map_io,

.init_irq = s3c24xx_init_irq,

.init_machine = qt2410_machine_init,

.timer = &s3c24xx_timer,

MACHINE_END


 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.