linux2.6内核中如何添加新的文件系统
2009-10-09 20:01
901 查看
《边干边学 - linux内核指导》中教授了如何在2.4内核中添加myext2文件系统的方法。2.6内核中文件组织稍有变化,通过试验,方法如下:
1. 将fs/ext2拷贝一份为fs/myext2
2. cd fs/myext2
3. sed -i "s/ext2/myext2/g" * //将fs/myext2目录下出现的所有ext2替换为myext2
4. sed -i "s/EXT2/MYEXT2/g" * //将fs/myext2目录下出现的所有EXT2替换为MYEXT2
5. 复制include/linux/ext2_fs.h 和 include/linux/ext2_fs_sb.h 为myext2_fs.h 和 myext2_fs_sb.h,并类似于3、4替换所有ext2为myext2 (大写和小写)
6. cp include/asm-generic/bitops/ext2-non-atomic.h asm-generic/bitops/myext2-non-atomic.h,然后替换所有ext2为myext2(大写和小写)
7.在 include/asm/bitops.h中添加如下内容:
8. 修改make menuconfig中的编译选项:
vi fs/Kconfig
照着EXT2的写就行了。
make menuconfig看一下,是不是发现多了几个编译选项?
9. make menuconfig
10. make -j4
11. make modules
12. make modules_install
13. make install
查看一下grub的配置(vi /etc/grub.conf)
重启即可。
1. 将fs/ext2拷贝一份为fs/myext2
2. cd fs/myext2
3. sed -i "s/ext2/myext2/g" * //将fs/myext2目录下出现的所有ext2替换为myext2
4. sed -i "s/EXT2/MYEXT2/g" * //将fs/myext2目录下出现的所有EXT2替换为MYEXT2
5. 复制include/linux/ext2_fs.h 和 include/linux/ext2_fs_sb.h 为myext2_fs.h 和 myext2_fs_sb.h,并类似于3、4替换所有ext2为myext2 (大写和小写)
6. cp include/asm-generic/bitops/ext2-non-atomic.h asm-generic/bitops/myext2-non-atomic.h,然后替换所有ext2为myext2(大写和小写)
7.在 include/asm/bitops.h中添加如下内容:
#include <asm-generic/bitops/ext2-non-atomic.h> #define ext2_set_bit_atomic(lock,nr,addr) / test_and_set_bit((nr),(unsigned long*)addr) #define ext2_clear_bit_atomic(lock,nr,addr) / test_and_clear_bit((nr),(unsigned long*)addr) #include <asm-generic/bitops/myext2-non-atomic.h> #define myext2_set_bit_atomic(lock,nr,addr) / test_and_set_bit((nr),(unsigned long*)addr) #define myext2_clear_bit_atomic(lock,nr,addr) / test_and_clear_bit((nr),(unsigned long*)addr)
8. 修改make menuconfig中的编译选项:
vi fs/Kconfig
config FS_XIP # execute in place bool depends on EXT2_FS_XIP default y config MYEXT2_FS tristate "My Second extended fs support" help Myext2 is a experimental filesystem To compile this file system support as a module, choose M here: the module will be called myext2. Be aware however that the file system of your root partition (the one containing the directory /) cannot be compiled as a module, and so this could be dangerous. If unsure, say Y. config MYEXT2_FS_XATTR bool "Ext2 extended attributes" depends on MYEXT2_FS help Extended attributes are name:value pairs associated with inodes by the kernel or by users (see the attr(5) manual page, or visit <http://acl.bestbits.at/> for details).
照着EXT2的写就行了。
make menuconfig看一下,是不是发现多了几个编译选项?
9. make menuconfig
10. make -j4
11. make modules
12. make modules_install
13. make install
查看一下grub的配置(vi /etc/grub.conf)
重启即可。
相关文章推荐
- 如何将自己的模块添加到Linux 2.6内核的配置系统中
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- 第二部分 s3c2440 移植linux内核 添加网卡支持 yaffs2文件系统支持
- Linux系统中如何添加自己的库文件路径
- Linux 内核使用register_filesystem添加自定义文件系统deanfs
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- Linux系统中如何添加自己的库文件路径
- notify -- Linux 2.6 内核中的文件系统变化通知机制
- Linux系统中如何添加自己的库文件路径
- Linux系统中如何添加自己的库文件路径
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- 用Linux 2.6内核中的文件系统变化通知机制inotify可实现跨机文件同步
- [转]详解Linux 2.6内核新文件系统变化机制(inotify)
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- Linux系统如何添加普通用户到 sudoers 文件
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- inotify -- Linux 2.6 内核中的文件系统变化通知机制