From f4e928a95e310b6a8c26b6107bcc7f164d65fc3d Mon Sep 17 00:00:00 2001 From: Tobias Poganiuch <tobias.poganiuch@seco.com> Date: Mon, 31 Jul 2023 16:10:07 +0200 Subject: [PATCH] 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 --- recipes-bsp/fng-boot/fng-install-fngboot.bb | 32 ---- .../fng-install-fngboot.sh | 166 ------------------ 2 files changed, 198 deletions(-) delete mode 100644 recipes-bsp/fng-boot/fng-install-fngboot.bb delete mode 100755 recipes-bsp/fng-boot/fng-install-fngboot/fng-install-fngboot.sh diff --git a/recipes-bsp/fng-boot/fng-install-fngboot.bb b/recipes-bsp/fng-boot/fng-install-fngboot.bb deleted file mode 100644 index d03665d5..00000000 --- a/recipes-bsp/fng-boot/fng-install-fngboot.bb +++ /dev/null @@ -1,32 +0,0 @@ -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 diff --git a/recipes-bsp/fng-boot/fng-install-fngboot/fng-install-fngboot.sh b/recipes-bsp/fng-boot/fng-install-fngboot/fng-install-fngboot.sh deleted file mode 100755 index b1530d3d..00000000 --- a/recipes-bsp/fng-boot/fng-install-fngboot/fng-install-fngboot.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/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" -- GitLab