How to put an extra file in the kernel image by yocto - linux

I have a trouble of putting my initramfs.cpio in my kernel image by yocto.
I have two bb files, one is used to build an initramfs, and the other one is used to build a fitimage.
I successful to build the fitimage bundled with my initramfs image.
But it always failed to build a fitImage that has an initramfs.cpio.gz in the /usr directory in the fitImage.
( I mean, I want to see a file named initramfs.cpio in the /usr when I use my fitImage booting to console )
====================================================================
Here are my error message..
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: QA Issue: linux-mine: Files/directories were installed but not shipped in any package:
/usr
/usr/initramfs-mine-qemu.cpio
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
linux-mine: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Fatal QA errors found, failing task.
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /home/paul/projects/Test/yocto/build/tmp/work/mine-poky-linux-gnueabi/linux-mine/1_4.9.27+gitAUTOINC+d87116e608-r0/temp/log.do_package.26149
ERROR: Task (/home/paul/projects/Test/yocto/yocto-2.2/poky/../meta-mine/recipes-kernel/linux/linux-mine_4.9.bb:do_package) failed with exit code '1'
====================================================================
Here is my kernel image bb file
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
LINUX_VERSION ?= "4.9.27"
SRCREV = "d87116e608e94ad684b5e94d46c892e33b9e2d78"
SRC_URI = "git://local/kernel;protocol=ssh;branch=master"
#FILES_${PN} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#FILES_${PN}-${PV} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#IMAGE_INSTALL = "initramfs-mine"
do_install_append () {
echo "WangPaul : S=[${S}]"
echo "WangPaul : B=[${B}]"
echo "WangPaul : D=[${D}]"
install -d ${D}/usr/
install -m 0444 ${B}/usr/initramfs-mine-${MACHINE_ARCH}.cpio ${D}/usr/
}
====================================================================
Here is my initramfs bb file
LICENSE = "GPLv2"
PACKAGE_INSTALL = "initramfs-live-boot ${VIRTUAL-RUNTIME_base-utils} udev ${ROOTFS_BOOTSTRAP_INSTALL}"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image
====================================================================
I have found similar questions:
Ship extra files in kernel module recipe and
An example of using FILES_${PN}
The way in aboves discussion are not work...
Any information would be appreciate !!
Thanks !!

The error seems to QA issues it means the source is compiled but not adding to rootfs. Add below line to yourkernel-image.bb. it will solve the issue.
FILES_${PN} += "${exec_prefix}/*"
Note: may be In your kernel.bb file you have given wrong format

Related

Add wilc3000 driver to Yocto raspberry pi

I want to build my own yocto image for a raspberry (cm3). I use the meta-raspberry (dunfell) layer and poky dunfell-23.0.0.
For installing the microchip wilc3000 module I have to modify the kernel following this guide. In that way, I change the kernel conf (Kconfig) to add the mchp driver in the menu and later selecting it.
I have generated a patch to the kernel using this guide (Patch-based workflow). After generating the patch, I have modified and generated a new kernel config (defconfig). All the changes are applied in my own layer with this recipe (linux-raspberrypi_%.bbappend):
FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"
SRC_URI += "file://0001-Add-wilc3000-driver.patch \
file://defconfig_my \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
# PR="r2"
INTREE_DEFCONFIG_pn-linux-ti = "defconfig_my"
kmoddir = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/mchp"
# do_configure_append() {
# cat ${WORKDIR}/*.cfg >> ${B}/.config
# }
do_install_append() {
install -d ${D}${kmoddir}
install -m 0755 ${WORKDIR}/wilc-spi.ko ${D}${kmoddir}
}
FILES_${PN}_append += " \
${kmoddir}/wilc-spi.ko \
"
The patchs folder contains the patch for the kernel and the new kernel configuration generated
When I generate the image:
bitbake -v core-image-base
The generation fails in do_install task when it tries to copy wilc-spi.ko, which is not generated.
Which is the way to compile and deploy the kernel with my own configuration? if I download and compile the kernel in a separate folder, it successfully generates the wilc-spi.ko, but inside build folder in yocto there is no trace of the file generation.
Please, help me to add this driver to the kernel, Thanks a lot.
As #qschulz pointed out, the solution was to change defconfig_my to defconfig and remove all the extra code. Finally, the code looks like this:
FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"
SRC_URI += "file://0001-Add-wilc3000-driver.patch \
file://defconfig \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
PR="r3"
FILES_${PN}_append += " \
${kmoddir}/wilc-spi.ko \
"
KERNEL_MODULE_AUTOLOAD += "wilc-spi.ko"
And add in the layer.conf the instruction to load the module:
MACHINE_EXTRA_RDEPENDS += " kernel-module-wilc-spi "

Yocto Bitbake doesn't include kernel config fragment in build

I am currently trying to setup docker on my yocto (thud - 2.6) project. For that, I need to enable some kernel configuration.
The problem is that the kernel config fragment is not included in the build.
To include the config fragment I created a custom layer with the following structure
meta-edge_controller
|__conf
| |__layer.conf
|__recipes-kernel
|__linux
|__linux-intel
| |__docker_required.cfg
|__linux-intel_4.14.bbappend
linux-intel_4.14.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URL += "file://docker_required.cfg"
docker_required.cfg
CONFIG_CGROUP_DEVICE=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_TABLES=y
CONFIG_NF_NAT=y
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_COMMENT=y
CONFIG_NETFILTER_XT_MATCH_HL=y
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NETFILTER_XT_MATCH_RECENT=y
CONFIG_IP_VS=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_MANGLE=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_FILTER=y
CONFIG_IP6_NF_MANGLE=y
CONFIG_BTRFS_FS=y
CONFIG_OVERLAY_FS=y
I am builing for an Intel based Board (Atom E3940) and I have integrated the meta-intel layer, using the machine type "intel-corei7-64".
How can I further debug or investigate why bitbake doesn't include the kernel config fragment?
I also tried rebuilding the kernel manually: bitbake -c cleanall linux-intel and bitbake linux-intel
I see a typo in your snippet. SRC_URL should be SRC_URI instead. More info here.

Yocto do_package_qa hangs for bin_package nodejs recipe

Using Yocto morty, I'm trying to add a prebuilt version of nodejs in my distribution. When I bitbake core-image-sato, do_package_qa hangs for hours. I'd be grateful for your help in getting me past this issue.
I've added this to the bottom of local.conf:
CORE_IMAGE_EXTRA_INSTALL += "mynode"
This is my recipe for mynode:
SUMMARY = "puts the node.js binary distribution into my image"
SECTION = "base"
LICENSE = "MIT & BSD & Artistic-2.0"
LIC_FILES_CHKSUM = "file://usr/node-v7.10.0-linux-x64/LICENSE;md5=d29463feca32ea5977af7b6c7d62c14a"
SRC_URI = "https://nodejs.org/dist/v7.10.0/node-v7.10.0-linux-x64.tar.xz;subdir=usr"
SRC_URI[md5sum] = "b9122f212e0716d199d7e954ff81e1ec"
SRC_URI[sha256sum] = "6166b9f3fb1a9e861335d864688fee5366f040db808080856a1a2b71b6019786"
S = "${WORKDIR}"
inherit bin_package
This is the content of log.do_install for my nodejs package. Maybe the message from tar describes my problem somehow?
DEBUG: Executing shell function do_install
tar: ./pseudo/pseudo.socket: socket ignored
DEBUG: Shell function do_install finished
There doesn't appear to be anything useful in log.do_package_qa for my nodejs package, but maybe somebody will see something that I don't see:
DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing python function do_package_qa
NOTE: DO PACKAGE QA
DEBUG: Executing python function read_subpackage_metadata
DEBUG: Python function read_subpackage_metadata finished
NOTE: Checking Package: mynode-dev
NOTE: Checking Package: mynode
I see a few bitbake-worker processes running, one with argument decafbad, two with argument decafbadbeef. I also see a pseudo process running.
If you're going to use
subdir=usr
At the end of SRC_URI then you also need to change the source directory it uses (S) accordingly:
S = "${WORKDIR}/usr"
In addition, I think for all pre-built binary packages (inherit bin_package), you want to do it that way. I tried without either and it hung forever. Also, you may want to use a subdir name that nothing else uses, like say external_binary. That way each binary recipe can use the same subdir.

How to list the packages installed in a target rootfs built using oe-core?

