-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
virtualbox: Fix build for manual kernel. #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
830e9db
31d8a9a
e32d784
3e62a02
9fb1d2e
1b8ec2e
0f9a5eb
347e8c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,13 +8,27 @@ | |
|
|
||
| with stdenv.lib; | ||
|
|
||
| let version = "4.1.18"; in | ||
|
|
||
| stdenv.mkDerivation { | ||
| let | ||
| version = "4.1.18"; | ||
| forEachModule = action: '' | ||
| for mod in \ | ||
| $sourcedir/out/linux.*/release/bin/src/vboxdrv \ | ||
| $sourcedir/out/linux.*/release/bin/src/vboxpci \ | ||
| $sourcedir/out/linux.*/release/bin/src/vboxnetadp \ | ||
| $sourcedir/out/linux.*/release/bin/src/vboxnetflt | ||
| do | ||
| if [ "x$(basename "$mod")" != xvboxdrv -a ! -e "$mod/Module.symvers" ] | ||
| then | ||
| cp -v $sourcedir/out/linux.*/release/bin/src/vboxdrv/Module.symvers \ | ||
| "$mod/Module.symvers" | ||
| fi | ||
| INSTALL_MOD_PATH="$out" INSTALL_MOD_DIR=misc \ | ||
| make -C "$MODULES_BUILD_DIR" "M=$mod" DEPMOD=/do_not_use_depmod ${action} | ||
| done | ||
| ''; | ||
| in stdenv.mkDerivation { | ||
| name = "virtualbox-${version}-${kernel.version}"; | ||
|
|
||
| NIX_CFLAGS_COMPILE="-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated"; | ||
|
|
||
| src = fetchurl { | ||
| url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2"; | ||
| sha256 = "e650e4fdc23581b9edc0e5d5705cc596c76796851ebf65ccda0edb8e413fa3b7"; | ||
|
|
@@ -42,10 +56,11 @@ stdenv.mkDerivation { | |
| ''; | ||
|
|
||
| configurePhase = '' | ||
| sourcedir="$(pwd)" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be necessary, the standard unpackPhase sets $sourceRoot
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, it is necessary, as $sourceRoot is not an absolute path.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, OK. I wonder if that should be changed in stdenv-updates... @edolstra? |
||
| ./configure --with-qt4-dir=${qt4} \ | ||
| ${optionalString (!javaBindings) "--disable-java"} \ | ||
| ${optionalString (!pythonBindings) "--disable-python"} \ | ||
| --disable-pulse --disable-hardening \ | ||
| --disable-pulse --disable-hardening --disable-kmods \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this affect what happens when you run kmk? Does it do anything else?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Personally I think that given VirtualBox size, building one main binary
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an interesting idea, @aszlig do you have any sense of if the main binary is kernel version dependent? |
||
| --with-mkisofs=${xorriso}/bin/xorrisofs | ||
| sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \ | ||
| -i AutoConfig.kmk | ||
|
|
@@ -63,51 +78,35 @@ stdenv.mkDerivation { | |
|
|
||
| enableParallelBuilding = true; | ||
|
|
||
| preBuild = '' | ||
| buildPhase = '' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does just running 'make' do? Build the modules, or is something else build too?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, virtualbox is using its own build system, but uses make for their kernel modules, so in fact the buildPhase was essentially just building the kernel modules, while virtualbox itself was built earlier in preBuild |
||
| source env.sh | ||
| kmk | ||
| cd out/linux.*/release/bin/src | ||
| export KERN_DIR=${kernel}/lib/modules/*/build | ||
| ${forEachModule "modules"} | ||
| ''; | ||
|
|
||
| postBuild = '' | ||
| cd ../../../../.. | ||
| ''; | ||
|
|
||
| installPhase = '' | ||
| libexec=$out/libexec/virtualbox | ||
|
|
||
| # Install VirtualBox files | ||
| cd out/linux.*/release/bin | ||
| mkdir -p $libexec | ||
| cp -av * $libexec | ||
|
|
||
| # Install kernel module | ||
| cd src | ||
| kernelVersion=$(cd ${kernel}/lib/modules; ls) | ||
| export MODULE_DIR=$out/lib/modules/$kernelVersion/misc | ||
|
|
||
| # Remove root ownership stuff, since this does not work in a chroot environment | ||
| for i in `find . -name Makefile`; do | ||
| sed -i -e "s|-o root||g" \ | ||
| -e "s|-g root||g" $i | ||
| done | ||
|
|
||
|
|
||
| # Install kernel modules | ||
| make install | ||
| ${forEachModule "modules_install"} | ||
|
|
||
| # Create wrapper script | ||
| mkdir -p $out/bin | ||
| for file in VirtualBox VBoxManage VBoxSDL VBoxBalloonCtrl VBoxBFE VBoxHeadless; do | ||
| ln -s "$libexec/$file" $out/bin/$file | ||
| done | ||
|
|
||
| # Create and fix desktop item | ||
| mkdir -p $out/share/applications | ||
| sed -i -e "s|Icon=VBox|Icon=$libexec/VBox.png|" $libexec/virtualbox.desktop | ||
| ln -sfv $libexec/virtualbox.desktop $out/share/applications | ||
| ''; | ||
|
|
||
| meta = { | ||
| description = "PC emulator"; | ||
| homepage = http://www.virtualbox.org/; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably respect makeFlags, makeFlagsArray, buildFlags{,Array}(when building), and installFlags{,Array}(when installing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to set DEPMOD=? Why didn't we need that before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we built kernel modules using the build system from virtualbox itself, which was generating the Makefiles for the module build.
Unfortunately this won't work with kernels that have split build and source trees.
So this is done like in their install targets for RPM based distros, using the build system from the kernel itself.