Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Juri!

From a quick look, moving this block breaks at least the SKIP_SYSTEMD logic in the block just above. I'm thinking it could make sense to just have a BUILD_DIR variable that the user could override and with a default value of ".". Then we could use it as part of the existing default MAKE command and we wouldn't have to reorder these blocks. I think it'd be a bit more inline with the existing (whacky, I agree) logic, what do you think ?

I'm on holiday for a week so I'll only be able to give this a proper look in some time, apologies in advance if I'm not responsive ;)

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"}
Expand Down Expand Up @@ -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
;;
Expand Down