commit:     531d8afa4029a0c8bf180e94488783cce34e5dfe
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 06:38:48 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 06:48:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=531d8afa

app-emulation/virtualbox-modules: fix build with kernel 6.9+

Closes: https://bugs.gentoo.org/937445
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 .../virtualbox-modules-7.0.14-kernel-6.9.patch     | 46 ++++++++++++++++++++++
 .../virtualbox-modules-6.1.50-r2.ebuild            | 39 ++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git 
a/app-emulation/virtualbox-modules/files/virtualbox-modules-7.0.14-kernel-6.9.patch
 
b/app-emulation/virtualbox-modules/files/virtualbox-modules-7.0.14-kernel-6.9.patch
new file mode 100644
index 000000000000..2b2928303c91
--- /dev/null
+++ 
b/app-emulation/virtualbox-modules/files/virtualbox-modules-7.0.14-kernel-6.9.patch
@@ -0,0 +1,46 @@
+https://www.virtualbox.org/ticket/22033
+https://bugs.gentoo.org/937445
+
+--- a/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
++++ b/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+@@ -114,6 +114,14 @@
+ # define LNX_MM_UP_WRITE(a_pMm)       up_write(&(a_pMm)->mmap_sem)
+ #endif
+ 
++/*
++ * p.._large alias for p.._leaf is gone in 6.9
++ */
++#if RTLNX_VER_MIN(6,9,0)
++# define p4d_large p4d_leaf
++# define pmd_large pmd_leaf
++# define pud_large pud_leaf
++#endif
+ 
+ 
/*********************************************************************************************************************************
+ *   Structures and Typedefs                                                   
                                                   *
+--- a/vboxnetflt/linux/VBoxNetFlt-linux.c
++++ b/vboxnetflt/linux/VBoxNetFlt-linux.c
+@@ -926,7 +926,10 @@ static void vboxNetFltLinuxSkBufToSG(PVB
+     for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++)
+     {
+         skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i];
+-# if RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2)
++# if RTLNX_VER_MIN(6,9,0)
++        pSG->aSegs[iSeg].cb = pFrag->len;
++        pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->offset;
++# elif RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2)
+         pSG->aSegs[iSeg].cb = pFrag->bv_len;
+         pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
+ # else /* < KERNEL_VERSION(5, 4, 0) */
+@@ -947,7 +950,10 @@ static void vboxNetFltLinuxSkBufToSG(PVB
+         for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++)
+         {
+             skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i];
+-# if RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2)
++# if RTLNX_VER_MIN(6,9,0)
++            pSG->aSegs[iSeg].cb = pFrag->len;
++            pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->offset;
++# elif RTLNX_VER_MIN(5,4,0) || RTLNX_SUSE_MAJ_PREREQ(15, 2)
+             pSG->aSegs[iSeg].cb = pFrag->bv_len;
+             pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + 
pFrag->bv_offset;
+ # else /* < KERNEL_VERSION(5, 4, 0) */

diff --git 
a/app-emulation/virtualbox-modules/virtualbox-modules-6.1.50-r2.ebuild 
b/app-emulation/virtualbox-modules/virtualbox-modules-6.1.50-r2.ebuild
new file mode 100644
index 000000000000..0f8363855a0e
--- /dev/null
+++ b/app-emulation/virtualbox-modules/virtualbox-modules-6.1.50-r2.ebuild
@@ -0,0 +1,39 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# XXX: the tarball here is just the kernel modules split out of the binary
+#      package that comes from VirtualBox-*.run
+# XXX: update: now it is split from virtualbox-*-Debian~bullseye_amd64.deb
+
+EAPI=8
+
+inherit linux-mod-r1
+
+MY_P="vbox-kernel-module-src-${PV}"
+DESCRIPTION="Kernel Modules for Virtualbox"
+HOMEPAGE="https://www.virtualbox.org/";
+SRC_URI="https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${MY_P}.tar.xz";
+S="${WORKDIR}"
+
+LICENSE="GPL-2"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+CONFIG_CHECK="~!SPINLOCK JUMP_LABEL"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-7.0.14-kernel-6.6-warning.patch
+       "${FILESDIR}"/${PN}-7.0.14-kernel-6.9.patch
+)
+
+src_compile() {
+       local modlist=( {vboxdrv,vboxnetflt,vboxnetadp}=misc )
+       local modargs=( KERN_DIR="${KV_OUT_DIR}" KERN_VER="${KV_FULL}" )
+       linux-mod-r1_src_compile
+}
+
+src_install() {
+       linux-mod-r1_src_install
+       insinto /usr/lib/modules-load.d/
+       newins "${FILESDIR}"/virtualbox.conf-r1 virtualbox.conf
+}

Reply via email to