首页 技术 正文
技术 2022年11月15日
0 收藏 478 点赞 3,310 浏览 2078 个字

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=;
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,);//number of dev
register_chrdev_region(my_devno,,"my_cdev");//register qudong chengxu 在建立字符设备驱动时首先要获取设备号 cdev_init(&my_cdev,&my_cdev_ops);//内核在内部使用类型 struct cdev 的结构来代表字符设备,初始化一个字符设备
cdev_add(&my_cdev,my_devno,);//cdev 结构建立, 最后的步骤是把它告诉内核
}
static void test(void)
{
return ;
// 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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,493
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,495
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,133
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,297