Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Methods of installing and uninstalling file system in Linux operating system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the installation and uninstallation method of Linux operating system file system". In the daily operation, I believe that many people have doubts about the installation and uninstallation method of Linux operating system file system. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "installation and uninstallation method of Linux operating system file system". Next, please follow the editor to study!

Take mounting the minix file system under Fedora8 as an example:

In order to match the kernel of the system, you must first obtain the source code of the corresponding version of minix. First, query the kernel version of the machine through uname-r:

[cocobear@cocobear] $uname-r

2.6.24.4-64.fc8

The source code for the 2.6.24.4-64 kernel is available on the Kernel.org home page, but all we need is the code in the linux-2.6.24.4/fs/minix/ directory. Because we don't need to recompile the entire kernel, we just need to write a Makefile in the linux- .6.24.4 / fs/minix/ directory and generate the corresponding minix.ko.

Before you start writing Makefile, make sure that the system has the following packages installed:

[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 needs to be used in the process of module compilation.

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 to:

# 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) KERNELDIR $(PWD) modules clean: rm-rf * .o * .mod.c * .ko * .symvers

To explain briefly here, obj-m indicates that the file will be compiled as a module; because the module consists of multiple files, the module name is suffixed with-objs (minix-objs) to define the component file of the module. KERNELDIR defines the location of the code tree, PWD defines the current folder location, while the-C option in the make command specifies the location of the code tree (given by KERNELDIR), and PWD $(build) specifies the current build work.

The * * line cleans up the files generated by the compilation process.

After completing the Makefile, we can start compiling the filesystem module. Type make directly and 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.fc8muri686' 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.fc8muri i686'

After the compilation, we will now generate the minix.ko file. This is what we need. We can install the minix filesystem module using the insmod command. Of course, root permission is required here. Let's demonstrate the loading of the minix module:

[cocobear@cocobear minix] $cat / proc/modules | grep minix

[cocobear@cocobear minix] $

You can see here that minix is not loaded, so 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 we do not need to use this module, we can also easily uninstall it: [cocobear@cocobear minix] $sudo rmmod minix.ko.

[cocobear@cocobear minix] $cat / proc/modules | grep minix

[cocobear@cocobear minix] $

At this point, on the "Linux operating system file system installation and uninstallation methods" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report