Bug 5685 - Cannot extend linux-yocto-custom with FILES_${PN}
Summary: Cannot extend linux-yocto-custom with FILES_${PN}
Status: RESOLVED NOTABUG
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: kernel (show other bugs)
Version: 1.5
Hardware: x86 x86_64
: Medium major
Target Milestone: 1.6
Assignee: Darren Hart
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-12-21 01:29 UTC by Tom Walsh
Modified: 2014-04-04 14:57 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Walsh 2013-12-21 01:29:28 UTC
Not sure if this is a bug or a planned "feature" of the linux-yocto-custom build of a kernel. This technique worked with Bernard-5.0.1 and I am in the process of migrating from that to Dora (git).

Here is what I'm trying to do. I've some custom interface to hardware which is driven by a kernel module that I wrote.  I need to export the header file into the target image inside /usr/include/linux so that the hardware definition (IOCTLs, etc.) can be exposed.  In Bernard, this was simply done with:

<code>

do_install_append() {
   install -m 0755 -d ${D}/usr/include/linux/
   install -m 0644 ${S}/include/linux/sys3000.h ${D}/usr/include/linux/
}

FILES_${PN} = "/usr/include/linux"

</code>

While this same approach causes Dora to throw:

<code>

ERROR: QA Issue: linux-yocto-custom: Files/directories were installed but not shipped
  /usr/include
  /usr/include/linux
  /usr/include/linux/sys3000.h

</code>

What finally did work was this, and add "linux-extra" to IMAGE_EXTRAS:

<code>

PACKAGES += "linux-extra"

do_install_append() {
   install -m 0755 -d ${D}${includedir}/linux/
   install -m 0644 ${S}/include/linux/sys3000.h ${D}${includedir}/linux/sys3000.h
}

FILES_linux-extra = "${includedir}/linux/sys3000.h"

</code>


My problem, at the moment, is resolved. However, the original approach should have been the solution, given the documentation of how recipes are to be written to achieve the desired result?

This is the complete, working, Dora/<machine>/meta/recipes-kernel/linux/linux-yocto-custom.bb recipe:

<code>

inherit kernel
require recipes-kernel/linux/linux-yocto.inc

SRC_URI = "git://git@wonderbox/repos/gitRepository/linux-cpu8-3.4.74;protocol=ssh;bareclone=1"

SRC_URI += "file://defconfig"

SRC_URI += "file://cpu8.scc \
            file://cpu8.cfg \
            file://cpu8-user-config.cfg \
            file://cpu8-user-patches.scc \
           "


LINUX_VERSION ?= "3.4.74"
LINUX_VERSION_EXTENSION ?= "-cpu8"

SRCREV="${AUTOREV}"

PR = "r9"
PV = "${LINUX_VERSION}+git${SRCPV}"

COMPATIBLE_MACHINE_cpu8 = "cpu8"

PACKAGES += "linux-extra"

do_install_append() {
   install -m 0755 -d ${D}${includedir}/linux/
   install -m 0644 ${S}/include/linux/sys3000.h ${D}${includedir}/linux/sys3000.h
}

FILES_linux-extra = "${includedir}/linux/sys3000.h"

</code>
Comment 1 Darren Hart 2014-01-09 19:02:36 UTC
For various reasons that have been discussed at length in the past and which I don't completely agree with, we package the /usr/include/linux files from the linux-libc-headers recipe which uses a static kernel.org kernel, rather than the one being built for the image, to populate the headers with. You'll note linux-yocto (and the relevant classes) do not package any of /usr/include/linux.

There are three approaches I can think of to resolve this:

1) Exactly what you are doing.
2) Start using the machine kernel to populate /usr/include/linux
3) Build such modules as external modules and package the additional header files with them. See hello-mod in meta-skeleton for an example.

Richard/Bruce - care to comment?
Comment 2 Bruce Ashfield 2014-01-13 04:43:53 UTC
(In reply to comment #1)
> For various reasons that have been discussed at length in the past and which
> I don't completely agree with, we package the /usr/include/linux files from
> the linux-libc-headers recipe which uses a static kernel.org kernel, rather
> than the one being built for the image, to populate the headers with. You'll
> note linux-yocto (and the relevant classes) do not package any of
> /usr/include/linux.

All of the above is true.

> 
> There are three approaches I can think of to resolve this:
> 
> 1) Exactly what you are doing.

#1 is a good option.

> 2) Start using the machine kernel to populate /usr/include/linux
> 3) Build such modules as external modules and package the additional header
> files with them. See hello-mod in meta-skeleton for an example.

BUT, the QA error actually shouldn't have been a result of libc-headers
versus the kernel source tree installing into /usr/include/linux. If the
custom kernel is not modifying an existing header, then exporting it into
/usr/include/linux and packaging it, should have worked.

It looks more like a wildcard issue, i.e. was:

FILES_${PN} = "/usr/include/linux/sys3000.h"

Ever explicitly tried as the linux-yocto-custom FILES_ line ?
I know it is in the extras package that is shown here, but it
wasn't clearly mentioned in the first reference to the bernard
recipe.

> 
> Richard/Bruce - care to comment?
Comment 3 Darren Hart 2014-03-13 15:22:17 UTC
Tom Walsh, is this still an issue for you? If so, could you please provide the additional detail Bruce and I have requested.
Comment 4 Richard Purdie 2014-04-04 14:57:20 UTC
On a linux system, for better or worse, /usr/include/linux are the system's libc's linux headers. They're used by the toolchain, specifically by the libc. If we were to make them machine specific, the whole toolchain becomes machine specific and we do not want this. As such, we therefore install a pretty modern kernel's system headers into /usr/include/linux which we build all our toolchains against. This is the practise advised by the kernel itself. If the kernel running on the device is older, this is not an issue in practice due to the way libc works.

The main issue people have with this is their machine specific kernel headers don't get put into /usr/include/linux. This is unfortunate but not something we're going to change, you need to install those headers in other ways. Those headers usually are machine specific and therefore should be handled differently.

Since there was no feedback from Tom and he's found the working solution, closing this as working as designed.