BitBake add tmux package to image - yocto

I'm trying to add the tmux package to the image that I build with BitBake.
The recipe for tmux is known to bitbake:
user#ubuntu:/opt/user/build$ bitbake-layers show-recipes | grep -A 1 tmux
tmux:
meta-oe 2.1
Added this line to my conf/local.conf:
IMAGE_INSTALL_append = " tmux"
Clean & build the image:
bitbake -c cleansstate phytec-headless-image
bitbake -c clean phytec-headless-image
bitbake phytec-headless-image
Output of the build:
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal-4.8"
TARGET_SYS = "arm-phytec-linux-gnueabi"
MACHINE = "phyboard-mira-imx6-9"
DISTRO = "yogurt"
DISTRO_VERSION = "BSP-Yocto-i.MX6-PD18.1.2"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa9"
TARGET_FPU = "hard"
meta
meta-poky = "HEAD:5f660914cd7eec8117efccdf1eb29c466b4e74f7"
meta-oe
meta-networking
meta-python
meta-multimedia = "HEAD:eae996301d9c097bcbeb8046f08041dc82bb62f8"
meta-gstreamer1.0 = "HEAD:802a5db727edf0ec1d142122241c857bffab8667"
meta-phytec = "HEAD:fcc5c4c755fd273b951ac4726b795ca5a9e9a5ed"
meta-rauc = "HEAD:e9c3928d6c24bd58c613bd8334066021946d6347"
meta-qt5 = "HEAD:e6fb3850d43f857e87f7c53fc7df5933fef98cbd"
meta-yogurt = "HEAD:608387f14f29509af5d029347ab2049764b453d2"
Copy the image to sdcard, it boots fine. But there is no tmux:
root#phyboard-mira-imx6-3:~# tmux
-sh: tmux: command not found
root#phyboard-mira-imx6-3:~# find / -name tmux
root#phyboard-mira-imx6-3:~#
Guidance or hints as to why tmux isn't added to the image are appreciated.

