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.

geniso 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. #
  3. # Generate a isolinux ISO boot image
  4. #
  5. # geniso foo.iso foo.lkrn
  6. #
  7. # the ISO image is the first argument so that a list of .lkrn images
  8. # to include can be specified
  9. #
  10. case $# in
  11. 0|1)
  12. echo Usage: $0 foo.iso foo.lkrn ...
  13. exit 1
  14. ;;
  15. esac
  16. # This should be the default location of the isolinux.bin file
  17. isolinux_bin=${ISOLINUX_BIN:-util/isolinux.bin}
  18. if [ ! -r $isolinux_bin ]
  19. then
  20. echo $0: $isolinux_bin not found, please install, or set ISOLINUX_BIN in arch/i386/Makefile correctly
  21. exit 1
  22. fi
  23. # There should either be mkisofs or the compatible genisoimage program
  24. mkisofs=`which mkisofs genisoimage 2>/dev/null | head -n1`
  25. if [ -z $mkisofs ]
  26. then
  27. echo $0: mkisofs or genisoimage not found, please install or set PATH
  28. exit 1
  29. fi
  30. # isohybrid will be used if available
  31. isohybrid=`which isohybrid 2>/dev/null`
  32. out=$1
  33. shift
  34. dir=`mktemp -d bin/iso.dir.XXXXXX`
  35. cfg=$dir/isolinux.cfg
  36. cp -p $isolinux_bin $dir
  37. cat > $cfg <<EOF
  38. # These default options can be changed in the geniso script
  39. SAY iPXE ISO boot image
  40. TIMEOUT 30
  41. EOF
  42. first=
  43. for f
  44. do
  45. if [ ! -r $f ]
  46. then
  47. echo $f does not exist, skipping 1>&2
  48. continue
  49. fi
  50. b=$(basename $f)
  51. g=${b%.lkrn}
  52. g=${g//[^a-z0-9]}.krn
  53. case "$first" in
  54. "")
  55. echo DEFAULT $b
  56. ;;
  57. esac
  58. first=$g
  59. echo LABEL $b
  60. echo "" KERNEL $g
  61. cp -p $f $dir/$g
  62. done >> $cfg
  63. $mkisofs -quiet -l -o $out -c boot.cat -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table $dir
  64. rm -fr $dir
  65. if [ -n "$isohybrid" ]
  66. then
  67. $isohybrid $out >/dev/null
  68. fi