Commit Graph

379 Commits

Author SHA1 Message Date
Gabriel Valcazar 52c37a6fe5 hardknott: meta-digi: replace GPL-2.0 license file with GPL-2.0-only
The common license file GPL-2.0 is now called GPL-2.0-only in poky, so we need
to reflect this name change to avoid errors

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar 1f2d0b8535 hardknott: packagegroup-dey-core: add firmwared dependency
This is a generic package that is currently being used by NXP to load firmware
on the target, so include it in our images as well. Since it only works with
systemd, leave it out of builds that use sysvinit.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar 9a399811cd hardknott: systemd-gpuconfig: sync with meta-imx hardknott-5.10.72-2.2.0 branch
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar 6bf8c97b50 hardknott: sysvinit: update to v2.99
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar 0c9cbf3ca7 hardknott: glib-2.0: remove patch already included in hardknott version
This patch was initially needed for a specific version combination of
NetworkManager (>= v1.22) and glib-2.0 (v2.63.3 - v2.64.X), but since the
hardknott branch of poky now provides glib-2.0 v2.66.7, the patch isn't
needed anymore.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar a627ccb6f3 hardknott: glibc: remove v2.33 recipes and their respective files
The recipes for this version are already provided by poky

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2022-01-05 11:09:46 +01:00
Gabriel Valcazar b97d824d38 busybox: add support to run mdev in daemon mode
This mode is necessary in the recovery initramfs to be able to properly detect
any external storage device that might contain an update package. The
configuration option associated with this mode became explicit after upgrading
busybox to v1.34.1, so enable it in our defconfig.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-11-30 14:08:50 +01:00
Francisco Gil 24063490ea recovery-initramfs-init: fix condition for nand devices
The nand devices doesn't need to call the mount_cryptrootfs
script.

Reported-by: Francisco Gil <francisco.gilmartinez@digi.com>
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-11-25 08:41:03 +01:00
Gabriel Valcazar f3aab304c6 busybox: upgrade to v1.34.1
Backport the recipes from the honister poky branch. This version includes fixes
for several CVEs:

https://thehackernews.com/2021/11/14-new-security-flaws-found-in-busybox.html

Sync our defconfig with the latest version while keeping our custom config
changes.

https://onedigi.atlassian.net/browse/DEL-7728

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-11-16 13:16:34 +01:00
Hector Palacios 116fb5e203 meta-digi-dey: append 'dey' distro override to PACKAGECONFIG_remove
Some recipes were forcibly removing conflicting packages.
This does not allow to add those packages back for users that
want to use meta-digi layer, but a different distro than 'dey'.
With the 'dey' distro override, such removals are only done
if using this distro.

