Add support for building an "install kernel", which contains a ramdisk

in its belly.  This differs from the floppy kernel in that it uses the
sysinst installation tool (and thus requires more space; the ramdisk is
3M).

This is useful for netbooting and installing or for placing on a CD-ROM.
This commit is contained in:
thorpej 1998-02-01 01:58:47 +00:00
parent 696b21e65f
commit 508eb6d6ba
12 changed files with 497 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# $NetBSD: Makefile,v 1.1 1998/02/01 01:58:47 thorpej Exp $
SUBDIR= ramdisk instkernel
.include <bsd.subdir.mk>

View File

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

View File

@ -0,0 +1,14 @@
# $NetBSD: Makefile,v 1.1 1998/02/01 01:58:51 thorpej Exp $
RAMDISK!=cd ${.CURDIR}/../ramdisk; \
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/ramdisk.fs\n" | \
${MAKE} -s -f-
KERNEL=${.CURDIR}/../../../../sys/arch/alpha/compile/INSTALL/netbsd
all:
cp ${KERNEL} netbsd
mdsetimage -v netbsd ${RAMDISK}
.include <bsd.own.mk>
.include <bsd.obj.mk>

View File

@ -0,0 +1,55 @@
# $NetBSD: list2sh.awk,v 1.1 1998/02/01 01:58:49 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,55 @@
# $NetBSD: Makefile,v 1.1 1998/02/01 01:58:52 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
VND_CDEV= /dev/${VND}c
VND_CRDEV= /dev/r${VND}c
IMAGE?= xxx.fs
MDEC= ${DESTDIR}/usr/mdec
LISTS= list
CRUNCHCONF= ${CBIN}.conf
MTREE= mtree.conf
all: ${CBIN}
dd if=/dev/zero of=${IMAGE} count=6144
vnconfig -v -c ${VND_CDEV} ${IMAGE}
# disklabel -rw ${VND_CDEV} ${DISKTYPE}
newfs -m 0 -o space -i 5120 ${VND_RDEV}
mount ${VND_DEV} ${MOUNT_POINT}
mtree -def ${.CURDIR}/${MTREE} -p ${MOUNT_POINT}/ -u
TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
TARGDIR=${MOUNT_POINT} sh ${TOP}/runlist.sh ${.CURDIR}/${LISTS}
@echo ""
@df -i ${MOUNT_POINT}
@echo ""
umount ${MOUNT_POINT}
vnconfig -u ${VND_CDEV}
unconfig:
-umount -f ${MOUNT_POINT}
-vnconfig -u ${VND_DEV}
-/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:
/bin/rm -f *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.subdir.mk>

View File

@ -0,0 +1,31 @@
# $NetBSD: disktab.preinstall,v 1.1 1998/02/01 01:58:52 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,58 @@
# $NetBSD: dot.hdprofile,v 1.1 1998/02/01 01:58:53 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 by Christopher G. Demetriou.
# 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.
#
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
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,66 @@
# $NetBSD: dot.profile,v 1.1 1998/02/01 01:58:53 thorpej Exp $
#
# Copyright (c) 1994 Christopher G. Demetriou
# Copyright (c) 1997 Perry E. Metzger
# 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 by Christopher G. Demetriou.
# 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.
#
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
export PATH
TERM=sun
export TERM
HOME=/
export HOME
umask 022
ROOTDEV=/dev/md0a
if [ "X${DONEPROFILE}" = "X" ]; then
DONEPROFILE=YES
# get the terminal type
eval `tset -s -m ":?$TERM"`
# set up some sane defaults
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
echo ''
# run update, so that installed software is written as it goes.
update
# 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 program
sysinst
fi

View File

@ -0,0 +1,87 @@
# $NetBSD: list,v 1.1 1998/02/01 01:58:54 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/mt
LINK ramdiskbin bin/mv
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_msdos
LINK ramdiskbin sbin/mount_nfs
LINK ramdiskbin sbin/mount_kernfs
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/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/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/mdec/installboot
SYMLINK /bin/cat usr/sbin/bad144
SYMLINK /bin/cat usr/sbin/chown
SYMLINK /bin/cat usr/sbin/chroot
SYMLINK /bin/cat usr/sbin/update
SPECIAL /bin/rm ramdiskbin
# copy the MAKEDEV script and make some devices
COPY ${CURDIR}/../../../../etc/etc.alpha/MAKEDEV dev/MAKEDEV
SPECIAL cd dev; sh MAKEDEV minimal
SPECIAL /bin/rm dev/MAKEDEV
# we need the boot blocks /usr/mdec
COPY ${DESTDIR}/usr/mdec/boot usr/mdec/boot
COPY ${DESTDIR}/usr/mdec/bootxx usr/mdec/bootxx
# 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/services etc/services
SPECIAL pwd_mkdb -p -d ./ etc/master.passwd
# and the common installation tools
COPY ${DESTDIR}/usr/share/misc/termcap usr/share/misc/termcap
# the disktab explanation file
COPY disktab.preinstall etc/disktab.preinstall
# and the installation tools
COPY dot.profile .profile
COPY dot.hdprofile tmp/.hdprofile

View File

@ -0,0 +1,77 @@
# $NetBSD: mtree.conf,v 1.1 1998/02/01 01:58:55 thorpej Exp $
/set type=dir uname=root gname=wheel mode=0755
# .
.
# ./bin
bin
# ./bin
..
# ./dev
dev
# ./dev
..
# ./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,32 @@
# $NetBSD: ramdiskbin.conf,v 1.1 1998/02/01 01:58:55 thorpej Exp $
#
# ramdiskbin.conf - unified binary for the install ramdisk
#
srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin sys/arch/alpha/stand
progs bad144 cat chmod chown chroot cp dd df disklabel ed
progs fsck fsck_ffs ftp gzip ifconfig init installboot less
progs ln ls mkdir mknod mount mount_cd9660 mount_ffs mount_msdos
progs mount_nfs mount_kernfs mt mv newfs ping pwd reboot restore rm
progs route sed sh shutdown slattach strings stty sync tar test
progs tip umount update
progs sysinst
special sysinst srcdir distrib/utils/sysinst/arch/alpha
special init srcdir distrib/utils/init_s
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 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm

View File

@ -0,0 +1,13 @@
# $NetBSD: runlist.sh,v 1.1 1998/02/01 01:58:50 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}/list2sh.awk | ${SHELLCMD}