For documentary purpose,
I am looking for efficient ways to list the packages installed in a target rootfs built using oe-core.
The list of packages installed in your image is stored in the manifest file (besides of build history which is already mentioned).
Content of the manifest file looks like:
alsa-conf cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-conf-base cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-lib cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-states cortexa7hf-neon-vfpv4 0.2.0-r5.1
alsa-utils-alsactl cortexa7hf-neon-vfpv4 1.1.2-r0.5
alsa-utils-alsamixer cortexa7hf-neon-vfpv4 1.1.2-r0.5
...
The list consists of the package name, architecture and a version.
That manifest is located in the deploy directory (i.e. deploy/images/${MACHINE}/). Here as an example of the directory listing (there are target images and the manifest file)
example-image-genericx86.ext3
example-image-genericx86.manifest
example-image-genericx86.tar.bz2
USER_CLASSES ?= "buildname image-mklibs image-prelink buildhistory"
ERROR: Error executing a python function in /opt/apps_proc/oe-core/meta/recipes-core/eglibc/eglibc_2.17.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'buildhistory_emit_pkghistory', lineno: 216, function:
0212:
0213: write_pkghistory(pkginfo, d)
0214:
0215:
***0216:buildhistory_emit_pkghistory(d)
0217:
File: 'buildhistory_emit_pkghistory', lineno: 207, function: buildhistory_emit_pkghistory
0203: filelist = []
0204: pkginfo.size = 0
0205: for f in pkgfiles[pkg]:
0206: relpth = os.path.relpath(f, pkgdestpkg)
***0207: fstat = os.lstat(f)
0208: pkginfo.size += fstat.st_size
0209: filelist.append(os.sep + relpth)
0210: filelist.sort()
0211: pkginfo.filelist = " ".join(filelist)
Exception: OSError: [Errno 2] No such file or directory: '/opt/apps_proc/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/eglibc/2.17-r3/packages-split/eglibc-thread-db/lib/libthread_db-1.0.so'
ERROR: Function failed: buildhistory_emit_pkghistory
Add build history to your USER_CLASSES variable in local.conf
USER_CLASSES ?= "buildhistory"
After you rerun the build look in build/buildhistory for more info.
You may need to force rebuilds to properly populate the directory.

teamcity xbuild on linux

When I run my build it will fail with the following log:
[14:14:45]Checking for changes
[14:15:02]Publishing internal artifacts
[14:15:02]Clearing temporary directory: /var/TeamCity/buildAgent/temp/buildTmp
[14:15:02]Free disk space requirement
[14:15:02][Free disk space requirement] Free disk space requirement of 3.0Gb is not met for directory /var/TeamCity/buildAgent/work/870524f98b27404c (only 2474.7Mb is free).
[14:15:02][Free disk space requirement] Free disk space requirement of 3.0Gb could not be met for directory /var/TeamCity/buildAgent/work/870524f98b27404c (only 2474.7Mb is free)
[14:15:02]Checkout directory: /var/TeamCity/buildAgent/work/870524f98b27404c
[14:15:02]Repository sources transferred
[14:15:02]Updating sources: server side checkout
[14:15:02]Starting: /usr/bin/mono /var/TeamCity/buildAgent/plugins/dotnetPlugin/bin/JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:/var/TeamCity/buildAgent/work/870524f98b27404c /msbuildPath:/usr/lib/mono/4.0/xbuild.exe
[14:15:02]in directory: /var/TeamCity/buildAgent/work/870524f98b27404c
[14:15:03]Process exited with code 1
[14:15:03]MSBuild output
[14:15:03][MSBuild output] Start MSBuild...
[14:15:03][MSBuild output] '/usr/bin/mono' '/usr/lib/mono/4.0/xbuild.exe "#/var/TeamCity/buildAgent/work/870524f98b27404c/MyNancy.sln.teamcity.msbuild.tcargs" MyNancy.sln'
[14:15:03][MSBuild output] working dir = '/var/TeamCity/buildAgent/work/870524f98b27404c'
[14:15:03][MSBuild output] MSBUILD: error MSBUILD0004: Too many project files specified
[14:15:04]Publishing internal artifacts
[14:15:04][Publishing internal artifacts] Sending build.finish.properties.gz file
[14:15:04]Build finished
Is there a way to catch the tcargs file contents? It is not in the temp dir of the buildagent. Maybe someone knows what I am doing wrong. When I call the xbuild on the working dir manually it builds fine.
Thanx

Resources