I have two recipes, the first, adduser, is based on the useradd example in the meta-skeleton layer, and creates the directory /home/foo/, for the user foo:
SUMMARY = "Example recipe for using inherit useradd"
DESCRIPTION = "This recipe serves as an example for using features from useradd.bbclass"
SECTION = "examples"
PR = "r1"
LICENSE = "MIT"
S = "${WORKDIR}"
inherit useradd
# You must set USERADD_PACKAGES when you inherit useradd. This
# lists which output packages will include the user/group
# creation code.
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "-d /home/foo -r -s /bin/bash -p 'bar' foo"
do_install () {
install -d -m 755 ${D}/usr/share/foo
install -d -m 755 ${D}/home/foo
chown -R foo ${D}/usr/share/foo
chown -R foo ${D}/home/foo
}
FILES_${PN} = "/usr/share/foo /home/foo"
# Prevents do_package failures with:
# debugsources.list: No such file or directory:
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
I then have a second recipe, which should add the directory "code" to the user's home directory, and put a file in it:
LICENSE = "CLOSED"
DEPENDS = "adduser"
FILES_${PN} += "/home/foo/code /home/foo/code/base_reading.py"
SRC_URI = "file://base_reading.py \
"
S = "${WORKDIR}"
do_install() {
install -d ${D}/home/foo/code
install -m 0755 ${S}/base_reading.py ${D}/home/foo/code/base_reading.py
chown -R foo ${D}/home/foo/code
}
This is the whole error: https://paste.ubuntu.com/p/6bfH4vf8qw but the TL;DR is:
Error: Transaction check error:
file /home/foo conflicts between attempted installs of basecode-1.0-r0.cortexa7hf_neon_vfpv4 and adduser-1.0-r1.cortexa7hf_neon_vfpv4
At first, I tried to fix this by adding the DEPENDS = "adduser", thinking that that would ensure that /home/foo exists before it tries to create /home/foo/code, but it didn't make any difference.
Related
i try to implement botan library in yocto, i have the recipe with following content
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://license.txt;md5=bf361fc63df3fa25652ee82c43b7601a"
SRC_URI = "https://cdn-aws.deb.debian.org/debian/pool/main/b/botan/botan_${PV}.orig.tar.gz"
SRC_URI[md5sum] = "e52c6e15c0017eb2d61838f56f051ded"
SRC_URI[sha256sum] = "2d5696c75b89e3c2e888867907764ab063daca9a1a42ea35649792dace4eff83"
S = "${WORKDIR}/${BPN}-2.4.0"
B = "${WORKDIR}/build"
#DEPENDS = "pkgconfig"
inherit autotools pkgconfig
do_install () {
install -d ${D}${libdir}
install -d ${D}${libdir}/.debug/
install -d ${D}${includedir}/botan
install -m 0755 ${B}/libbotan-2.so ${D}${libdir}
install -m 0755 ${B}/libbotan-2.a ${D}${libdir}
install -m 0755 ${WORKDIR}/botan-2.4.0/src/botan/*.hpp ${D}${includedir}/botan
rm ${WORKDIR}/botan-2.4.0/src/botan/*.cpp
rm ${WORKDIR}/botan-2.4.0/src/botan/*.hpp
}
FILES_${PN} += " \
${libdir}/libbotan-2.so \
"
FILES_${PN}-dev += " \
${includedir}/botan/*.hpp \
"
FILES_${PN}-staticdev += " \
${libdir}//libbotan-2.a \
"
FILES_${PN}-dbg += " \
${libdir}/.debug/* \
"
When i try bitbake botan, i encountered error:
Log data follows:
| DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'arm-32', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
| DEBUG: Executing shell function do_compile
| NOTE: make -j 4
| make: *** No targets specified and no makefile found. Stop.
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile
Anything i doing it wrong or misinterpret?
i create this recipe using recipetool create https://cdn-aws.deb.debian.org/debian/pool/main/b/botan/botan_2.4.0.orig.tar.gz
I tried bitbake -c botan and bitbake again, it still the same.
The error tells it could not find Makefile in source directory. From the readme.rst file present in botan-2.4.0.tar.gz it is said that to run ./configure.py before start compiling, which will generate Makefile. so try to add something like below to your recipe
do_configure_prepend() {
${PYTHON} ${S}/configure.py
}
I am trying to install audit daemon on Renases RZ/G1E platform
Build Configuration:
BB_VERSION = "1.22.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "Ubuntu-14.04"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "iwg22m"
DISTRO = "poky"
DISTRO_VERSION = "1.6.1"
TUNE_FEATURES = "armv7a vfp neon callconvention-hard cortexa7"
TARGET_FPU = "vfp-neon"
meta
meta-yocto
meta-yocto-bsp = "tmp:c4f1f0f491f988901bfd6965f7d10f60cb94a76f"
meta-renesas
meta-rzg1 = "tmp:19bf1ed97d04009722bb88a780268822ee60ff83"
meta-oe
meta-multimedia = "tmp:dca466c074c9a35bc0133e7e0d65cca0731e2acf"
meta-linaro-toolchain = "tmp:8a0601723c06fdb75e62aa0f0cf15fc9d7d90167"
when i give the command
$bitbake audit
Audit daemon is installed and i can see the files inside the image folder of audit
ls tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/image/*
tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/image/etc:
audisp audit default init.d libaudit.conf
tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/image/lib:
libaudit.a libaudit.la libaudit.so libaudit.so.1 libaudit.so.1.0.0 libauparse.a libauparse.la libauparse.so libauparse.so.0 libauparse.so.0.0.0
tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/image/sbin:
audispd audisp-remote auditctl auditd augenrules aureport ausearch autrace
tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/image/usr:
bin include lib share
when i build the rootfs and add audit daemon by adding the following line in conf/local.conf
CORE_IMAGE_EXTRA_INSTALL += " audit"
I only get the following file inside the rootfs
/etc/libaudit.conf
Audit_2.8.4.bb
SUMMARY = "User space tools for kernel auditing"
DESCRIPTION = "The audit package contains the user space utilities for \
storing and searching the audit records generated by the audit subsystem \
in the Linux kernel."
HOMEPAGE = "http://people.redhat.com/sgrubb/audit/"
SECTION = "base"
LICENSE = "GPLv2+ & LGPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
SRC_URI = "http://people.redhat.com/sgrubb/${BPN}/${BPN}-${PV}.tar.gz \
file://audit-python-configure.patch \
file://audit-python.patch \
file://fix-swig-host-contamination.patch \
file://auditd \
file://auditd.service \
file://audit-volatile.conf \
"
SRC_URI[md5sum] = "ec9510312564c3d9483bccf8dbda4779"
SRC_URI[sha256sum] = "a410694d09fc5708d980a61a5abcb9633a591364f1ecc7e97ad5daef9c898c38"
inherit autotools pythonnative update-rc.d systemd
UPDATERCPN = "auditd"
INITSCRIPT_NAME = "auditd"
INITSCRIPT_PARAMS = "defaults"
SYSTEMD_PACKAGES = "auditd"
SYSTEMD_SERVICE_auditd = "auditd.service"
DEPENDS += "python tcp-wrappers libcap-ng linux-libc-headers (>= 2.6.30) swig-native"
EXTRA_OECONF += "--without-prelude \
--with-libwrap \
--enable-gssapi-krb5=no \
--with-libcap-ng=yes \
--with-python=yes \
--libdir=${base_libdir} \
--sbindir=${base_sbindir} \
--without-python3 \
--disable-zos-remote \
"
EXTRA_OECONF_append_arm = " --with-arm=yes"
EXTRA_OECONF_append_aarch64 = " --with-aarch64=yes"
EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' \
PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \
pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
STDINC='${STAGING_INCDIR}' \
pkgconfigdir=${libdir}/pkgconfig \
"
SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher"
DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \
interface to the audit system, audispd. These plugins can do things \
like relay events to remote machines or analyze events for suspicious \
behavior."
PACKAGES =+ "audispd-plugins"
PACKAGES += "auditd ${PN}-python"
FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*"
FILES_auditd += "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*"
FILES_audispd-plugins += "${sysconfdir}/audisp/audisp-remote.conf \
${sysconfdir}/audisp/plugins.d/au-remote.conf \
${sbindir}/audisp-remote ${localstatedir}/spool/audit \
"
FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
CONFFILES_auditd += "${sysconfdir}/audit/audit.rules"
RDEPENDS_auditd += "bash"
do_install_append() {
rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
# reuse auditd config
[ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default
mv ${D}/etc/sysconfig/auditd ${D}/etc/default
rmdir ${D}/etc/sysconfig/
# replace init.d
install -D -m 0755 ${S}/../auditd ${D}/etc/init.d/auditd
rm -rf ${D}/etc/rc.d
if ${#bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d/
install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
fi
# install systemd unit files
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system
# audit-2.5 doesn't install any rules by default, so we do that here
mkdir -p ${D}/etc/audit ${D}/etc/audit/rules.d
cp ${S}/rules/10-base-config.rules ${D}/etc/audit/rules.d/audit.rules
chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
# Based on the audit.spec "Copy default rules into place on new installation"
cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
}
Audit_2.8.4.bb is a recipe. You run recipies with bitbake .
Recipes produce >= 1 packages. You install packages in an image.
You can look in the packages-split directory in tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/audit/2.8.4-r0/ to see what goes into which package.
I'm trying to change the password for Intel-Edison board, using the Yocto project.
I have made a recipe for this.
#
# 'abc-' password
#
DESCRIPTION = "ROOT PASSWORD"
SECTION = "abc"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=xyz"
PR = "r0"
SRC_URI = "file://test.txt"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
inherit extrausers
EXTRA_USERS_PARAMS = "usermod -P hello root;"
do_install() {
install -d ${D}${sysconfdir}
install -m 0755 ${WORKDIR}/test.txt ${D}${sysconfdir}
}
To check if it works I added a file in my /etc/ location.
Everything is working perfectly , but my password remains 'root' . It should be 'hello'.
What I am doing wrong? Can someone tell me what should I do more?
Thank you.
I am very new to yocto and am trying to learn how to use it. I followed the steps in the mega-manual section section 5.1.9. I ran
yocto-layer create mylayer
and edited my bblayers.conf file to have this:
BBLAYERS = ?" \
/usr/local/src/yocto/meta \
/usr/local/src/yocto/meta-poky \
/usr/local/src/yocto/meta-yocto-bsp \
/usr/local/src/yocto/meta-mylayer \
"
I ran source oe-init-build-env and then bitbake core-image-sato. When the build finished, I ran runqemu qemu86 nographics and after logging in, ran find / -name helloworld since mylayer defines a recipe for building helloworld. However, the file was not found.
Shouldn't this program (helloworld) be included in the image created? What step(s) am I missing here?
meta-mylayer/conf/layer.conf:
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "mylayer"
BBFILE_PATTERN_mylayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_mylayer = "6"
meta-mylayer/recipies-example/example/example_0.1.bb
#
# This file was derived from the 'Hello World!' example recipe in the
# Yocto Project Development Manual.
#
SUMMARY = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
${CC} ${LDFLAGS} helloworld.c -o helloworld
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}
meta-mylayer/recipes-example/example/example-0.1/helloworld.c:
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello World!\n");
return 0;
}
Adding a new layer doesn't add every recipe in the layer to every image, it just makes those recipes available to build.
Add the packages that you want in the image using IMAGE_INSTALL in the image recipe.
This is covered in the documentation at http://www.yoctoproject.org/docs/latest/dev-manual/dev-manual.html#usingpoky-extend-customimage.
DESCRIPTION = "Copies hello-binaries to the image"
LICENSE = "CLOSED"
FILESEXTRAPATHS_prepend := "${THISDIR}:"
SRC_URI += "file://hello "
S = "${WORKDIR}"
do_install() {
install -d ${D}${bindir}
install -m 0777 hello ${D}${bindir}
}
#FILES_${PN} += "${bindir}"
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN}-dev = "ldflags"
In the above recipe i commented the line FILES_ then also the hello binary is adding to the image how is it possible? I have no idea how the recipe is copying binaries to image.*
FILES_${PN} has a default value that includes among other things "${bindir}/*". So appending to the value in the recipe isn't needed.
You can see the default value in meta/conf/bitbake.conf and check what the value ends up as with bitbake -e <hellorecipe> | grep ^FILES_