SUMMARY: Kernel mod using adb

From: Andy Kumeda (kumeda@tds.com)
Date: Thu May 19 1994 - 02:50:58 CDT


Original post:
 
# Hardware: Tadpole SPARCbook 3
# Software: Solaris 1.1.1
#
# How can I go about modifying the kernel using adb to do the following:
#
# Increase the shared memory size (SHMSIZE) to => 0x20000
# Increase the number of semaphores (SEMMNS) to => 640
# Increase the number of shared memory identifiers (SHMMNI) to => 256
#
# I cannot define these parameters in the kernel config files or the
# header files because I am lacking a kernel patch required to fix a mouse
# bug so that I can create a new kernel.
#
# (Note: this should be of interest to all those who wish to run Sybase
# and use an external mouse on a SPARCbook 3 with SunOS 4.1.3_U1.)
#

I received several responses, of which one did the trick -- thanks Nate
Itkin. (I will include his response below.) Also, Mike Raffety
included a nice script to increase the shared memory size, which I will
also include. The only problem with his script was that it only
modified the shared memory size, and I also needed to deal with
semaphores and shared memory identifiers also, but nevertheless, it does
work if you wish to only increase shared memory.

The others suggested that it was dangerous to modify the kernel -- so
far, I have not had any problems. Both Sybase and the external mouse
(along with the rest of the OS) functions normally. (One strange thing
I did notice though, thinking it was related to the kernel mod, PID's 3
and 4 show up as being blank. It turns out that this is 'normal'.
Anyone know what is causing this? I'm assuming that these are
Tadpole-related processes.)

Thanks to the following for their suggestions:
        Nate Itkin <Nate-Itkin@ptdcs2.intel.com>
        Mike Raffety <mike_raffety@il.us.swissbank.com>
        rwolf@dretor.dciem.dnd.ca
        allyn@bigbird.ca.boeing.com (Mark Allyn)
        grs@claircom.com (Gregg Siegfried)
        Barry Margolin <barmar@Think.COM>

---------------- 8< cut here -------------- >8 -----------------

>From Nate Itkin <Nate-Itkin@ptdcs2.intel.com>:

I can tell you how to change the IPC info structures, but I'm not sure
it will work correctly. I have never gone deep into the IPC section of
the BSD kernel, so I don't know what might depend on these values. I
would SAVE MY OLD KERNEL BEFORE DOING THIS if I were you. Reboot after
doing the patch.

If this doesn't work, boot /vmunix.good, copy it back to /vmunix, and
reboot. Let me know if these adb patches work - my confidence level is
about 85% on this one. This script is off the cuff and UNTESTED!!

--
- Nate Itkin
- Portland Technology Development, Intel Corporation      Aloha, Oregon
- E-mail:    Nate-Itkin@ptdcs2.intel.com
- Humorism:  Use the source young jedi.  (from UNIX WARS)

=========================== CUT HERE =========================== #! /bin/sh

/bin/cp /vmunix /vmunix.good || exit 1 # bail if the copy fails

# Note "/" changes the running kernel, "?" writes the changes to /vmunix.

# Bump SEMMNS from 60 to 640. If you increase SEMMNS (semaphores in system), # you should also bump SEMMSL (semaphores per id).

echo "_seminfo+8/W 0x280" | /bin/adb -k -w /vmunix /dev/mem echo "_seminfo+8?W 0x280" | /bin/adb -k -w /vmunix /dev/mem echo "_seminfo+10/W 0x280" | /bin/adb -k -w /vmunix /dev/mem echo "_seminfo+10?W 0x280" | /bin/adb -k -w /vmunix /dev/mem

# Bump SHMSIZE from 1 KB to 128 KB. This implies a change to the maximum # shared memory segment size (SHMSIZE * 1024).

echo "_shminfo/W 0x8000000" | /bin/adb -k -w /vmunix /dev/mem echo "_shminfo?W 0x8000000" | /bin/adb -k -w /vmunix /dev/mem

# Bump SHMMNI (shared memory identifiers) from 100 to 256.

echo "_shminfo+8/W 0x100" | /bin/adb -k -w /vmunix /dev/mem echo "_shminfo+8?W 0x100" | /bin/adb -k -w /vmunix /dev/mem

=========================== CUT HERE ===========================

>From Mike Raffety <mike_raffety@il.us.swissbank.com>:

#!/bin/csh -f -b

# All programs ... set path=(/usr/ucb /bin /usr/bin)

# Which devices to use? switch ($#argv) case 0: set vmunix=/vmunix breaksw case 1: set vmunix=$1 breaksw default: echo "usage: $0 [<vmunix>]" exit 1 endsw

# Patch to change the shminfo struct echo "WARNING: This script can CRASH your machine\!"

# First, find out what it's set to now # The assumption is that they are currently running /vmunix @ shmmax = `echo "shminfo?D" | adb $vmunix | tail -1 | awk '{print $2}'` @ size = $shmmax / 1024 echo Current shared memory size is ${size}K

# Get a size echo -n "What would you like your shared memory to be (in decimal K)? " @ size = $< @ shmmax = $size * 1024 @ shmall = $shmmax / `pagesize` echo size=$size shmmax=$shmmax shmall=$shmall

# Now install the patch adb -w $vmunix << EOF shminfo?W 0t$shmmax shminfo+0x10?W 0t$shmall EOF

# Report on our success echo "Shared memory is now set to " $size echo "Reboot for it to take effect"

-- Andy Kumeda Trident Data Systems [ PGP Key E-mail: kumeda@tds.com 5933 West Century Blvd Available Voice: (310) 348-6327 Suite 700 Upon FAX: (310) 649-5437 Los Angeles, CA 90045 Request ]



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:01 CDT