• [gentoo-dev] [COMMITTED] kernel-build.eclass: handle CTF if enabled

    From Sam James@21:1/5 to All on Tue Sep 3 11:50:01 2024
    genpatches will soon be adding optional CTF debug information support
    via a patch. If it's enabled, we need to call a few special make targets
    to create and install the CTF information. We also need to avoid stripping
    the CTF archive.

    Signed-off-by: Sam James <sam@gentoo.org>
    ---
    eclass/kernel-build.eclass | 13 ++++++++++++-
    1 file changed, 12 insertions(+), 1 deletion(-)

    diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
    index 10fd0cca2cc5..1fc86c4a2208 100644
    --- a/eclass/kernel-build.eclass
    +++ b/eclass/kernel-build.eclass
    @@ -296,7 +296,13 @@ kernel-build_src_configure() {
    kernel-build_src_compile() {
    debug-print-function ${FUNCNAME} "${@}"

    - emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all
    + local targets=( all )
    +
    + if grep -q "CONFIG_CTF=y" "${WORKDIR}/modprep/.config"; then
    + targets+=( ctf )
    + fi
    +
    + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" "${targets[@]}"
    }

    # @FUNCTION: kernel-build_src_test
    @@ -337,6 +343,10 @@ kernel-build_src_install() {
    targets+=( dtbs_install )
    fi

    + if grep -q "CONFIG_CTF=y" "${WORKDIR}/modprep/.config"; then
    + targets+=( ctf_install )
    + fi
    +
    # Use the kernel build system to strip, this ensures the modules
    # are stripped *before* they are signed or compressed.
    local strip_a