First cut at instkernel for NetBSD/shark. Based on NetBSD/alpha

instkernel.
This commit is contained in:
thorpej 2002-02-11 17:49:40 +00:00
parent 54dd82020c
commit f0c87a0e2d
12 changed files with 536 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# $NetBSD: Makefile,v 1.1 2002/02/11 17:49:40 thorpej Exp $
SUBDIR= ramdisk .WAIT instkernel
.include <bsd.subdir.mk>

View File

@ -0,0 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1 2002/02/11 17:49:40 thorpej Exp $
REV!=sh ${.CURDIR}/../../../../sys/conf/osrelease.sh -s
VER!=sh ${.CURDIR}/../../../../sys/conf/osrelease.sh

View File

@ -0,0 +1,36 @@
# $NetBSD: Makefile,v 1.1 2002/02/11 17:49:41 thorpej Exp $
.include "../../../../Makefile.inc"
TOP= ${.CURDIR}/../../../..
RAMDISK!=cd ${.CURDIR}/../ramdisk; \
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/ramdisk.fs\n" | \
${MAKE} -s -f-
MDSETIMAGE?= mdsetimage
KERNEL?=${KERNOBJDIR}/INSTALL/netbsd
KERNEL=/sys/arch/shark/compile/INSTALL/netbsd
STRIP?= strip # make STRIP=echo can be useful
all:
cp ${KERNEL} netbsd
${MDSETIMAGE} -v netbsd ${RAMDISK}
${STRIP} netbsd
OBJCOPY=${OBJCOPY:Q} SIZE=${SIZE:Q} \
${TOP}/sys/arch/arm/conf/elf2aout.sh netbsd netbsd
gzip -9f netbsd
clean cleandir distclean:
rm -f netbsd netbsd.gz
release:
-mkdir -p ${RELEASEDIR}/binary/kernel
cp -p netbsd.gz ${RELEASEDIR}/binary/kernel/netbsd.INSTALL.gz
# nothing to do here
depend includes lint regress tags:
.include <bsd.kernobj.mk>
.include <bsd.own.mk>
.include <bsd.obj.mk>

View File

