16d983feaSJan-Benedict Glaw#!/bin/sh 2b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 36d983feaSJan-Benedict Glaw 46d983feaSJan-Benedict Glaw# 5af7db99aSMatteo Croce# buildtar 0.0.5 66d983feaSJan-Benedict Glaw# 76073aa64SJan-Benedict Glaw# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de> 86d983feaSJan-Benedict Glaw# 96d983feaSJan-Benedict Glaw# This script is used to compile a tarball from the currently 106d983feaSJan-Benedict Glaw# prepared kernel. Based upon the builddeb script from 116d983feaSJan-Benedict Glaw# Wichert Akkerman <wichert@wiggy.net>. 126d983feaSJan-Benedict Glaw# 136d983feaSJan-Benedict Glaw 14*c0414419SMasahiro Yamadaset -eu 156d983feaSJan-Benedict Glaw 166d983feaSJan-Benedict Glaw# 176d983feaSJan-Benedict Glaw# Some variables and settings used throughout the script 186d983feaSJan-Benedict Glaw# 191fc90958SMasahiro Yamadatmpdir=$1 206d983feaSJan-Benedict Glaw 216d983feaSJan-Benedict Glaw# 226d983feaSJan-Benedict Glaw# Clean-up and re-create the temporary directory 236d983feaSJan-Benedict Glaw# 246d983feaSJan-Benedict Glawrm -rf -- "${tmpdir}" 256d983feaSJan-Benedict Glawmkdir -p -- "${tmpdir}/boot" 266d983feaSJan-Benedict Glaw 2755a87cd8SDomenico Andreoli 2855a87cd8SDomenico Andreoli# 2955a87cd8SDomenico Andreoli# Try to install dtbs 3055a87cd8SDomenico Andreoli# 3155a87cd8SDomenico Andreoliif grep -q '^CONFIG_OF_EARLY_FLATTREE=y' include/config/auto.conf; then 3255a87cd8SDomenico Andreoli # Only some architectures with OF support have this target 3355a87cd8SDomenico Andreoli if [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then 3455a87cd8SDomenico Andreoli $MAKE ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_DTBS_PATH="${tmpdir}/boot/dtbs/${KERNELRELEASE}" dtbs_install 3555a87cd8SDomenico Andreoli fi 3655a87cd8SDomenico Andreolifi 3755a87cd8SDomenico Andreoli 3855a87cd8SDomenico Andreoli 396d983feaSJan-Benedict Glaw# 40b28d6ca1SPetr Vorel# Install modules 416d983feaSJan-Benedict Glaw# 42175209ccSMasahiro Yamadamake ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install 436d983feaSJan-Benedict Glaw 446d983feaSJan-Benedict Glaw 456d983feaSJan-Benedict Glaw# 466d983feaSJan-Benedict Glaw# Install basic kernel files 476d983feaSJan-Benedict Glaw# 486073aa64SJan-Benedict Glawcp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}" 49cfd63736SNicolas Porcelcp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}" 506073aa64SJan-Benedict Glawcp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 516d983feaSJan-Benedict Glaw 526d983feaSJan-Benedict Glaw 536d983feaSJan-Benedict Glaw# 546d983feaSJan-Benedict Glaw# Install arch-specific kernel image(s) 556d983feaSJan-Benedict Glaw# 56c3f7bed8SMasahiro Yamada# Note: 57a0b49a91SEmil Renner Berthing# mips and arm64 copy the first image found. This may not produce the desired 58a0b49a91SEmil Renner Berthing# outcome because it may pick up a stale file remaining in the build tree. 59c3f7bed8SMasahiro Yamada# 606d983feaSJan-Benedict Glawcase "${ARCH}" in 616d983feaSJan-Benedict Glaw alpha) 62c3f7bed8SMasahiro Yamada cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 636d983feaSJan-Benedict Glaw ;; 6491400ac3SHelge Deller parisc*) 65c3f7bed8SMasahiro Yamada cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 6691400ac3SHelge Deller [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}" 6791400ac3SHelge Deller ;; 687848ea79SStuart Longland mips) 69c3f7bed8SMasahiro Yamada # Please note the following code may copy a stale file. 707848ea79SStuart Longland if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then 717848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 727848ea79SStuart Longland elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" ]; then 737848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 747848ea79SStuart Longland elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.srec" ]; then 757848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.srec" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 767848ea79SStuart Longland elif [ -f "${objtree}/vmlinux.32" ]; then 777848ea79SStuart Longland cp -v -- "${objtree}/vmlinux.32" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 787848ea79SStuart Longland elif [ -f "${objtree}/vmlinux.64" ]; then 797848ea79SStuart Longland cp -v -- "${objtree}/vmlinux.64" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 807848ea79SStuart Longland elif [ -f "${objtree}/arch/mips/boot/vmlinux.bin" ]; then 817848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/vmlinux.bin" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 827848ea79SStuart Longland elif [ -f "${objtree}/arch/mips/boot/vmlinux.ecoff" ]; then 837848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/vmlinux.ecoff" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 847848ea79SStuart Longland elif [ -f "${objtree}/arch/mips/boot/vmlinux.srec" ]; then 857848ea79SStuart Longland cp -v -- "${objtree}/arch/mips/boot/vmlinux.srec" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 867848ea79SStuart Longland elif [ -f "${objtree}/vmlinux" ]; then 877848ea79SStuart Longland cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 887848ea79SStuart Longland fi 897848ea79SStuart Longland ;; 900df57d90SOlof Johansson arm64) 91c3f7bed8SMasahiro Yamada # Please note the following code may copy a stale file. 92731c4eacSVeronika Kabatova for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo vmlinuz.efi ; do 930df57d90SOlof Johansson if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then 940df57d90SOlof Johansson cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 950df57d90SOlof Johansson break 960df57d90SOlof Johansson fi 970df57d90SOlof Johansson done 980df57d90SOlof Johansson ;; 997d0bc44bSCarlos de Paula riscv) 100a0b49a91SEmil Renner Berthing case "${KBUILD_IMAGE##*/}" in 101a0b49a91SEmil Renner Berthing Image.*|vmlinuz.efi) 102a0b49a91SEmil Renner Berthing cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}";; 103a0b49a91SEmil Renner Berthing *) 104a0b49a91SEmil Renner Berthing cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}";; 105a0b49a91SEmil Renner Berthing esac 1067d0bc44bSCarlos de Paula ;; 1076d983feaSJan-Benedict Glaw *) 1082b1ab140SMasahiro Yamada cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 1096d983feaSJan-Benedict Glaw ;; 1106d983feaSJan-Benedict Glawesac 111