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

Linux设备驱动程序学习之基础篇


Linux设备驱动程序学习笔记系列文章原作者是:Tekkaman Ninja,他博客地址:
http://blog.chinaunix.net/u1/34474/showart_404278.html
在此向Tekkaman Ninja表示感谢,写出这么好的文章,使我少走了很多弯路。
Linux设备驱动程序学习(0)-Hello, world!模块
文章来源:http://blog.chinaunix.net/u2/62910/showart_492083.html
一个学习Linux设备驱动程序都会碰到的第一个例程:
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
    printk(KERN_ALERT "Hello, Tekkaman Ninja !\n");
    return 0;
}
static void hello_exit(void)
{
    printk(KERN_ALERT "Goodbye, Tekkaman Ninja !\n Love Linux !Love ARM ! Love KeKe !\n");
}
module_init(hello_init);
module_exit(hello_exit);
我将其复制到我的工作目录,并编写了一个简单的Makefile文件:
KERNELDIR = /home/tekkaman/working/SBC2440/linux-2.6.22.2
    # The current directory is passed to sub-makes as argument
PWD := $(shell pwd)
INSTALLDIR = /home/tekkaman/working/rootfs/lib/modules
CROSS_COMPILE    =/home/tekkaman/working/crosstool-gcc410-k26222/gcc-4.1.0-glibc-2.3.2/arm-9tdmi-linux-gnu/bin/arm-9tdmi-linux-gnu-
CC    = $(CROSS_COMPILE)gcc
obj-m := hello.o
modules:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
    cp hello.ko $(INSTALLDIR)
clean:
    rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
说实话,以上是我参考了《Linux设备驱动程序(第3版)》的Makefile源码修改得来的。我对Makefile不是很了解,是该好好学习学习了!
然后就是make  modules 、 make  modules_install 。
[root@Tekkaman-Ninja Helloworld]# make modules
make -C /home/tekkaman/working/SBC2440/linux-2.6.22.2 M=/home/tekkaman/working/Linuxdriver/Helloworld modules
make[1]: Entering directory `/home/tekkaman/working/SBC2440/linux-2.6.22.2


相关文档:

linux权限说明

查看文件权限的语句:
 
  在终端输入:
 
  ls -l xxx.xxx (xxx.xxx是文件名)
 
  那么就会出现相类似的信息,主要都是这些:
 
  -rw-rw-r——
 
  一共有10位数
 
  其中: 最前面那个 - 代表的是类型
 
  中间那三个 rw- 代表的是所有者(user)
 
  然后那三个 r ......

UBUNTU一句话技巧 Linux入门(给新手)

查看软件xxx安装内容
dpkg -L xxx
 
 
查找软件
apt-cache search 正则表达式
 
 
查找文件属于哪个包
dpkg -S filename           apt-file search filename
 
 
查询软件xxx依赖哪些包
apt-cache depends xxx
 
查询 ......

Linux下mysql中文乱码解决方法

上次在碰到这问题,在网上找了解决方法,可是没记下来。这星期要换机器,要把原来linux下的mysql数据库移到另一台服务器上。安装suse系统、再配置telnet、ftp服务、安装java JDK并配置、再安装eclipse和mysql,又花了一天的时间。感觉还是不熟练,配置防火墙老是不能将telnet和ftp服务排外。mysql又碰到了中文乱码问题,又在 ......

linux编程基础—文件I/O编程

    Linux文件I/O主要由read、write、open、close、lseek五个函数组成;
一、文件描述符
    在嵌入式Linux中每打开一个文件都有一个描述符与之对应,该描述符是一个非负整数;
    当用open打开或新建一个文件时,该函数的返回值就是该文件的描述符;
   ......

Fedora Linux 下安装 source navigator 的 bug shoot!

安装后
运行snavigator
出现
Can't find a usable tk.tcl in the following directories: 
/opt/sourcenav/share/tk8.3
/opt/sourcenav/share/tk8.3/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号