7373kmake_single () {
7474 # XXX: kmake operations depend on variable expansion- do not quote variables here.
7575 # Except for compiler option since ccache will be involved
76- make $KM_A $KP_PARAMS " $KM_C " $KM_L -j1 $@
76+ make $KM_A $KP_PARAMS " $KM_C " $KM_L $KM_O -j1 $@
7777}
7878
7979kmake () {
8080 # XXX: kmake operations depend on variable expansion- do not quote variables here.
8181 # Except for compiler option since ccache will be involved
82- make $KM_A $KP_PARAMS " $KM_C " $KM_L -j$KM_CPUS $@
82+ make $KM_A $KP_PARAMS " $KM_C " $KM_L $KM_O -j$KM_CPUS $@
8383}
8484
8585to_time () {
@@ -380,7 +380,11 @@ defconfig() {
380380 if [ -n " $DEFCONFIG " ]; then
381381 kmake " $DEFCONFIG " > /dev/null
382382 else
383- cp " $TEST_DIR " /.config .config
383+ if [ -n " $BUILD_OUTPUT_DIR " ]; then
384+ cp " $TEST_DIR " /.config " $BUILD_OUTPUT_DIR " /.config
385+ else
386+ cp " $TEST_DIR " /.config .config
387+ fi
384388 kmake olddefconfig > /dev/null
385389 fi
386390}
@@ -597,7 +601,11 @@ on_exit() {
597601 fi
598602 if [ -f " $TEST_DIR /.config" ]; then
599603 echo " restoring .config"
600- cp " $TEST_DIR " /.config .config
604+ if [ -n " $BUILD_OUTPUT_DIR " ]; then
605+ cp " $TEST_DIR " /.config " $BUILD_OUTPUT_DIR " /.config
606+ else
607+ cp " $TEST_DIR " /.config .config
608+ fi
601609 fi
602610 if [ -n " $TEST_DIR " ] && [ -d " $TEST_DIR " ]; then
603611 echo " Removing temp dir"
@@ -784,14 +792,18 @@ check_missing_application() {
784792recommend_missing_application () {
785793 check_missing_application
786794 if [ -n " $APPS_MISSING " ]; then
787- echo " Missing Applications in system: $APPS_MISSING " >&2
795+ # Red background, white foreground
796+ echo -e " \e[1m\e[97m\e[101mError: Missing Applications in system: $APPS_MISSING \e[0m" >&2
797+ echo " " >&2
788798 # Lets see if we can recommend an application
789799 if [ -x /usr/lib/command-not-found ]; then
790800 for i in $APPS_MISSING
791801 do
792802 /usr/lib/command-not-found --no-failure-msg " $i "
793803 done
794804 fi
805+ echo " " >&2
806+ echo " Please install the missing applications and try again." >&2
795807 return 2
796808 fi
797809 return 0
@@ -806,14 +818,15 @@ usage() {
806818
807819 printf ' %s\n' \
808820 ' ' \
809- " Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-T tmp_dir_base] [-l logfile] [-C] [-P] [-c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
821+ " Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-O build_output_dir] [- T tmp_dir_base] [-l logfile] [-C] [-P] [-c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
810822 ' '
811823
812824 printf ' \t%s\n' \
813825 " -d: if not already defined, use CROSS_COMPILE=$DEF_CROSS_COMPILE , ARCH=$DEF_ARCH , and builds for '$KP_TARGETS $DEF_BUILDTARGETS ' build targets" \
814826 " -V: (default armV8 targets) if not already defined, use CROSS_COMPILE=$DEF_V8_CROSS_COMPILE , ARCH=$DEF_V8_ARCH , and builds for '$KP_TARGETS $DEF_V8_BUILDTARGETS ' build targets" \
815827 " -j CPUs: override default CPUs count with build (default is $KM_CPUS )" \
816828 " -B build_target: override default build target and use provided build_target" \
829+ " -O build_output_dir: kernel build output directory (for separate build directory with O=)" \
817830 " -T temp_dir_base: temporary directory base (default is $TEST_B_DIR )" \
818831 " -l logfile: report file (defaults to $LOG_FILE )" \
819832 " -L Use llvm to build 'LLVM=1 CC='$ccache clang''" \
@@ -854,7 +867,9 @@ usage() {
854867 " Example usage 7: on a cross_compiled ARM build using defaults, 1 patch" \
855868 " $APP_NAME -d -1" \
856869 " Example usage 8: on a cross_compiled ARM build using defaults,15 patches" \
857- " $APP_NAME -d -n 15"
870+ " $APP_NAME -d -n 15" \
871+ " Example usage 9: verify last patch using separate build output directory" \
872+ " $APP_NAME -O /path/to/build/output -1"
858873
859874 printf ' %s\n' ' '
860875
@@ -865,7 +880,8 @@ usage() {
865880
866881ORIDE=0
867882DTB_NOSKIP=0
868- while getopts " S:n:j:c:T:B:l:p:b:t:m:123456789CdDUVZLP" opt; do
883+ BUILD_OUTPUT_DIR=" "
884+ while getopts " S:n:j:c:T:B:l:p:b:t:m:O:123456789CdDUVZLP" opt; do
869885 case $opt in
870886 j)
871887 KM_CPUS=$OPTARG
@@ -938,6 +954,13 @@ while getopts "S:n:j:c:T:B:l:p:b:t:m:123456789CdDUVZLP" opt; do
938954 exit 1
939955 fi
940956 ;;
957+ O)
958+ BUILD_OUTPUT_DIR=$OPTARG
959+ if [ ! -d " $BUILD_OUTPUT_DIR " ]; then
960+ usage " Build output directory $BUILD_OUTPUT_DIR does not exist"
961+ exit 1
962+ fi
963+ ;;
941964 C)
942965 COMPLETE_TESTS=1
943966 KP_PARAMS=" $KP_PARAMS W=12 EXTRA_CFLAGS=-W"
@@ -1038,8 +1061,7 @@ if [ -n "${CROSS_COMPILE}" ]; then
10381061 APPS_NEEDED=" $APPS_NEEDED ${CROSS_COMPILE} gcc"
10391062fi
10401063
1041- if ! check_missing_application; then
1042- usage " Missing apps"
1064+ if ! recommend_missing_application; then
10431065 exit 2
10441066fi
10451067
@@ -1077,6 +1099,10 @@ if [ -n "$ARCH" ]; then
10771099 KM_A=" ARCH=$ARCH "
10781100fi
10791101
1102+ if [ -n " $BUILD_OUTPUT_DIR " ]; then
1103+ KM_O=" O=$BUILD_OUTPUT_DIR "
1104+ fi
1105+
10801106KDIR=$( pwd)
10811107
10821108CURRENT_BRANCH=$( git branch | grep ' ^\*' | cut -d " " -f 2)
@@ -1093,7 +1119,12 @@ if [ -n "$TEST_BRANCH" ] && [ "$TEST_BRANCH" = "$BASE_BRANCH" ]; then
10931119 exit 3
10941120fi
10951121
1096- if [ ! -e " .config" ] && [ -z " $DEFCONFIG " ]; then
1122+ CONFIG_FILE=" .config"
1123+ if [ -n " $BUILD_OUTPUT_DIR " ]; then
1124+ CONFIG_FILE=" $BUILD_OUTPUT_DIR /.config"
1125+ fi
1126+
1127+ if [ ! -e " $CONFIG_FILE " ] && [ -z " $DEFCONFIG " ]; then
10971128 usage " No default .config exists nor is a defconfig specified with -c"
10981129 exit 3
10991130fi
@@ -1117,7 +1148,7 @@ if [ -e "$GIT_RM_DIR" ] || [ -e "$GIT_RA_DIR" ]; then
11171148 exit 3
11181149fi
11191150
1120- cp .config " $TEST_DIR " /.config 2> /dev/null
1151+ cp " $CONFIG_FILE " " $TEST_DIR " /.config 2> /dev/null
11211152if [ -z " $SMATCH " ]; then
11221153 SMATCH=$TEST_DIR /smatch
11231154 echo -e ' #!/bin/bash\nsmatch -p=kernel $@' > " $SMATCH "
0 commit comments