Reported-by: Michael Burr <michael.burr@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7712
2021-11-12 09:01:44 +01:00
Hector Palacios fe2a1f281e Merge branch 'dey-3.2/master' into dey-3.2/maint
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-11-11 16:23:43 +01:00
Arturo Buzarra d81444a574 swu-images: fix support to preinstallation script in swu update package
Since commit 11558352 ("swu-images: add "installed-directly" flag to
sw-description") the swu package images are streamed into the target without
any temporary copy to support devices with low memory available, that forces a
different order according with the swupdate documentation because scripts
should packed before the rest. This means that all the pre, post and shell
scripts will be executed after the images will be installed. This behavior
breaks the current support to mount the cryptorootfs node before install an
encrypted rootfs.

This commit moves the shell script to mount the cryptorootfs node to the
recovery initramfs and modifies the swupdate command line to call the shell
script before the images installation.

https://onedigi.atlassian.net/browse/CC8X-320

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-11-08 08:39:18 +01:00
Arturo Buzarra b03a2af5b2 recovery-initramfs-init: fix support to identify encrypted rootfs images
Since we added support for compressing rootfs images, we need to manage SWU
packages with a regular rootfs image and with compressed images. That support
was missing in the identification process when the SWU packet was verified.
This commit fixes the identification of compressed rootfs images.

https://onedigi.atlassian.net/browse/CC8X-320

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-11-08 08:22:11 +01:00
Hector Palacios 71b3623b59 init-ifupdown: adapt recipe for read-only-rootfs
This recipe had a post install script to do the following:
 - create runlevel symlinks.
 - comment the 'auto' lines of /etc/network/interfaces if running on
   a non-Wi-Fi variant.
 - add Atheros or QCA bridge examples depending on the detected chip.
 - add wlan1 interface only if QCA chip is detected.

This post install cannot run on a read-only-rootfs so the recipe has been
reworked to do the same things at build time:

 - the runlevel symlinks have been removed because they are taken care
   of by a poky class.
 - add a pre-up condition (the existance of a wireless entry on the device
   tree) so that the interface is not brought up if the condition is not met.
 - for the cc6/cc6n, since the Wi-Fi chip can be Atheros or QCA, add
   specific wlan1 and br0 fragments with a pre-up condition basing on the
   detected ID of the Wi-Fi chip

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7708
2021-11-05 11:30:12 +01:00
Javier Viguera c89a66480b meta-digi: remove postinst on target when using read-only-rootfs image feature
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
2021-11-05 11:18:16 +01:00
Gabriel Valcazar f3210db348 ccimx6sbc: adapt recipes to support Atheros and Qualcomm wireless chips
Some packages require different scripts, configuration files or installations
depending on the wireless chip assembled on the target. In general, the way
to support both chips in one image is to have the recipes install both
versions of the aforementioned files, then leave only the strictly necessary
version once the wireless chip can be deduced.

In the case of the init-ifupdown recipe, this involves installing temporary
configuration fragments that are later erased. In the case of the standby
script, the logic can be implemented in a single file.

https://onedigi.atlassian.net/browse/DEL-7661
https://onedigi.atlassian.net/browse/DEL-7666

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-11-03 15:58:53 +01:00
Arturo Buzarra 67c1ef2c9e recovery-initramfs-init: fix psplash communication FIFO path
The latest version of psplash changed the default path to store the
communication FIFO with other processes to "/run" to allow keeping the
information between reboots, however we are using this tool from an initramfs
where "/run" does not exist, producing multiple errors trying to write to a
nonexistent path, delaying the update process.

This commit forces psplash to use an existing path like "/tmp" to handle the
communication FIFO, because we don't need to maintain the update information.

https://onedigi.atlassian.net/browse/CC8X-318

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-10-29 11:26:43 +02:00
Arturo Buzarra 4a54512d64 recovery-initramfs-init: fix psplash communication FIFO path
The latest version of psplash changed the default path to store the
communication FIFO with other processes to "/run" to allow keeping the
information between reboots, however we are using this tool from an initramfs
where "/run" does not exist, producing multiple errors trying to write to a
nonexistent path, delaying the update process.

This commit forces psplash to use an existing path like "/tmp" to handle the
communication FIFO, because we don't need to maintain the update information.

https://onedigi.atlassian.net/browse/CC8X-318

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-10-29 09:35:53 +02:00
Hector Palacios cc2df395c5 uboot: ccimx6ul: rename variable for single MTD system partition
Rename from 'ubisysvols' to 'singlemtdsys'.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-29 13:44:50 +02:00
Hector Palacios 6910a11eab recovery: turn is_dualboot_enabled() into generic function
The new function compares the value of the variable with
one given as parameter.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios ec08b1277a recovery-initramfs-init: add support for ubisysvols
Adapt the format_ubi_volume() function to wipe out UBI volumes
instead of formatting MTD partitions.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7614
2021-09-09 17:38:44 +02:00
Hector Palacios 90706f5d39 recovery: free strings returned by uboot_getenv()
The function uboot_getenv() is a wrapper over libuboot_get_env() and
requires that the returned strings are freed when no longer in use.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7645
(cherry picked from commit 27ce7a4f20)
2021-08-27 12:49:31 +02:00
Hector Palacios c93945c995 recovery: [cosmetic] replace whitespaces with tabs where appropriate
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
(cherry picked from commit f806979c84)
2021-08-27 12:49:25 +02:00
Hector Palacios 846bccc8bf recovery: rework is_dualboot_enabled() function
- The function is only used internally in this file, so make it static.
- Convert the function from 'int' to 'bool', since no other values are
  evaluated.
- Only return true if the variable 'dualboot' is set to 'yes'. Before,
  the function returned true if 'dualboot' was different than 'no'.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
(cherry picked from commit 9a519570ba)
2021-08-27 12:49:22 +02:00
Hector Palacios 53759cd29c recovery: check variable returned by uboot_getenv() is not NULL
The use of this function, which is a wrapper over libuboot_get_env(),
requires checking if the returned string is NULL.
Manipulations of such string without checking whether it's NULL may lead
to segfault errors.
This was seen during firmware update on a device that didn't have the
'dualboot' variable set.

Reported-by: Chandrababu Pigilam <chandrababu.pigilam@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7645
(cherry picked from commit 8a4484bbd6)
2021-08-27 12:49:16 +02:00
Hector Palacios 27ce7a4f20 recovery: free strings returned by uboot_getenv()
The function uboot_getenv() is a wrapper over libuboot_get_env() and
requires that the returned strings are freed when no longer in use.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7645
2021-08-25 16:20:43 +02:00
Hector Palacios f806979c84 recovery: [cosmetic] replace whitespaces with tabs where appropriate
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-08-25 16:20:43 +02:00
Hector Palacios 9a519570ba recovery: rework is_dualboot_enabled() function
- The function is only used internally in this file, so make it static.
- Convert the function from 'int' to 'bool', since no other values are
  evaluated.
- Only return true if the variable 'dualboot' is set to 'yes'. Before,
  the function returned true if 'dualboot' was different than 'no'.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-08-25 16:20:43 +02:00
Hector Palacios 8a4484bbd6 recovery: check variable returned by uboot_getenv() is not NULL
The use of this function, which is a wrapper over libuboot_get_env(),
requires checking if the returned string is NULL.
Manipulations of such string without checking whether it's NULL may lead
to segfault errors.
This was seen during firmware update on a device that didn't have the
'dualboot' variable set.

Reported-by: Chandrababu Pigilam <chandrababu.pigilam@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7645
2021-08-25 16:20:24 +02:00
Gabriel Valcazar feec2aa4f7 glib-2.0: backport 2.65 patch to prevent NetworkManager segmentation faults
NetworkManager's main library went through a major overhaul in v1.22, changing
the way it interacts with glib among other things. When using a NetworkManager
version equal or newer than v1.22 along with a glib version between 2.63.3 and
2.65, a race condition can happen, randomly causing segmentation faults.

Since Yocto 3.2 uses NetworkManager 1.22.14 and glib 2.64.5, the race condition
is reproducible, but it can be fixed with the patch introduced in this commit.
The patch in question is commit e4a690f5dd959e74b2d6054826f61509892c8aa7 in the
glib git repo.

https://onedigi.atlassian.net/browse/DEL-7523

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-08-16 15:26:40 +02:00
Gabriel Valcazar 78e8a75ff2 glib-2.0: backport 2.65 patch to prevent NetworkManager segmentation faults
NetworkManager's main library went through a major overhaul in v1.22, changing
the way it interacts with glib among other things. When using a NetworkManager
version equal or newer than v1.22 along with a glib version between 2.63.3 and
2.65, a race condition can happen, randomly causing segmentation faults.

Since Yocto 3.2 uses NetworkManager 1.22.14 and glib 2.64.5, the race condition
is reproducible, but it can be fixed with the patch introduced in this commit.
The patch in question is commit e4a690f5dd959e74b2d6054826f61509892c8aa7 in the
glib git repo.

https://onedigi.atlassian.net/browse/DEL-7523

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-08-11 12:38:10 +02:00
Mike Engel 37832e8b3b glibc: upgrade to version 2.33 for eIQ support
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
2021-08-11 10:39:26 +02:00
Mike Engel c47377df22 recovery-utils: add check into recover library if dualboot is enabled
This commit add a verification into the recovery library to avoid
that it is executed when in dualboot mode.

Signed-off-by: Mike Engel <Mike.Engel@digi.com>

https://onedigi.atlassian.net/browse/DEL-7580
(cherry picked from commit 30aa4a7444)
2021-07-28 17:19:44 +02:00
Mike Engel 30aa4a7444 recovery-utils: add check into recover library if dualboot is enabled
This commit add a verification into the recovery library to avoid
that it is executed when in dualboot mode.

Signed-off-by: Mike Engel <Mike.Engel@digi.com>

https://onedigi.atlassian.net/browse/DEL-7580
2021-07-15 10:17:53 +02:00
Gonzalo Ruiz 3e75c1ed34 recovery-initramfs: launch mdev as daemon
'mdev -s' run on ramfs initialization is able to mount external media already
detected but fails to automatically mount any media detected afterwards.
Running it as a daemon first it will also be able to mount any media detected
after 'mdev -s' is run.

Use argument '-d' to first run mdev as daemon in background.

Move 2 seconds delay to after mdev has been initialized to give external
hardware all the time possible to be successfully detected and mounted.

https://onedigi.atlassian.net/browse/DEL-7285

Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-06-24 10:46:19 +02:00
Mike Engel 5c77cbb502 recovery: add swupdate parameter to select image description.
This commit adds some swupdate parameter to select the sw-description
configuration depending on the used platform.

Signed-off-by: Mike Engel <Mike.Engel@digi.com>
2021-06-08 16:25:04 +02:00
Gabriel Valcazar d5c696fd5b recovery-utils: only print open device warning when encrypting partitions
Technically, partition unencryption is safe to do in open devices, although it
implies that at least one partition has already been encrypted. If we aren't
going to encrypt any partitions, there's no need to print the warning.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-06-02 14:45:00 +02:00
Gabriel Valcazar 8c19cda181 recovery: change way of deciding if platform uses NAND or eMMC
Instead of checking for the existence of /proc/mtd, which might lead to false
positives, check the "root" parameter in /proc/cmdline. Assume eMMC in case of
any error.

https://onedigi.atlassian.net/browse/DEL-7539

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-06-02 14:45:00 +02:00
Arturo Buzarra 8227a49140 systemd: reduce verbosity of sysv-generator
There are some init packages from the poky layer that remain using only a SysV
init script. Systemd converts these init scripts to systemd service format on
boot and shows an ugly warning for each one. To avoid flooding the console with
this kind of messages, we reduce the verbosity of these messages.

https://onedigi.atlassian.net/browse/DEL-7540

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-06-01 16:26:01 +02:00
Gabriel Valcazar 94551f0c4d recovery-initramfs: correctly set environment variables containing spaces
In the libubootenv implementation of fw_setenv, multiple variables can be set
in one call. When setting a variable with a space-separated list, the app
interprets the list as new variable/value tuples, for example:

    fw_setenv myvar value1 value2 value3

Results in:

    myvar=value1
    value2=value3

This was causing the encrypted eMMC partition mechanism to break, because the
list of encrypted partitions is stored as a space-separated list in an
environment variable. Avoid this by enclosing the variable argument of
set_uboot_var() with double quotes.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-06-01 09:47:39 +02:00
Gabriel Valcazar 737230a2f4 recovery-initramfs: automatically set an encryption key if needed
Before using the encrypted partition functionality, users have to manually
install the encryption key in the system. Failing to install said key will
result in errors later on.

Even though the installation isn't a difficult operation from a user's point of
view, the recovery script has the necessary logic to detect cases where a
partition is going to be encrypted with no key installed. Automatically
generate a key in these cases to avoid undesired behavior and to improve the
overall user experience.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:44 +02:00
Gabriel Valcazar 158a9e1779 trustfence-tool: update to v2.5
This version adds new functionality to check if an encryption key is installed
as well as a fix for an issue that happens when encrypting partitions with long
names (over 12 characters).

https://onedigi.atlassian.net/browse/DEL-7535

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:44 +02:00
Gabriel Valcazar 32984efc90 recovery-utils: ask for confirmation when changing the encryption key
If we trigger a key change while there are partitions that are encrypted,
print a warning and ask for confirmation so users know that the operation will
erase the contents of said partitions.

Like in the partition (un)encryption mechanism, add the possibility to skip
both the warning message and the confirmation prompt.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:44 +02:00
Gabriel Valcazar e2cd4f6d9a trustfence-initramfs: remove support for platforms with NAND internal storage
This initramfs only makes sense in platforms with an eMMC as the internal
storage, due to how the partition encryption support is implemented. In
plaatforms that use NAND instead, ths initramfs offers no functionality and
increases the recovery image size, so remove it.

https://onedigi.atlassian.net/browse/DEL-7534

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:44 +02:00
Gabriel Valcazar a432a6353a recovery-initramfs: make rootfs encryption status changeable via updates only
If we allow users to manually change the encryption status of the rootfs
partition, we run the risk of wiping it without flashing a proper replacement
image. Because of this, rootfs encryption status should be determined
automatically using information from the update package.

Have the recovery script parse the update package's description to determine
whether to encrypt the rootfs or not.

https://onedigi.atlassian.net/browse/DEL-7174

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00
Gabriel Valcazar 953a376d97 recovery-utils: don't allow manual (un)encryption of rootfs partition
This partition isn't blacklisted, but it should only be (un)encrypted when
providing an update package. Make it so that manual encryption status changes
for this partition aren't possible from the recovery library.

https://onedigi.atlassian.net/browse/DEL-7174

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00
Gabriel Valcazar 82a76a7106 trustfence: split filesystem encryption support into two variables
Previously, TRUSTFENCE_INITRAMFS_IMAGE was the only variable used to configure
rootfs encryption. Now that any partition can be encrypted and the rootfs
encryption still needs to be handled differently, use two variables instead.

    * TRUSTFENCE_ENCRYPT_PARTITIONS to control partition encryption in general
    * TRUSTFENCE_ENCRYPT_ROOTFS to control rootfs encryption

As with most trustfence functionality, enable both by default. Leave
TRUSTFENCE_INITRAMFS_IMAGE as an internal variable only.

https://onedigi.atlassian.net/browse/DEL-7174

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00
Gabriel Valcazar 402f9775b9 recovery-initramfs: manage update partition correctly with partition encryption
Since the update partition might be involved during a software update, we need
to make sure that its contents are accesible and safe when using the partition
encryption feature at the same time.

Mount and unmount the partition correctly if it's encrypted and cancel any
operations that will result in the deletion of the update package.

https://onedigi.atlassian.net/browse/DEL-7174
https://onedigi.atlassian.net/browse/DEL-7422

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00
Gabriel Valcazar d54510766a recovery-utils: add partition encryption support
Add a new function to the recovery library to be able to encrypt/unencrypt any
partition on the internal storage media. Since it's a destructive operation,
add a warning message and a confirmation prompt that can be skipped if needed.

Reflect this new functionality in the recovery-reboot app. Change the logic so
that an encryption key can be set even if there's no update package, because
now it's possible to encrypt other partitions while leaving the rootfs intact.
Also change the logic so that the app doesn't reboot into recovery mode if
there's no recovery command set.

Implement the same blacklist as the one in the recovery script.

https://onedigi.atlassian.net/browse/DEL-7174

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00
Gabriel Valcazar 59e652ec9b trustfence: extend partition encryption support to any partition
Modify the recovery and trustfence initramfs scripts to be able to encrypt any
partition on the internal storage media, not just the rootfs.

To implement this functionality, add a new recovery command called
'encrypt_partitions'. When used, this command must contain a comma-separated
list of the partitions that are to be encrypted by the end of the recovery
process, including partitions that were already encrypted beforehand. Any
partition that isn't in the list will be unencrypted. If the command is absent,
no changes will be made, but it's possible to pass an empty command to
unencrypt all partitions.

Include a blacklist to avoid encrypting partitions that shouldn't be encrypted,
such as partitions that need to be accessed by the ROM code/U-Boot or
partitions that contain encryption keys.

While at it, remove unnecessary "get_kernel_version" function from the script.

https://onedigi.atlassian.net/browse/DEL-7174

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-05-27 12:10:43 +02:00