162306a36Sopenharmony_ci#!/bin/sh
262306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciset -e
562306a36Sopenharmony_ci
662306a36Sopenharmony_cidestdir=${1}
762306a36Sopenharmony_ci
862306a36Sopenharmony_citest -n "${srctree}"
962306a36Sopenharmony_citest -n "${SRCARCH}"
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciis_enabled() {
1262306a36Sopenharmony_ci	grep -q "^$1=y" include/config/auto.conf
1362306a36Sopenharmony_ci}
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cimkdir -p "${destdir}"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci(
1862306a36Sopenharmony_ci	cd "${srctree}"
1962306a36Sopenharmony_ci	echo Makefile
2062306a36Sopenharmony_ci	find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
2162306a36Sopenharmony_ci	find include scripts -type f -o -type l
2262306a36Sopenharmony_ci	find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
2362306a36Sopenharmony_ci	find "arch/${SRCARCH}" -name include -o -name scripts -type d
2462306a36Sopenharmony_ci) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci{
2762306a36Sopenharmony_ci	if is_enabled CONFIG_OBJTOOL; then
2862306a36Sopenharmony_ci		echo tools/objtool/objtool
2962306a36Sopenharmony_ci	fi
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	find "arch/${SRCARCH}/include" Module.symvers include scripts -type f
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	if is_enabled CONFIG_GCC_PLUGINS; then
3462306a36Sopenharmony_ci		find scripts/gcc-plugins -name '*.so'
3562306a36Sopenharmony_ci	fi
3662306a36Sopenharmony_ci} | tar -c -f - -T - | tar -xf - -C "${destdir}"
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci# copy .config manually to be where it's expected to be
3962306a36Sopenharmony_cicp "${KCONFIG_CONFIG}" "${destdir}/.config"
40