Many thanks for your reply. The reason for compiling a kernel in gentoo tailored for use in debian is as follows.
A while ago when the first set of kernels were made with the patches for the meltdown and spectre vulnerabilities, I installed the latest kernels with these fixes as soon as they were released into my gentoo install. Then I thought to do the same thing in debian. But there was a problem. Debian only put out new kernels from time to time and no spectre enabled off the shelf kernel was available. So that meant I would have to compile a custom kernel in debian as I did in gentoo which would have the spectre fix in it. This turned out not to be an easy task. At the time you could only compile the spectre fix with gcc 8 and you could only install it if you were running debian unstable (sid). I ended up upgrading my debian stretch install to unstable and installed gcc 8 with some effort. I tried to configure and install a new kernel using the make kpkg command in debian but I could not make it work. It seemed to me that building kernels in gentoo was a lot easier than in debian at the time. Since then off the shelf kernels have been created in debian that contain the meltdown and spectre fixes but I notice there seem to be new vulnerability fixes in the pipeline in upcoming kernel releases. So I then began to wonder if I could make an extra kernel that would be made to be used in debian at the same time as I would make the gentoo one - both kernels being made in gentoo. The debian one would be ported to my debian install. I then posted this on to the gentoo kernel page on the forum site and Neddy Seagoon the site administrator and Hu the moderator both helped with some creative suggestions see here: https://forums.gentoo.org/viewtopic-t-1096872.html Neddy Seagoon suggested (at least) two useful things: 1. make a new copy of the makefile for the current kernel and change the EXTRAVERSION parameter from -gentoo to -debian: e.g. # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 1 SUBLEVEL = 1 EXTRAVERSION = -gentoo NAME = Shy Crocodile He then pointed out that the kernel make system has some useful targets in it: ... Kernel packaging: rpm-pkg - Build both source and binary RPM kernel packages binrpm-pkg - Build only the binary kernel RPM package deb-pkg - Build both source and binary deb kernel packages bindeb-pkg - Build only the binary kernel deb package ... 2. He then said I would have to copy the kernel directory contents and compile the new kernel in it etc. We then had a discussion about the fact that copying the kernel directory was kind of untidy etc. Then Hu made a post saying there there were ways to build multiple kernels from a single tree by setting certain environment variables ($KBUILD_OUTPUT, $INSTALL_PATH, $INSTALL_MOD_PATH) that would mean you could avoid copying the kernel. I found a script Hu had posted on this elsewhere on the gentoo forums: #!/bin/bash TDIR="$1"; shift if [ -z "${TDIR}" ]; then TDIR="$(uname -r)" echo 'No release specified. Defaulting to '"\"$TDIR\""'.' fi TKERN="${TDIR/*_}" BDIR="$HOME"/kernel/ KSRC="${1:-/usr/src/linux-"${TKERN}"}"; shift export KBUILD_OUTPUT="${BDIR}${TDIR}/" export INSTALL_PATH="${BDIR}install/${TDIR}/boot/" export INSTALL_MOD_PATH="${BDIR}install/${TDIR}/" if [ ! -d "$KSRC" ]; then echo 'Directory '"$KSRC"' does not exist.' >&2 exit 1 fi for a in "$KBUILD_OUTPUT" "$INSTALL_PATH"; do if [ ! -d "$a" ]; then mkdir -p "$a" || exit $? echo "Created $a" fi done echo KBUILD_OUTPUT="${KBUILD_OUTPUT}" echo INSTALL_PATH="${INSTALL_PATH}" echo INSTALL_MOD_PATH="${INSTALL_MOD_PATH}" cd "$KSRC" exec /bin/bash I had a go at running it. If you look toward the end of the gentoo forums thread you will see the problems i encountered trying to do this in practice. I had problems making the make deb-pkg and/or make bindeb-pkg command work in gentoo. Then I had the idea of installing gentoo prefix in debian itself and experimenting with the idea of getting the host debian install to make the deb packages that produce the debian kernel image files and doing the initramfs set up but still using the gentoo prefix and portage to compile and configure the kernel itself ready for debian to do the packaging that gentoo seemed to be poor at doing in practice. I also looked at the electron builder package a bit to see if it could help here. Comments appreciated. Regards MF
