LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux kernel module installation and other questions related to kernel module install (https://www.linuxquestions.org/questions/linux-newbie-8/linux-kernel-module-installation-and-other-questions-related-to-kernel-module-install-4175544401/)

yashgovin19 06-03-2015 02:17 PM

Linux kernel module installation and other questions related to kernel module install
 
I have installed Linux 3.5 kernel and have compiled e2fsprogs as well. I have my own version of ext3 file system - lets say it is myfs. I have compiled myfs as well. Now I have few questions:

1.How to insert myfs module and where? When I do modprobe myfs (.ko file) it says module not found. When I simply do insmod myfs.ko it works but I am not sure where is it putting the .ko file. Also the displays I have added (on mkdir call) are not showing up (kernel debug level is also set to 8) when I try to create a directory in mounted folder

Makefile in myfs directory looks like this:

KERNEL_TREE ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

obj-m := iext3.o

iext3-objs := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
ioctl.o namei.o super.o symlink.o hash.o resize.o ext3_jbd.o \
xattr.o xattr_user.o xattr_trusted.o acl.o xattr_security.o icefs.o \
transaction.o commit.o recovery.o checkpoint.o revoke.o journal.o

all:
make -C $(KERNEL_TREE) M=$(PWD) modules

clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.markers *.order *.symvers

and I am compiling myfs from my own directory: /home/myname/soft/myfs.

Also, I don't see any ext2/ext3/ext4 directories in /lib/modules/linuxversion/kernel/fs/ -- not sure if this is right or wrong.

2.Mount is working fine. I can see myfs is mounted on /dev/sda3 by doing df -a. When I unmount It says - umount: /home/..../mnt: not mounted and then if I do df -a the file system is unmounted. This is strange as its unmounting but still throwing error.

Some Background: Directory where I have everything: /home/soft myfs/ mye2fs/ Linux-3.5/ mnt/

Step1: cd Linux-3.5 --> 1) make 2) make modules 3) make modules_install 4) make install 5) reboot

Step2: compile myfs (my version of ext3) and insert the myfs kernel module --> cd myfs/ --> make --> insmod myfs.ko

Step3: compiled mye2fs for mkfs

Step4: use mye2fs to create myfilesystem on a device --> mount --> test printk statements put under myfs modules

suicidaleggroll 06-03-2015 02:33 PM

Quote:

Originally Posted by yashgovin19 (Post 5371674)
1.How to insert myfs module and where? When I do modprobe myfs (.ko file) it says module not found. When I simply do insmod myfs.ko it works but I am not sure where is it putting the .ko file.

You need to put it in the standard /lib/modules/... path so that modprobe can find it:
http://stackoverflow.com/questions/2...find-my-module

Insmod doesn't "put" the .ko file anywhere. It inserts it directly into the running kernel.

Quote:

Originally Posted by yashgovin19 (Post 5371674)
Also, I don't see any ext2/ext3/ext4 directories in /lib/modules/linuxversion/kernel/fs/ -- not sure if this is right or wrong.

Modules can either be loadable on the fly, or built directly into the kernel. The other ext filesystem modules are likely compiled directly into the kernel, they're not loadable modules like yours is.


All times are GMT -5. The time now is 06:26 PM.