nfs网络文件系统
smb 修改配置文件 sudo vim /etc/samba/smb.conf 重启服务 /etc/init.d/samba restart
自制小的文件系统
1.编译内核;2动态加载模块
mydev.c
#include<linux/init.h> #include<linux/module.h> #include<linux/kernel.h> #include<linux/fs.h> #include<linux/cdev.h> static struct cdev my_cdev;//内核内部使用struct cdev结构代表字符设备 static int my_dev_major=350; static dev_t my_devno; int hello_open(struct inode *pnode,struct file *filp)//funcation { printk(KERN_NOTICE "<1> hello"); } static struct file_operations my_cdev_ops={ //operations .open=hello_open,}; int my_proc_init(void) { my_devno=MKDEV(my_dev_major,0);//number of dev register_chrdev_region(my_devno,1,"my_cdev");//register qudong chengxu 在建立字符设备驱动时首先要获取设备号 cdev_init(&my_cdev,&my_cdev_ops);//内核在内部使用类型 struct cdev 的结构来代表字符设备,初始化一个字符设备 cdev_add(&my_cdev,my_devno,1);//cdev 结构建立, 最后的步骤是把它告诉内核 } static void test(void) { return 0; // printk("bye"); } module_init(my_proc_init); module_exit(test); MODULE_LICENSE("GPL");
Makefile:
obj-m:=mydev.o #obj-m:=说明要使用mydev.o建立一个模块 CURRENT_PATH:=$(shell pwd) LINUX_KERNEL:=$(shell uname -r) LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) all: make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules clean: make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean
参考链接:写一个简单的字符设备驱动http://blog.csdn.net/haomcu/article/details/44620725
HelloWorld 模块http://www.cnblogs.com/main-xlg/p/4042667.html
module_init();
module_exit()
obj-m +=
make -C //http://blog.sina.com.cn/s/blog_89fa41ef0100trjr.html
insmod ***.ko
lsmod展示动态加载的模块
sudo rmmod ×× //注销
#include<linux/init.h>
#include<linux/fs.h>
#include<cdev.h>
#Include<linux/module.h>
static struct cdev my_cdev;
static int my_dev_major=350;
static dev_t my_devno;
int hello_open( struct inode *pnode,struct file *pfile)
{ptintk("hello"); }
static struct file_operations my_cdev_ops={
.open=hello_open,}
int my_proc_init(void)
{
my_devno=MKDEV(my_dev_major,0);
register_chrdev_region(my_devno,1,"hello");
cdev_init(&my_cdev,&my_cdev_ops);
cdev_add(&my_dev,my_devno,1);//注册
}
sudo mknod my_dev c 350 0
stat my_dev
ctags:
http://www.cnblogs.com/chijianqiang/archive/2012/12/17/vim-4.html
多种插件:http://blog.csdn.net/bokee/article/details/6633193
make tags
set tags=/usr/
编译内核:http://www.cnblogs.com/wang_yb/p/3899439.html