linux kernel learning notes

问题:1.insmod: ERROR: could not insert module hello.ko: Invalid module format
解决:使用modprobe --force-modversion  强制插入  找相同版本内核
2./opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/ld: /home/centos/tiny6410/rootfs: No such file: File format not recognized
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] 错误 1
解决:make menuconfig的时候出现了问题。应该是设置installation options 下面的安装选项




1.linux体系结构:user space和kernel space。他们是程序执行的两种不同状态。通过系统调用和硬件中断能够完成从用户控件内核控件的转换


2.ARM7种工作模式:用户模式(usr)。快速终端(fiq)。外部终端(irq)。管理模式(svc)。数据访问终止(abt)。系统模式(sys)。未定义指令异常(und)


3.x86,用户代码运行在Ring3,内核代码运行在Ring0


4.linux内核架构:System call interface(SCI) Process Management(P,M)
Virtual File System(VFS) Memory Management(MM) Network Stack
Arch(体系结构相关的代码) 。Devic Drivers(DD)。


5.make clean (remove most generated files but keep the config)
make mrproper (remov all generated file+config files)


6.make menuconfig :基于文本模式的菜单型配


7.下载源码:www.kernel.org
编译内核:make zImage  获取详细编译信息:make zImage V=1
编译好的内核位于arch/<cpu>/boot/


5.内核模块的特点:模块本身并不被编译进内核文件
模块加载函数(必须)module_init();
模块卸载函数(必须)module_exit();
6.进入内核模块文件:insmod  ---加载  rmmod--卸载(rmmod hello)   lsmod--查看  modprobe---加载(会更加强大,能够自动找到依赖模块,直接加上hello)


7.GPL:开源代码的协议


8.模块参数:module_param  module_param(name,type,perm(访问权限));type常见值:bool,int,charp


9. uname -r    查看当前内核版本号


10.U-BOOT
1.嵌入式系统从软件上分的层次:bootloader-kernel-file system
2.RAM中运行程序比FLASH中快
3.arm-linux-gcc的安装
4.6410是小端处理器
5.下载uboot源码:ftp://ftp.denx.de/pub/u-boot/
6.printenv---查看环境变量
7. a.[root@localhost u-boot-mini6410]# make clean
make: “clean”是最新的。
b.vim Makefile 找到需要编译的选项
c.make mini6410_nand_config-ram256 
d.make CROSS_COMPILE=arm-linux-
e.进行u-boot烧写
8.uboot命令:
11.ARM-linux内核制作:
a.[root@localhost tiny6410]# cd linux-2.6.38/
b.[root@localhost linux-2.6.38]# make distclean
c.[root@localhost linux-2.6.38]# make menuconfig ARCH=arm(配置内核)
d.[root@localhost linux-2.6.38]# make uImage ARCH=arm CROSS_COMPILE=arm-linux-(编译内核)
e.编译完成后:linux-2.6.38/arch/arm/boot 中有一个uImage 
12.ARM根文件系统制作:
a.root@localhost tiny6410]# mkdir rootfs(建立一个总目录)
b.[root@localhost tiny6410]# cd rootfs
c.[root@localhost rootfs]# mkdir bin dev etc lib proc sbin sys usr mnt tmp var
d.[root@localhost rootfs]# cd usr
[root@localhost usr]# ls
[root@localhost usr]# mkdir bin lib sbin lib/moudles
e.创建设备文件:
cd /rootfs/dev
1.mknod -m 666 console c 5 1
2.mknod -m 666 null c 1 3
f.安装/etc
g.(内核模块编译)[root@localhost linux-2.6.38]# make modules ARCH=arm CROSS_COMPILE=arm-linux-
h.配置busybox(具体百度)[centos@localhost busybox-1.17.2]$ make menuconfig
i.编译和安装busybox make ARCH=arm CROSS_COMPILE=arm-linux-   [root@localhost busybox-1.17.2]# make ARCH=arm CROSS_COMPILE=arm-linux-


[root@localhost busybox-1.17.2]# make install
ll
j.(安装内核模块)[root@localhost linux-2.6.38]# make modules_install ARCH=arm INSTALL_MOD_PATH=../rootfs
k>检查是否安装根文件系统成功:1.home/tiny6410/rootfs/lib/modules/2.6.38-FriendlyARM/kernel/drivers/char查看这个目录下的模块是否安装成功
2.检查busybox是否安装成功。/home/tiny6410/rootfs/bin
13.initramfs格式的文件系统:
1.[root@localhost linux-2.6.38]# make menuconfig



2.进入根文件系统:
3.重新编译内核:[root@localhost linux-2.6.38]# make uImage ARCH=arm CROSS_COMPILE=arm-linux-
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值