If Windows 7 has become mainstream, Will Linux Become a non-mainstream operating system. In Linux, there are still many user groups. After studying how to install and uninstall the Linux operating system file system for a long time, I would like to share my learning experience with you. I hope this will be an inspiration for those who do not know about it.
Take the installation of minix file system under Fedora8 as an example:
To ensure matching with the system kernel, first obtain the minix source code of the corresponding version. First, query the kernel version of the local machine through uname-r:
[Cocobear @ cocobear ~] $ Uname-r
2.6.24.4-64. fc8
On the Kernel.org homepage, we can get the source code of 2.6.24.4-64 kernel. In fact, we only need the code in the linux-2.6.24.4/fs/minix/directory. Because we do not need to re-compile the entire kernel, we only need -. 6.24.4/fs/minix/directory write a Makefile to generate the corresponding minix. ko.
Before writing Makefile, make sure that the system has installed the following packages:
- [cocobear@cocobear ~]$ rpm -qa | grep kernel
- kernel-devel-2.6.24.4-64.fc8
- kernel-headers-2.6.24.4-64.fc8
- kernel-2.6.24.4-64.fc8
It is required in the module compilation process.
There is already a Makefile in the source code:
- #
- # Makefile for the Linux minix filesystem routines.
- #
- obj-$CONFIG_MINIX_FS) += minix.o
- minix-objs := bitmap.o itree_v1.o itree_v2.o namei.o inode.o file.o dir.o
Modify the file:
- #
- Makefile for the Linux minix filesystem routines.
- # make minix fs as kernel module
- obj-m += minix.o
- minix-objs := bitmap.o itree_v1.o itree_v2.o namei.o inode.o file.o dir.o
- KERNELDIR:=/lib/modules/$shell uname -r)/build
- PWD:=$shell pwd)
- default:
- make -C $KERNELDIR) M=$PWD) modules
- clean:
- rm -rf *.o *.mod.c *.ko *.symvers
Here is a simple explanation. obj-m indicates that the file will be compiled as a module, because this module is composed of multiple files and uses the module name plus-objsminix-objs) suffix to define the module composition file. KERNELDIR defines the location of the code tree, PWD defines the location of the current folder, and the-C option in the make command specifies the location of the code tree given by KERNELDIR), M = $ PWD) specifies the current build work.
The last line clears the files generated during the compilation process.
After Makefile is complete, we can start to compile the file system module, and directly input make to start compiling:
- [cocobear@cocobear minix]$ make
- make -C /lib/modules/2.6.24.4-64.fc8/build M=/home/cocobear/minix modules
- make[1]: Entering directory `/usr/src/kernels/2.6.24.4-64.fc8-i686′
- CC [M] /home/cocobear/minix/bitmap.o
- CC [M] /home/cocobear/minix/itree_v1.o
- CC [M] /home/cocobear/minix/itree_v2.o
- CC [M] /home/cocobear/minix/namei.o
- CC [M] /home/cocobear/minix/inode.o
- CC [M] /home/cocobear/minix/file.o
- CC [M] /home/cocobear/minix/dir.o
- LD [M] /home/cocobear/minix/minix.o
- Building modules, stage 2.
- MODPOST 1 modules
- CC /home/cocobear/minix/minix.mod.o
- LD [M] /home/cocobear/minix/minix.ko
- make[1]: Leaving directory `/usr/src/kernels/2.6.24.4-64.fc8-i686′
After compilation, the minix. ko file is generated at present. This is what we need. You can install the minix file system module by using the insmod command. Of course, the root permission is required here. Let's demonstrate how to load the minix module:
[Cocobear @ cocobear minix] $ cat/proc/modules | grep minix
[Cocobear @ cocobear minix] $
Here we can see that minix is not loaded. We use the insmod minix. ko command:
[Cocobear @ cocobear minix] $ sudo insmod minix. ko
[Cocobear @ cocobear minix] $ cat/proc/modules | grep minix
Minix 28676 0-Live 0xd0e7d000
After insmod, we can see from the above information that the minix module has been loaded. If you do not need to use this module, we can easily uninstall it: [cocobear @ cocobear minix] $ sudo rmmod minix. ko
[Cocobear @ cocobear minix] $ cat/proc/modules | grep minix
[Cocobear @ cocobear minix] $
By now, we have successfully completed the installation, uninstallation, and compilation of the Linux operating system file system.
- Setting Linux to delete automatic backup saves system space
- Configure and use Samba to share directories in Linux
- Abandon the Linux operating system and select Microsoft?
- Better online shopping for Linux Online Banking
- Business empire's "cloud computing" Linux operating system