Skip to content
Snippets Groups Projects
Commit 9b022e2b authored by Tobias Kahlki's avatar Tobias Kahlki
Browse files

fng-install: Updated post-install scripts

The environmental variable based passing of devicetrees and overlays has
been replaced entirely by a file-based mechanism.
The documentation, comments, and format of the post-install scripts
have been extended and reworked.
parent 92399b95
No related branches found
No related tags found
1 merge request!422fng-install: Updated post-install scripts
......@@ -25,16 +25,13 @@ mount_bootpartition BOOTFILES_DIR
#========================================================
# ENV Variable DEVICETREE is set from the fng-install script
# when it was called with --DTB parameter
#
if [ -z "$DEVICETREE" ]
then
# Read the default devicetree file from the boot partition
if [ -r "$BOOTFILES_DIR"/devicetree ]
then
DEVICETREE_FILE="$( head -n 1 "$BOOTFILES_DIR"/devicetree )"
else
# If no default devicetree is set, detect a valid
# devicetree based on the platform
get_platform PLATFORM
for dtb in "$BOOTFILES_DIR/"*"$PLATFORM.dtb" ; do
......@@ -45,9 +42,11 @@ then
echo "No devicetree found for: $PLATFORM"
exit 1
fi
fi
else
DEVICETREE_FILE="$DEVICETREE"
mount -o remount,async "$BOOTFILES_DIR"
# Mark the selected devicetree as default
echo "$DEVICETREE_FILE" > "$BOOTFILES_DIR/devicetree"
fi
if [ ! -e "$BOOTFILES_DIR/$DEVICETREE_FILE" ]
......@@ -56,14 +55,6 @@ then
exit 1
fi
mount -o remount,async "$BOOTFILES_DIR"
# Mark the selected devicetree as default
#
# Note: Since we are on a fat partition,
# we use a textfile instead of a link.
echo "$DEVICETREE_FILE" > "$BOOTFILES_DIR/devicetree"
exit 0
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
......@@ -7,18 +7,14 @@
# BOOTPARTITION='$TARGET_PARTITION_BOOT' \
#
# The script can also be called standalone, or by the fnginstall-postinstallation
# script in the target OS, to update configurations
# script in the target OS, to update configurations.
#
# This helper script to select the used base kernel and base devicetree
# and combine those together to linux image
# In dunfell we currently use the feature to load the devicetree directly
# after the kernel in the memory by concat both files
# This helper script loads/detects the active/valid kernel, loads the active
# devicetree, and appends the devicetree overlays to the active devicetree
# if applicable.
#
# Kernel and devicetree files are detect automatically
# but may be specified on the commandline
# After the selection, the result is written to two textfiles
# 'kernel' and 'devicetree'.
# When these are found, these values override the autodetection
# Note: For i.MX6 devices, the kernel and devicetree (including the overlays)
# are combined into a single file (named linuximage) that is loaded altogether.
#
# The files to work on, are selected by a list of known boot partitions
# from which the first one is selected.
......@@ -44,37 +40,31 @@ mount_bootpartition BOOTFILES_DIR
# Detect active kernel
#========================================================
# Allows to specify a specific kernel as environment variable
# Not used currently
if [ -z "$KERNEL" ]
then
# Read default kernel file from boot partitione
# Read the active kernel from the boot partition
if [ -r "$BOOTFILES_DIR"/kernel ]
then
KERNEL_FILE="$( head -n 1 "$BOOTFILES_DIR"/kernel )"
else
# Mark the currently installed kernel as selected:
# (we are on fat, so we use a textfile instead of links):
# If no kernel is marked as active, detect a valid kernel
# inside the boot partition and mark it as active
KERNEL_FILE="$( find "$BOOTFILES_DIR" -maxdepth 1 -name "*Image*" \
-exec basename {} \; | head -n 1 )"
if [ -z "$KERNEL_FILE" ]
then
echo "Failed to determine the kernel file to use."
echo "Failed to determine a valid kernel to be used."
exit 1
fi
# Store the active kernel for later usage
echo "$KERNEL_FILE" > "$BOOTFILES_DIR/kernel"
# Set the active kernel in the boot configuration
sed -i "$BOOTFILES_DIR/boot.cfg" -e "s|kernel=.*|kernel=$KERNEL_FILE|"
fi
else
KERNEL_FILE="$KERNEL"
fi
mount -o remount,async "$BOOTFILES_DIR"
# Store default kernel file for later usage
echo "$KERNEL_FILE" > "$BOOTFILES_DIR/kernel"
#========================================================
# Load active devicetree from file and apply overlays
#========================================================
......@@ -84,8 +74,7 @@ DEVICETREE_APPEND_FILE=$DEVICETREE_FILE
# Load the active overlays from the overlays.txt
if [ -e "$BOOTFILES_DIR/overlays.txt" ]; then
DEVICETREE_OVERLAYS_FILE="$( head -n 1 "$BOOTFILES_DIR"/overlays.txt | awk -F '=' '{print $2}' )"
DEVICETREE_OVERLAYS="$DEVICETREE_OVERLAYS_FILE $DEVICETREE_OVERLAYS"
DEVICETREE_OVERLAYS="$( head -n 1 "$BOOTFILES_DIR"/overlays.txt | awk -F '=' '{print $2}' )"
fi
# Change into the boot directory and combine the devicetree
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment