Commit Graph

3652 Commits

Author SHA1 Message Date
Mike Engel 2145614724 images: add function to sign read only rootfs when Trustfence is enabled
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
2021-11-11 13:37:30 +01:00
Mike Engel eb730358e5 trustfence: add read only rootfs signing option to signing script
Signed-off-by: Mike Engel <Mike.Engel@digi.com>
2021-11-11 13:37:30 +01:00
Hector Palacios 75fca73cc5 u-boot: cc6ul: fix script adding missing call to 'uuu'
Add missing call to 'uuu' and erase the partition before creating
the UBI volumes.

Also add larger timeouts to erase operations.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-11-11 13:32:16 +01:00
Francisco Gil efa9d527a1 MM: Stop MM daemon before going to suspend
In the cc6ul we are not powering-off the supply of the XBee.
This is making that after a suspend/resume action the XBee
hangs due to ModemManager hasn't been stopped before the suspend.

Stopping ModemManager before going to suspend solves the issue.

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

Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
2021-11-08 16:17:50 +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
Gabriel Valcazar 4e303ab542 swu-images: remove ccimx6ul preinstallation script
Since commit bf8c73322b, the script is no longer
used, so remove it.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-11-05 14:20:36 +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
Hector Palacios bc88451131 machines: add SQUASFS to IMAGE_FSTYPES for read-only-rootfs
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7708
2021-11-05 11:18:16 +01:00
Hector Palacios 0ba9b85574 hostapd: adapt recipe for read-only-rootfs
The access point configuration files are dynamically modified on a post
install script to generate an SSID name based on the last digits of the
MAC address (physical or virtual) assigned to a wlanX interface.

On read-only file systems, this is not possible, so add some conditional
code to the do_install() to use instead the $DIGI_FAMILY name.

Caveat: if several identical SOMs with read-only-rootfs co-exist on the
same network as APs, they will identify with the same SSID.

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

https://onedigi.atlassian.net/browse/DEL-7708
2021-11-05 11:18:16 +01:00
Hector Palacios 7cd57a40e3 libubootenv: adapt recipe for read-only-rootfs
The config file /etc/fw_env.config is generated dynamically basing on
the partition table and, in the case of NAND-based SOMs, on the NAND
geometry. This is done on a postinst script that modifies the file on the
first boot of the target. Since this is not allowed on read-only-rootfs,
this commit adds a default fw_env.config file to use instead when
read-only-rootfs is enabled.

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

https://onedigi.atlassian.net/browse/DEL-7708
2021-11-05 11:18:16 +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
Arturo Buzarra a93176815d sdk: remove framebuffer from ccimx6ulsbc platform
Framebuffer support has been removed for all platforms, however it was missing
from the ccimx6ulsbc configuration notes.

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
2021-11-04 12:27:34 +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
Gabriel Valcazar dcd97799c9 ccimx6sbc: install Qualcomm-related packages along with the Atheros ones
The idea is to have the support for both chips co-exist in the same image, then
have the system detect which chip is being used during runtime.

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
Gabriel Valcazar 7ea02c26aa qualcomm: adapt firmware and module recipes to be compatible with the ccimx6sbc
This allows the packages to be included in the ccimx6sbc images. While at it,
include the Qualcomm bluez patches in ccimx6 builds. These patches aren't
destructive, they simply add functionality required by the Qualcomm chip, so
they shouldn't have any secondary effects when using the Atheros chip.

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 899f89eb33 digi-defaults: use '+=' operator in assignment of BOOT_SCRIPTS
Other layers, such as meta-digi-dualboot, may add scripts to this
list on their layer.conf file. Depending on the order and priority
of layers, using a strict '=' here completely overrides previous
values, which is not desired.

Reported-by: Francisco Gil <francisco.gilmartinez@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-20 10:10:40 +02:00
Hector Palacios 2e35d16e03 linux-dey: fix apply of kernel configuration fragments
- Add the '-m' parameter. Without it, the script doesn't
  generate the output merged configuration file, and the
  fragments are not applied.
- Fix the if condition. The '*.cfg' expands to a list of
  files, but the '-f' only admits one parameter. Use instead
  the Python find_cfgs() function.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-15 19:14:27 +02:00
