Yocto do_install action not performed - embedded-linux

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"

Related

How to run aws bash commands consecutively?

How can I execute the following bash commands consecutively?
aws logs create-export-task --task-name "cloudwatch-log-group-export1" \
--log-group-name "/my/log/group1" \
--from 1488708419000 --to 1614938819000 \
--destination "my-s3-bucket" \
--destination-prefix "my-log-group1"
aws logs create-export-task --task-name "cloudwatch-log-group-export" \
--log-group-name "/my/log/group2" \
--from 1488708419000 --to 1614938819000 \
--destination "my-s3-bucket" \
--destination-prefix "my-log-group2"
The problem I have with the above commands is that after the first command completes execution, the script will stuck at the following state, making the second command not reachable.
{
"taskId": "0e3cdd4e-1e95-4b98-bd8b-3291ee69f9ae"
}
It seems that I should find a way to wait for cloudwatch-log-group-export1 task to complete.
You could have to crate a waiter function which uses describe-export-tasks to get current status of an export job.
Example of such function:
wait_for_export() {
local sleep_time=${2:-10}
while true; do
job_status=$(aws logs describe-export-tasks \
--task-id ${1} \
--query "exportTasks[0].status.code" \
--output text)
echo ${job_status}
[[ $job_status == "COMPLETED" ]] && break
sleep ${sleep_time}
done
}
Then you use it:
task_id1=$(aws logs create-export-task \
--task-name "cloudwatch-log-group-export1" \
--log-group-name "/my/log/group1" \
--from 1488708419000 --to 1614938819000 \
--destination "my-s3-bucket" \
--destination-prefix "my-log-group1" \
--query 'taskId' --output text)
wait_for_export ${task_id1}
# second export
aws-cli auto access to vim edit mode by default.
You can avoid it by setting AWS_PAGER environment variable is "" before execute aws command.
export AWS_PAGER=""
aws logs create-export-task...
Or, you can fix it in to aws's config file (~/.aws/config):
[default]
cli_pager=

Yocto, Meta-selinux does not work on raspberry pi 3

I realize a yocto image for a raspberry pi 3. I want to install selinux on the image with the Meta-selinux. The compilation works, but selinux remains disabled even if it is in enforcing or permissive mode in the / etc / selinux / config file. I also tried adding "selinux = 1 security = selinux" in the cmdline.txt file of the bootloader, but selinux is still disabled.
Here is what I added in my local.conf:
RPI_USE_U_BOOT = "1"
ENABLE_UART = "1"
INHERIT += "rm_work"
DISTRO_FEATURES_append = " acl xattr pam selinux"
PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls"
IMAGE_INSTALL_append = " packagegroup-core-selinux"
Here is what I added in my bblayers.conf:
BBLAYERS ?= " \
/home/.../poky/meta \
/home/.../meta-poky \
/home/.../meta-yocto-bsp \
/home/.../meta-openembedded/meta-oe \
/home/.../meta-openembedded/meta-networking \
/home/.../meta-openembedded/meta-multimedia \
/home/.../meta-openembedded/meta-python \
/home/.../meta-selinux \
/home/.../meta-raspberrypi \
"
Thank you for your help.

Bazel genrule: Use linebreaks in command

I use a genrule with a lot of sources, that have a long identifier. The command needs to list all sources explicitely, which would result in a reeaally long cmd. Therefore I tried to use linebreaks (as known from bash or shell commands)...
However, bazel complains about unterminated strings.
genrule(
name = "Aggregate_Reports",
srcs = ["//really/long/path/to/module/ModuleA/src:CoverageHtml",
"//really/long/path/to/module/ModuleA/src:TestRun",
"//really/long/path/to/module/ModuleB/src:CoverageHtml",],
outs = ["UT_Summary.txt"],
message = "Create unified report",
tools = [":Create_Summary"],
cmd = "$(location :Create_Summary) -t \
$(location //really/long/path/to/module/ModuleA/src:TestRun) \
$(location //really/long/path/to/module/ModuleB/src:TestRun) \
-c \
$(location //really/long/path/to/module/ModuleA/src:CoverageHtml) \
$(location //really/long/path/to/module/ModuleB/src:CoverageHtml) \
-o $(#)",
executable = True,
visibility=["//visibility:public"],
)
Escaping the \ with $ does not change anything...
As in Python, you can use triple-quotes to preserve the newlines:
cmd = """$(location :Create_Summary) -t \
$(location //really/long/path/to/module/ModuleA/src:TestRun) \
$(location //really/long/path/to/module/ModuleB/src:TestRun) \
-c \
$(location //really/long/path/to/module/ModuleA/src:CoverageHtml) \
$(location //really/long/path/to/module/ModuleB/src:CoverageHtml) \
-o $(#)""",

Yocto 1.6 no libboost_log in toolchain

I've installed Yocto 1.6 and run the bitbake to set up the toolchain, following the tutorial written by Daiane Angolini. While I see most of the boost libraries under $SDKTARGETSYSROOT/usr/lib, there seems to be no libboost_log.a nor libboost_log_setup.a. I believe these were introduced with Boost 1.55, and that Yocto 1.6 has moved to Boost 1.55. Shouldn't they be there, or have I done something wrong?
My .../fsl-community-bsp/build/conf/local.conf:
BB_NUMBER_THREADS ?= "${#oe.utils.cpu_count()}"
PARALLEL_MAKE ?= "-j ${#oe.utils.cpu_count()}"
MACHINE ??= 'imx6qsabresd'
DISTRO ?= 'poky'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-sdk"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
BB_NUMBER_THREADS = '1'
PARALLEL_MAKE = '-j 1'
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = ""
CORE_IMAGE_EXTRA_INSTALL += "boost"
The right way is to extend the existing recipe. In fact, you normally never change a 3rd-party recipe directly. This means, you are creating your own "recipes-support/boost/" folder which includes a file called "boost_%.bbappend".
'%' means that the boost version is not of interest. 'bbappend' means that you extend the existing boost-recipe. This file contains only one line:
BOOST_LIBS += " log"
In order to add log library you should edit boost recipe file.
In this example you should edit boost.inc.
To add log, atomic and loace libraries, replace
BOOST_LIBS = "\
date_time \
filesystem \
graph \
iostreams \
program_options \
regex \
serialization \
signals \
system \
test \
thread \
"
with
BOOST_LIBS = "\
date_time \
filesystem \
graph \
iostreams \
program_options \
regex \
serialization \
signals \
system \
test \
thread \
log \
atomic \
locale
"

Installing Magento using SSH to bypass web based installer

I know that I am supposed to use (;) to separate multiple commands but what is the correct format for issuing all these commands in a single line to install magento using ssh to bypass the web based installer?
php-cli -f install.php -- \
--license_agreement_accepted "yes" \
--locale "en_US" \
--timezone "America/Los_Angeles" \
--default_currency "USD" \
--db_host "DB_HOST" \
--db_name "DB_NAME" \
--db_user "DB_USER" \
--db_pass "DB_PASS" \
--url "SITE_URL" \
--use_rewrites "yes" \
--use_secure "no" \
--secure_base_url "" \
--use_secure_admin "no" \
--admin_firstname "FIRST_NAME" \
--admin_lastname "LAST_NAME" \
--admin_email "EMAIL_ADDRESS" \
--admin_username "USERNAME" \
--admin_password "PASSWORD"
Those don't seem to be commands but parameters. Putting them all into a single line:
php-cli -f install.php --license_agreement_accepted "yes" --locale "en_US" ...
should work.

Resources