From: egger@slsvaat.sel.de (Jochen Egger Fa. SSW US/ESS B.60/1/15 #3578)
Subject: Re: modload limit on SunOS 4.1.3
Organization: SEL-Alcatel LTS Dept. US/ES
X-Newsreader: Tin 1.1 PL3
Date: Thu, 17 Dec 92 16:56:38 GMT

alan@metadigm.co.uk (Alan McRae) writes:
: Openwindows, Sun-PC, CoPoP (parallel port driver), ... use
: modload to load kernel modules. I don't know if its the number
: of modules or the total size but currently I appear to have a limit
: of 3 modules after which no more can be loaded.
: 
: Can this be increased and how?
: 
: ---
: Alan McRae                                     | Phone: +44 223 871577
: Metadigm Ltd                                   | Fax:   +44 223 873032 (G3)
: 33 West Green,Barrington,Cambridge,UK,CB2 5RZ  | Email: alan@metadigm.co.uk
: "True wisdom must comprise some nonsense as a compromise..." -- Piet Hein
: 

Hmm..., might be true, I thought 4 are possible, at least on 4.1.2. However
in 4.1.2 and 4.1.3 there are only 3 or 4 unused driver slots in the standard
kernel. But you can patch this very easily.
We had a similar problem.
We wanted to attach a SparcPrinter to a SS2 running ISDN software.
The ISDN software uses to load 4 modules at runtime. The NewsPrint software
wanted to load an additional module to run the SparcServer via the video
interface.

To increase the number of supported modules, you have to change your
/sys/sun4/conf.c (I hope you are using sun4) the following way:

At about line 1108 you will find 3 elements of an array of datastructures
which reserve the space for the unused driver slots. Yank one of them in
a buffer:
  
------------ CUT --------------
   {
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   /*59*/
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   0,
        0,              0,
    },
------------ CUT --------------

go down to the end of the array, almost until the end of the file (5 lines
before). This should look as follows:

------------ CUT --------------
    {
        nodev,          nodev,          nodev,          nodev,          /*104*/
        nodev,          nodev,          nodev,          0,
        lightpentab,          0,
    },
};

int     nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);

int     mem_no = 3;     /* major device number of memory special file */
int     dump_no = 41;   /* major device number of dump special file */
------------ CUT --------------

Paste the buffer as often to the end of the array, as may as free slots
you need.


If you add 3 more slots, it will look as follows:

------------ CUT --------------
    {
        nodev,          nodev,          nodev,          nodev,          /*104*/
        nodev,          nodev,          nodev,          0,
        lightpentab,          0,
    },
    {
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   /*105*/
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   0,
        0,              0,
    },
    {
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   /*106*/
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   0,
        0,              0,
    },
    {
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   /*107*/
        vd_unuseddev,   vd_unuseddev,   vd_unuseddev,   0,
        0,              0,
    },
};

int     nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);

int     mem_no = 3;     /* major device number of memory special file */
int     dump_no = 41;   /* major device number of dump special file */
---------- CUT --------------

After the modification in the file, you have to recompile your kernel with
your favourite configuration.
This has worked fine for a SS2 running SunOS4.1.2.


Have fun,
--
-----------------------------------------------------------------------------
Jochen Egger              |
                         < >              intentionally left blank
egger@us-es.sel.de        |
--------------------------+--------------------------------------------------






Newsgroups: comp.sys.sun.admin,comp.unix.programmer