Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1636901
  • 博文数量: 511
  • 博客积分: 967
  • 博客等级: 准尉
  • 技术积分: 2560
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-06 14:19
文章分类

全部博文(511)

文章存档

2016年(11)

2015年(61)

2014年(257)

2013年(63)

2012年(119)

分类: LINUX

2012-12-29 10:23:21

vmlinux.lds.S 链接脚本
SECTIONS
{
 .init : {
  INIT_CALLS
  CON_INITCALL-----------> #define CON_INITCALL       \         
  SECURITY_INITCALL          VMLINUX_SYMBOL(__con_initcall_start) = .;  \
  INIT_RAM_FS                *(.con_initcall.init)     \       
 }                              VMLINUX_SYMBOL(__con_initcall_end) = .;         
 }    
}
在init.h里面有这么一句宏定义啊
#define console_initcall(fn) \
 static initcall_t __initcall_##fn \
 __used __section(.con_initcall.init) = fn
串口驱动----> 
\drivers\amlogic\uart\uart\am_uart.c
static int __init am_uart_console_init(void)
{
 register_console(&am_uart_console);
 return 0;
}
console_initcall(am_uart_console_init);
static void __exit am_uart_exit(void)
{
#if 0
#ifdef CONFIG_AM_UART_CONSOLE
        unregister_console(&am_uart_console);
#endif
#endif
       platform_driver_unregister(&am_uart_platform_driver);
 uart_unregister_driver(&am_uart_reg);
}
module_init(am_uart_init);===============>在启动的时候去调用初始化串口
module_exit(am_uart_exit);
看到这里,我想大家都懂了
 
阅读(1873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~