Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 1 | SUMMARY = "VirtualBox Linux Guest Drivers" |
| 2 | SECTION = "core" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 3 | LICENSE = "GPL-2.0-only" |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 4 | LIC_FILES_CHKSUM = "file://${WORKDIR}/${VBOX_NAME}/COPYING;md5=e197d5641bb35b29d46ca8c4bf7f2660" |
| 5 | |
| 6 | DEPENDS = "virtual/kernel" |
| 7 | |
| 8 | inherit module kernel-module-split |
| 9 | |
| 10 | COMPATIBLE_MACHINE = "(qemux86|qemux86-64)" |
| 11 | |
| 12 | VBOX_NAME = "VirtualBox-${PV}" |
| 13 | |
| 14 | SRC_URI = "http://download.virtualbox.org/virtualbox/${PV}/${VBOX_NAME}.tar.bz2 \ |
| 15 | file://Makefile.utils \ |
| 16 | file://0001-utils-fix-build-against-5.15-libc-headers-headers.patch \ |
| 17 | " |
| 18 | |
Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 19 | SRC_URI[sha256sum] = "9c3ce1829432e5b8374f950698587038f45fb0492147dc200e59edb9bb75eb49" |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 20 | |
| 21 | S ?= "${WORKDIR}/vbox_module" |
| 22 | S:task-patch = "${WORKDIR}/${VBOX_NAME}" |
| 23 | |
| 24 | export BUILD_TARGET_ARCH="${ARCH}" |
| 25 | export BUILD_TARGET_ARCH:x86-64="amd64" |
| 26 | |
| 27 | EXTRA_OEMAKE += "KERN_DIR='${WORKDIR}/${KERNEL_VERSION}/build' KBUILD_VERBOSE=1" |
| 28 | |
| 29 | # otherwise 5.2.22 builds just vboxguest |
| 30 | MAKE_TARGETS = "all" |
| 31 | |
| 32 | addtask export_sources after do_patch before do_configure |
| 33 | |
| 34 | do_export_sources() { |
| 35 | mkdir -p "${S}" |
| 36 | ${WORKDIR}/${VBOX_NAME}/src/VBox/Additions/linux/export_modules.sh ${T}/vbox_modules.tar.gz |
| 37 | tar -C "${S}" -xzf ${T}/vbox_modules.tar.gz |
| 38 | |
| 39 | # add a mount utility to use shared folder from VBox Addition Source Code |
| 40 | mkdir -p "${S}/utils" |
| 41 | install ${WORKDIR}/${VBOX_NAME}/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c ${S}/utils |
| 42 | install ${WORKDIR}/${VBOX_NAME}/src/VBox/Additions/linux/sharedfolders/vbsfmount.c ${S}/utils |
| 43 | install ${S}/../Makefile.utils ${S}/utils/Makefile |
| 44 | |
| 45 | } |
| 46 | |
| 47 | do_configure:prepend() { |
| 48 | # vboxguestdrivers/5.2.6-r0/vbox_module/vboxguest/Makefile.include.header:99: *** The variable KERN_DIR must be a kernel build folder and end with /build without a trailing slash, or KERN_VER must be set. Stop. |
| 49 | # vboxguestdrivers/5.2.6-r0/vbox_module/vboxguest/Makefile.include.header:108: *** The kernel build folder path must end in <version>/build, or the variable KERN_VER must be set. Stop. |
| 50 | mkdir -p ${WORKDIR}/${KERNEL_VERSION} |
| 51 | ln -snf ${STAGING_KERNEL_DIR} ${WORKDIR}/${KERNEL_VERSION}/build |
| 52 | } |
| 53 | |
| 54 | # compile and install mount utility |
| 55 | do_compile() { |
| 56 | oe_runmake all |
| 57 | oe_runmake 'LD=${CC}' 'EXTRA_CFLAGS=-I${STAGING_KERNEL_BUILDDIR}/include/' 'LDFLAGS=${LDFLAGS}' -C ${S}/utils |
| 58 | if ! [ -e vboxguest.ko -a -e vboxsf.ko -a -e vboxvideo.ko ] ; then |
| 59 | echo "ERROR: One of vbox*.ko modules wasn't built" |
| 60 | exit 1 |
| 61 | fi |
| 62 | } |
| 63 | |
| 64 | module_do_install() { |
| 65 | MODULE_DIR=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/misc |
| 66 | install -d $MODULE_DIR |
| 67 | install -m 644 vboxguest.ko $MODULE_DIR |
| 68 | install -m 644 vboxsf.ko $MODULE_DIR |
| 69 | install -m 644 vboxvideo.ko $MODULE_DIR |
| 70 | } |
| 71 | |
| 72 | do_install:append() { |
| 73 | install -d ${D}${base_sbindir} |
| 74 | install -m 755 ${S}/utils/mount.vboxsf ${D}${base_sbindir} |
| 75 | } |
| 76 | |
| 77 | PACKAGES += "kernel-module-vboxguest kernel-module-vboxsf kernel-module-vboxvideo" |
| 78 | RRECOMMENDS:${PN} += "kernel-module-vboxguest kernel-module-vboxsf kernel-module-vboxvideo" |
| 79 | |
| 80 | FILES:${PN} = "${base_sbindir}" |
| 81 | |
| 82 | # autoload if installed |
| 83 | KERNEL_MODULE_AUTOLOAD += "vboxguest vboxsf vboxvideo" |