buildtar 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/sh
  2. #
  3. # buildtar 0.0.3
  4. #
  5. # (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
  6. #
  7. # This script is used to compile a tarball from the currently
  8. # prepared kernel. Based upon the builddeb script from
  9. # Wichert Akkerman <wichert@wiggy.net>.
  10. #
  11. set -e
  12. #
  13. # Some variables and settings used throughout the script
  14. #
  15. version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}"
  16. tmpdir="${objtree}/tar-install"
  17. tarball="${objtree}/linux-${version}.tar"
  18. #
  19. # Figure out how to compress, if requested at all
  20. #
  21. case "${1}" in
  22. tar-pkg)
  23. compress="cat"
  24. file_ext=""
  25. ;;
  26. targz-pkg)
  27. compress="gzip -c9"
  28. file_ext=".gz"
  29. ;;
  30. tarbz2-pkg)
  31. compress="bzip2 -c9"
  32. file_ext=".bz2"
  33. ;;
  34. *)
  35. echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
  36. exit 1
  37. ;;
  38. esac
  39. #
  40. # Clean-up and re-create the temporary directory
  41. #
  42. rm -rf -- "${tmpdir}"
  43. mkdir -p -- "${tmpdir}/boot"
  44. #
  45. # Try to install modules
  46. #
  47. if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then
  48. echo "" >&2
  49. echo "Ignoring error at module_install time, since that could be" >&2
  50. echo "a result of missing local modutils/module-init-tools," >&2
  51. echo "or you just didn't compile in module support at all..." >&2
  52. echo "" >&2
  53. fi
  54. #
  55. # Install basic kernel files
  56. #
  57. cp -v -- System.map "${tmpdir}/boot/System.map-${version}"
  58. cp -v -- .config "${tmpdir}/boot/config-${version}"
  59. cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}"
  60. #
  61. # Install arch-specific kernel image(s)
  62. #
  63. case "${ARCH}" in
  64. i386)
  65. [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}"
  66. ;;
  67. alpha)
  68. [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}"
  69. ;;
  70. vax)
  71. [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS"
  72. [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk"
  73. ;;
  74. *)
  75. [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}"
  76. echo "" >&2
  77. echo '** ** ** WARNING ** ** **' >&2
  78. echo "" >&2
  79. echo "Your architecture did not define any architecture-dependant files" >&2
  80. echo "to be placed into the tarball. Please add those to ${0} ..." >&2
  81. echo "" >&2
  82. sleep 5
  83. ;;
  84. esac
  85. #
  86. # Create the tarball
  87. #
  88. (
  89. cd "${tmpdir}"
  90. tar cf - . | ${compress} > "${tarball}${file_ext}"
  91. )
  92. echo "Tarball successfully created in ${tarball}${file_ext}"
  93. exit 0