I want to create a new folder in "/etc", as following
/etc
----/shared
-----------example.txt
I created a new recipe in a custom yocto layer. The recipe is under a folder meta-own\recipes-own\shared and the structure of recipes-own is:
.
├── files
│ ├── example.txt
└── shared_configuration_1.0.bb
and the recipe is:
DESCRIPTION = "Script for copying example configurations"
SUMMARY = "example configurations"
LICENSE = "CLOSED"
SRC_URI = "file://example.txt"
do_install_append() {
install -dm644 ${D}${sysconfdir}/shared
install -m 0755 ${WORKDIR}/example.txt ${D}${sysconfdir}/example.txt
FILES_${PN} = "\
${sysconfdir} \
"
When I add the recipe to my recipes-core/images/example-image.bb:
IMAGE_INSTALL_append = " \
bash \
util-linux \
shared_configuration \
"
it outputs me always:
ERROR: Nothing RPROVIDES
But if I don't place it in the example-image, it is running through but the file is not copied.
Try to rename shared_configuration to shared-configuration because after the underscore should be the version of the recipe.
[EDIT]
.
├── files
│ ├── example.txt
└── shared-configuration_1.0.bb
IMAGE_INSTALL_append = " \
bash \
util-linux \
shared-configuration \
"
And the recipe:
DESCRIPTION = "Script for copying example configurations"
SUMMARY = "example configurations"
LICENSE = "CLOSED"
SRC_URI = "file://example.txt"
do_install_append() {
install -d 644 ${D}${sysconfdir}
install -m 0755 ${WORKDIR}/example.txt ${D}${sysconfdir}
FILES_${PN} = "${sysconfdir}"
Related
here is my bbappend file.
LICENSE = "MIT"
IMAGE_LINGUAS = " "
# User preferences
inherit extrausers
# Change root password (note the capital -P)
EXTRA_USERS_PARAMS = "\
usermod -P toor root; \
useradd -P michael -G sudo michael; \
useradd -P nfi -G sudo nfi; \
"
# uncomment the line %sudo ALL=(ALL) ALL in /etc/sudoers
modify_sudoers() {
sed 's/# %sudo/%sudo/' < ${IMAGE_ROOTFS}${sysconfdir}/sudoers > ${IMAGE_ROOTFS}${sysconfdir}/sudoers.tmp
mv ${IMAGE_ROOTFS}${sysconfdir}/sudoers.tmp ${IMAGE_ROOTFS}${sysconfdir}/ROOTFS
}
sudoers_POSTPROCESS_COMMAND_append = " modify_sudoers;"
IMAGE_INSTALL = "base-files \
base-passwd \
busybox \
mtd-utils \
mtd-utils-ubifs \
libconfig \
swupdate \
swupdate-www \
${#bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts systemd', d)} \
util-linux-sfdisk \
mmc-utils \
e2fsprogs-resize2fs \
lua \
debugconfigs \
"
IMAGE_FSTYPES = "ext4.gz.u-boot ext4 cpio.gz.u-boot"
PACKAGE_EXCLUDE += " jailhouse kernel-module-jailhouse libncursesw5 libpanelw5 libpython3 python3* perl* apt dpkg "
SRC_URI += "file://set-ttymxc0-permissions.sh"
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/set-ttymxc0-permissions.sh ${D}${sysconfdir}/init.d/
}
addtask install after do_build
I am using SWUpdate. I can build their kernel and run it on my device. However I cannot login as root or any user I have created. It seems this could be related to user permissions in the getty serial terminal ttymxc0. So I am attempting to add a script to init.d. The script contains
#!/bin/sh
# Set permissions on ttymxc0
chmod 660 /dev/ttymxc0
chown root:tty /dev/ttymxc0
The bitbake file I am appending to is swupdate-image.bb. This file does not do much. It does not have a do_install section. So I am attempting to add one. However it is never run. Can anyone speculate as to why?
You actually noticed that the file swupdate-image.bb require an other file swupdate-image.inc.
You should pay attention to this line:
${#bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts systemd', d)} \
${#bb.utils.contains() is a (Python) function. Basically it will check the SWUPDATE_INIT variable, if there is a match with tiny then it will return virtual/initscripts-swupdate to IMAGE_INSTALL. Else, it will return initscripts systemd to IMAGE_INSTALL.
So you should only set your variable SWUPDATE_INIT= "tiny" in a .bbappend file.
Adding this should install rcS.swupdate in your final image according to initscripts-swupdate recipe:
https://github.com/sbabic/meta-swupdate/blob/master/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb
N.B: I have noticed that you added resize2fs. If you want to add this binary make sure that the right kernel flag is set ! You will more likely need to create a .bbappend file and add the following :
EXTRA_OECONF_append_class-target = " --enable-resizer"
I've built a simple recipe which works as long as I don't need gps.h:
recipes/foo (dunfell) $ cat foo_3.0.0.bb
DESCRIPTION = "FOO Daemon"
LICENSE = "CLOSED"
SRC_URI = " file://*.* \
"
S = "${WORKDIR}"
INSANE_SKIP_${PN} = "ldflags"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
do_compile() {
cd ${S}/src
make
cp foo ~/
cd -
}
do_install() {
install -d ${D}${bindir}
install -m 0755 foo ${D}${bindir}
}
gps.h is in /usr/include on my local machine, but as Yocto is cross-compiling it provides a reasonable explanation of why it can't use the local /usr/include/gps.h:
cc1: error: include location "/usr/include" is unsafe for cross-compilation [-Werror=poison-system-directories]
foo.c:54:10: fatal error: gps.h: No such file or directory
54 | #include <gps.h>
| ^~~~~~~
cc1: all warnings being treated as errors
I've tried IMAGE_INSTALL_append " libgps-dev" and " gps-lib-dev" in my layer.conf but neither of those work.
How can I get the gps.h header into my Yocto project/recipe at build time?
Let me copy your recipe and add some comments first:
DESCRIPTION = "FOO Daemon"
LICENSE = "CLOSED"
# --- COMMENT ---
# It is not recommended to use "*" with SRC_URI,
# as Yocto will not keep track of your files if you edit them
# so it will never rebuild automaticall after a change
# Best practice is to sepecify the local files like:
# SRC_URI = "file://src"
# This will make bitbake unpacks the "src" folder into ${WORKDIR}
# --- COMMENT ---
SRC_URI = " file://*.* \
"
# --- COMMENT ---
# The ${S} variable is the defautl workind directory for compilation tasks,
# do_configure, do_compile, ...,
# So, if you have "src" folder that will be unpacked into ${WORKDIR}
# you need to set S to that:
# S = "${WORKDIR}/src"
# --- COMMENT ---
S = "${WORKDIR}"
INSANE_SKIP_${PN} = "ldflags"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
# --- COMMENT ---
# If your project has a "Makefile" you can use the "autotools" class
# it runs oe_runmake automatically
# inherit autotools
# If you want to copy the output to your home directory you can do it in "do_install"
# If you use autotools you do not need do_compile
# --- COMMENT ---
do_compile() {
cd ${S}/src
make
cp foo ~/
cd -
}
do_install() {
install -d ${D}${bindir}
install -m 0755 foo ${D}${bindir}
}
# --- COMMENT ---
# Do not forget to specify your output files into FILES for do_package to work well
# FILES_${PN} = "${bindir}/foo"
# --- COMMENT ---
Now, after dealing with that, if your recipe requires something at build-time, than the dependency needs to exist in the same recipe's workding directory, because if you are adding libgps into IMAGE_INSTALL it will be present in the rootfs but not during your build time.
So, to do that, you need to specify the dependencies recipe with DEPENDS.
I have looked for gps.h and I found it packages with gpsd recipe.
So, try:
DEPENDS += "gpsd"
So, the final recipe would look like the following:
DESCRIPTION = "FOO Daemon"
LICENSE = "CLOSED"
SRC_URI = "file://src"
S = "${WORKDIR}/src"
DEPENDS += "gpsd"
inherit autotools
do_install(){
install -d ${D}${bindir}
install -m 0755 foo ${D}${bindir}
cp foo ~/
}
FILES_${PN} = "${bindir}/foo"
The only thing left is to test.
I have a recipe canboat which was previously based on no official release version and was based on the SRCREV on the master branch.
canboat.bb
SUMMARY = "CANBOAT- A small but effective set of command-line utilities to work with CAN networks on BOATs."
SECTION = "base"
LICENSE = "GPLv3"
DEPENDS += "libxslt-native canboat-native"
LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"
SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH} \
file://0001-Do-not-use-root-user-group-during-install.patch \
file://0001-Define-ANALYZEREXEC.patch \
file://0001-use-php-instead-of-php5.patch \
"
SRCBRANCH = "master"
SRCREV = "93b2ebfb334d7a9750b6947d3a4af9b091be2432"
S = "${WORKDIR}/git"
PREFIX ?= "${root_prefix}"
#PREFIX_class-native = "${prefix}"
EXTRA_OEMAKE_append_class-target = " ANALYZEREXEC=analyzer "
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} PREFIX=${root_prefix} EXEC_PREFIX=${exec_prefix} install
}
RDEPENDS_${PN}_append_class-target = " php-cli perl"
BBCLASSEXTEND = "native nativesdk"
The main repository did a release officially a couple of days ago and I want to update my recipe to point to v.1.0.0.
Workflow
I used devtool add canboat [link-tar-ball]
copied the changes in the original canboat.bb
changed the name of the recipe to canboat_1.0.0.bb since the recipe now has ${PV} for fetching the right version
Updated recipe
only the SRC_URI now pointing to the .tar.gz is and the md5sums have been updated.
SUMMARY = "CANBOAT- A small but effective set of command-line utilities to work with CAN networks on BOATs."
SECTION = "base"
LICENSE = "GPLv3"
DEPENDS += "libxslt-native canboat-native"
LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"
SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH} \
file://0001-Do-not-use-root-user-group-during-install.patch \
file://0001-Define-ANALYZEREXEC.patch \
file://0001-use-php-instead-of-php5.patch \
"
SRC_URI = "https://github.com/canboat/canboat/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "6ee6162d30faa3b3f1ff068cc7a70a60"
SRC_URI[sha256sum] = "6bf1050a83a5d7eb8351547c10e7e2ae2e1811250d50a63880074f0c07ec672e"
S = "${WORKDIR}/git"
PREFIX ?= "${root_prefix}"
#PREFIX_class-native = "${prefix}"
EXTRA_OEMAKE_append_class-target = " ANALYZEREXEC=analyzer "
do_compile() {
oe_runmake
}
do_install() {
oe_runmake DESTDIR=${D} PREFIX=${root_prefix} EXEC_PREFIX=${exec_prefix} install
}
RDEPENDS_${PN}_append_class-target = " php-cli perl"
BBCLASSEXTEND = "native nativesdk"
I tried bitbake -k canboat to check the build process
Error
I get a QA error as following:
QA Issue: canboat-native: LIC_FILES_CHKSUM points to an invalid file:
/home/des/Yocto/PHYTEC_BSPs/yocto_fsl/build/tmp/work/x86_64-linux/canboat-native/1.0.0-r0/git/GPL
I tried going into the above mentioned folder and there was no GPL file there on the contrary the file is present in the canboat_1.0.0 folder.
The structure is as follows:
.
├── canboat-1.0.0
│ ├── actisense-serial
│ ├── airmar
│ ├── analyzer
│ ├── candump2analyzer
│ ├── common
│ ├── config
│ ├── group-function
│ ├── ip
│ ├── n2kd
│ ├── nmea0183
│ ├── samples
│ ├── send-message
│ ├── socketcan-writer
│ └── util
├── git
└── temp
and the git folder has nothing in it.
Question
How do I overcome the QA test and is there a better way to update the recipes?
You don't need S = "${WORKDIR}/git" in your new recipe. When you refer specific version from tarball, yocto de-references the path using ${PN}-${PV}
This is because when tarball is extracted, the source path will be ${WORKDIR}/${PN}-${PV}.
Additionally, you can remove do_compile section of your recipe as Yocto by default calls make when it can't find Makefile.am/in or autoconf files.
I've been trying to generate minimal extensible sdk using Yocto 2.5 Sumo. I've cloned only the poky and meta-openembedded repositories. In local.conf I've set the SDK type to minimal and set SDK_INCLUDE_PKGDATA. During the last task (do_populate_sdk_ext) bitbake throws that locked-sigs-pkgdata.inc is not found in this directory
tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/world-pkgdata/
Find shows that this file is avaible here
./tmp/work/genericx86_64-poky-linux/meta-world-pkgdata/1.0-r0/image/world-pkgdata/locked-sigs-pkgdata.inc
./tmp/work/genericx86_64-poky-linux/meta-world-pkgdata/1.0-r0/recipe-sysroot/world-pkgdata/locked-sigs-pkgdata.inc
When I copy this file from on of above directories eSDK is correctly generated. I believe that this should be done automatically by one of recipe for poky/meta-openembedded. Probably I miss some config, but I'am unable to correctly identify the source of this problem.
Here is my bblayers.conf:
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/work/build/yocto/poky/meta \
/work/build/yocto/poky/meta-poky \
/work/build/yocto/poky/meta-yocto-bsp \
/work/build/yocto/meta-openembedded/meta-oe \
/work/build/yocto/meta-openembedded/meta-python \
/work/build/yocto/meta-openembedded/meta-multimedia \
/work/build/yocto/meta-openembedded/meta-perl \
/work/build/yocto/meta-openembedded/meta-gnome \
/work/build/yocto/meta-openembedded/meta-filesystems \
/work/build/yocto/meta-openembedded/meta-initramfs \
/work/build/yocto/meta-openembedded/meta-networking \
/work/build/yocto/openembedded-core/meta \
"
And my local.conf:
MACHINE = "genericx86-64"
BUILD_ARCH ?= "x86_64"
SDKMACHINE ?= "x86_64"
SDK_UPDATE_URL ?= "http://my-url/sdk-updater"
SDK_EXT_TYPE = "minimal"
SDK_INCLUDE_TOOLCHAIN = "0"
SDK_INCLUDE_PKGDATA = "1"
SSTATE_MIRRORS_append = " file://.* http://my-url/sstate/PATH \n"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_ipk"
LICENSE_FLAGS_WHITELIST = "commercial"
CONF_VERSION = "1"
I've tested
core-image-full-cmdline
and
core-image-minimal-dev
on both I've the same problem.
Thanks for any help and clues how to resolve this issue.
I have files in folder:
folder_a/
subfolder_1/
file.txt
subfolder_2/
subfolder_3
file2.txt
file3.txt
I need to get symlinks to .txt-files into folder_b:
folder_b/
000_file.txt ---> folder_a/subfolder_1/file.txt
001_file2.txt ---> folder_a/subfolder_2/subfolder_3/file2.txt
003_file3.txt ---> folder_a/file3.txt
In Bash:
shopt -s globstar # Enable **/* glob
for fname in folder_a/**/*.txt; do # Get all .txt in folder_a
bname=${fname##*/} # Basename of link target
# Assemble link name
printf -v lname '%s%03d%s' 'folder_b/' "${bname//[!0-9]}" "_$bname"
# Create link
ln -s "$fname" "$lname"
done
resulting in
.
├── folder_a
│ ├── file3.txt
│ ├── subfolder_1
│ │ └── file.txt
│ └── subfolder_2
│ └── subfolder_3
│ └── file2.txt
└── folder_b
├── 000_file.txt -> folder_a/subfolder_1/file.txt
├── 002_file2.txt -> folder_a/subfolder_2/subfolder_3/file2.txt
└── 003_file3.txt -> folder_a/file3.txt
Can do this with ruby script:
src = '/path/to/folder_a/'
dst = '/path/to/folder_b/'
files = `find $(realpath #{src}) -type f -iname "*.txt"`.split("\n")
files.each_with_index do |path, idx|
name = File.basename path
`ln -s "#{path}" "#{dst + "%03d" % idx}__#{name}"`
end