mksyslinux.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. #
  3. # Formats a floppy to use Syslinux
  4. dummy=""
  5. # need to have mtools installed
  6. if [ -z `which mformat` -o -z `which mcopy` ]; then
  7. echo "You must have the mtools package installed to run this script"
  8. exit 1
  9. fi
  10. # need an arg for the location of the kernel
  11. if [ -z "$1" ]; then
  12. echo "usage: `basename $0` path/to/linux/kernel"
  13. exit 1
  14. fi
  15. # need to have a root file system built
  16. if [ ! -f rootfs.gz ]; then
  17. echo "You need to have a rootfs built first."
  18. echo "Hit RETURN to make one now or Control-C to quit."
  19. read dummy
  20. ./mkrootfs.sh
  21. fi
  22. # prepare the floppy
  23. echo "Please insert a blank floppy in the drive and press RETURN to format"
  24. echo "(WARNING: All data will be erased! Hit Control-C to abort)"
  25. read dummy
  26. echo "Formatting the floppy..."
  27. mformat a:
  28. echo "Making it bootable with Syslinux..."
  29. syslinux -s /dev/fd0
  30. echo "Copying Syslinux configuration files..."
  31. mcopy syslinux.cfg display.txt a:
  32. echo "Copying root filesystem file..."
  33. mcopy rootfs.gz a:
  34. # XXX: maybe check for "no space on device" errors here
  35. echo "Copying linux kernel..."
  36. mcopy $1 a:linux
  37. # XXX: maybe check for "no space on device" errors here too
  38. echo "Finished: boot floppy created"