[yocto] Header files in /usr/include of rootfs

Andy Hung(洪翊桓_Pegatron) Andy_Hung at pegatroncorp.com
Wed Dec 2 01:47:59 PST 2015


Hi Anders,
Thanks for your help, pls see updates below,

> Message: 2
> Date: Tue, 24 Nov 2015 14:25:14 +0100
> From: Anders Darander <anders at chargestorm.se>
> To: yocto at yoctoproject.org
> Subject: Re: [yocto] Header files in /usr/include of rootfs
> Message-ID: <20151124132514.GB2165 at ad.chargestorm.se>
> Content-Type: text/plain; charset=utf-8

> * Andy Hung(???_Pegatron) <Andy_Hung at pegatroncorp.com> [151124 11:35]:
> > I was trying to add some pre-built binaries and files by using a recipe.
> > The recipe has something like this:

> > SRC_URI = file://files<file:///\\files> ?
> > do_install() {
> >     install ?d ${D}
> > }

>	> What files are you installing? How does those look like?
>	The content of the folder has those sub-folders, sbin, root, lib, etc.
>	Those sub-folders contains files such as executable binaries, config files, kernel modules, .so files ...
>	All these files are actually built from the source code of a specific WiFi driver,
>	what I want to do is installing all pre-built binaries/files into corresponding locations in rootfs.

>There's no way to build this using OE?...

>Though, sure, it's should work as long as the binaries and kernel modules actually loads and runs.

> > FILES_${PN} = ?/*?

>	> Here you add say that anything that has been installed, but not put into any other package, should be added to ${PN}. Is that what you want?
>	Yes, all files are installed in a package.

> > ALLOW_EMPTY_${PN} = ?1?

>	> Remove this one unless ${PN} is going to be empty.
>	This line is removed.

> > INSANE_SKIP_${PN} = ?debug-files dev-so?

>	> These might be needed if you get certain QA-warnings/error without them.
>	Yes, got some QA-warnings when building so I keep this.

> > The result was all the binaries and files installed and packages are 
> > created, But I also found kernel header files are also built in under /usr/include in rootfs image.
> > For my understanding those header files should be used if I want to develop/debug applications on the target device but it is not the case.

>Could you check if any -dev packages gets installed into the image? If so which one? Do anything like kernel-src or something similar gets installed?

> > Also I noticed the use of INSANE_SKIP_${PN} so I check the usage of 
> > debug-files and dev-so, And it turned out there are .debug folders in the WORKDIR/package folder so I thought that is why debug-files was used.

>	> See answer below.

> > The questions are,
> > Why are those kernel header files installed in rootfs? How do I prevent thisa?

>	> I assume that they aren't in the package you just created? Do you have anything in your package that might have a dependency on the kernel headers? Do you have anything in your IMAGE_FEATURES?
>	No, header files aren't in the package.
>	I checked the driver source code and many files include kernel headers like this  "#include <linux/xxx.h>" , is this what you meant by dependency on kernel headers?

Are the source code packaged installed and packaged?

Can you inspect the generated package ${PN}, and see what it's depencies are?

>	IMAGE_FEATURES was not used in the recipe file.

That would rather be in either local.conf, distro, or in your image.

> > Why are there .debug in the package folder, it should only be in package ?dbg folder, right?

>	> Where are the .debug directories located? You should add them to:
>	> FILES_${PN}-dbg += "<location>/.debug"
>	I add this line and rebuild but the result seems unchanged.
>	the .debug folders are located in 
>	${WORKDIR}/package
>	${WORKDIR}/package-split/<package name> - dbg

>I don't understand. Were the .debug directories located in packages-split/<package-name>-dbg? If so, that's where we want them.

>Which package do you add to your image? 
>If you remove that package, do you still get the kernel headers installed?

>Cheers,
>Anders

The kernel headers wouldn't get installed if I removed my package.
I looked at the packages-split folder again and I found besides the -dbg folder, .so libraries are in <package-name>-dev folder,
I searched on the Yocto site and learned that packages are split by the variable PACKAGES defined in bitbake.conf
and it turns out ${PN}-dbg , ${PN}-dev are processed before ${PN}, so I modified my bb file by adding FILE_${PN}-dev = ""
I rebuild the rootfs and I found the kernel headers are not installed then.

Here are the extra packages get installed before I add FILE_${PN}-dev = "" to the recipe,
eglibc-extra-nss
libc6-dev
libthread-db1
linux-libc-headers-dev
merge-files-dev

(merge-files is the name of my package)

I think maybe I don't understand Yocto quite well,
What is the rule for OE to install those dev packages?
How do I decide which packages ( dbg, dev, doc, locale...) to get installed?

Many thanks,
Andy


More information about the yocto mailing list