diff --git a/local.sh b/local.sh index dda21bd..7a2a93c 100644 --- a/local.sh +++ b/local.sh @@ -10,7 +10,8 @@ # export PATH=$HOME/qemu/bin/:$PATH ## Generate objects in a subdirectory -# MAKE="$MAKE O=.vscode/build-$TARGET_ARCH/" +# BUILD_DIR="build" +# MAKE="$MAKE O=${BUILD_DIR}/" ## Enable some random kernel CONFIG by default as part of the .config generation # if [ $COMMAND = "defconfig" ]; then diff --git a/tasks.sh b/tasks.sh index f9103bf..ecaa932 100755 --- a/tasks.sh +++ b/tasks.sh @@ -47,14 +47,9 @@ COMMAND=$1 : ${SCRIPT:=`realpath -s "$0"`} : ${SCRIPT_DIR:=`dirname "${SCRIPT}"`} -# Let the user override environment variables for their special needs -files_to_source=$(find ${SCRIPT_DIR} -maxdepth 1 -xtype f -name "local*.sh") -for file in $files_to_source; do - source "$file" -done - # Default context variables, can be overridden by local.sh or in environment. : ${WORKSPACE_DIR:=`realpath -s "${SCRIPT_DIR}/.."`} +: ${BUILD_DIR:="${WORKSPACE_DIR}"} : ${MAKE:="make -j`nproc` LLVM=1 LLVM_IAS=1 CC='ccache clang'"} : ${TARGET_ARCH:="x86_64"} : ${SILENT_BUILD_FLAG="-s"} @@ -75,6 +70,12 @@ if [[ $SKIP_SYSTEMD == 1 ]]; then KERNEL_CMDLINE_EXTRA="init=/sbin/init-minimal $KERNEL_CMDLINE_EXTRA" fi +# Let the user override environment variables for their special needs +files_to_source=$(find ${SCRIPT_DIR} -maxdepth 1 -xtype f -name "local*.sh") +for file in $files_to_source; do + source "$file" +done + # Convenience environment variables derived from the context if [ "${TARGET_ARCH}" = "x86_64" ]; then : ${VMLINUX:="bzImage"} @@ -161,9 +162,9 @@ case "${COMMAND}" in # Kernel build "defconfig") # Only generate .config if it doesn't already exist - if [ ! -f ${WORKSPACE_DIR}/.config ]; then + if [ ! -f ${BUILD_DIR}/.config ]; then eval ${MAKE} ARCH=${TARGET_ARCH} defconfig kvm_guest.config - scripts/config --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT + scripts/config --file "${BUILD_DIR}/.config" --enable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT eval ${MAKE} ARCH=${TARGET_ARCH} olddefconfig fi ;;