易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

添加开机logo(amlogic open linux) 学习笔记

1、修改kernel配置(linux os)
在linux下,终端---进入编译目录,执行make k.menuconfig,
在弹出的配置窗口里选择Device Drivers-----Amlogic Devices Driver-----Amlogic Display Driver-----setup logo和logo on osd0
2、图片转换(windows os)
   a、打开BitmapDataGet.exe工具,选择32位。
b、选择加 ......

Linux 文件系统概述

Linux 文件系统概述
作者:北南南北
来自:LinuxSir.Org
摘要: 本文通过文件系统的定义说起,然后通过引文简单的介绍了一下文件系统类型;对Linux常用的ext2、ext3及reiserfs 根据本人使用经验也泛泛的谈了谈,但并不是专业的。如何阅读本文,还是用马克思理论告诉我们的方法:一分为二,边看边批吧;目录索引 一、什么 ......

Linux下安装MyEclipse

在安装完jdk以后,就来安装MyEclipse了。
 有一些安装了jdk以后没有生效,出现的还是1.4版本的。
所以安装MyEclipse7.0或者是6.5、6.6的都会出错
[root@gupt aaaa]# ll
总用量 380
dr-xr-xr-x  6 root root   4096
2009-01-17  configuration
-r--r--r--  1 root root   7 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号