
		Sun Kernel Patch Info for Linux Xkernel

Linux networking currently does not support packet fragmentation.
Unfortunately, Sun NFS by default uses packet sizes that require
fragmentation.  Normally, options can be set on the Sun to reduce the
NFS packet size from 8192 bytes to 1024 bytes, thus avoiding
fragmentation.  However, when the Sun is BOOTING over nfs, there is no
way to change the defaults.  Thus, they need to be changed IN THE SUN
KERNEL.  This file describes how to patch a Sun3 kernel so that it can
be booted from linux over NFS.  Original credit for the kernel
modifications goes to Mark Eichin.

You will probably need a Sun3 that is still running SunOS to apply
these patches.  A Sun4 *might* work, but I'm not sure.  The patch is
to use Sun's adb (yuck!) to modify the code that sets up the initial
NFS structure.  You will need to type "adb -w vmunix" (On some vmunix
other than the one the machine is running!  :-).  adb will not print
any prompt.  You then type, all on one line, the following: (broken up
into several lines for organization and to prevent wrapping.)

_nfs_mountroot+10a,20?w
217c 0 e10 66
217c 0 400 1a
217c 0 400 8e
217c 0 8ca0 62
217c 0 8ca0 6a

This overwrites a section of code with a bunch of store (movl)
instructions.  The original code also did some stores, but I overwrote
it with a little more efficient code that stored a few more values.
The structure this is writing into is the NFS mount info structure
(mntinfo).  The entries of significance are

1a: transfer size
1e: server's max transfer size
62,66,6a: Timeouts for other things.  I think these were being set in
          the code I overwrote.
8e: current read size
92: current write size

I don't think I needed to change 1e or 92 because those are only for
writing, and it is read-only to boot.

Also, you should note that on a Sun3 (doesn't seem to work on a Sun4)
the following command may be useful if you understand 68000 assembly
to make sure you are doing the right thing:

_nfs_mountroot+f0,15?i

Before the patch it looks like this in a Sun3 kernel:

_nfs_mountroot+0xf0:                    jsr     _pn_free:l
        addqw   #4,sp
        movl    d7,d0
        bra     _nfs_mountroot+0x180
        movl    a3@(0x20),a0
        movl    #0xe10,a0@(0x5e)
        movl    a3@(0x20),a0
        movl    #0x8ca0,a0@(0x62)
        movl    a3@(0x20),a0
        movl    #0xe10,a0@(0x66)
        movl    a3@(0x20),a0
        movl    #0x8ca0,a0@(0x6a)
        movl    a3@(0x20),a0
        bset    #2,a0@(0x14)
        movl    a6@(-0x84),a0
        movl    a0@(0x14),sp@-
        jsr     _vfs_unlock:l
        addqw   #4,sp
        movl    a6@(0xc),a0
        movl    a6@(-0x84),a0@
        pea     a6@(-0x50)

After the patch it looks like this:

_nfs_mountroot+0xf0:                    jsr     _pn_free:l
        addqw   #4,sp
        movl    d7,d0
        bra     _nfs_mountroot+0x180
        movl    a3@(0x20),a0
        movl    #0xe10,a0@(0x5e)
        movl    #0xe10,a0@(0x66)
        movl    #0x400,a0@(0x1a)
        movl    #0x400,a0@(0x8e)
        movl    #0x8ca0,a0@(0x62)
        movl    #0x8ca0,a0@(0x6a)
        bset    #2,a0@(0x14)
        movl    a6@(-0x84),a0
        movl    a0@(0x14),sp@-
        jsr     _vfs_unlock:l
        addqw   #4,sp
        movl    a6@(0xc),a0
        movl    a6@(-0x84),a0@
        pea     a6@(-0x50)
        pea     a5@
        jsr     _strcpy:l

This should be all the information you need to know to patch your Sun3
kernel.  However, do look for one someone else has patched.  It's
easier.  :-)