The issue was that the board I thought I was flashing was booting from NAND instead of the SD card that I was using. It has a small hardware-switch to chose where to boot from so I never actually booted the Image that I presumed included tmux.
As described by Parthiban you can verify that the binaries included with IMAGE_INSTALL_append are actually included, have a look at image/*/rootfs.

Check if certain package is present on current Yocto Setup
bitbake -s | grep 
see https://community.nxp.com/docs/DOC-94953

Related

Petalinux--ERROR:conflicts between attempted installs

I am trying to modify /etc/inittab file to add a restart function. To check whether I can add a line in inittab, I created a demo. I created a .bb file under proect-spec/meta-user/recipes-apps:
#
# This is the GPIO-DEMO apllication recipe
#
#
SUMMARY = "automatic-restart application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://* \
"
S = "${WORKDIR}"
FILESEXTAPATHS_preprend := "${THISDIR}/files:"
#inherit update-rc.d
INITSCRIPT_NAME = "hello"
INITSCRIPT_PARAMS = "start 98 5 ."
do_install() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${S}/hello ${D}${sysconfdir}/init.d/hello
install -d ${D}/opt/hello
cp ${S}/hello.elf ${D}/opt/hello/
}
do_install_append(){
echo "adding a line" >> ${D}${sysconfdir}/inittab
}
FILES_${PN} += "${sysconfdir}/*"
FILES_${PN} += "/opt/hello/"
By the way, this file is used firsly put an .elf file under /etc/init.d and it worked.
However, when I was adding these below code block to check whether I can modify "inittab" :
do_install_append(){
echo "adding a line" >> ${D}${sysconfdir}/inittab
}
then building the petalinux project, I encountered with this error:
"file /etc/inittab conflicts between attempted installs of hello-1.0-r0.cortexa9hf_neon and sysvinit-inittab-2.88dsf-r10.plnx_zynq7"
This is a well known issue in Yocto which is you cannot ship two packages(recipes) that are installing the same file in the final rootfs.
So, either you remove one of hello or sysvinit-inittab from the image, or use update-alternatives class as mentioned in this question.

Run application at start up with Yocto Dunfell

I have coded a toggle.c application in C that toggles on and off a GPIO of the BeagleBone Black board. Practically it causes an external LED to flash.
I wish to prepare a Yocto image which includes the executable binary of the application and it launches the application automatically when starting up, thus causing the LED to flash.
I have followed along the examples I found on the web. My Yocto image includes the compiled binary of the application inside /usr/bin. I can execute it from command line, all fine.
But my Yocto generated image does not start the binary automatically. LED does not flash when starting Yocto generated Linux Image.
My workflow was:
create a new layer
new layer has an automatically generated 'recipes-example' directory
underneath 'recipes-example' there was a directory which I renamed to 'toggle'
inside 'toggle' there is the recipe toggle_0.1.bb
I created a new directory inside 'toggle' that called 'files' where I stored the toggle.c and toggle.service files
toggle.service file
[Unit]
Description= A start script from a toggle.c program
[Service]
ExecStart=/usr/bin/toggle
[Install]
WantedBy=multi-user.target
toggle_0.1.bb
DESCRIPTION = "This is a program to toggle GPIO on/off at an interval of 1s"
PRIORITY = "optional"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://toggle.c"
S = "${WORKDIR}"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} toggle.c -o toggle
}
do_install() {
install -d ${D}${bindir}
install -m 0755 toggle ${D}${bindir}
}
inherit systemd
SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE_${PN} = "toggle.service"
SRC_URI_append = " file://toggle.service "
FILES_${PN} += "${systemd_unitdir}/system/toggle.service"
do_install_append() {
install -d ${D}/${systemd_unitdir}/system
install -m 064 ${WORKDIR}/toggle.service ${D}/${systemd_unitdir}/system
}
I tried the same thing with diferent kind of image recipes: core-image-minimal, core-image-base, core-image-full-cmdline. All the same. They do not hold the normal Linux files for executing apps at start-up like /etc/init.d/rc.local.
Please point me towards a solution that would work for me. Thank you very much.
I finally found a solution for my problem, but I sorted it out using the update-rc.d class , instead of systemd. For some reason, even though I added systemd to my image by modifying conf/local.conf with DISTRO_FEATURES_append = " systemd" , still I had no access to systemctl commands for debugging within the Yocto Project image.
My working solution is:
DESCRIPTION = "This is a recipe to launch executable program out of toggle.c at start up."
PRIORITY = "optional"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://toggle.c"
S = "${WORKDIR}"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} toggle.c -o toggle
}
do_install() {
install -d ${D}${bindir}
install -m 755 toggle ${D}${bindir}
install -d ${D}${sysconfdir}/init.d
install -m 755 toggle ${D}${sysconfdir}/init.d/toggle
}
inherit update-rc.d
INITSCRIPT_NAME="toggle"
INITSCRIPT_PARAMS= "defaults 10"
For more information about update-rc.dand services, I recommend checking https://www.jamescoyle.net/cheat-sheets/791-update-rc-d-cheat-sheet.

Make img from ext4, dtb and uboot.bin

I have recently used yocto to compile a custom OS and it resulted in the constituent parts of the ext4 file structure, the hardware dtb and the uboot image.
The device I am trying to replace the firmware on is android based and has its own windows based application to replace the firmware. The software needs a singular img file.
Is it possible to compile one from the 3 files listed above?
I have been looking at mkimage but to no joy. I don't know how to use the -d script possibly. Yocto produces a file that looks like it would work with -d argument but doesn't seem to.
I come from OpenWRT where it produced a single bin image which could be mtd'd (the verb to use mtd).
Thoughts?
My build configuration is:
Build Configuration:
BB_VERSION = "1.37.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "aarch64-poky-linux"
MACHINE = "nexbox-a95x-s905x"
DISTRO = "poky"
DISTRO_VERSION = "2.5"
TUNE_FEATURES = "aarch64"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "sumo:b369e613a1d3af6439905724031aa2b75423aeee"
meta-meson = "sumo:9a060d8cb106fd86ed7ac93b66675a639bfc6045"
meta-oe
meta-python
meta-networking = "master:bb57bac845f3cd1634862fa9868bc8e294ba74a9"
meta-openwrt = "master:3f94c4f5aa965aa5d65419d6691b40a3870e84a8"
No other changes made to config files.
Resultant files are:
aml_autoscript
amlogic-image-headless-sd-nexbox-a95x-s905x-20180608105022.testdata.json
amlogic-image-headless-sd-nexbox-a95x-s905x-20180609220030.rootfs.ext4
amlogic-image-headless-sd-nexbox-a95x-s905x-20180609220030.rootfs.manifest
amlogic-image-headless-sd-nexbox-a95x-s905x-20180609220030.rootfs.tar.bz2
amlogic-image-headless-sd-nexbox-a95x-s905x-20180609220030.testdata.json
amlogic-image-headless-sd-nexbox-a95x-s905x.ext4
amlogic-image-headless-sd-nexbox-a95x-s905x.manifest
amlogic-image-headless-sd-nexbox-a95x-s905x.tar.bz2
amlogic-image-headless-sd-nexbox-a95x-s905x.testdata.json
Image--4.16.5+git0+e5ce9f6879-r0-meson-gxl-s905x-nexbox-a95x-20180608105022.dtb
Image-meson-gxl-s905x-nexbox-a95x.dtb
meson-gxl-s905x-nexbox-a95x.dtb
modules--4.16.5+git0+e5ce9f6879-r0-nexbox-a95x-s905x-20180608105022.tgz
modules-nexbox-a95x-s905x.tgz
uImage
uImage--4.16.5+git0+e5ce9f6879-r0-nexbox-a95x-s905x-20180608105022.bin
uImage-nexbox-a95x-s905x.bin
Try using skales-tools
dtbTool -o dt.img arch/arm/dts/
mkbootimg --kernel=uboot.bin --dt=dt.img --cmdline="" --pagesize 2048 --base --output=u-boot.img --ramdisk=
Are you sure the img you want to generate is using mkimage tool? mkimage is used to make u-boot image. What you are looking for is probably the genimage tool to combine all the generated output in one single image.

How do I boot a Yocto generated image on the MX6 SABRE devices

Question: What output should I expect from core-image-minimal the U-boot platform, running on i.MX6 quad core Sabre devkit?
I can see a splash screen with the Freescale logo, but then the display goes blank. I was expecting some kind of boot-sequence and a U-Boot> command interface.
I also see from uboot_mx6x.pdf the following:
By default, U-Boot is configured to display the command prompt and receive serial keyboard input on certain UART ports with 115,200-8-N-1 settings.
Question: Where is this defined? How do I change it? How do I listen to this?
I followed a guide on NXP forums to start understanding Yocto and u-boot.
I have installed and followed the procedures from here.
I have used the command:
$ bitbake core-image-minimal
Loading cache: 100% |#######################################| Time: 0:00:00
Loaded 2274 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "arm-fslc-linux-gnueabi"
MACHINE = "imx6qdlsabresd"
DISTRO = "fslc-framebuffer"
DISTRO_VERSION = "2.4"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard"
TARGET_FPU = "hard"
meta
meta-poky = "HEAD:fdeecc901196bbccd7c5b1ea4268a2cf56764a62"
meta-oe
meta-multimedia = "HEAD:dacfa2b1920e285531bec55cd2f08743390aaf57"
meta-freescale = "HEAD:d6141ea291a1ac9ab8fb1dd1110d408f840fda57"
meta-freescale-3rdparty = "HEAD:62de01743c9233ea718de22991c47b73a78b4857"
meta-freescale-distro = "HEAD:0ec6d7e206705702b5b534611754de0787f92b72"
Initialising tasks: 100% |###################################| Time: 0:00:04
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 3032 tasks of which 2366 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
$ wic create imx-uboot-spl-bootpart -e core-image-minimal
INFO: Building wic-tools...
Previous bitbake instance shutting down?, waiting to retry...
Loading cache: 100% |###################################| Time: 0:00:00
Loaded 2274 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "arm-fslc-linux-gnueabi"
MACHINE = "imx6qdlsabresd"
DISTRO = "fslc-framebuffer"
DISTRO_VERSION = "2.4"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard"
TARGET_FPU = "hard"
meta
meta-poky = "HEAD:fdeecc901196bbccd7c5b1ea4268a2cf56764a62"
meta-oe
meta-multimedia = "HEAD:dacfa2b1920e285531bec55cd2f08743390aaf57"
meta-freescale = "HEAD:d6141ea291a1ac9ab8fb1dd1110d408f840fda57"
meta-freescale-3rdparty = "HEAD:62de01743c9233ea718de22991c47b73a78b4857"
meta-freescale-distro = "HEAD:0ec6d7e206705702b5b534611754de0787f92b72"
Initialising tasks: 100% |#####################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 380 tasks of which 380 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
INFO: Creating image(s)...
INFO: The new image(s) can be found here:
./imx-uboot-spl-bootpart-201804091703-mmcblk.direct
The following build artifacts were used to create the image(s):
ROOTFS_DIR: /media/mattis/7228221d-c3f3-424e-8443-8e97176c6a6d/sandbox/fsl-community-bsp/tmp.wic.yc_b166n/rootfs_copy
BOOTIMG_DIR: /media/mattis/7228221d-c3f3-424e-8443-8e97176c6a6d/sandbox/fsl-community-bsp/build/tmp/work/imx6qdlsabresd-fslc-linux-gnueabi/core-image-base/1.0-r0/recipe-sysroot/usr/share
KERNEL_DIR: /media/mattis/7228221d-c3f3-424e-8443-8e97176c6a6d/sandbox/fsl-community-bsp/build/tmp/deploy/images/imx6qdlsabresd
NATIVE_SYSROOT: /media/mattis/7228221d-c3f3-424e-8443-8e97176c6a6d/sandbox/fsl-community-bsp/build/tmp/work/armv7at2hf-neon-fslc-linux-gnueabi/wic-tools/1.0-r0/recipe-sysroot-native
INFO: The image(s) were created using OE kickstart file:
/media/mattis/7228221d-c3f3-424e-8443-8e97176c6a6d/sandbox/fsl-community-bsp/sources/meta-freescale/wic/imx-uboot-spl-bootpart.wks
Lastly I use the command:
dd if=imx-uboot-spl-bootpart-201804091703-mmcblk.direct of=/dev/sdb
After this process, I take the SDCard, and plug it into my sabre development kit, this then boots up the splash screen, after which nothing happens.
To answer your questions:
You should expect to see u-boots output, followed by the kernel's console output, and finally a login prompt.
The console is defined by the SERIAL_CONSOLES variable. You would listen to this by connecting a serial cable to the board and using a program like minicom.
Reading into your questions a bit, I believe the image you are putting on the SD card is not going to work. I do not know much about imx-uboot-spl-bootpart other than how it is described in the kickstart file, and can't say for sure which boards it is compatible with.
You should be able to use the default wic image that is generated once the build is complete. It looks like you are building from Yocto 2.4 Rocko, so once your build is finished you will have two files located here:
$BUILD_DIR/tmp/deploy/images/imx6qdlsabresd/...
core-image-minimal-imx6qdlsabresd.wic
core-image-minimal-imx6qdlsabresd.wic.bmap
If these files do not exist you can create them by adding this line to your local.conf file:
IMAGE_FSTYPES += "wic wic.bmap"
I would recommend using bmap-tools instead of dd as it will save you a lot of time.
In your example the command should look like this:
bmaptool copy /path/to/core-image-minimal-imx6qdlsabresd.wic /dev/sdb
That image should boot and you will be given the chance to stop u-boot and land at the u-boot prompt.
It looks like the default Freescale image is currently wic.gz, which bmap-tools should handle as well.

systemd yocto recipe for an existing executable

I'm looking for a template recipe for enabling a systemd recipe in yocto. The executable is already installed by a recipe provided by yocto. The goal of this recipe is to provide make /usr/bin/btattach be run at startup.
As a start I created the following structure in my layer in the appropriate recipe directory:
btattach-systemd/
|-- files
| `-- btattach.service
`-- btattach-systemd.bb
The content of the recipe
SUMMARY = "Writes patterns to the fb device"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit systemd
REQUIRED_DISTRO_FEATURES= "systemd"
SRC_URI = "file://btattach.service"
S = "${WORKDIR}"
do_install () {
install -m 0644 ${WORKDIR}/btattach.service.service ${D}${sysconfdir}/systemd/system
}
SYSTEMD_SERVICE_${PN} = "btattach.service"
Besides that, the IMAGE_INSTALL in the image recipe has been correctly extended with btattach-systemd.
bitbake btattach-systemd runns ok but when trying to build the complete image the at do_rootfs step for the whole image. with the error:
* opkg_solver_install: Cannot install package btattach-systemd.
Ideas on where the bug is?
I think the recipe should look like this (leaving out summary, license, license checksum, and assuming that the binary package is called "btattach"):
SRC_URI = "file://btattach.service"
SYSTEMD_SERVICE_${PN} = "btattach.service"
inherit systemd
do_install_append() {
install -d ${D}${systemd_unitdir}/system
for service in ${SYSTEMD_SERVICE_${PN}}; do
install -m 0644 ${WORKDIR}/${service} ${D}${systemd_unitdir}/system/
sed -i -e 's,#BINDIR#,${bindir},g' ${D}${systemd_unitdir}/system/${service}
done
}
RDEPENDS_${PN} = "btattach"
I am sorry for not commenting your question as I have no reputation for that. Also, LetoThe2nd answer is more complete than mine, but here follows a possible quick fix:
It seems to me you are installing 'btattach.service.service' instead of 'btattach.service'.
Assuming that the .service file is correct, my take on the Yocto recipe and why it might be failing is because that the btattach.service file isn't included with the installation which is what the final line does below.
Have you ensured that you do a bitbake btattach.systemd -c cleanall and bitbake btattach.systemd -c cleanstate beforehand as well, as I noticed you had a typo in the Yocto recipe as btattach.service.service.
SUMMARY = "Writes patterns to the fb device"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit systemd
REQUIRED_DISTRO_FEATURES= "systemd"
SRC_URI = "file://btattach.service"
S = "${WORKDIR}"
do_install () {
install -m 0644 ${WORKDIR}/btattach.service ${D}${sysconfdir}/systemd/system
}
SYSTEMD_SERVICE_${PN} = "btattach.service"
FILES_${PN} += "/lib/systemd/system/btattach.service"