You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

genliso 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. #
  3. # Generate a legacy floppy emulation ISO boot image
  4. #
  5. # genliso foo.liso foo.lkrn bar.lkrn ...
  6. #
  7. # The .liso image filename is the first argument followed by
  8. # a list of .lkrn images include in .liso image
  9. case $# in
  10. 0|1)
  11. echo Usage: $0 foo.liso foo.lkrn ...
  12. exit 1
  13. ;;
  14. esac
  15. case "`mtools -V`" in
  16. Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
  17. ;;
  18. *)
  19. echo Mtools version 3.9.9 or later is required
  20. exit 1
  21. ;;
  22. esac
  23. out=$1
  24. shift
  25. dir=bin/liso.dir
  26. mkdir -p $dir
  27. img=$dir/boot.img
  28. mformat -f 1440 -C -i $img ::
  29. cfg=bin/syslinux.cfg
  30. cat > $cfg <<EOF
  31. # These default options can be changed in the genliso script
  32. SAY gPXE ISO boot image generated by genliso
  33. TIMEOUT 30
  34. EOF
  35. first=
  36. for f
  37. do
  38. if [ ! -r $f ]
  39. then
  40. echo $f does not exist, skipping 1>&2
  41. continue
  42. fi
  43. # shorten name for 8.3 filesystem
  44. b=$(basename $f)
  45. g=${b%.lkrn}
  46. g=${g//[^a-z0-9]}
  47. g=${g:0:8}.krn
  48. case "$first" in
  49. "")
  50. echo DEFAULT $g
  51. ;;
  52. esac
  53. first=$g
  54. echo LABEL $b
  55. echo "" KERNEL $g
  56. mcopy -m -i $img $f ::$g
  57. done >> $cfg
  58. mcopy -i $img $cfg ::syslinux.cfg
  59. if ! syslinux $img
  60. then
  61. exit 1
  62. fi
  63. mkisofs -q -o $out -c boot.cat -b boot.img $dir
  64. rm -fr $dir