• [gentoo-dev] [PATCH] kernel-build.eclass: install x509.genkey and every

    From Nowa Ammerlaan@21:1/5 to All on Fri Nov 8 13:10:02 2024
    Users setting up kernel module signing are instructed by our and upstream documentation to use the kernels x509.genkey config file. This ensures that
    a supported key is generated.

    However, in the current situation users will first have to emerge gentoo-sources or similar to actually get this genkey file. This is inconvenient
    so lets just install the genkey config file in our dist-kernels.

    There are also some other tools, scripts, and lists that may be useful, so while
    we are changing this anyway lets just install all of those as well and in the process simplify the code.

    Signed-off-by: Nowa Ammerlaan <andrewammerlaan@gentoo.org>
    ---
    eclass/kernel-build.eclass | 11 +++--------
    1 file changed, 3 insertions(+), 8 deletions(-)

    diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
    index 4a2af9845ad4..9d33aef92691 100644
    --- a/eclass/kernel-build.eclass
    +++ b/eclass/kernel-build.eclass
    @@ -397,7 +397,7 @@ kernel-build_src_install() {
    fi

    dodir "${kernel_dir}/arch/${kern_arch}"
    - mv include scripts "${ED}${kernel_dir}/" || die
    + mv certs include scripts "${ED}${kernel_dir}/" || die
    mv "arch/${kern_arch}/include" \
    "${ED}${kernel_dir}/arch/${kern_arch}/" || die
    # some arches need module.lds linker script to build external modules @@ -438,13 +438,8 @@ kernel-build_src_install() {
    local image=${ED}${kernel_dir}/${image_path}
    cp -p "build/${image_path}" "${image}" || die

    - # If a key was generated, copy it so external modules can be signed
    - local suffix
    - for suffix in pem x509; do
    - if [[ -f "build/certs/signing_key.${suffix}" ]]; then
    - cp -p "build/certs/signing_key.${suffix}" "$