LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-22-2005, 12:29 PM   #1
dplazz
LQ Newbie
 
Registered: Jul 2005
Distribution: RedHat AS4
Posts: 5

Rep: Reputation: 0
Modifying / replacing a kernel module


I recently created a thread asking for input on how to increase the number of loop devices allowed by the kernel. I ended up find a solution after many hours of trolling forums and newgroups. The solution is to unload the "loop.ko" module (/sbin/./rmmod /lib/modules/2.6.9-11.ELsmp/kernel/drivers/block/loop.ko) and then reloading it with an additional "max_loop=255" parameter (/sbin/./insmod /lib/modules/2.6.9-11.ELsmp/kernel/drivers/block/loop.ko max_loop=255). This works perfectly, even the extra loop devices spawn in /dev. The problem is that everything reverts on reboot. After a reboot, it's back to only allowing 8 loop devices (instead of the 255 I changed it to).

Does anyone know a way that I can modify the loop.ko module, replace the loop.ko module, or add these commands to a startup script to make sure that I have access to all 255 loop devices on the next boot?
 
Old 07-22-2005, 03:14 PM   #2
bruce ford
Member
 
Registered: Jul 2004
Location: Munich, Germany
Distribution: Sun Solaris 8, SuSE 9.0
Posts: 43

Rep: Reputation: 15
Quote:
Does anyone know a way that I can modify the loop.ko module, replace the loop.ko module, or add these commands to a startup script to make sure that I have access to all 255 loop devices on the next boot?
How about getting the kernel src, locating the file kernel/drivers/block/loop.c and changing your value there:

Code:
#include <asm/uaccess.h>

#include <linux/loop.h>		

#define MAJOR_NR LOOP_MAJOR

static int max_loop = 8;
static struct loop_device *loop_dev;
static int *loop_sizes;
After recompiling the kernel source, you can replace your module (/lib/modules/2.6.9-11.ELsmp/kernel/drivers/block/loop.ko)
by the newly compiled one.

Or: create a startup skript like (I don't know the exact syntax of the insmod/rmmod cmds in kernel 2.6.x):
Code:
case "$1" in
    start)
        echo -n "Reloading loopback module"
        /sbin/rmmod loop.ko
        /sbin/insmod loop.ko max_loop=255
       ;;
esac
and put it in your /etc/rc.d dir and reference it from an appropriate runlevel dir.

-bruce

Last edited by bruce ford; 07-22-2005 at 03:15 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 06:34 PM
bootsplash causes kernel panic after modifying initrd bewareofthesnowman Linux - Software 2 02-28-2006 06:33 PM
Trouble replacing a kernel module with the latest version Khang Linux - General 2 11-02-2004 09:56 AM
modifying TCP packets using kernel module shinkm Linux - Networking 2 09-02-2004 09:37 AM
kernel module ignorant newbie looking for any one with kernel module knowledge cpoet Slackware 4 11-24-2003 09:37 PM


All times are GMT -5. The time now is 01:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration