Commit Graph

3536 Commits

Author SHA1 Message Date
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
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 13df57c1fc ccimx6ul: add support for ubisysvols on SD/USB install scripts
The script preserves the current value of env variable 'ubisysvols'
so that the new partition script generates the appropriate partition
table before proceeding with the update operations.
If using a UBI volumes layout, the script will not erase the 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 e380377310 uboot: exit on error on uuu install script
Exit on error to prevent continuation of programming when
there was an issue.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios f46851e245 uboot: ccimx6ul: add ubisysvols support to uuu install script
With U-Boot supporting the creation of mtdparts and UBI volumes depending
on the value of variable 'ubisysvols', adapt the install script to make
use of those to generate a partition table and UBI volumes accordingly.
This can be triggered with new option '-b'.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios fcd3791535 ccimx6ul: boot: set 'rootfsvol' variable for dualboot
Set the new variable 'rootfsvol' to rootfs_a or rootfs_b when dualboot is
enabled, to cover the case where the devices uses the 'system' partition
with different UBI volumes.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios f00ce5ca9b u-boot-dey: add support for dualboot to boot scripts
The support for dualboot was integrated on meta-digi-dualboot layer, but it
really depends only on environment variable 'dualboot' so we'd better
integrate the support on the scripts in meta-digi, to avoid synchonization
problems between both layers.
This also allows to be able to easily enable dualboot in U-Boot with the
variable, without needing to update the script on the linux partition.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Hector Palacios 91bfa01a52 udev: automount UBI volumes named "linux" or "recovery"
Traditionally, platforms based on NAND, used one UBI volume
per MTD partition.
Now it's possible to use only one MTD partition containing many
UBI volumes.

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 c33fc8a7fe uboot/linux: fix build from internal MTK Digi git server
Enabling DIGI_INTERNAL_GIT defaults to LOG server. The build from local
MTK Digi server was broken.

Fix uboot and linux recipes declaring different repo paths depending on
whether the local remote is LOG or MTK.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-09 17:38:44 +02:00
Gabriel Valcazar 50cbe9e6c8 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-09 09:48:37 +02:00
Gabriel Valcazar e24525af5d 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-09 09:48:25 +02:00
Hector Palacios 9352fc1395 digi: [cosmetic] remove final slash from Digi remotes and move it to recipes
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
2021-09-07 11:01:29 +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