Changes from Matthias Pfaller to have a compresed kernel AND

a compressed RAM disk root file system on the boot floppy.
So a single floppy can include vi, ppp, slip, ......
This commit is contained in:
phil 1995-09-26 21:24:41 +00:00
parent 601a054fb3
commit 58aa66a652
24 changed files with 348 additions and 86 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile.inc,v 1.1.1.1 1995/09/10 06:13:41 phil Exp $
# $Id: Makefile.inc,v 1.2 1995/09/26 21:24:41 phil Exp $
# Revision is 1.0A
REV= 10A

View File

@ -1,4 +1,4 @@
# $Id: Makefile.inc,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
# $Id: Makefile.inc,v 1.2 1995/09/26 21:25:02 phil Exp $
# TOP is assumed to be defined by Makefile including this one.
@ -7,22 +7,34 @@ COMMONDIR= ${TOP}/inst-common
MOUNT_POINT?= /mnt
VND?= vnd0
VND_DEV= /dev/${VND}c
VND_RDEV= /dev/r${VND}c
VND_DEV= /dev/${VND}a
VND_RDEV= /dev/r${VND}a
IMAGE?= xxx-${REV}.fs
MDEC= ${DESTDIR}/usr/mdec
LISTS= ${COMMONDIR}/list ${.CURDIR}/list
CRUNCHCONF= ${COMMONDIR}/${CBIN}.conf
MTREE= ${COMMONDIR}/mtree.conf
ADIR= ${.CURDIR}/../../../../sys/arch/pc532
ADIR= ${TOP}/../../../sys/arch/pc532
all: ${CBIN} netbsd
all: netbsd
dd if=/dev/zero of=${IMAGE} bs=18k count=80
disklabel -r -w ${.OBJDIR}/${IMAGE} boot3
-yes|bim -c init -c "add ${MDEC}/boot boot" -c "default 0" -c "exit" ${.OBJDIR}/${IMAGE}
disklabel -r -w ${.OBJDIR}/${IMAGE} boot3 2>/dev/null
-yes|bim -c init -c "add ${MDEC}/boot boot" -c "default 0" \
-c "exit" ${.OBJDIR}/${IMAGE} 2>/dev/null >/dev/null
vnconfig -v -c ${VND_DEV} ${IMAGE}
newfs -O -m 0 -o space -i 7168 -c 80 ${VND_RDEV} boot3
newfs -b 8192 -f 1024 -O -m 0 -o space -i 204800 -c 80 ${VND_RDEV} boot3
mount ${VND_DEV} ${MOUNT_POINT}
cp netbsd ${MOUNT_POINT}/netbsd
@df -i ${MOUNT_POINT}
@echo ""
umount ${MOUNT_POINT}
vnconfig -u ${VND_DEV}
inject.fs: ${CBIN} ${LISTS} netbsd.gz
dd if=/dev/zero of=${.TARGET} bs=128k count=16
vnconfig -v -c ${VND_DEV} ${.TARGET}
newfs -b 8192 -f 1024 -O -m 0 -o space -i 7168 ${VND_RDEV} rd
mount ${VND_DEV} ${MOUNT_POINT}
mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u
TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
@ -32,7 +44,6 @@ all: ${CBIN} netbsd
@echo ""
umount ${MOUNT_POINT}
vnconfig -u ${VND_DEV}
cat /*bin/* > /dev/null
unconfig:
-umount -f ${MOUNT_POINT}
@ -47,14 +58,26 @@ ${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
cloak: ${COMMONDIR}/cloak.c
netbsd.o: cloak
cp ${ADIR}/compile/INSTALL/netbsd /tmp/$$$$; \
strip /tmp/$$$$; \
gzip -9 </tmp/$$$$ | ./cloak >netbsd.o; \
rm /tmp/$$$$
inject: ${COMMONDIR}/inject.c
netbsd: netbsd.o
ld -s -z -T 380000 -e begin ${MDEC}/zboot.o netbsd.o -o netbsd
netbsd.gz:
gzip -9 <${ADIR}/compile/DEFAULT/netbsd >netbsd.gz
# cp ${ADIR}/compile/DEFAULT/netbsd /var/tmp/$$$$; \
# strip /var/tmp/$$$$; \
# gzip -9 </var/tmp/$$$$ >netbsd.gz; \
# rm /var/tmp/$$$$
netbsd.o: inject cloak inject.fs
cp ${ADIR}/compile/INSTALL/netbsd /var/tmp/$$$$; \
strip /var/tmp/$$$$; \
./inject /var/tmp/$$$$ inject.fs; \
gzip -9 </var/tmp/$$$$ | ./cloak >netbsd.o; \
rm /var/tmp/$$$$
go.o: ${COMMONDIR}/go.c
netbsd: netbsd.o go.o
ld -s -z -T 240000 -e _go go.o netbsd.o ${MDEC}/zboot.o -o netbsd
clean cleandir:
/bin/rm -f core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994 Matthias Pfaller.
* Copyright (c) 1995 Matthias Pfaller.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,7 +27,7 @@
* (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: cloak.c,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
* $Id: cloak.c,v 1.2 1995/09/26 21:25:03 phil Exp $
*/
#include <stdio.h>
@ -70,10 +70,10 @@ main(int argc, char **argv)
n = sizeof(SYM_DATA) + sizeof(SYM_LEN) + sizeof(n);
nlist[0].n_un.n_strx = sizeof(n);
nlist[0].n_type = N_DATA | N_EXT;
nlist[0].n_type = N_TEXT | N_EXT;
nlist[0].n_value = 0;
nlist[1].n_un.n_strx = nlist[0].n_un.n_strx + sizeof(SYM_DATA);
nlist[1].n_type = N_DATA | N_EXT;
nlist[1].n_type = N_TEXT | N_EXT;
nlist[1].n_value = ALIGN(data_len);
writex(1, nlist, sizeof(nlist), argv[0]);
writex(1, &n, sizeof(n), argv[0]);
@ -81,8 +81,8 @@ main(int argc, char **argv)
writex(1, SYM_LEN, sizeof(SYM_LEN), argv[0]);
N_SETMAGIC(exec, OMAGIC, MID_MACHINE, 0);
exec.a_text = 0;
exec.a_data = ALIGN(data_len) + sizeof(data_len);
exec.a_text = ALIGN(data_len) + sizeof(data_len);
exec.a_data = 0;
exec.a_bss = 0;
exec.a_syms = sizeof(nlist);
exec.a_trsize = 0;

View File

@ -27,7 +27,7 @@
# (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: dot.commonutils,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
# $Id: dot.commonutils,v 1.2 1995/09/26 21:25:05 phil Exp $
# Installation utilites (functions), to get NetBSD installed on
# the hard disk. These are meant to be invoked from the shell prompt,
@ -130,3 +130,8 @@ Extract()
esac
cat "$1"* | $GUNZIP | (cd $dest_dir ; $TAR --unlink -xp"$tarverbose"f - )
}
xd()
{
hexdump -e '"%6_ax " 4/1 "%02x " " " 4/1 "%02x " " " 4/1 "%02x " " " 4/1 "%02x " " "' -e '16/1 "%_p" "\n"' $*
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 1995 Matthias Pfaller.
* 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 Matthias Pfaller.
* 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: go.c,v 1.1 1995/09/26 21:25:06 phil Exp $
*/
#include <sys/reboot.h>
register r6 asm("r6");
/*
* In order to install netbsd on 4mb machines, netbsd must survive an overflow
* of the real kernel into the netbsd image. So the compressed kernel image
* has to be linked in front of the uncompressing code. This code fragment
* sets the default root disk to rd0 and then jumps behind the compressed
* kernel image.
*/
go()
{
extern begin() asm("begin");
/* One more place that knows that rd is at major 3 ... */
r6 = MAKEBOOTDEV(3, 0, 0, 0, 0);
begin();
}

View File

@ -0,0 +1,98 @@
/*
* Copyright (c) 1995 Matthias Pfaller.
* 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 Matthias Pfaller.
* 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: inject.c,v 1.1 1995/09/26 21:25:07 phil Exp $
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <bm.h>
void *map(char *file, int mode, int *len)
{
int fd;
struct stat sb;
void *p;
fd = open(file, mode);
if (fd < 0) {
perror(file);
exit(1);
}
if (fstat(fd, &sb) < 0) {
perror("fstat");
exit(1);
}
*len = sb.st_size;
p = mmap(NULL, *len, PROT_READ | (mode == O_RDWR ? PROT_WRITE : 0),
MAP_SHARED, fd, 0);
if (p == NULL) {
perror("mmap");
exit(1);
}
madvise(p, *len, MADV_SEQUENTIAL);
close(fd);
return(p);
}
main(int argc, char **argv)
{
void *kern, *filesys, *ramdisk;
int kernlen, filesyslen;
bm_pat *bm;
static char pattern[] = "Ramdiskorigin";
if (argc != 3) {
fprintf(stderr, "usage: %s kernel filesystem", argv[0]);
exit(1);
}
kern = map(argv[1], O_RDWR, &kernlen);
filesys = map(argv[2], O_RDONLY, &filesyslen);
bm = bm_comp(pattern, sizeof(pattern), NULL);
ramdisk = bm_exec(bm, kern, kernlen);
if (!ramdisk) {
fprintf(stderr, "Origin of ramdisk not found in kernel\n");
exit(1);
}
if ((kernlen - (ramdisk - kern)) < filesyslen) {
fprintf(stderr, "Kernel image to small\n");
exit(1);
}
memcpy(ramdisk, filesys, filesyslen);
msync(kern, kernlen);
munmap(kern, kernlen);
munmap(filesys, filesyslen);
exit(0);
}

View File

@ -1,14 +1,21 @@
#
# kcbin.conf - unified binary for the kc floppy
# $Id: instbin.conf,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
# $Id: instbin.conf,v 1.2 1995/09/26 21:25:08 phil Exp $
#
srcdirs bin sbin usr.bin usr.sbin gnu/usr.bin
srcdirs bin sbin usr.bin usr.sbin gnu/usr.bin games
progs bim cat chmod chown chroot cp dd df disklabel ed expr fsck ftp gawk
progs gzip ifconfig init ln ls mkdir mknod more mount mount_cd9660
progs mount_msdos mount_nfs mv newfs ping pwd reboot rm route sed sh
progs shutdown slattach strings stty sync tar test tip umount update
progs bc bim cat chat chmod chown chroot cp dd df disklabel dump expr factor
progs find fsck ftp gawk gzip hexdump ifconfig init ln ls mkdir mknod more
progs mount mount_cd9660 mount_ffs mount_msdos mount_nfs mt mv newfs
progs pax ping pppd pppstats pwd rcp reboot restore rm rmdir route
progs sed sh shutdown slattach strings stty sync tar test tip traceroute
progs umount update vi
special chat srcdir usr.sbin/pppd/chat
special chat objdir usr.sbin/pppd/chat/obj
special pppstats srcdir usr.sbin/pppd/pppstats
special vi srcdir usr.bin/vi/common
ln chown chgrp
ln gawk awk
@ -16,8 +23,11 @@ ln gzip gzcat gunzip
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 vi ex
ln vi view
ln reboot halt
libs -ledit -lutil -ltermcap -lcrypt -ll -lm
libs -ledit -lcurses -lutil -ltermcap -lcrypt -ll -lm

View File

@ -1,21 +1,24 @@
# $Id: list,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
# $Id: list,v 1.2 1995/09/26 21:25:09 phil Exp $
# copy the crunched binary, link to it, and kill it
COPY ${OBJDIR}/netbsd.gz netbsd.gz
COPY ${OBJDIR}/instbin instbin
COPY ${OBJDIR}/netbsd netbsd
LINK instbin bin/cat
LINK instbin bin/chmod
LINK instbin bin/cp
LINK instbin bin/dd
LINK instbin bin/df
LINK instbin bin/ed
LINK instbin bin/expr
LINK instbin bin/ln
LINK instbin bin/ls
LINK instbin bin/mkdir
LINK instbin bin/mt
LINK instbin bin/mv
LINK instbin bin/pax
LINK instbin bin/pwd
LINK instbin bin/rcp
LINK instbin bin/rm
LINK instbin bin/rmdir
LINK instbin bin/sh
LINK instbin bin/stty
LINK instbin bin/sync
@ -23,6 +26,7 @@ LINK instbin bin/test
LINK instbin bin/[
LINK instbin sbin/bim
LINK instbin sbin/disklabel
LINK instbin sbin/dump
LINK instbin sbin/fsck
LINK instbin sbin/halt
LINK instbin sbin/ifconfig
@ -30,28 +34,41 @@ LINK instbin sbin/init
LINK instbin sbin/mknod
LINK instbin sbin/mount
LINK instbin sbin/mount_cd9660
LINK instbin sbin/mount_ffs
LINK instbin sbin/mount_msdos
LINK instbin sbin/mount_nfs
LINK instbin sbin/newfs
LINK instbin sbin/ping
LINK instbin sbin/reboot
LINK instbin sbin/restore
LINK instbin sbin/route
LINK instbin sbin/shutdown
LINK instbin sbin/slattach
LINK instbin sbin/umount
SYMLINK /bin/cat usr/bin/awk
SYMLINK /bin/cat usr/bin/chgrp
SYMLINK /bin/cat usr/bin/hexdump
SYMLINK /bin/cat usr/bin/ex
SYMLINK /bin/cat usr/bin/find
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/netstat
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/vi
SYMLINK /bin/cat usr/bin/view
SYMLINK /bin/cat usr/games/factor
SYMLINK /bin/cat usr/sbin/chat
SYMLINK /bin/cat usr/sbin/chown
SYMLINK /bin/cat usr/sbin/chroot
SYMLINK /bin/cat usr/sbin/pppd
SYMLINK /bin/cat usr/sbin/pppstats
SYMLINK /bin/cat usr/sbin/traceroute
SYMLINK /bin/cat usr/sbin/update
SPECIAL /bin/rm instbin
@ -71,6 +88,7 @@ COPY ${DESTDIR}/etc/protocols etc
COPY ${DESTDIR}/etc/pwd.db etc
COPY ${DESTDIR}/etc/services etc
COPY ${DESTDIR}/etc/spwd.db etc
SPECIAL >etc/ppp/options
# and the common installation tools
COPY ${TOPDIR}/inst-common/dot.commonutils .commonutils

View File

@ -0,0 +1,5 @@
0x400000 Top of physical RAM for 4mb machine
0x3E6800 Start of boot code
0x288000 Start of ramdisk when booting from rd0
0x240000 Start of netbsd image (may overflow into rd0 image)
0x002000 Start of kernel (may overflow into netbsd image)

View File

@ -1,4 +1,4 @@
# $Id: mtree.conf,v 1.1.1.1 1995/09/10 06:13:44 phil Exp $
# $Id: mtree.conf,v 1.2 1995/09/26 21:25:12 phil Exp $
/set type=dir uname=root gname=wheel mode=0755
# .
@ -16,6 +16,12 @@ dev
# ./etc
etc
# ./etc/ppp
ppp
# ./etc/ppp
..
# ./etc
..
@ -39,6 +45,28 @@ tmp
# ./tmp
..
# ./var
var
# ,/var/run
run
# ./var/run
..
# ./var/tmp
tmp
# ./var/tmp/vi.recover
vi.recover
# ./var/tmp/vi.recover
..
# ./var/tmp
..
# ./var
..
# ./usr
usr
@ -47,6 +75,12 @@ bin
# ./usr/bin
..
# ./usr/games
games
# ./usr/games
..
# ./usr/mdec
mdec
# ./usr/mdec

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: Makefile,v 1.2 1995/09/26 21:24:52 phil Exp $
TOP= ${.CURDIR}/..

View File

@ -27,9 +27,9 @@
# (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: dot.hdprofile,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: dot.hdprofile,v 1.2 1995/09/26 21:24:54 phil Exp $
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/games:/
export PATH
TERM=vt100
export TERM
@ -47,7 +47,7 @@ if [ "X${DONEPROFILE}" = "X" ]; then
# set up some sane defaults
echo 'erase ^?, werase ^W, kill ^U, intr ^C'
stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
stty newcrt werase ^W intr ^C kill ^U erase ^?
echo ''
# run update, so that installed software is written as it goes.

View File

@ -27,7 +27,7 @@
# (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: dot.instutils,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: dot.instutils,v 1.2 1995/09/26 21:24:56 phil Exp $
# Installation configuration utilites (functions), to get NetBSD configured
# reasonably once it is installed on the hard disk. These are meant to be

View File

@ -27,9 +27,9 @@
# (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: dot.profile,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: dot.profile,v 1.2 1995/09/26 21:24:57 phil Exp $
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/games:/
export PATH
TERM=vt100
export TERM

View File

@ -8,7 +8,6 @@
# 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
@ -28,7 +27,7 @@
# (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: install.sh,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: install.sh,v 1.2 1995/09/26 21:24:58 phil Exp $
# NetBSD installation script.
# In a perfect world, this would be a nice C program, with a reasonable
@ -189,17 +188,9 @@ if [ $sizeunit = "sectors" ]; then
echo "multiples of the cylinder size ($cylindersize sectors)."
fi
echo -n ""
echo -n "Size of NetBSD portion of disk (in $sizeunit)? "
getresp
partition=$resp
partition_sects=`expr $resp \* $sizemult`
partition=`expr $disksize / $sizemult`
partition_sects=`expr $partition \* $sizemult`
part_offset=0
if [ $partition_sects -lt $disksize ]; then
echo -n "Offset of NetBSD portion of disk (in $sizeunit)? "
getresp
part_offset=$resp
fi
badspacesec=0
if [ "$sect_fwd" = "sf:" ]; then
badspacecyl=`expr $sects_per_track + 126`
@ -255,11 +246,32 @@ while [ $swap -eq 0 ]; do
done
swap_offset=`expr $root_offset + $root`
part_used=`expr $part_used + $swap`
units_left=`expr $partition - $part_used`
echo ""
boot=0
while [ $boot -eq 0 ]; do
echo "$units_left $sizeunit remaining in NetBSD portion of disk."
echo -n "Boot partition size (in $sizeunit)? "
getresp
case $resp in
[1-9]*)
if [ $boot -gt $units_left ]; then
echo -n "Boot size is greater than remaining "
echo "free space on disk."
else
boot=$resp
fi
;;
esac
done
boot_offset=`expr $root_offset + $root + $swap + $units_left - $boot`
part_used=`expr $part_used + $boot`
echo ""
fragsize=1024
blocksize=8192
$DONTDOIT mount -u /dev/fd0a /
$DONTDOIT mount -u /dev/rd0 /
cat /etc/disktab.preinstall > $DT
echo "" >> $DT
echo "$labelname|NetBSD installation generated:\\" >> $DT
@ -277,6 +289,9 @@ echo " :pb#${_size}:ob#${_offset}:tb=swap:\\" >> $DT
_size=`expr $partition \* $sizemult`
_offset=`expr $part_offset \* $sizemult`
echo " :pc#${_size}:oc#${_offset}:\\" >> $DT
_size=`expr $boot \* $sizemult`
_offset=`expr $boot_offset \* $sizemult`
echo " :ph#${_size}:oh#${_offset}:th=boot:\\" >> $DT
echo "You will now have to enter information about any other partitions"
echo "to be created in the NetBSD portion of the disk. This process will"
@ -311,11 +326,18 @@ while [ $part_used -lt $partition ]; do
;;
esac
done
if [ "$ename" = "" ]; then
ename=$part_name
if [ "$dname" = "" ]; then
dname=$part_name
offset=`expr $part_offset + $root + $swap`
_size=`expr $part_size \* $sizemult`
_offset=`expr $offset \* $sizemult`
echo -n " :pd#${_size}:od#${_offset}" >> $DT
echo ":td=4.2BSD:bd#${blocksize}:fd#${fragsize}:\\" >> $DT
offset=`expr $offset + $part_size`
elif [ "$ename" = "" ]; then
ename=$part_name
_size=`expr $part_size \* $sizemult`
_offset=`expr $offset \* $sizemult`
echo -n " :pe#${_size}:oe#${_offset}" >> $DT
echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >> $DT
offset=`expr $offset + $part_size`
@ -333,13 +355,6 @@ while [ $part_used -lt $partition ]; do
echo -n " :pg#${_size}:og#${_offset}" >> $DT
echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >> $DT
offset=`expr $offset + $part_size`
elif [ "$hname" = "" ]; then
hname=$part_name
_size=`expr $part_size \* $sizemult`
_offset=`expr $offset \* $sizemult`
echo -n " :ph#${_size}:oh#${_offset}" >> $DT
echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >> $DT
part_used=$partition
fi
done
echo " :pd#${disksize}:od#0:" >> $DT
@ -374,7 +389,7 @@ done
echo ""
echo -n "Labeling disk $drivename..."
$DONTDOIT disklabel -w $drivename $labelname
$DONTDOIT disklabel -r -w $drivename $labelname
$DONTDOIT echo "y"|bim -c init -c "add /usr/mdec/boot boot" -c "default 0" -c "exit" /dev/${drivename}c
echo " done."
@ -387,6 +402,13 @@ fi
echo "Initializing root filesystem, and mounting..."
$DONTDOIT newfs /dev/r${drivename}a $name
$DONTDOIT mount -v /dev/${drivename}a /mnt
if [ "$dname" != "" ]; then
echo ""
echo "Initializing $dname filesystem, and mounting..."
$DONTDOIT newfs /dev/r${drivename}d $name
$DONTDOIT mkdir -p /mnt/$dname
$DONTDOIT mount -v /dev/${drivename}d /mnt/$dname
fi
if [ "$ename" != "" ]; then
echo ""
echo "Initializing $ename filesystem, and mounting..."
@ -408,33 +430,30 @@ if [ "$gname" != "" ]; then
$DONTDOIT mkdir -p /mnt/$gname
$DONTDOIT mount -v /dev/${drivename}g /mnt/$gname
fi
if [ "$hname" != "" ]; then
echo ""
echo "Initializing $hname filesystem, and mounting..."
$DONTDOIT newfs /dev/r${drivename}h $name
$DONTDOIT mkdir -p /mnt/$hname
$DONTDOIT mount -v /dev/${drivename}h /mnt/$hname
fi
echo ""
echo "Populating filesystems with bootstrapping binaries and config files"
$DONTDOIT tar --one-file-system -cf - . | (cd /mnt ; tar --unlink -xpf - )
$DONTDOIT cp /tmp/.hdprofile /mnt/.profile
$DONTDOIT gzip -d /mnt/netbsd.gz
echo ""
echo -n "Creating an fstab..."
echo /dev/${drivename}a / ufs rw 1 1 | sed -e s,//,/, > $FSTAB
echo /dev/${drivename}a / ffs rw 1 1 | sed -e s,//,/, > $FSTAB
if [ "$dname" != "" ]; then
echo /dev/${drivename}d /$dname ffs rw 1 2 | sed -e s,//,/, >> $FSTAB
fi
if [ "$ename" != "" ]; then
echo /dev/${drivename}e /$ename ufs rw 1 2 | sed -e s,//,/, >> $FSTAB
echo /dev/${drivename}e /$ename ffs rw 1 2 | sed -e s,//,/, >> $FSTAB
fi
if [ "$fname" != "" ]; then
echo /dev/${drivename}f /$fname ufs rw 1 3 | sed -e s,//,/, >> $FSTAB
echo /dev/${drivename}f /$fname ffs rw 1 3 | sed -e s,//,/, >> $FSTAB
fi
if [ "$gname" != "" ]; then
echo /dev/${drivename}g /$gname ufs rw 1 4 | sed -e s,//,/, >> $FSTAB
echo /dev/${drivename}g /$gname ffs rw 1 4 | sed -e s,//,/, >> $FSTAB
fi
if [ "$hname" != "" ]; then
echo /dev/${drivename}h /$hname ufs rw 1 5 | sed -e s,//,/, >> $FSTAB
echo /dev/${drivename}h /$hname ffs rw 1 5 | sed -e s,//,/, >> $FSTAB
fi
sync
echo " done."

View File

@ -1,4 +1,4 @@
# $Id: list,v 1.1.1.1 1995/09/10 06:13:42 phil Exp $
# $Id: list,v 1.2 1995/09/26 21:25:00 phil Exp $
# the disktab explanation file
COPY disktab.preinstall etc

View File

@ -1,4 +1,4 @@
# $Id: list2sh.awk,v 1.1.1.1 1995/09/10 06:13:41 phil Exp $
# $Id: list2sh.awk,v 1.2 1995/09/26 21:24:45 phil Exp $
BEGIN {
printf("cd ${CURDIR}\n");

View File

@ -1,4 +1,4 @@
# $Id: runlist.sh,v 1.1.1.1 1995/09/10 06:13:41 phil Exp $
# $Id: runlist.sh,v 1.2 1995/09/26 21:24:48 phil Exp $
if [ "X$1" = "X-d" ]; then
SHELLCMD=cat

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: Makefile,v 1.2 1995/09/26 21:25:14 phil Exp $
TOP= ${.CURDIR}/..

View File

@ -27,7 +27,7 @@
# (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: dot.hdprofile,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: dot.hdprofile,v 1.2 1995/09/26 21:25:15 phil Exp $
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
export PATH

View File

@ -27,7 +27,7 @@
# (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: dot.profile,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: dot.profile,v 1.2 1995/09/26 21:25:18 phil Exp $
PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
export PATH

View File

@ -27,7 +27,7 @@
# (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: dot.upgrutils,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: dot.upgrutils,v 1.2 1995/09/26 21:25:19 phil Exp $
# Upgrade cleanup utilites (functions), to make sure a recently-upgraded
# system is safely runnable. These are meant to be invoked from the shell

View File

@ -1,4 +1,4 @@
# $Id: list,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: list,v 1.2 1995/09/26 21:25:20 phil Exp $
# and the upgrade tools
COPY dot.profile .profile

View File

@ -28,7 +28,7 @@
# (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: upgrade.sh,v 1.1.1.1 1995/09/10 06:13:43 phil Exp $
# $Id: upgrade.sh,v 1.2 1995/09/26 21:25:22 phil Exp $
# NetBSD upgrade script.
# In a perfect world, this would be a nice C program, with a reasonable