#!/bin/sh # #define Q+D # # This makes a bootkernel disk in /dev/fd0 from a kernel image. # # Run this in a directory containing the kernels you're gonna use, and a # subdirectory with a master image of the bootkernel disk. # # This is the command to use: # # makedisk kernel_image disk_size # ^^ ^^^^^^^^^ This is 1440 or 1200 # ^^^^^ This is the name (and maybe path to) the kernel you're going # to use, such as scsinet/scsinet. # # KERNEL=$1 DISKSIZE=$2 FSSIZE=`filesize $1` FSSIZE=`expr $FSSIZE + 122112` FSSIZE=`expr $FSSIZE / 1024` TARGET=/dev/fd0 MASTER_DIR=/tmp/master-$$ CWD=`pwd` MOUNT=/tmp/mnt-$$ if [ ! -d $MASTER_DIR ]; then mkdir -p $MASTER_DIR ( cd $MASTER_DIR ; tar xzvf $CWD/master.tar.gz ) DELETE_MASTER=true fi if [ ! -d $MOUNT ]; then mkdir -p $MOUNT DELETE_MOUNT=true fi if [ $DISKSIZE = 1200 ]; then cp lilo.conf.1200 $MASTER_DIR/etc/lilo.conf RAMSIZE=1200 elif [ $DISKSIZE = 1440 ]; then cp lilo.conf.1440 $MASTER_DIR/etc/lilo.conf RAMSIZE=1440 else echo echo "Usage: makedisk kernel_image disk_size" echo echo "Disk is made in /dev/fd0. Target disk must be formatted." echo "Legal disk sizes are 1200 and 1440." echo exit fi if [ -r $1 ]; then echo "Making a bootkernel disk from kernel image $1..." else echo "Image $1 not readable." exit fi cp $1 $MASTER_DIR/vmlinuz echo "Rdeving -R $MASTER_DIR/vmlinuz 0" rdev -R $MASTER_DIR/vmlinuz 0 #echo "Rdeving -r $MASTER_DIR/vmlinuz $RAMSIZE" #rdev -r $MASTER_DIR/vmlinuz $RAMSIZE echo "Rdeving rdev -r $MASTER_DIR/vmlinuz 49152" rdev -r $MASTER_DIR/vmlinuz 49152 echo "Rdeving -v $MASTER_DIR/vmlinuz -v" rdev -v $MASTER_DIR/vmlinuz -1 # It's possible some people might want to use /dev/fd0h1200 or /dev/fd0H1440 # on the line below... echo "Rdeving $MASTER_DIR/vmlinuz /dev/fd0" rdev $MASTER_DIR/vmlinuz /dev/fd0 #echo "Formatting the target disk..." #fdformat /dev/fd0H1200 echo "Blanking the target disk..." dd if=/dev/zero of=$TARGET bs=1024 count=$FSSIZE echo "Making the MINIX/Linux filesystem..." # Let's use a 600K size, since that's good enough for the kernel + utilities # needed to boot... then we can reduce the size of the uncompressed disks. mkfs.minix -i 400 $TARGET $FSSIZE echo "Mounting the disk on $MOUNT..." mount $TARGET $MOUNT cd $MASTER_DIR echo "Copying the files over..." cp -a * $MOUNT sync echo "Installing LILO..." lilo -r $MOUNT sync umount $MOUNT echo "Bootkernel disk created." if [ "$DELETE_MASTER" = "true" ]; then rm -rf $MASTER_DIR fi if [ "$DELETE_MOUNT" = "true" ]; then rm -rf $MOUNT fi NAME=`dirname $1` NAME=`basename $NAME` dd if=/dev/fd0 of=/tmp/$NAME bs=1024 count=$FSSIZE