mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
6073aa643f
Fix out-of-tree builds for the tar-pkg targets When I wrote the buildtar script, I didn't even think about out-of-tree builds because I didn't use these back then. This patch throughoutly uses ${objtree} instead of `pwd`. Also, the kernel version is no longer manually built. Instead, it will properly use $KERNELRELEASE . Installing modules is only done if CONFIG_MODULES is set. Signed-off-by: Jan-Benedict Glaw <jbglaw@lug-owl.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
107 lines
2.4 KiB
Bash
107 lines
2.4 KiB
Bash
#!/bin/sh
|
|
|
|
#
|
|
# buildtar 0.0.4
|
|
#
|
|
# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
|
#
|
|
# This script is used to compile a tarball from the currently
|
|
# prepared kernel. Based upon the builddeb script from
|
|
# Wichert Akkerman <wichert@wiggy.net>.
|
|
#
|
|
|
|
set -e
|
|
|
|
#
|
|
# Some variables and settings used throughout the script
|
|
#
|
|
tmpdir="${objtree}/tar-install"
|
|
tarball="${objtree}/linux-${KERNELRELEASE}.tar"
|
|
|
|
|
|
#
|
|
# Figure out how to compress, if requested at all
|
|
#
|
|
case "${1}" in
|
|
tar-pkg)
|
|
compress="cat"
|
|
file_ext=""
|
|
;;
|
|
targz-pkg)
|
|
compress="gzip -c9"
|
|
file_ext=".gz"
|
|
;;
|
|
tarbz2-pkg)
|
|
compress="bzip2 -c9"
|
|
file_ext=".bz2"
|
|
;;
|
|
*)
|
|
echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
|
|
#
|
|
# Clean-up and re-create the temporary directory
|
|
#
|
|
rm -rf -- "${tmpdir}"
|
|
mkdir -p -- "${tmpdir}/boot"
|
|
|
|
|
|
#
|
|
# Try to install modules
|
|
#
|
|
if grep -q '^CONFIG_MODULES=y' "${objtree}/.config"; then
|
|
make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install
|
|
fi
|
|
|
|
|
|
#
|
|
# Install basic kernel files
|
|
#
|
|
cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
|
|
cp -v -- "${objtree}/.config" "${tmpdir}/boot/config-${KERNELRELEASE}"
|
|
cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
|
#
|
|
# Install arch-specific kernel image(s)
|
|
#
|
|
case "${ARCH}" in
|
|
i386)
|
|
[ -f "${objtree}/arch/i386/boot/bzImage" ] && cp -v -- "${objtree}/arch/i386/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
;;
|
|
alpha)
|
|
[ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
;;
|
|
vax)
|
|
[ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
|
|
[ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
|
|
;;
|
|
*)
|
|
[ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
|
|
echo "" >&2
|
|
echo '** ** ** WARNING ** ** **' >&2
|
|
echo "" >&2
|
|
echo "Your architecture did not define any architecture-dependant files" >&2
|
|
echo "to be placed into the tarball. Please add those to ${0} ..." >&2
|
|
echo "" >&2
|
|
sleep 5
|
|
;;
|
|
esac
|
|
|
|
|
|
#
|
|
# Create the tarball
|
|
#
|
|
(
|
|
cd "${tmpdir}"
|
|
tar cf - . | ${compress} > "${tarball}${file_ext}"
|
|
)
|
|
|
|
echo "Tarball successfully created in ${tarball}${file_ext}"
|
|
|
|
exit 0
|
|
|