[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

making the floppy without rebooting



I'm working on a script based on Marcus's ``how to make a boot disk
(part I)''
(http://www.debian.org/Lists-Archives/debian-hurd-9909/msg00079.html).
My hope is to have it create the boot disk under Linux without
requiring a reboot.  The resulting disk boots goes fine until this:

  Hit return to resume /hurd/ext2fs.static.gz<RET>
  /hurd/ext2fs.static.gz: fd0: Invalid argument

Was I supposed to insert the root disk when it asked for a return?
Perhaps my script corrupts the floppy filesystem with dd, grub, and/or
failing to sync at the right times.

Thanks
-John

#!/bin/bash

fd=/dev/fd0
floppy=/floppy
gnu=/gnu

#test -f /usr/share/grub/i386-pc/stage2 || ( apt-get install grub )
if [ ! -f $gnu/boot/gnumach.gz ]
then
    echo "Follow the instructions at http://www.pick.ucam.org/~mcv21/hurd.html";
    echo "(skipping the part about GRUB) through running cross-install,"
    echo "then run this script again."
    exit 1
fi

dd if=/dev/zero of=$fd bs=1k count=1440 || exit 1
mke2fs -N 32 -o hurd $fd
mount $fd $floppy
mkdir $floppy/boot
cp $gnu/boot/gnumach.gz $gnu/boot/serverboot.gz $floppy/boot/

cat > $floppy/boot/servers.boot <<'EOF'
# GNU Mach boot script for Debian GNU/Hurd.  Each line specifies a
# file for serverboot to load (the first word), and actions to be done
# with it.

# First, the bootstrap filesystem.  It needs several ports as arguments,
# as well as the user flags from the boot loader.
/hurd/ext2fs.static.gz --bootflags=${boot-args} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -Tbunzip2:device ${root-device} $(task-create) $(prompt-task-resume)

# Now the exec server; to load the dynamically-linked exec server
# program, we have serverboot in fact load and run ld.so, which in
# turn loads and runs /hurd/exec.  This task is created, and its task
# port saved in ${exec-task} to be passed to the fs above, but it is
# left suspended; the fs will resume the exec task once it is ready.
/lib/ld.so.1.gz /hurd/exec $(exec-task=task-create)
EOF

mkdir $floppy/hurd $floppy/lib
gzip -9c $gnu/hurd/ext2fs.static > $floppy/hurd/ext2fs.static.gz
gzip -9c $gnu/lib/ld.so.1 > $floppy/lib/ld.so.1.gz
mkdir $floppy/boot/grub
cp /usr/share/grub/i386-pc/stage2 $floppy/boot/grub/

cat > $floppy/boot/grub/menu.lst <<'EOF'
# This is the amount grub waits before booting the default entry
timeout= 10

# Tell which entry to boot by default.  Note that this is origin zero
# from the beginning of the file.  
default= 0

# Note that to GRUB, all hard disks are `hd' and all floppy disks are `fd'.
# To Mach, SCSI disks are `sd' and IDE type disks are `hd'.  Use
# GRUB names in the `root' command and prefixing filenames.  Use a 
# Mach name as the `root' arg for the kernel, and whenever running the Hurd.

# Entry 0:
title= Floppy
root= (fd0)
kernel= /boot/gnumach.gz root=fd0
module= /boot/serverboot.gz
EOF

umount $floppy
dd if=/usr/share/grub/i386-pc/stage1 of=/dev/fd0 bs=512 count=1

cat <<'EOF' | grub --batch
install= (fd0)+1 (fd0) (fd0)/boot/grub/stage2 0x8000 p
quit
EOF

sync


Reply to: