Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion changelog/changes/2025-10-30-kmod-build.md

This file was deleted.

1 change: 1 addition & 0 deletions changelog/updates/2026-03-06-linux-6.6.129-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Linux ([6.6.129](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tag/?h=v6.6.129) (includes [6.6.128](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tag/?h=v6.6.128)))
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
: ${MODULES_ROOT:=$(echo ${SYSROOT}/lib/modules/*)}
KERNEL_DIR="${MODULES_ROOT}/build"

# This addresses an issue with the kernel version compatibility check
# when installing zfs-kmod to /build/<arch> (e.g. via build_packages)
# from its binpkg (i.e. not recompiling it).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ kmake() {
if gcc-specs-pie; then
kernel_cflags="-nopie -fstack-check=no ${kernel_cflags}"
fi
emake "--directory=${KERNEL_DIR}" \
emake "--directory=${S}/source" \
ARCH="${kernel_arch}" \
CROSS_COMPILE="${CHOST}-" \
KBUILD_OUTPUT="${S}/build" \
KBUILD_OUTPUT="../build" \
KCFLAGS="${kernel_cflags}" \
LDFLAGS="" \
"V=1" \
Expand Down Expand Up @@ -184,6 +184,85 @@ shred_keys() {
cp certs/modules.pub.pem "${sig_key}" || die
}

# Populate /lib/modules/$(uname -r)/{build,source}
install_build_source() {
local kernel_arch=$(tc-arch-kernel)
local host_kernel_arch=$(tc-ninja_magic_to_arch kern "${CBUILD}")

# NOTE: We have to get ${archabspaths} before removing symlinks under
# /usr/lib/modules. However, do not exclude "dt-bindings" for now,
# as it looks architecture-independent.
local archabspaths=($(ls -1d ${D}/usr/lib/modules/${KV_FULL}/source/scripts/dtc/include-prefixes/* \
| grep -v dt-bindings ))

# remove the broken symlinks referencing $ROOT
rm "${D}/usr/lib/modules/${KV_FULL}/build" || die

# Compose list of architectures to be excluded from the kernel modules
# tree in the final image. It is an array to be used as a pattern for
# grep command below at the end of "find source/scripts" command for
# fetching kernel modules list, e.g.:
# find source/scripts -follow -print \
# | grep -E -v -w "include-prefixes/arc|include-prefixes/xtensa"
declare -a excarchlist
local excarchstr

for apath in "${archabspaths[@]}"; do
local arch
arch=$(basename "${apath}")
if [[ "${arch}" != "${kernel_arch}" ]]; then
excarchlist+=("include-prefixes/${arch}")

# Do not append delimiter '|' in case of the last element.
if [[ "${apath}" != "${archabspaths[-1]}" ]]; then
excarchlist+=("|")
fi
fi
done

# Remove every whitespace from the grep pattern string, to make pattern
# matching work well.
excarchstr=$(echo "${excarchlist[@]}" | sed -e 's/[[:space:]]*//g')

# Install a stripped source for out-of-tree module builds (Debian-derived)
#
# NOTE: we need to exclude unsupported architectures from source/scripts,
# to prevent the final image from having unnecessary directories under
# /usr/lib/modules/${KV_FULL}/source/scripts/dtc/include-prefixes.
# The grep must run with "-w" to exclude exact patterns like either arm
# or arm64.
{
echo source/Makefile
find source/arch/${host_kernel_arch} -follow -maxdepth 1 -name 'Makefile*' -print
find source/arch/${kernel_arch} -follow -maxdepth 1 -name 'Makefile*' -print
find source/arch/${kernel_arch} -follow \( -name 'module.lds' -o -name 'Kbuild.platforms' -o -name 'Platform' \) -print
find $(find source/arch/${kernel_arch} -follow \( -name include -o -name scripts \) -follow -type d -print) -print
find source/include -follow -print
find source/scripts -follow -print | grep -E -v -w "${excarchstr}"
find build/ -print
} | cpio -pd \
--preserve-modification-time \
--owner=root:root \
--dereference \
"${D}/usr/lib/modules/${KV_FULL}" || die
# ./build/source is a symbolic link so cpio ends up creating an empty dir.
# Restore the symlink.
pushd "${D}/usr/lib/modules/${KV_FULL}"
rmdir build/source || die
ln -sr source build || die
# Symlink includes into the build directory to resemble Ubuntu's /lib/modules
# layout. This lets the Nvidia driver build when passing SYSSRC=/lib/modules/../build
# instead of requiring SYSOUT/SYSSRC.
{
find source/include -mindepth 1 -maxdepth 1 -type d
find source/arch/${kernel_arch}/include -mindepth 1 -maxdepth 1 -type d
} | while read src; do
dst="${src/source/build}"
ln -sr "${src}" "${dst}" || die
done || die
popd
}

coreos-kernel_pkg_pretend() {
[[ "${MERGE_TYPE}" == binary ]] && return

Expand All @@ -201,7 +280,10 @@ coreos-kernel_pkg_setup() {
}

coreos-kernel_src_unpack() {
# we more or less reproduce the layout in /lib/modules/$(uname -r)/
mkdir -p "${S}/build" || die
mkdir -p "${S}/source" || die
ln -s "${KERNEL_DIR}"/* "${S}/source/" || die
}

coreos-kernel_src_configure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,34 @@ src_compile() {
}

src_install() {
local build="lib/modules/${KV_FULL}/build"

# Install modules to /usr, assuming USE=symlink-usr
# Install firmware to a temporary (bogus) location.
# The linux-firmware package will be used instead.
# Stripping must be done here, not portage, to preserve sigs.
kmake INSTALL_MOD_PATH="${ED}/usr" \
kmake INSTALL_MOD_PATH="${D}/usr" \
INSTALL_MOD_STRIP="--strip-debug" \
INSTALL_FW_PATH="${T}/fw" \
modules_install

# Install to /usr/lib/debug with debug symbols intact
kmake INSTALL_MOD_PATH="${ED}/usr/lib/debug/usr" \
kmake INSTALL_MOD_PATH="${D}/usr/lib/debug/usr" \
INSTALL_FW_PATH="${T}/fw" \
modules_install
rm "${ED}/usr/lib/debug/usr/lib/modules/${KV_FULL}"/{build,modules.*} || die
rm "${D}/usr/lib/debug/usr/lib/modules/${KV_FULL}/"modules.* || die
rm "${D}/usr/lib/debug/usr/lib/modules/${KV_FULL}/build" || die

# Clean up the build tree
shred_keys
kmake clean
find "build/" -type d -empty -delete || die
rm "build/.config.old" || die

# Replace the broken /lib/modules/${KV_FULL}/build symlink with a copy of
# the files needed to build out-of-tree modules.
rm "${ED}/usr/${build}" || die
kmake run-command KBUILD_RUN_COMMAND="${KERNEL_DIR}/scripts/package/install-extmod-build ${ED}/usr/${build}"
# Install /lib/modules/${KV_FULL}/{build,source}
install_build_source

# Not strictly required but this is where we used to install the config.
dodir "/usr/boot"
local build="lib/modules/${KV_FULL}/build"
dosym "../${build}/.config" "/usr/boot/config-${KV_FULL}"
dosym "../${build}/.config" "/usr/boot/config"

# Symlink "source" to "build" for compatibility. Fedora does this.
dosym build "/usr/${build}/../source"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DIST linux-6.6.tar.xz 140064536 BLAKE2B 5f02fd8696d42f7ec8c5fbadec8e7270bdcfcb1f9844a6c4db3e1fd461c93ce1ccda650ca72dceb4890ebcbbf768ba8fba0bce91efc49fbd2c307b04e95665f2 SHA512 458b2c34d46206f9b4ccbac54cc57aeca1eaecaf831bc441e59701bac6eadffc17f6ce24af6eadd0454964e843186539ac0d63295ad2cc32d112b60360c39a35
DIST patch-6.6.127.xz 5558692 BLAKE2B 185e48ad883ef81948f8b4879acf1e6b79a23dcab340f5d7b0b165787e98f5b1bc13b321370e1208435b48875381bba98beecf8ea9f63758b52e70ff2d1e29b1 SHA512 8a8338089b47b6cea467a6986ffcdc5d48669396c1c9b0ef1792ec5d03802ade7824f20325e61febc5d45abc5b952dda044ab2e2c1850b3971dc362f37af12cf
DIST patch-6.6.129.xz 5689260 BLAKE2B 4047b1fec11e1e66c29411ef19007682e9e64e25436be66594907d0fd5919e1492651340fa26df7a14ee1e61068466f0cbd6b27020cf611e6ec0091d1ccf66e1 SHA512 3878b0ace6b90dc738555b75daf05dfd22cf40c88447f14b79391262f812df8073e7fc43e26907d13a57aef99b8277113313308f5946ff001ed7430a86ea92b3
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ IUSE=""

# XXX: Note we must prefix the patch filenames with "z" to ensure they are
# applied _after_ a potential patch-${KV}.patch file, present when building a
# patchlevel revision. We mustn't apply our patches first, it fails when the
# patchlevel revision. We mustn't apply our patches first, it fails when the
# local patches overlap with the upstream patch.
UNIPATCH_LIST="
${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \
${PATCH_DIR}/z0002-revert-pahole-flags.patch \
${PATCH_DIR}/z0003-Revert-x86-boot-Remove-the-bugger-off-message.patch \
${PATCH_DIR}/z0004-Revert-kbuild-Add-objtool-to-top-level-clean-target \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From d2498944ecd30f80ba5431e52360f590e19d4bc7 Mon Sep 17 00:00:00 2001
From: Sayan Chowdhury <sayan.chowdhury2012@gmail.com>
Date: Fri, 20 Mar 2026 17:17:11 +0530
Subject: [PATCH 1/1] Revert "kbuild: Add objtool to top-level clean target"

This reverts commit d809ee17c0d15857c768d1abaea0ce4387776c7b.

Signed-off-by: Sayan Chowdhury <sayan.chowdhury2012@gmail.com>
---
Makefile | 11 +----------
tools/objtool/Makefile | 2 --
2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 022aed903173..141167bc280a 100644
--- a/Makefile
+++ b/Makefile
@@ -1356,15 +1356,6 @@ ifneq ($(wildcard $(resolve_btfids_O)),)
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
endif

-PHONY += objtool_clean
-
-objtool_O = $(abspath $(objtree))/tools/objtool
-
-objtool_clean:
-ifneq ($(wildcard $(objtool_O)),)
- $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean
-endif
-
tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
@@ -1518,7 +1509,7 @@ vmlinuxclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)

-clean: archclean vmlinuxclean resolve_btfids_clean objtool_clean
+clean: archclean vmlinuxclean resolve_btfids_clean

# mrproper - Delete all generated files, including .config
#
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index e9a0f89e9c39..83b100c1e7f6 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -7,8 +7,6 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
endif

-RM ?= rm -f
-
LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/
ifneq ($(OUTPUT),)
LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd
--
2.53.0