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
相关文档:
1、总结背景
在linux系统下,如果你下载并安装了应用程序,很有可能在键入它的名称时出现“command not
found”的提示内容。如果每次都到安装目标文件夹内,找到可执行文件来进行操作就太繁琐了。这涉及到环境变量PATH的设置问题,而PATH的设置也
是在linux下定制环境变量的一个组成部分。本案例基于RedHat ......
一、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、修改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 文件系统概述
作者:北南南北
来自:LinuxSir.Org
摘要: 本文通过文件系统的定义说起,然后通过引文简单的介绍了一下文件系统类型;对Linux常用的ext2、ext3及reiserfs 根据本人使用经验也泛泛的谈了谈,但并不是专业的。如何阅读本文,还是用马克思理论告诉我们的方法:一分为二,边看边批吧;目录索引 一、什么 ......
brctl addbr br0
ifconfig br0
br0 MAC is 00:00:00:00:00:00
brctl addif br0 eth1 (eth1 is xx:xx:xx:xx:xx:33)
ifconfig br0
br0 MAC is xx:xx:xx:xx:xx:33 same as eth1, auto change
brctl addif br0 eth2 (eth2 is xx:xx:xx:xx:xx:30)
ifconfig br0
br0 MAC is xx:xx:xx:xx:xx:30 sa ......