Skip to content
Snippets Groups Projects
Commit b8c69230 authored by Tobias Kahlki's avatar Tobias Kahlki Committed by Jonas Höppner
Browse files

post-install: Rework and fix of overlay handling

Overlays that have been installed by Yocto are now moved
into /boot/overlays. This is due to the inability of Yocto
to easily handle devicetree overlays during the build.

Overlays that are provided via the parameters of fng-install
(--DTBO) are also placed inside /boot/overlays. Additionally,
they are appended to the overlays variable inside the
overlays.txt file.
The overlays.txt file is parsed during the prepare-kernel
post-install step. The loaded overlays are then applied to
the default devicetree.

BCS 746-000414
BCS 746-000877

(cherry picked from commit 5f97c8e6)
parent ba006a1d
No related branches found
No related tags found
2 merge requests!418Integrate gitlab-ci/fix-gitlab-ci-integration and 6 more,!396Pull changes from dunfell branch
......@@ -1051,14 +1051,20 @@ load_and_write_files()
load_file "${DT}" "${TMP_MOUNT_POINT}/${DTBASE}"
done
for DT in ${DEVICETREEOV};
do
DTBASE=$( basename "${DT}" )
load_file "${DT}" "${TMP_MOUNT_POINT}/${DTBASE}"
# Load overlays that are provided via the script's arguments.
# Overlays are placed in /boot/overlays and are activated by
# adding them to the overlays.txt file.
mkdir -p "${TMP_MOUNT_POINT}/overlays"
for DT in ${DEVICETREEOV}; do
DTBASE=$( basename "$DT" )
load_file "${DT}" "${TMP_MOUNT_POINT}/overlays/${DTBASE}"
if [ ! -f "${TMP_MOUNT_POINT}/overlays.txt" ]; then
echo "overlays=" >> "${TMP_MOUNT_POINT}/overlays.txt"
echo "overlays=" >> "${TMP_MOUNT_POINT}/overlays.txt"
fi
sed -i "s/^\(overlays=.*\)$/\1 ${DTBASE}/g" "${TMP_MOUNT_POINT}/overlays.txt"
sed -i "/^overlays=/s/$/ overlays\/${DTBASE}/" "${TMP_MOUNT_POINT}/overlays.txt"
done
#================================================
......
......@@ -209,7 +209,6 @@ get_platform()
# =================================================================
# Functions to find out if we are inside fngsystem
#
# =================================================================
is_fng_system_gfversion()
......@@ -219,6 +218,7 @@ is_fng_system_gfversion()
gf-versions.sh -q fngsystem 2>/dev/null && return 0
return 1
}
is_fng_system_deprecated()
{
# if the hostname contains 'FLASH-N-GO', return 0
......@@ -226,6 +226,38 @@ is_fng_system_deprecated()
return 1
}
#===================================================
# Appends the devicetree overlay to the overlays
# variable inside the overlays.txt.
#
# $1 = Name of the overlay
# $2 = Path to the boot folder (Optional)
#
# NOTE: We assume, that the overlays are always
# located inside an overlays folder in /boot.
#===================================================
append_overlay()
{
BOOTFILES_DIR="."
if [ -z "$1" ]; then
echo "Error: Missing overlay name"
return 1
fi
if [ -n "$2" ]; then
BOOTFILES_DIR=$2
fi
if [ ! -f "${BOOTFILES_DIR}/overlays.txt" ]; then
echo "overlays=" >> "${BOOTFILES_DIR}/overlays.txt"
fi
sed -i "/^overlays=/s/$/ overlays\/$1/" "${BOOTFILES_DIR}/overlays.txt"
return 0
}
# Allow to debug commands
VERBOSE="${VERBOSE:-0}"
if [ "$VERBOSE" -ge 2 ];then
......
#!/bin/sh
# shellcheck source=../../../recipes-guf/sharedconf/sharedconf/gf-functions.sh
if ! . /usr/sbin/gf-functions.sh; then
echo "Unable to include gf-functions"
fi
# shellcheck source=./gf-prepare-common.sh
if ! . /usr/sbin/gf-prepare-common.sh; then
echo "Unable to include gf-prepare-common"
fi
# Get the directory containing the bootfiles
mount_bootpartition BOOTFILES_DIR
# Change into boot directory
cd "$BOOTFILES_DIR" || exit 1
# Create overlays directory if it doesn't exist
mkdir -p overlays
# Move any overlays to /boot/overlays
for DT in `find . -name '*-overlay.dtb*' -maxdepth 1`; do
mv "$DT" overlays/
done
exit 0
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment