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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. # syslinux 6.x needs a file called ldlinux.c32
  38. ldlinux_c32=$(dirname ${isolinux_bin})/ldlinux.c32
  39. if [ -s ${ldlinux_c32} ]
  40. then
  41. cp -p ${ldlinux_c32} ${dir}
  42. fi
  43. cat > $cfg <<EOF
  44. # These default options can be changed in the geniso script
  45. SAY iPXE ISO boot image
  46. TIMEOUT 30
  47. EOF
  48. first=
  49. for f
  50. do
  51. if [ ! -r $f ]
  52. then
  53. echo $f does not exist, skipping 1>&2
  54. continue
  55. fi
  56. b=$(basename $f)
  57. g=${b%.lkrn}
  58. g=${g//[^a-z0-9]}.krn
  59. case "$first" in
  60. "")
  61. echo DEFAULT $b
  62. ;;
  63. esac
  64. first=$g
  65. echo LABEL $b
  66. echo "" KERNEL $g
  67. cp -p $f $dir/$g
  68. done >> $cfg
  69. $mkisofs -quiet -l -o $out -c boot.cat -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table $dir
  70. rm -fr $dir
  71. if [ -n "$isohybrid" ]
  72. then
  73. $isohybrid $out >/dev/null
  74. fi