Hector Palacios 9ac3bd46ca uboot: install-uuu: restore variables on bootcmd after 'env default -a'
The variable 'dualboot' (and 'singlemtdsys' for CC6UL) was restored
after the bootcmd that runs the first time after programming U-Boot runs
fastboot again to resume the script.
This is ok for the CC6UL but not for the rest of platforms, that run the
partition script on the bootcmd, *before* running fastboot.

Restore the variables for all platforms in the bootcmd right after
resetting the environment.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-14 13:35:46 +02:00
Hector Palacios 3ab0340741 u-boot: print what system is booting after update
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-11 11:36:00 +02:00
Hector Palacios 13a46ed323 conf: move UBOOT_HAS_FASTBOOT to ccimx8x common include
The SBC Express also supports fastboot now.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-08 14:20:22 +02:00
Hector Palacios f7a1a484a6 conf: move BOOT_SCRIPTS variable to common include file
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-10-08 14:15:13 +02:00
Francisco Gil e67ed06dd5 dualboot: move the logic of fallback boot to altbootcmd
U-Boot has embedded support to handle bootcount tries.
When the limit of tries is reached, U-Boot runs the script
in `altbootcmd` rather than the usual `bootcmd`.
This other script resides on meta-digi-dualboot layer.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
2021-10-08 12:59:30 +02:00
Francisco Gil 3334568347 bluez5: patch to fix CVE-2021-37577
This CVE is fixed in bluez 5.57

Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
2021-10-06 12:27:43 +02:00
Gonzalo Ruiz 825dd6a555 install_linux_fw_uuu: remove redirection in every case
Ensure stdout redirection to the USB interface is removed in every case.
Otherwise, it would be left redirected when INSTALL_UBOOT_FILENAME is
manually set.

Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-09-30 10:36:40 +02:00
Gonzalo Ruiz 555be511a6 u-boot-dey: customize install_linux_fw_uuu script for ccimx6/ccimx6qp
Also, set UBOOT_HAS_FASTBOOT = "true" for these platforms.

Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-09-30 10:32:17 +02:00
Gonzalo Ruiz 1166981fa1 u-boot-dey: add install_linux_fw_uuu.sh for ccimx6/ccimx6qp
Add initially as a copy of the script used on the ccimx8x platform.

Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-09-29 18:52:29 +02:00
Gonzalo Ruiz 2e375b2e3f u-boot-dey: [cosmetic] change permissions for install_linux_fw_uuu.sh
Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-09-29 18:52:29 +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 fa3028a17e uboot: install sd/usb: convert double condition in a simpler single condition
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-29 13:44:50 +02:00
Hector Palacios f3ae964d10 uboot: cc6ul: force erase of partitions before update on install scripts
Install scripts may rework the partition table basing on the value of
env variables. Information of UBI volumes may remain on the NAND that
could later not correspond to the new partition table.
Make sure the MTD partitions are erased prior to updating:
- For Multi-MTD, append '-e' option to the update command.
- For Single-MTD, erase the system partition.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-29 13:44:50 +02:00
Hector Palacios f647e6d442 uboot: add dualboot support to fw install script from SD/USB
Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7649
2021-09-24 09:42:59 +02:00
Hector Palacios dae2b5000a uboot: add dualboot support to uuu firmware install script
Check the status of 'dualboot' env variable.
If set to "yes", use the dualboot partition table in the script and
restore the variable (default is "no") after resetting the environment.
Also, for dualboot, there's no need to wipe the recovery partition or
boot into recovery mode.

For dualboot, this script programs both systems A and B with the same
images.

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

https://onedigi.atlassian.net/browse/DEL-7649
2021-09-24 09:42:50 +02:00
Hector Palacios 85d55a70a2 uboot: use ssh protocol when using Digi internal MTK remote
Commit c33fc8a7fe wrongly used
https protocol when using MTK remote when it should have been
ssh.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-16 12:53:09 +02:00
Gonzalo Ruiz 4502004cd7 conf: machine: add flexSPI overlay to CC8X/CC8M
https://onedigi.atlassian.net/browse/DEL-7584

Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
2021-09-15 15:58:12 +02:00
Gabriel Valcazar 42cab22b95 ccimx6: add "pam" to DISTRO_FEATURES
This is necessary for images that have SELinux enabled. Aside from changing
some package configurations and including an additional library in the rootfs,
this change has no apparent effects on the core functionality of the system.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:19:14 +02:00
Gabriel Valcazar 1e19618157 linux-dey: add config fragment to enable SELinux configuration options
These options should only be enabled when using SELinux, so apply them only
when "selinux" is in the DISTRO_FEATURES. The fragment is a copy of the one in
meta-selinux with the addition of DEFAULT_SECURITY_DAC and LSM.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:16:28 +02:00
Gabriel Valcazar 32a39c7910 linux-dey: add support for configuration fragments
This allows users to apply small changes to our kernel configuration without
having to create a completely new defconfig. Use a simplified version of the
kernel-yocto.bbclass implementation.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:16:28 +02:00
Gabriel Valcazar abba0948a9 refpolicy: adapt reference policy to DEY prebuilt image features
The default policy provided by meta-selinux breaks a lot of the features in
DEY, so adapt it to make most features work. Note that this is simply an
example, end users should create their own policies for their own needs.

Make these changes toggleable so that users can use the reference policy
instead.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:16:28 +02:00
Gabriel Valcazar a7b8288511 images: include packagegroup-core-selinux if "selinux" is in DISTRO_FEATURES
This packagegroup includes all of the userspace packages needed to use SELinux.
For now, use the same variant of the packagegroup, which contains all available
packages.

Since the meta-selinux layer isn't available in all platforms, implement this
change via a dynamic layer.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:16:28 +02:00
Gabriel Valcazar 3bccb2a6dd bblayers.conf.sample: add meta-selinux layer to all supported platforms
This layer has no effect unless "selinux" is in the DISTRO_FEATURES, so it's
safe to add it to our default builds.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-15 10:16:28 +02:00
Gabriel Valcazar 4876bc07b6 openssl: update to v1.1.1l
This fixes the following CVEs:

    * CVE-2021-3711
    * CVE-2021-3712

Port the recipe and patches from the dunfell poky branch, since the hardknott
version contains additional changes aside from the revision update.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-13 16:53:57 +02:00
Gabriel Valcazar 96f54105d3 ccimx6/6ul: add "firmware-imx-regulatory" package
This package includes a script that is executed by a udev rule that we
currently include in our sysvinit images. Without it, the regulatory firmware
mechanism is broken and an error appears when booting the system.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-13 16:42:35 +02:00
Gabriel Valcazar c26d78d7a1 firmware-imx: install firmware loading scripts regardless of the init manager
When we added the SDMA fw systemd service, we accidentally made it so that all
scripts were installed only when using systemd. These files are still needed
when using sysvinit, so correct this change.

While at it, include the SDMA fw service in firmware-imx-sdma's FILES.

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-13 16:42:22 +02:00
Gabriel Valcazar 8cb6075524 openssl: update to v1.1.1l
This fixes the following CVEs:

    * CVE-2021-3711
    * CVE-2021-3712

Port the recipe and patches from the dunfell poky branch, since the hardknott
version contains additional changes aside from the revision update.

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

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
2021-09-13 16:33:09 +02:00
Hector Palacios 05d21a1310 u-boot: boot.txt: move dualboot checks to the top
When DualBoot mechanism is enabled and an update is pending,
the boot script needs to change certain variables and save the
environment.
The regular boot script already changes a number of variables,
such as 'extra_bootargs' and 'overlays' by appending strings to
the already existing values. Saving the envionment may make these
grow endlessly with each iteration of the boot script.

For this reason, move the DualBoot check as the first thing in
the script, save the environment if needed, and then continue
with the normal flow, that changes variables before booting
but doesn't save them.

On certain scripts, this allows us to get rid of some instructions
for resetting the overlays variable.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios 27c13055eb uboot: ccimx6ul: decide on using UBI vols basing on ubisysvols
The script required the passing of option '-b' for setting up the
target to use a single MTD partition and multiple UBI volumes.
If a target however already has the variable 'ubisysvols' set to
'yes' but this parameter is forgotten when calling the script, the
partition layout would change to default (several MTD partitions).

Remove the recently added '-b' option and make the script decide
basing on the current value of 'ubisysvols' variable.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +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