Subject: kvm_mkdb trouble
To: list NetBSD port-pc532 <port-pc532@netbsd.org>
From: Eyal Lebedinsky <eyal@eyal.emu.id.au>
List: port-pc532
Date: 12/27/2002 16:33:06
I am using 1.5.3 (do we have 1.6 stable enough to try?).

At boot time the kvm db is built. However, it does not know
the name of the booted image on pc532 since we do not set
machdep.booted_kernel. Building the wrong db means failed
commands (e.g. vmstat) that often actually segfault.

I am now playing with building a smaller kernel. With only
8MB RAM I can surely use the savings:

-rwxr-xr-x   1 root  wsrc   1210273 Jul  3 12:53 netbsd
-rwxr-xr-x   1 root  wsrc    820571 Dec 27 14:23 E2

The removed options are:
#file-system    OVERLAY                 # overlay file system
#file-system    UNION                   # union file system
#file-system    NFS                     # Network File System client
#options        NFSSERVER               # Network File System server
#options        INET6           # IPV6

Now, what I did is change /etc/rc.d/sysdb to assume the
image name is the same as the config file (from
kern.version), and fall back to /netbsd if this assumption
fails (see below).

Should we adopt such an approach? Of course it would be best
to make machdep.booted_kernel available.

And as always, I must ask, does anyone know a source for 4MB
sticks that will work in the pc532?

sysdb_start()
{
        #       Build ps databases. If this kernel supports
        #       machdep.booted_kernel, use that to build the KVM db so
dmesg
        #       will run work when we boot /netbsd.new, etc.
        #
        echo "Building databases..."
        image="`sysctl -n machdep.booted_kernel 2>/dev/null`"
        [ -z "$image" -a "pc532" = "`sysctl -n hw.machine 2>/dev/null`"
] && \
                image="`sysctl -n kern.version 2>/dev/null | tail -2 |
sed 's=.*/=='`"
        [ -z "$image" ] && \
                image="netbsd"
        [ -f /$image ] || \
                image="netbsd"
        if [ -f /$image ] ; then
                echo "   Using /$image"
                kvm_mkdb /$image
        fi
        dev_mkdb

        #       Re-create /var/run/utmp, which is deleted by
mountcritlocal
        #       but can't be recreated by it because install and chown
may
        #       not be available then (possibly no /usr).
        #
        install -c -m 664 -g utmp /dev/null /var/run/utmp
}

--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>