[OE-core] [PATCH 0/2] Support for VirtualBox guest additions

Bystricky, Juro juro.bystricky at intel.com
Fri Aug 7 22:13:31 UTC 2015


The guest additions basically use standard out-of-tree kernel device driver 
build  (as described http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html)

The build relies on the existence of  "/lib/modules/<kernel-version>/build",  containing (or symlink to) a necessary set
of  kernel development files. This is not really VirtualBox guest additions specific, it seems to be a common
packaging/install convention when installing  kernel development files via

apt-get install linux-headers-$(uname -r)

The  actual development files, AFAIK they can be installed in one of two ways:
1. Full kernel source tree (over 500MB)
2. Subset of the full kernel sources ("kernel-headers" or "linux-headers").
 These are  basically header files, Makefiles, scripts, .config, firware  and such. About 100MB.

The full set is provided by kernel-devsrc.
The subset should be provided by kernel-dev (but is not)

At some point kernel-dev provided the symlink , "/lib/modules/<kernel-version>/build".
The symlink  does not exist anymore. However, kernel.bbclass still contains some references to the 
/lib/modules/${KERNEL_VERSION}/build  in FILES_kernel-dev 






> -----Original Message-----
> From: Khem Raj [mailto:raj.khem at gmail.com]
> Sent: Wednesday, August 5, 2015 7:20 PM
> To: Bystricky, Juro
> Cc: Bruce Ashfield; Hatle, Mark G (Wind River); Purdie, Richard;
> jurobystricky at hotmail.com; openembedded-
> core at lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 0/2] Support for VirtualBox guest additions
> 
> On Wed, Aug 5, 2015 at 3:02 PM, Bystricky, Juro <juro.bystricky at intel.com>
> wrote:
> > Thanks for the link. My new understanding is that kernel-dev package
> > should already have essentially the same functionality as the
> > kernel-headers package, which makes kernel-headers package redundant.
> >  I tried it, but it did not work.
> > To be specific, I expected to see the folder "/usr/lib/modules/3.19.5-yocto-
> standard/build"
> > however, it is missing . Looking at kernel.bbclass it seems it used to
> > exist, but succumbed to some bitrot.
> >
> 
> have you thought of looking at the guest additions package and see if it could
> be doing something that can be fixed ? what you need here is kernel
> development files on target I assume, that should be easier than cross-build
> scenario which we have not fixed completely. I think this additional headers
> package is redundant.
> you could get by fixing the existing kernel-headers package ( for
> target) if anything is missing.
> 
> How is guest additions compiled ? is it during build or dynamically on target ?
> 
> > Just to make sure  we are on the same page, this is what I would like to
> accomplish:
> > http://www.cyberciti.biz/tips/build-linux-kernel-module-against-instal
> > led-kernel-source-tree.html
> >
> > Juro
> >
> >> -----Original Message-----
> >> From: Bruce Ashfield [mailto:bruce.ashfield at gmail.com]
> >> Sent: Tuesday, August 4, 2015 7:49 PM
> >> To: Hatle, Mark G (Wind River)
> >> Cc: Bystricky, Juro; openembedded-core at lists.openembedded.org;
> >> jurobystricky at hotmail.com; Purdie, Richard
> >> Subject: Re: [OE-core] [PATCH 0/2] Support for VirtualBox guest
> >> additions
> >>
> >> On Tue, Aug 4, 2015 at 11:43 PM, Bruce Ashfield
> >> <bruce.ashfield at gmail.com>
> >> wrote:
> >> > On Tue, Aug 4, 2015 at 2:32 PM, Mark Hatle
> >> > <mark.hatle at windriver.com>
> >> wrote:
> >> >> On 8/4/15 12:25 PM, Bystricky, Juro wrote:
> >> >>> I agree, the name "kernel-headers" may not be the most fortunate,
> >> "linux-headers"
> >> >>> is probably more fitting.  The recipe installs the files in a
> >> >>> similar fashion that is done by
> >> >>>
> >> >>> apt-get install linux-headers-$(uname -r)
> >> >>>
> >> >>> Typical contents can be viewed for example here:
> >> >>> https://www.archlinux.org/packages/core/i686/linux-headers/
> >> >>>
> >> >>> These files are needed to allow building  of kernel drivers
> >> >>> against the running Linux kernel. In a way, it is a subset of
> >> >>> kernel-devsrc, but including  ".config" file used for the actual running
> kernel.
> >> >>
> >> >> Again this is part of the purpose of the existing kernel-devsrc
> >> >> package.  So what is missing preventing this from working.  It
> >> >> likely needs to be added to the kernel-devsrc package instead (or
> >> >> a sub package that is created by the kernel-devsrc recipe.)
> >> >
> >> > Peeking in on vacation.
> >> >
> >> > At a minimum, we need to figure out why the existing package wasn't
> >> > able to build the use case in question here .. I've built pretty
> >> > much everything against it at one point .. so I'd like to learn more.
> >> >
> >> > And yes, what we don't need is more sets of rules that copy and
> >> > package parts of the kernel build. We are already doing that in our
> >> > do_shared_workdir and that is pretty much the minimum to build
> >> > against the kernel. If that directory structure needs more for this
> >> > purpose (or less),
> >> then update it.
> >> >
> >> > But we need to do all of this in the existing classes, to keep
> >> > everything in one place, not more recipes that are grabbing chunks
> >> > of the same source tree.
> >>
> >> FYI: exiting thoughts are here:
> >>
> >> https://bugzilla.yoctoproject.org/show_bug.cgi?id=7095
> >>
> >> So as you can see, we aren't offended by a 'headers' package, but it
> >> has to make sense with the existing packages, and needs to be
> >> generating from our existing bits of the system.
> >>
> >> Cheers,
> >>
> >> Bruce
> >>
> >> >
> >> > Bruce
> >> >
> >> >
> >> >>
> >> >>> Having these files installed, it is possible  to compile
> >> >>> additional kernel drivers that are not part of the kernel-devsrc .
> >> >>>  VirtualBox compiles some of their own drivers this way, others as
> well.
> >> >>> There are many other scenarios where you may want to add a new
> >> >>> kernel driver to an already installed Linux kernel.
> >> >>
> >> >> Yes, this was part of the design behind the kernel-devsrc, make
> >> >> sure the sources and components used to build the running kernel
> >> >> were made available to the target so that out-of-tree/external
> >> >> kernel modules could be built to match the running system -- as
> >> >> well as the ability to reconfigure and rebuild the kernel itself.
> >> >>
> >> >> Bruce is on vacation this week and may not be around to respond,
> >> >> but adding yet another package is not the right answer here.  Lets
> >> >> fix what may be broken in what we have.
> >> >>
> >> >> --Mark
> >> >>
> >> >>> Juro
> >> >>>
> >> >>>
> >> >>>
> >> >>>> -----Original Message-----
> >> >>>> From: Mark Hatle [mailto:mark.hatle at windriver.com]
> >> >>>> Sent: Tuesday, August 4, 2015 9:20 AM
> >> >>>> To: Bystricky, Juro; openembedded-core at lists.openembedded.org;
> >> >>>> jurobystricky at hotmail.com
> >> >>>> Cc: Purdie, Richard
> >> >>>> Subject: Re: [OE-core] [PATCH 0/2] Support for VirtualBox guest
> >> >>>> additions
> >> >>>>
> >> >>>> On 8/3/15 3:35 PM, Juro Bystricky wrote:
> >> >>>>> In order to support VirtualBox guest additions, kernel headers
> >> >>>>> need to be present in the VM. I am aware we already have two
> >> >>>>> packages/recipes that are somewhat similar (kernel-devsrc.bb,
> >> >>>>> linux-libc-headers), but none
> >> >>>> of them is suitable for this purpose.
> >> >>>>> Besides the kernel headers, some additional files (scripts,
> >> >>>>> Makefiles, .config, etc) are also required.
> >> >>>>
> >> >>>> linux-libc-headers is only for building applications.
> >> >>>> kernel-devsrc is for building modules on the target.
> >> >>>>
> >> >>>> What do these specific modules need that are not present in
> >> >>>> kernel-
> >> devsrc?
> >> >>>> (I really don't want 'yet another' confusing package added to
> >> >>>> the
> >> >>>> system.)
> >> >>>>
> >> >>>>> The new recipe "kernel-headers.bb" can in principle be used by
> >> >>>>> other
> >> >>>> images as well.
> >> >>>>> It is not limited to the Build Appliance and hence is not a
> >> >>>>> part of the Build Appliance recipe.
> >> >>>>
> >> >>>> I think kernel-headers is a bad name for a package.  It could be
> >> confusing.
> >> >>>>
> >> >>>> --Mark
> >> >>>>
> >> >>>>> Juro Bystricky (2):
> >> >>>>>   kernel-headers: linux kernel headers
> >> >>>>>   build-appliance-image: support for VirtualBox guest addtions
> >> >>>>>
> >> >>>>>  .../README_vbox_guest_additions.txt                | 78
> >> >>>> ++++++++++++++++++++++
> >> >>>>>  .../images/build-appliance-image_12.0.1.bb         |  4 +-
> >> >>>>>  meta/recipes-kernel/linux/kernel-headers.bb        | 66
> >> >>>> ++++++++++++++++++
> >> >>>>>  3 files changed, 147 insertions(+), 1 deletion(-)  create mode
> >> >>>>> 100644
> >> >>>>> meta/recipes-core/images/build-appliance-
> >> >>>> image/README_vbox_guest_addit
> >> >>>>> ions.txt  create mode 100644
> >> >>>>> meta/recipes-kernel/linux/kernel-headers.bb
> >> >>>>>
> >> >>>
> >> >>
> >> >> --
> >> >> _______________________________________________
> >> >> Openembedded-core mailing list
> >> >> Openembedded-core at lists.openembedded.org
> >> >> http://lists.openembedded.org/mailman/listinfo/openembedded-
> core
> >> >
> >> >
> >> >
> >> > --
> >> > "Thou shalt not follow the NULL pointer, for chaos and madness
> >> > await thee at its end"
> >>
> >>
> >>
> >> --
> >> "Thou shalt not follow the NULL pointer, for chaos and madness await
> >> thee at its end"
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core at lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core


More information about the Openembedded-core mailing list