Linux每日一记(2014-6-4)

来源:互联网 发布:excel 示例数据 编辑:程序博客网 时间:2024/06/05 07:30

Linux交叉编译器

  1. 下载解压编译器压缩包
  2. 将压缩包中/bin路径包括进PATH环境变量

                  可修改~/.profile(针对用户)

                  修改/etc/profile(针对全部)

                  添加export PATH=$PATH:path

        3. source ~/.profile或者source /etc/profile重新载入配置文件


arm-linux-gcc出现no such file or directory:

ubuntu14.04系统64位,arm-linux-gcc为32位,要安装兼容包

sudo apt-get install ia32-libs

(tq提供的交叉编译器4.3.3不行。。。3.4.5可以。。。解压后在同一目录下,老是出现ccl没找到。。。坑爹阿,让我调了一晚上。。。根本没问题。。。)


Linux模块

模块参数:

module_param(name, type, perm)

name:模块参数名称

type:参数类型(常见,bool,int,charp(字符串型))

perm:参数访问权限

代码例程:

#include <linux/init.h>#include <linux/module.h>#define DEBUG_ENABLE#define _KERNEL_#include "debug.h"#include "debug.h"MODULE_LICENSE("Dual BSD/GPL");static char     *str = "songruiwang";static intnum = 12;module_param(str, charp, S_IRUGO);module_param(num, int, S_IRUGO);static inthello_init(void){printk(KERN_WARNING "%s %d", str, num);return(0);}static voidhello_exit(void){DEBUG("%s", "Goodbye, cruel world\n");}module_init(hello_init);module_exit(hello_exit);

使用方式:

insmod hello.ko str="song" num=10


内核符号导出

让其他内核模块可以使用本模块的函数或者变量

EXPORT_SYMBOL(functionname/variablename);

所有导出的符号在/proc/kallsyms中查询


BootLoader初始化

  1.  

硬件设备初始化

为加载BootLoader的stage2准备RAM空间

拷贝BootLoader的stage2到RAM空间中

设置好堆栈

跳转到stage2的C入口点

       2.

初始化本阶段要使用到的硬件设备

将内核映像和根文件系统映像从flash上读到RAM中

调用内核
0 0
原创粉丝点击