I’m currently trying to compile a custom Ubuntu Jammy (22.04) HWE kernel, version 6.8.0-45
, by following a procedure similar to the one mentioned here. I’m applying some patches to the iwlwifi
driver.
Here’s my step-by-step process:
git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy && cd jammy
git checkout Ubuntu-hwe-6.8-6.8.0-45.45_22.04.1
git switch -c my_branch/6.8.0-45_iwl_patch
- Apply my changes to
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
file git add . && git commit -m "My commit message"
cp /boot/config-$(uname -r) .config
sed -i 's/CONFIG_LOCALVERSION=""/CONFIG_LOCALVERSION="-ricciolino"/g' .config
make oldconfig
fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary-generic
Everything works fine until step 10, where I encounter the following error during the build process:
(my_branch/6.8.0-45_iwl_patch)> fakeroot debian/rules binary-headers binary-generic
Debug: /opt/my-kernel/jammy/debian/stamps/stamp-prepare-indep
dh_prep -i
[ -d /opt/my-kernel/jammy/debian/stamps/ ] || mkdir /opt/my-kernel/jammy/debian/stamps/; touch /opt/my-kernel/jammy/debian/stamps/stamp-prepare-indep
Debug: /opt/my-kernel/jammy/debian/stamps/stamp-install-headers
dh_testdir
install -d /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45
find . -path './debian' -prune -o -path './debian.hwe-6.8' -prune \
-o -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pd --preserve-modification-time /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45
27658 blocks
cp -a scripts include /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45
(find arch -name include -type d -print | \
xargs -n1 -i: find : -type f) | \
cpio -pd --preserve-modification-time /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45
xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value
cpio: /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45/arch/powerpc/include/uapi/asm/Kbuild not created: newer or same age version exists
...
<more cpio lines>
...
cpio: /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45/arch/x86/include/asm/Kbuild not created: newer or same age version exists
28358 blocks
# Do not ship .o and .cmd artifacts in headers
find /opt/my-kernel/jammy/debian/linux-hwe-6.8-headers-6.8.0-45/usr/src/linux-hwe-6.8-headers-6.8.0-45 -name \*.o -or -name \*.cmd -exec rm -f {} \;
[ -d /opt/my-kernel/jammy/debian/stamps/ ] || mkdir /opt/my-kernel/jammy/debian/stamps/; touch /opt/my-kernel/jammy/debian/stamps/stamp-install-headers
Debug: binary-headers
dh_installchangelogs -plinux-hwe-6.8-headers-6.8.0-45
dh_installdocs -plinux-hwe-6.8-headers-6.8.0-45
dh_compress -plinux-hwe-6.8-headers-6.8.0-45
dh_fixperms -plinux-hwe-6.8-headers-6.8.0-45
dh_installdeb -plinux-hwe-6.8-headers-6.8.0-45
flock -w 60 /opt/my-kernel/jammy/debian/.LOCK dh_gencontrol -plinux-hwe-6.8-headers-6.8.0-45
dh_md5sums -plinux-hwe-6.8-headers-6.8.0-45
dh_builddeb -plinux-hwe-6.8-headers-6.8.0-45
dpkg-deb: building package 'linux-hwe-6.8-headers-6.8.0-45' in '../linux-hwe-6.8-headers-6.8.0-45_6.8.0-45.45~22.04.1_all.deb'.
x86_64-linux-gnu-gcc-12 debian/scripts/fix-filenames.c -o debian/scripts/fix-filenames
Debug: /opt/my-kernel/jammy/debian/stamps/stamp-prepare-tree-generic
install -d /opt/my-kernel/jammy/debian/build/build-generic
touch /opt/my-kernel/jammy/debian/build/build-generic/ubuntu-build
python3 debian/scripts/misc/annotations --export --arch amd64 --flavour generic > /opt/my-kernel/jammy/debian/build/build-generic/.config
sed -i 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu 6.8.0-45.45~22.04.1-generic 6.8.12"/' /opt/my-kernel/jammy/debian/build/build-generic/.config
find /opt/my-kernel/jammy/debian/build/build-generic -name "*.ko" | xargs rm -f
make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- HOSTCC=x86_64-linux-gnu-gcc-12 CC=x86_64-linux-gnu-gcc-12 BINDGEN=bindgen-0.65 KERNELRELEASE=6.8.0-45-generic CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_BUILD_VERSION="45~22.04.1" CFLAGS_MODULE="-DPKG_ABI=45" PYTHON=python3 O=/opt/my-kernel/jammy/debian/build/build-generic -j24 rustavailable || true
make[1]: Entering directory '/opt/my-kernel/jammy'
make[2]: Entering directory '/opt/my-kernel/jammy/debian/build/build-generic'
***
*** Rust bindings generator 'bindgen-0.65' could not be found.
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
make[3]: *** [/opt/my-kernel/jammy/Makefile:1718: rustavailable] Error 1
make[2]: *** [/opt/my-kernel/jammy/Makefile:240: __sub-make] Error 2
make[2]: Leaving directory '/opt/my-kernel/jammy/debian/build/build-generic'
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/opt/my-kernel/jammy'
make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- HOSTCC=x86_64-linux-gnu-gcc-12 CC=x86_64-linux-gnu-gcc-12 BINDGEN=bindgen-0.65 KERNELRELEASE=6.8.0-45-generic CONFIG_DEBUG_SECTION_MISMATCH=y KBUILD_BUILD_VERSION="45~22.04.1" CFLAGS_MODULE="-DPKG_ABI=45" PYTHON=python3 O=/opt/my-kernel/jammy/debian/build/build-generic -j24 olddefconfig
make[1]: Entering directory '/opt/my-kernel/jammy'
make[2]: Entering directory '/opt/my-kernel/jammy/debian/build/build-generic'
***
*** The source tree is not clean, please run 'make ARCH=x86 mrproper'
*** in /opt/my-kernel/jammy
***
make[3]: *** [/opt/my-kernel/jammy/Makefile:646: outputmakefile] Error 1
make[2]: *** [/opt/my-kernel/jammy/Makefile:240: __sub-make] Error 2
make[2]: Leaving directory '/opt/my-kernel/jammy/debian/build/build-generic'
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/opt/my-kernel/jammy'
make: *** [debian/rules.d/2-binary-arch.mk:23: /opt/my-kernel/jammy/debian/stamps/stamp-prepare-tree-generic] Error 2
What is wrong ?
Thanks for suppoort
I think I understand what was wrong.
I just created a GitHub gist with all updated steps.
I report them here also:
Particularly important is the
fakeroot debian/rules editconfigs
step, before finalfakeroot
command for starting the build.