@ -0,0 +1,57 @@
# $NetBSD: Makefile,v 1.1 2002/02/11 17:49:41 thorpej Exp $
TOP= ${.CURDIR}/..
.include "${TOP}/Makefile.inc"
IMAGE= ramdisk.fs
CBIN= ramdiskbin
MOUNT_POINT?= /mnt
# DEV/RDEV file system device, CDEV/RDEV vnconfig device
VND?= vnd0
VND_DEV= /dev/${VND}a
VND_RDEV= /dev/r${VND}a
MDEC= ${DESTDIR}/usr/mdec
LISTS= list
CRUNCHCONF= ${CBIN}.conf
MTREECONF= mtree.conf
CRUNCHGEN?= crunchgen
all: ${CBIN}
dd if=/dev/zero of=${IMAGE} count=6150
vnconfig -v -c ${VND} ${IMAGE}
# disklabel -rw ${VND} ${DISKTYPE}
# XXX otherwise we error out with "can't rewrite disklabel"
-newfs -B le -m 0 -o space -i 5120 -b 8192 -f 1024 -c 20 ${VND_RDEV}
mount ${VND_DEV} ${MOUNT_POINT}
${MTREE} -def ${.CURDIR}/${MTREECONF} -p ${MOUNT_POINT}/ -u
TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
KERNOBJDIR=${KERNOBJDIR} \
TARGDIR=${MOUNT_POINT} sh ${TOP}/src/runlist.sh ${.CURDIR}/${LISTS}
@echo ""
@df -i ${MOUNT_POINT}
@echo ""
umount ${MOUNT_POINT}
vnconfig -u ${VND}
unconfig:
-umount -f ${MOUNT_POINT}
-vnconfig -u ${VND}
-/bin/rm -f ${IMAGE}
${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
${CRUNCHGEN} -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
${MAKE} -f ${CBIN}.mk all
clean cleandir distclean:
/bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.subdir.mk>
.include <bsd.sys.mk>

View File

@ -0,0 +1,31 @@
# $NetBSD: disktab.preinstall,v 1.1 2002/02/11 17:49:41 thorpej Exp $
#
# Disk geometry and partition layout tables.
# Key:
# dt controller type
# ty type of disk (fixed, removeable, simulated)
# d[0-4] drive-type-dependent parameters
# ns #sectors/track
# nt #tracks/cylinder
# nc #cylinders/disk
# sc #sectors/cylinder, nc*nt default
# su #sectors/unit, sc*nc default
# se sector size, DEV_BSIZE default
# rm rpm, 3600 default
# sf supports bad144-style bad sector forwarding
# sk sector skew per track, default 0
# cs sector skew per cylinder, default 0
# hs headswitch time, default 0
# ts one-cylinder seek time, default 0
# il sector interleave (n:1), 1 default
# bs boot block size, default BBSIZE
# sb superblock size, default SBSIZE
# o[a-h] partition offsets in sectors
# p[a-h] partition sizes in sectors
# b[a-h] partition block sizes in bytes
# f[a-h] partition fragment sizes in bytes
# t[a-h] partition types (filesystem, swap, etc)
#
# All partition sizes reserve space for bad sector tables.
# (5 cylinders needed for maintenance + replacement sectors)
#

View File

@ -0,0 +1,62 @@
# $NetBSD: dot.hdprofile,v 1.1 2002/02/11 17:49:41 thorpej Exp $
#
# Copyright (c) 1994 Christopher G. Demetriou
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed for the
# NetBSD Project. See http://www.netbsd.org/ for
# information about NetBSD.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
export PATH
TERM=pc3
export TERM
HOME=/
export HOME
umask 022
if [ "X${DONEPROFILE}" = "X" ]; then
DONEPROFILE=YES
export DONEPROFILE
echo "Checking filesystems..."
fsck -y
echo "Mounting root..."
mount -u /
# set up some sane defaults
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
echo ''
TERMCAP=/.termcap ; export TERMCAP
[ -x /sysinst ] && /sysinst
fi

View File

@ -0,0 +1,64 @@
# $NetBSD: dot.profile,v 1.1 2002/02/11 17:49:41 thorpej Exp $
#
# Copyright (c) 1997 Perry E. Metzger
# Copyright (c) 1994 Christopher G. Demetriou
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed for the
# NetBSD Project. See http://www.netbsd.org/ for
# information about NetBSD.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
export PATH
TERM=pc3
export TERM
HOME=/
export HOME
umask 022
ROOTDEV=/dev/md0a
if [ "X${DONEPROFILE}" = "X" ]; then
DONEPROFILE=YES
export DONEPROFILE
# set up some sane defaults
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
echo ''
# mount the ramdisk read write
mount -u $ROOTDEV /
# mount the kern_fs so that we can examine the dmesg state
mount -t kernfs /kern /kern
# run the installation or upgrade script.
sysinst
fi

View File

@ -0,0 +1,92 @@
# $NetBSD: list,v 1.1 2002/02/11 17:49:42 thorpej Exp $
# copy the crunched binary, link to it, and kill it
COPY ${OBJDIR}/ramdiskbin ramdiskbin
LINK ramdiskbin sysinst
LINK ramdiskbin bin/cat
LINK ramdiskbin bin/chmod
LINK ramdiskbin bin/cp
LINK ramdiskbin bin/dd
LINK ramdiskbin bin/df
LINK ramdiskbin bin/ed
LINK ramdiskbin bin/ln
LINK ramdiskbin bin/ls
LINK ramdiskbin bin/mkdir
LINK ramdiskbin bin/mv
LINK ramdiskbin bin/pax
LINK ramdiskbin bin/pwd
LINK ramdiskbin bin/rm
LINK ramdiskbin bin/sh
LINK ramdiskbin bin/stty
LINK ramdiskbin bin/sync
LINK ramdiskbin bin/test
LINK ramdiskbin bin/[
LINK ramdiskbin sbin/disklabel
LINK ramdiskbin sbin/fsck
LINK ramdiskbin sbin/fsck_ffs
LINK ramdiskbin sbin/halt
LINK ramdiskbin sbin/ifconfig
LINK ramdiskbin sbin/init
LINK ramdiskbin sbin/mknod
LINK ramdiskbin sbin/mount
LINK ramdiskbin sbin/mount_cd9660
LINK ramdiskbin sbin/mount_ffs
LINK ramdiskbin sbin/mount_kernfs
LINK ramdiskbin sbin/mount_msdos
LINK ramdiskbin sbin/mount_nfs
LINK ramdiskbin sbin/newfs
LINK ramdiskbin sbin/ping
LINK ramdiskbin sbin/reboot
LINK ramdiskbin sbin/restore
LINK ramdiskbin sbin/route
LINK ramdiskbin sbin/rrestore
LINK ramdiskbin sbin/shutdown
LINK ramdiskbin sbin/slattach
LINK ramdiskbin sbin/swapctl
LINK ramdiskbin sbin/umount
SYMLINK /bin/cat usr/bin/chgrp
SYMLINK /bin/cat usr/bin/ftp
SYMLINK /bin/cat usr/bin/gunzip
SYMLINK /bin/cat usr/bin/gzcat
SYMLINK /bin/cat usr/bin/gzip
SYMLINK /bin/cat usr/bin/less
SYMLINK /bin/cat usr/bin/more
SYMLINK /bin/cat usr/bin/sed
SYMLINK /bin/cat usr/bin/strings
SYMLINK /bin/cat usr/bin/tar
SYMLINK /bin/cat usr/bin/tip
SYMLINK /bin/cat usr/bin/tset
SYMLINK /bin/cat usr/sbin/chown
SYMLINK /bin/cat usr/sbin/chroot
SPECIAL /bin/rm ramdiskbin
# copy the MAKEDEV script and make some devices
COPY ${CURDIR}/../../../../etc/etc.shark/MAKEDEV dev/MAKEDEV
SPECIAL cd dev; sh MAKEDEV ramdisk
SPECIAL /bin/rm dev/MAKEDEV
# we need the boot blocks /usr/mdec
#COPY ${DESTDIR}/usr/mdec/ofwboot usr/mdec/ofwboot
# various files that we need in /etc for the install
COPY ${CURDIR}/../../../../etc/group etc/group
COPY ${CURDIR}/../../../../etc/master.passwd etc/master.passwd
COPY ${CURDIR}/../../../../etc/protocols etc/protocols
COPY ${CURDIR}/../../../../etc/netconfig etc/netconfig
COPY ${CURDIR}/../../../../etc/services etc/services
SPECIAL pwd_mkdb -p -d ./ etc/master.passwd
SPECIAL /bin/rm etc/spwd.db
SPECIAL /bin/rm etc/pwd.db
# and the common installation tools
COPY ${DESTDIR}/usr/share/misc/termcap usr/share/misc/termcap
# the disktab explanation file
COPY ${CURDIR}/disktab.preinstall etc/disktab.preinstall
# and the installation tools
COPY ${CURDIR}/dot.profile .profile
COPY ${CURDIR}/dot.hdprofile tmp/.hdprofile
#the lists of obsolete files used by sysinst
SPECIAL sh ${CURDIR}/../../../../distrib/sets/makeobsolete -b -s ${CURDIR}/../../../../distrib/sets -t ./dist

View File

@ -0,0 +1,82 @@
# $NetBSD: mtree.conf,v 1.1 2002/02/11 17:49:42 thorpej Exp $
/set type=dir uname=root gname=wheel mode=0755
# .
.
# ./bin
bin
# ./bin
..
# ./dev
dev
# ./dev
..
# ./dist
dist
# ./dist
..
# ./etc
etc
# ./etc
..
# ./mnt
mnt
# ./mnt
..
# ./mnt2
mnt2
# ./mnt2
..
# ./kern
kern
# ./kern
..
# ./sbin
sbin
# ./sbin
..
# ./tmp
tmp mode=01777
# ./tmp
..
# ./usr
usr
# ./usr/bin
bin
# ./usr/bin
..
# ./usr/mdec
mdec
# ./usr/mdec
..
# ./usr/sbin
sbin
# ./usr/sbin
..
# ./usr/share
share
# ./usr/share/misc
misc
# ./usr/share/misc
..
# ./usr/share
..
# ./usr
..

View File

@ -0,0 +1,35 @@
# $NetBSD: ramdiskbin.conf,v 1.1 2002/02/11 17:49:42 thorpej Exp $
#
# ramdiskbin.conf - unified binary for the install ramdisk
#
srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin
progs cat chmod chown chroot cp dd df disklabel ed
progs fsck fsck_ffs ftp gzip ifconfig init less ln ls
progs mkdir mknod mount mount_cd9660 mount_ffs mount_msdos
progs mount_nfs mount_kernfs mv newfs ping pwd reboot restore rm
progs route sed sh shutdown slattach stty swapctl sync test
progs tip umount
progs sysinst pax
progs tset
special sysinst srcdir distrib/utils/sysinst/arch/shark
special init srcdir distrib/utils/init_s
special ping srcdir distrib/utils/x_ping
ln pax tar
ln chown chgrp
ln gzip gzcat gunzip
ln less more
ln sh -sh # init invokes the shell this way
ln test [
ln mount_cd9660 cd9660
ln mount_ffs ffs
ln mount_msdos msdos
ln mount_nfs nfs
ln mount_kernfs kernfs
ln reboot halt
ln restore rrestore
libs -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm

View File

@ -0,0 +1,55 @@
# $NetBSD: list2sh.awk,v 1.1 2002/02/11 17:49:42 thorpej Exp $
BEGIN {
printf("cd ${CURDIR}\n");
printf("\n");
}
/^$/ || /^#/ {
print $0;
next;
}
$1 == "COPY" {
printf("echo '%s'\n", $0);
printf("rm -f ${TARGDIR}/%s\n", $3);
printf("cp %s ${TARGDIR}/%s\n", $2, $3);
next;
}
$1 == "LINK" {
printf("echo '%s'\n", $0);
printf("rm -f ${TARGDIR}/%s\n", $3);
printf("(cd ${TARGDIR}; ln %s %s)\n", $2, $3);
next;
}
$1 == "SYMLINK" {
printf("echo '%s'\n", $0);
printf("rm -f ${TARGDIR}/%s\n", $3);
printf("(cd ${TARGDIR}; ln -s %s %s)\n", $2, $3);
next;
}
$1 == "COPYDIR" {
printf("echo '%s'\n", $0);
printf("(cd ${TARGDIR}/%s && find . ! -name . | xargs /bin/rm -rf)\n",
$3);
printf("(cd %s && find . ! -name . | cpio -pdamu ${TARGDIR}/%s)\n", $2,
$3);
next;
}
$1 == "SPECIAL" {
printf("echo '%s'\n", $0);
printf("(cd ${TARGDIR};");
for (i = 2; i <= NF; i++)
printf(" %s", $i);
printf(")\n");
next;
}
{
printf("echo '%s'\n", $0);
printf("echo 'Unknown keyword \"%s\" at line %d of input.'\n", $1, NR);
printf("exit 1\n");
exit 1;
}
END {
printf("\n");
printf("exit 0\n");
exit 0;
}

View File

@ -0,0 +1,13 @@
# $NetBSD: runlist.sh,v 1.1 2002/02/11 17:49:42 thorpej Exp $
if [ "X$1" = "X-d" ]; then
SHELLCMD=cat
shift
else
SHELLCMD="sh -e"
fi
( while [ "X$1" != "X" ]; do
cat $1
shift
done ) | awk -f ${TOPDIR}/src/list2sh.awk | ${SHELLCMD}