blob: 689782b7fdab4cf7c258d3e16b9bbc7113ba1225 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "VirtualBox Linux Guest Drivers"
2SECTION = "core"
3LICENSE = "GPL-2.0"
4LIC_FILES_CHKSUM = "file://${WORKDIR}/${VBOX_NAME}/COPYING;md5=e197d5641bb35b29d46ca8c4bf7f2660"
5
6DEPENDS = "virtual/kernel"
7
8inherit module kernel-module-split
9
10COMPATIBLE_MACHINE = "(qemux86|qemux86-64)"
11
12VBOX_NAME = "VirtualBox-${PV}"
13
14SRC_URI = "http://download.virtualbox.org/virtualbox/${PV}/${VBOX_NAME}.tar.bz2 \
15 file://Makefile.utils \
16"
Patrick Williams213cb262021-08-07 19:21:33 -050017
18SRC_URI[md5sum] = "fce04bbef244b4df1a50e53d132d3e6f"
19SRC_URI[sha256sum] = "0212602eea878d6c9fd7f4a3e0182da3e4505f31d25f5539fb8f7b1fbe366195"
Andrew Geissler82c905d2020-04-13 13:39:40 -050020
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050021S ?= "${WORKDIR}/vbox_module"
22S_task-patch = "${WORKDIR}/${VBOX_NAME}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050023
24export BUILD_TARGET_ARCH="${ARCH}"
Patrick Williams213cb262021-08-07 19:21:33 -050025export BUILD_TARGET_ARCH:x86-64="amd64"
Andrew Geissler82c905d2020-04-13 13:39:40 -050026
27EXTRA_OEMAKE += "KERN_DIR='${WORKDIR}/${KERNEL_VERSION}/build' KBUILD_VERBOSE=1"
28
29# otherwise 5.2.22 builds just vboxguest
30MAKE_TARGETS = "all"
31
32addtask export_sources after do_patch before do_configure
33
34do_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
Patrick Williams213cb262021-08-07 19:21:33 -050047do_configure:prepend() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050048 # 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
55do_compile() {
56 oe_runmake all
57 oe_runmake 'LD=${CC}' '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
64module_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
Patrick Williams213cb262021-08-07 19:21:33 -050072do_install:append() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050073 install -d ${D}${base_sbindir}
74 install -m 755 ${S}/utils/mount.vboxsf ${D}${base_sbindir}
75}
76
77PACKAGES += "kernel-module-vboxguest kernel-module-vboxsf kernel-module-vboxvideo"
Patrick Williams213cb262021-08-07 19:21:33 -050078RRECOMMENDS:${PN} += "kernel-module-vboxguest kernel-module-vboxsf kernel-module-vboxvideo"
Andrew Geissler82c905d2020-04-13 13:39:40 -050079
Patrick Williams213cb262021-08-07 19:21:33 -050080FILES:${PN} = "${base_sbindir}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050081
82# autoload if installed
83KERNEL_MODULE_AUTOLOAD += "vboxguest vboxsf vboxvideo"