Clean kernel source directory before setting up make alias
When kbuild is using a separate directory for output files then it will check if the kernel source directory is clean. The build will throw an error when the source directory is not clean: .. is not clean, please run 'make mrproper' Once envkernel.sh has aliased the make command then make mrproper will be run in the context of .output directory. If the source directory is not clean then user may be wondering why make mrproper doesn't clean it. This change will ensure that the source directory is clean when envkernel is setup.
This commit is contained in:
parent
87384aace6
commit
9d198f1ea4
|
@ -13,6 +13,30 @@ check_kernel_folder() {
|
|||
}
|
||||
|
||||
|
||||
clean_kernel_src_dir() {
|
||||
|
||||
if [ -f ".config" ] || [ -d "include/config" ]; then
|
||||
echo "Source directory is not clean, running 'make mrproper'."
|
||||
|
||||
tmp_dir=""
|
||||
if [ -d ".output" ]; then
|
||||
echo " * Preserving existing build output."
|
||||
tmp_dir=$(mktemp -d)
|
||||
sudo mv ".output" "$tmp_dir"
|
||||
fi;
|
||||
|
||||
# backslash is prefixed to disable the alias
|
||||
# shellcheck disable=SC1001
|
||||
\make mrproper
|
||||
|
||||
if [ ! -z "$tmp_dir" ]; then
|
||||
sudo mv "$tmp_dir/.output" ".output"
|
||||
sudo rmdir "$tmp_dir"
|
||||
fi;
|
||||
fi;
|
||||
}
|
||||
|
||||
|
||||
export_pmbootstrap_dir() {
|
||||
# Get pmbootstrap dir based on this script's location
|
||||
# See also: <https://stackoverflow.com/a/29835459>
|
||||
|
@ -144,6 +168,7 @@ main() {
|
|||
# Stop executing once a function fails
|
||||
# shellcheck disable=SC1090
|
||||
if check_kernel_folder \
|
||||
&& clean_kernel_src_dir \
|
||||
&& export_pmbootstrap_dir "$1" \
|
||||
&& set_alias_pmbootstrap \
|
||||
&& export_chroot_device_deviceinfo \
|
||||
|
|
Loading…
Reference in New Issue