Compile Linux Kernel Modules
我正在学习写linux device driver for embedded system.
我有一个linux嵌入式设备,也有这个设备的linux源代码。也有cross compiler tool chain.
第一步,就是写一个简单的hello模块,然后装到设备中。以验证我这个开发环境。
在网上搜索了一下, how to cross compile linux device driver
发现在linux代码根目录的Makefile中有关于cross compile的描述
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
#
# When performing cross compilation for other architectures ARCH shall be set
# to the target architecture. (See arch/* for the possibilities).
# ARCH can be set during invocation of make:
# make ARCH=ia64
# Another way is to have ARCH set in the environment.
# The default ARCH is the host where make is executed.
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
只要指定ARCH和CROSS_COMPILE就可以了。
在我的这个Makefile中,已经指定了ARCH=arm,CROSS_COMPILE=arm-linux-
因为在编译module的时候,使用的是内核构造系统,也就是使用的上面所说的这个在内核源码根目录的Makefile。所以我就不需要在我调用make的命令行中指定ARCH和CROSS_COMPILE了。
用来测试的hello模块的源码来自 http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html
hello.c
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
printk(KERN_INFO "Hello world\n");
return 0;
}
static void
相关文档:
由于 fc3 内核默认 fat32 文件系统字符编码是 ascii,如果优盘的文件名包含中文,那么在转换时会出问题,应用程序就会失去响应。具体的表现有多种,比如桌面假死,关机时提示无法卸载分区等等
解决的办法是在挂载时,根据语言环境 locale 的值,使用挂载参数。如果是 UTF- ......
一、Uboot烧录
1、连接jtag、网线、串口
2、把tftpd32.exe放到uboot烧录的目录里
3、启动tftpd32.exe
4、启动ttermpro.exe
5、双击uboot.bat
6、等到窗口弹出来
8、在串口工具中
1、 执行print 命令,查看环境变量
2、执行setenv serverip 具体IP 地址,配置tftp server 的地址等
3、执行setenv loadaddr 8200000 ......
1. I/O Port
和硬件打交道离不开I/O Port,老的ISA设备经常是占用实际的I/O端口,在linux下,操作系统没有对I/O口屏蔽,也就是说,任何驱动程序都可对任意的I/O口操作,这样就很容易引起混乱。每个驱动程序应该自己避免误用端口。
有两个重要的kernel函数可 ......
•所有编译调试命令都在ui_ref/trunk/bld_xxx下面执行,具体哪个bld要根据您使用的板子决定;
•Make #编译全部,包括kernel, busybox, packages等;
•Make root #编译文件系统;
•Make yaffs#把文件系统打包生成yaffs文件系统的映像rootfs.yaffsimage,并保存在build目录;
•编译内核
▫Make k. ......
Linux 文件系统概述
作者:北南南北
来自:LinuxSir.Org
摘要: 本文通过文件系统的定义说起,然后通过引文简单的介绍了一下文件系统类型;对Linux常用的ext2、ext3及reiserfs 根据本人使用经验也泛泛的谈了谈,但并不是专业的。如何阅读本文,还是用马克思理论告诉我们的方法:一分为二,边看边批吧;目录索引 一、什么 ......