+ # and in newer versions we can also pull LOCALVERSION if it is set.
+ # but before we do this, we need to find if we use a different object directory.
+ # This *WILL* break if the user is using localversions, but we assume it was
+ # caught before this if they are.
+ if [[ -z ${OUTPUT_DIR} ]] ; then
+ # Try to locate a kernel that is most relevant for us.
+ for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}" "" ; do
+ OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}/build"
+ if [[ -e ${OUTPUT_DIR} ]] ; then
+ break
+ fi
+ done
+ fi
+