linux-yocto/scripts/package/install-extmod-build
Masahiro Yamada c041441975 kbuild: package: add -e and -u options to some shell scripts
Set -e to make these scripts fail on the first error.

Set -u because these scripts are invoked by Makefile, and do not work
properly without necessary variables defined.

I tweaked mkdebian to cope with optional environment variables.

Remove the explicit "test -n ..." from install-extmod-build.

Both options are described in POSIX. [1]

[1]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/set.html

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2024-07-16 16:06:18 +09:00

841 B
Executable File

#!/bin/sh

SPDX-License-Identifier: GPL-2.0-only

set -eu

destdir=${1}

is_enabled() { grep -q "^$1=y" include/config/auto.conf }

mkdir -p "${destdir}"

( cd "${srctree}" echo Makefile find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*' find include scripts -type f -o -type l find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform find "arch/${SRCARCH}" -name include -type d ) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"

{ if is_enabled CONFIG_OBJTOOL; then echo tools/objtool/objtool fi

find "arch/${SRCARCH}/include" Module.symvers include scripts -type f

if is_enabled CONFIG_GCC_PLUGINS; then
	find scripts/gcc-plugins -name '*.so'
fi

} | tar -c -f - -T - | tar -xf - -C "${destdir}"

copy .config manually to be where it's expected to be

cp "${KCONFIG_CONFIG}" "${destdir}/.config"