We could get KBUILD_OUTPUT from "readlink -f /lib/modules/`uname -r`/build" The attached patch demonstrates the idea.
Created attachment 103190 [details, diff] linux-info.eclass.KBUILD_OUTPUT.patch
Honestly, I fail to see a single reason to touch the eclass because of this. Reading the target of some (potentially stale or dead) symlink is a horrible way to determine the correct directory for KBUILD_OUTPUT (and don't fix what's not broken applies as well).
(In reply to comment #2) > Honestly, I fail to see a single reason to touch the eclass because of this. > Reading the target of some (potentially stale or dead) symlink is a horrible > way to determine the correct directory for KBUILD_OUTPUT (and don't fix what's > not broken applies as well). > Then how about treat it as a fallback solution? I think normally this particular symlink /lib/modules/`uname -r`/build should be up-to-date. At least, maybe we can eliminate this: kbuild_output="$(getfilevar KBUILD_OUTPUT ${KV_DIR}/Makefile)" normally KV_DIR is /usr/src/linux, if my KBUILD_OUTPUT is elsewhere, then Makefile in /usr/src/linux won't contain KBUILD_OUTPUT. Please correct me if I were wrong.
This should already be in place in the code: [ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${KV_EXTRA}" == "$(uname -r)" ] && \ OUTPUT_DIR="${OUTPUT_DIR:-/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${KV_EXTRA}/build}" Any idea why this does not work for you?
(In reply to comment #4) > This should already be in place in the code: > > [ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${KV_EXTRA}" == "$(uname -r)" ] && \ > > OUTPUT_DIR="${OUTPUT_DIR:-/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${KV_EXTRA}/build}" > > Any idea why this does not work for you? Thanks genstef. I overlooked this. However there is a little mistake in this code, look at this: ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${KV_EXTRA} actually we don't need the dot between KV_PATCH and KV_EXTRA, otherwise kernel version like 2.6.18-suspend2 will become 2.6.18.-suspend2 I will post another patch.
Created attachment 103371 [details, diff] eliminate the dot between ${KV_PATCH}.${KV_EXTRA}
Thanks, I fixed this in linux-info.eclass