2005-05-24 11:27:37 +02:00
|
|
|
#!/bin/sh
|
2017-11-01 15:07:57 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2005-05-24 11:27:37 +02:00
|
|
|
|
|
|
|
|
#
|
2019-11-04 14:11:44 +01:00
|
|
|
# buildtar 0.0.5
|
2005-05-24 11:27:37 +02:00
|
|
|
#
|
2006-01-01 14:23:47 +01:00
|
|
|
# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
2005-05-24 11:27:37 +02:00
|
|
|
#
|
|
|
|
|
# This script is used to compile a tarball from the currently
|
|
|
|
|
# prepared kernel. Based upon the builddeb script from
|
|
|
|
|
# Wichert Akkerman <wichert@wiggy.net>.
|
|
|
|
|
#
|
|
|
|
|
|
2024-07-03 03:02:42 +09:00
|
|
|
set -eu
|
2005-05-24 11:27:37 +02:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Some variables and settings used throughout the script
|
|
|
|
|
#
|
2023-02-15 10:20:31 +09:00
|
|
|
tmpdir=$1
|
2005-05-24 11:27:37 +02:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Clean-up and re-create the temporary directory
|
|
|
|
|
#
|
|
|
|
|
rm -rf -- "${tmpdir}"
|
|
|
|
|
mkdir -p -- "${tmpdir}/boot"
|
|
|
|
|
|
2020-06-27 14:25:05 +02:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Try to install dtbs
|
|
|
|
|
#
|
|
|
|
|
if grep -q '^CONFIG_OF_EARLY_FLATTREE=y' include/config/auto.conf; then
|
|
|
|
|
# Only some architectures with OF support have this target
|
|
|
|
|
if [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then
|
|
|
|
|
$MAKE ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_DTBS_PATH="${tmpdir}/boot/dtbs/${KERNELRELEASE}" dtbs_install
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2005-05-24 11:27:37 +02:00
|
|
|
#
|
2023-11-21 12:58:55 +01:00
|
|
|
# Install modules
|
2005-05-24 11:27:37 +02:00
|
|
|
#
|
2023-11-21 12:58:55 +01:00
|
|
|
make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
|
2005-05-24 11:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Install basic kernel files
|
|
|
|
|
#
|
2006-01-01 14:23:47 +01:00
|
|
|
cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
|
2017-08-19 00:20:51 +02:00
|
|
|
cp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}"
|
2006-01-01 14:23:47 +01:00
|
|
|
cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
2005-05-24 11:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Install arch-specific kernel image(s)
|
|
|
|
|
#
|
2024-04-15 02:41:39 +09:00
|
|
|
# Note:
|
2024-05-02 13:16:08 +02:00
|
|
|
# mips and arm64 copy the first image found. This may not produce the desired
|
|
|
|
|
# outcome because it may pick up a stale file remaining in the build tree.
|
2024-04-15 02:41:39 +09:00
|
|
|
#
|
2005-05-24 11:27:37 +02:00
|
|
|
case "${ARCH}" in
|
|
|
|
|
alpha)
|
2024-04-15 02:41:39 +09:00
|
|
|
cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
2005-05-24 11:27:37 +02:00
|
|
|
;;
|
2009-02-18 22:12:21 +00:00
|
|
|
parisc*)
|
2024-04-15 02:41:39 +09:00
|
|
|
cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
2009-02-18 22:12:21 +00:00
|
|
|
[ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}"
|
|
|
|
|
;;
|
2010-10-08 11:45:37 +10:00
|
|
|
mips)
|
2024-04-15 02:41:39 +09:00
|
|
|
# Please note the following code may copy a stale file.
|
2010-10-08 11:45:37 +10:00
|
|
|
if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.srec" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.srec" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/vmlinux.32" ]; then
|
|
|
|
|
cp -v -- "${objtree}/vmlinux.32" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/vmlinux.64" ]; then
|
|
|
|
|
cp -v -- "${objtree}/vmlinux.64" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/arch/mips/boot/vmlinux.bin" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/vmlinux.bin" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/arch/mips/boot/vmlinux.ecoff" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/vmlinux.ecoff" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/arch/mips/boot/vmlinux.srec" ]; then
|
|
|
|
|
cp -v -- "${objtree}/arch/mips/boot/vmlinux.srec" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
elif [ -f "${objtree}/vmlinux" ]; then
|
|
|
|
|
cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
|
|
|
|
|
fi
|
|
|
|
|
;;
|
2018-07-13 09:24:58 -07:00
|
|
|
arm64)
|
2024-04-15 02:41:39 +09:00
|
|
|
# Please note the following code may copy a stale file.
|
2022-12-14 14:20:02 +01:00
|
|
|
for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo vmlinuz.efi ; do
|
2018-07-13 09:24:58 -07:00
|
|
|
if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then
|
|
|
|
|
cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
;;
|
2021-03-16 13:02:43 -03:00
|
|
|
riscv)
|
2024-05-02 13:16:08 +02:00
|
|
|
case "${KBUILD_IMAGE##*/}" in
|
|
|
|
|
Image.*|vmlinuz.efi)
|
|
|
|
|
cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}";;
|
|
|
|
|
*)
|
|
|
|
|
cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}";;
|
|
|
|
|
esac
|
2021-03-16 13:02:43 -03:00
|
|
|
;;
|
2005-05-24 11:27:37 +02:00
|
|
|
*)
|
2024-04-23 00:46:10 +09:00
|
|
|
cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
|
2005-05-24 11:27:37 +02:00
|
|
|
;;
|
|
|
|
|
esac
|