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

fngboot: Move install script to meta-seconorth-distro

The install scripts are all located within the distro layer.
Remove the install scripts in this layer and re-create them in the
distro layer.

BCS 746-001394
parent d255cfee
No related branches found
No related tags found
1 merge request!405mx6:boot: Combined bootloader (fngboot + U-Boot) for SECO NE i.MX6 devices
SUMMARY = "SECO Northern Europe FNG-Boot install script for Flash-N-Go System"
HOMEPAGE = "https://www.seco.com"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
RDEPENDS:${PN} = " \
fngboot \
"
INSTALL_SCRIPT="fng-install-fngboot.sh"
require recipes-bsp/fng-install/fng-install.inc
SRC_URI = " \
file://${INSTALL_SCRIPT} \
"
RPROVIDES:${PN} += " ${INSTALL_SCRIPT} "
FILES:${PN} = "${sbindir}/${INSTALL_SCRIPT}"
do_install() {
install -d ${D}${sbindir}
install -m 0755 ${S}/${INSTALL_SCRIPT} ${D}${sbindir}/
}
inherit deploy
do_deploy() {
install -m 0755 ${B}/${INSTALL_SCRIPT} ${DEPLOYDIR}/${INSTALL_SCRIPT}
}
addtask do_deploy after do_install
#!/bin/sh
# shellcheck disable=2153,2154,2034
# Shellcheck does not see the assignment of variables in the called functions
# and complains about using unassigned variables.
#
# FNG-Boot update script - (c) 2023 SECO Northern Europe GmbH
#
BOOTLOADER_PACKAGE=fngboot.tar.gz
BOOTLOADER=fngboot.bin
HELP="
# FNG-Boot update script - (c) 2023 SECO Northern Europe GmbH
#
# This script is designed to run from the Flash-N-Go system. It overwrites
# FNG-Boot with a new version.
#
# ATTENTION: This step is dangerous, because it might make the system
# unbootable. Run this script only if you are absolutely sure that you
# need a newer version of FNG-Boot.
#
# To run the script, either setup an TFTP or HTTP[S] server to allow access
# to this script and the other needed files ( $BOOTLOADER_PACKAGE ).
# Connect your device to the Ethernet, boot Flash-N-Go system and make
# sure it can access your server (try with 'ping', configure IP address if
# necessary).
#
# Then run the following commands (replace the IP address by your server's
# IP address):
# export URL=192.168.1.100;curl tftp://$URL/fng-install-fngboot.sh | sh -s -- <args>
#
# Installation from local media ( thumbdrive, ...) is also possible.
# unset URL; sh fng-install-fngboot.sh <args>
#
# Options:
# -b=*|--BOOTLOADER=* Specify alternative bootloader file, default is '$BOOTLOADER_PACKAGE'
#
"
# shellcheck source=../common/fnginstall-common.sh
. ./fnginstall-common.sh
FNGYSTEM_MIN_VERSION=17.0
#========================================
# Cleanup on exit
#========================================
cleanup()
{
trap nop EXIT
trap nop INT
set +e
info_msg
info_msg "Cleanup workspace..."
$DEBUG || rmdir -rf "$TMPDIR" 2>/dev/null
$DEBUG && info_msg "Debug: Don't erase $TMPDIR."
}
#======================================================
# Argument parsing
#======================================================
parse_extra_args()
{
ret=1
case $1 in
-b|--BOOTLOADER|-b=*|--BOOTLOADER=*)
parse_args_value BOOTLOADER_PACKAGE "$1" "$2" || ret=2
BOOTLOADER_PACKAGE="$SUBDIR$BOOTLOADER_PACKAGE"
;;
*) return 0;;
esac
return $ret
}
parse_args "" "$@"
setup_download_prefix
check_startup_conditions
# Setup exit traps, so cleanup is called when an error happens
trap exit_error EXIT
trap exit_error INT
# Get Bootloader from server
cd "$TMPDIR"
do_load "$BOOTLOADER_PACKAGE" || exit $?
# Extract the tar
COMPRESSION="$(tar_compression "$BOOTLOADER_PACKAGE")"
tar "$COMPRESSION"xf "$BOOTLOADER_PACKAGE"
MD5SUM=$(find . -name "fngboot*.md5" | head -n 1)
MD5SUM=${MD5SUM#*/} # remove the ./
BOOTLOADER="${MD5SUM%.*}" # like the md5sum but without .md5
[ -r "$MD5SUM" ] || exit_error "$MD5SUM not found."
grep -e " $BOOTLOADER$" "$MD5SUM" > "$MD5SUM.tmp" || exit_error "$MD5SUM does not contain entry for $BOOTLOADER"
md5sum -c "$MD5SUM.tmp" || exit_error "MD5 sum is not correct"
#============================================
#
#============================================
DEV="/dev/$TARGETDEVICE"
PART_BOOTLOADER="${DEV}boot0"
# Stop on errors
set -e
#============================================
# Write to disk
#===========================================
partition_write_access "$PART_BOOTLOADER"
# Write new system to eMMC
# INFO: The mmc bootpart command selects the boot
# partition on the eMMC.
# The selection is bitwise coded:
# 0x0 = Off
# 0x1 = Boot 1 (mmcblkNboot0)
# 0x2 = Boot 2 (mmcblkNboot1)
# 0x7 = User Area (mmcblkN)
TARGETDEVICE_BOOTLOADER="$PART_BOOTLOADER"
MMC_BOOTPART_NO=1
BOOTLOADER_SEEK=2
milestone "Writing ${BOOTLOADER} to $TARGETDEVICE_BOOTLOADER ..."
$DRYRUN dd if=/dev/zero of="$TARGETDEVICE_BOOTLOADER" bs=1M || true
$DRYRUN dd if="${BOOTLOADER}" of="$TARGETDEVICE_BOOTLOADER" bs=512 seek=$BOOTLOADER_SEEK
# If the target is an emmc, set the boot config flags
if [ -b "/dev/${TARGETDEVICE}boot0" ];then
# Old FNG Systems do not have a mmc command
if ! command -v mmc > /dev/null 2>&1
then
$DRYRUN echo 8 > /sys/devices/platform/sdhci-esdhc-imx.3/mmc_host/mmc0/mmc0:0001/boot_config
else
# Not sure if this command is needed:
# # Set the boot mode on emmc, sdcard does not need this
# $DRYRUN mmc bootbus set dual x1 x8 $DEV
$DRYRUN mmc bootpart enable "$MMC_BOOTPART_NO" 1 $DEV
fi
fi
#============================================
# Set write protection again
partition_write_access "$PART_BOOTLOADER" disable
#============================================
# Done writing
#============================================
sync
# Setup cleanup function to be called on exit (overwrites the error)
trap cleanup EXIT
milestone "Update successful"
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