Date: Thu, 23 Apr 1998 07:15:35 -0500 (CDT) From: "Paul T. Root" <proot@horton.iaces.com> To: dima@apc.net (Dima Dorfman) Cc: dwhite@resnet.uoregon.edu, freebsd-questions@FreeBSD.ORG Subject: Re: 2 simple questions Message-ID: <199804231215.HAA15929@horton.iaces.com> In-Reply-To: <3.0.5.32.19980422190314.0098c810@mail.apc.net> from Dima Dorfman at "Apr 22, 98 07:03:14 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
--ELM893333735-15900-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
In a previous message, Dima Dorfman said:
> I need to know how to create a boot disk. Like, how do I create a kernel
> small enough to fit it and mount, rm, ls, cp, ... on a 1.44MB disk.
Here's the script I use. You'll want to adjust the kernel for your
hardware.
--
"We are here on earth to do good to others. What the others
are here for, I don't know." --W.H. Auden 91907-1973)
--ELM893333735-15900-0_
Content-Type: application/x-sh
Content-Disposition: attachment; filename=create.sh
Content-Description: /home/proot/tmp/create.sh
Content-Transfer-Encoding: 7bit
#!/bin/sh
#
# create a restore floppy
#
# format the floppy
#
PATH=/bin:/sbin:/usr/sbin:/usr/bin
echo "Formatting fd0"
fdformat -q fd0
if [ $? -ne 0 ]
then
echo "Bad floppy, please use a new one"
exit 1
fi
# place boot blocks on the floppy
#
echo "Labeling fd0"
disklabel -w -B -b /usr/mdec/fdboot -s /usr/mdec/bootfd /dev/rfd0c fd1440
#
# newfs the one and only partition
#
echo "newfs fd0"
newfs -t 2 -u 18 -l 1 -c 40 -i 5120 -m 1 -o space /dev/rfd0a
#
# mount the new floppy
#
mount /dev/fd0a /mnt
#
# create required directories
#
echo "Creating directories"
mkdir /mnt/dev
mkdir /mnt/bin
mkdir /mnt/sbin
mkdir /mnt/etc
mkdir /mnt/mnt # for the root partition
mkdir /mnt/var
mkdir /mnt/cdrom
mkdir /mnt/usr
mkdir /mnt/usr/mdec
#
# populate the directories
#
echo "populate the directories"
if [ ! -x /sys/compile/MINI/kernel.kz ]
then
if [ ! -f /sys/i386/conf/MINI ]; then
CONFIG=MINI
else
CONFIG=MINI2
fi
echo "The MINI kernel does not exist, creating one."
cat >/sys/i386/conf/$CONFIG << EOM
#
# MINI -- A kernel to get FreeBSD on onto a disk.
#
machine "i386"
cpu "I586_CPU"
cpu "I686_CPU"
ident MINI
maxusers 5
options INET
options FFS #Berkeley Fast File System
options "CD9660" #ISO 9660 Filesystems
options "FAT_CURSOR" #block cursor in syscons or pccons
options "SCSI_DELAY=5" #Be pessimistic about Joe SCSI device
options "NCONS=2" # virtual consoles
options USERCONFIG #Allow user configuration with -c
config kernel root on sd0
controller isa0
controller pci0
controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintr
disk fd0 at fdc0 drive 0
controller wdc0 at isa? port "IO_WD1" bio irq 14 vector wdintr
disk wd0 at wdc0 drive 0
disk wd1 at wdc0 drive 1
#controller wdc1 at isa? port "IO_WD2" bio irq 15 vector wdintr
#disk wd2 at wdc1 drive 0
#disk wd3 at wdc1 drive 1
options ATAPI #Enable ATAPI support for IDE bus
options ATAPI_STATIC #Don't do it as an LKM
device wcd0 #IDE CD-ROM
controller ahc0
controller scbus0
device sc0 at isa? port "IO_KBD" tty irq 1 vector scintr
device npx0 at isa? port "IO_NPX" irq 13 vector npxintr
device sd0
device st0
device cd0
device fxp0
pseudo-device loop
pseudo-device ether
pseudo-device gzip
EOM
cd /sys/i386/conf
config $CONFIG
cd ../../compile/$CONFIG
make
kzip kernel
else
CONFIG=MINI
fi
echo "Copying kernel"
cp -f /sys/compile/${CONFIG}/kernel.kz /mnt
echo "copy sbin programs"
gzip -c -best /sbin/init > /mnt/sbin/init
gzip -c -best /sbin/fsck > /mnt/sbin/fsck
gzip -c -best /sbin/mount > /mnt/sbin/mount
gzip -c -best /sbin/mount_cd9660 >/mnt/sbin/mount_cd9660
gzip -c -best /sbin/halt > /mnt/sbin/halt
gzip -c -best /sbin/restore > /mnt/sbin/restore
gzip -c -best /sbin/ifconfig > /mnt/sbin/ifconfig
cd /mnt/sbin
ln restore rrestore
gzip -c -best /sbin/fdisk >/mnt/sbin/fdisk
gzip -c -best /sbin/disklabel >/mnt/sbin/disklabel
gzip -c -best /sbin/newfs >/mnt/sbin/newfs
gzip -c -best /bin/sh > /mnt/bin/sh
gzip -c -best /bin/sync > /mnt/bin/sync
gzip -c -best /bin/[ >/mnt/bin/[
cp /usr/mdec/boot1 /mnt/usr/mdec/sdboot
cp /usr/mdec/boot2 /mnt/usr/mdec/bootsd
cp /root/.profile /mnt/root
cp -f /dev/MAKEDEV /mnt/dev
chmod 755 /mnt/dev/MAKEDEV
chmod 500 /mnt/sbin/init
chmod 555 /mnt/sbin/fsck /mnt/sbin/mount /mnt/sbin/halt
chmod 555 /mnt/bin/sh /mnt/bin/sync /mnt/bin/[
chmod 555 /mnt/sbin/ifconfig /mnt/sbin/mount_cd9660
chmod 555 /mnt/sbin/fdisk /mnt/sbin/newfs /mnt/sbin/disklabel
chmod 6555 /mnt/sbin/restore
#
# create the devices nodes
#
echo "creating devices"
cd /mnt/dev
./MAKEDEV std
./MAKEDEV sd0
./MAKEDEV st0
./MAKEDEV pty0
#./MAKEDEV wd0
./MAKEDEV fd0
./MAKEDEV wcd0
cd /
echo "Create etc files"
#
# create minimum filesystem table
#
cat > /mnt/etc/fstab <<EOF
/dev/fd0a / ufs rw 1 1
/dev/wcd0c /cdrom cd9660 ro,noauto 0 0
EOF
#
# put in fdisk config file
#
cat >/mnt/etc/fdisk.conf <<EOF
# Config for IBM IntelliStation Z Pro
# Run with fdisk -i -f configfile /dev/rsd0
# WARNING - THIS WIPES THE DISK CLEAN
# WITHOUT ASKING.
g c548 h255 s63
p 1 165 63 4192902
a 1
EOF
#
# put in disklabel config file
#
cat >/mnt/etc/disklabel.conf <<EOF
# /dev/rsd0c:
type: SCSI
disk: sd0s1
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 260
sectors/unit: 4192902
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 204800 0 4.2BSD 0 0 0 # (Cyl. 0 - 12*)
b: 524288 204800 swap # (Cyl. 12*- 45*)
c: 4192902 0 unused 0 0 # (Cyl. 0 - 260*)
e: 524288 729088 4.2BSD 0 0 0 # (Cyl. 45*- 78*)
f: 2939526 1253376 4.2BSD 0 0 0 # (Cyl. 78*- 260*)
EOF
#
# create minimum passwd file
#
cat > /mnt/etc/master.passwd <<EOM
root::0:0::0:0:Charlie &:/root:/bin/sh
EOM
chmod 600 /mnt/etc/master.passwd
/usr/sbin/pwd_mkdb -d/mnt/etc /mnt/etc/master.passwd
#
# services for rrestore
#
cat >/mnt/etc/services <<EOF
shell 514/tcp cmd # no passwords used
EOF
#
# The RC script that should just do the
# install with just a couple of questions
#
cp ~proot/FreeBSD-install/auto-install/rc /mnt/etc/rc
#
# Create boot.config file
#
cat >/mnt/boot.config <<EOF
0:fd(0,a)/kernel.kz
EOF
#
# create symbolic link for /tmp to /mnt
# and /tmp to /mnt
#
cd /mnt
ln -s /mnt /mnt/tmp
#
echo "Disk complete, umount and eject"
--ELM893333735-15900-0_--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804231215.HAA15929>
