From: Hugo Villeneuve Date: Fri, 30 Dec 2022 05:01:05 +0000 (-0500) Subject: Add swupdate scripts and support files X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=74e03f30bf27b3d1e16c6c913d0cb75003f25e46;p=yocto%2Fmeta-hvmpd.git Add swupdate scripts and support files --- diff --git a/recipes-support/swupdate/swupdate/99-hvmpd-args.in b/recipes-support/swupdate/swupdate/99-hvmpd-args.in new file mode 100644 index 0000000..3713f84 --- /dev/null +++ b/recipes-support/swupdate/swupdate/99-hvmpd-args.in @@ -0,0 +1,21 @@ +#!/bin/sh + +# This file will be loaded when swupdate is started from a systemd service. + +# Find on which rootfs we are currently running (A or B): +device="/dev/$(lsblk -ndo kname $(findmnt -n -o SOURCE /))" +disk="/dev/$(lsblk -ndo pkname ${device})" + +part=$(echo "${device}" | sed "s@${disk}.*\([0-9]\+\)\$@\1@") + +if [ x"${part}" = x"@ROOT_PART_A_ID@" ]; then + next_rootfs=B +elif [ x"${part}" = x"@ROOT_PART_B_ID@" ]; then + next_rootfs=A +else + echo "Error: cannot determine current A/B partition" + exit 1 +fi + +SWUPDATE_EXTRA_ARGS="-e stable,rootfs${next_rootfs} -f /etc/swupdate.cfg" +SWUPDATE_ARGS="-v ${SWUPDATE_EXTRA_ARGS}" diff --git a/recipes-support/swupdate/swupdate/defconfig b/recipes-support/swupdate/swupdate/defconfig new file mode 100644 index 0000000..26d9e11 --- /dev/null +++ b/recipes-support/swupdate/swupdate/defconfig @@ -0,0 +1,104 @@ + + +CONFIG_HAVE_DOT_CONFIG=y + +# +# Swupdate Settings +# + +# +# General Configuration +# +# CONFIG_CURL is not set +# CONFIG_CURL_SSL is not set +CONFIG_SYSTEMD=y +CONFIG_DEFAULT_CONFIG_FILE="/etc/swupdate.cfg" +CONFIG_SCRIPTS=y +CONFIG_HW_COMPATIBILITY=y +CONFIG_HW_COMPATIBILITY_FILE="/etc/hwrevision" +CONFIG_SW_VERSIONS_FILE="/etc/sw-versions" + +# +# Socket Paths +# +CONFIG_SOCKET_CTRL_PATH="" +CONFIG_SOCKET_PROGRESS_PATH="" +CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/" +CONFIG_MTD=y +CONFIG_LUA=y +CONFIG_LUAPKG="lua" +# CONFIG_FEATURE_SYSLOG is not set + +# +# Build Options +# +CONFIG_CROSS_COMPILE="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_LDLIBS="" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_WERROR is not set +# CONFIG_NOCLEANUP is not set +# CONFIG_BOOTLOADER_EBG is not set +CONFIG_UBOOT=y +# CONFIG_BOOTLOADER_NONE is not set +# CONFIG_BOOTLOADER_GRUB is not set +CONFIG_UBOOT_FWENV="/etc/fw_env.config" +CONFIG_UBOOT_DEFAULTENV="/etc/u-boot-initial-env" +# CONFIG_SSL_IMPL_NONE is not set +CONFIG_SSL_IMPL_OPENSSL=y +# CONFIG_SSL_IMPL_MBEDTLS is not set +# CONFIG_DOWNLOAD is not set +CONFIG_HASH_VERIFY=y +# CONFIG_SIGNED_IMAGES is not set +# CONFIG_ENCRYPTED_IMAGES is not set +# CONFIG_SURICATTA is not set +CONFIG_WEBSERVER=n + +# +# Webserver Features +# +CONFIG_MONGOOSE=n + +# +# Mongoose Feature +# +CONFIG_MONGOOSEIPV6=n +CONFIG_MONGOOSESSL=n + +# +# Archival Features +# +CONFIG_GUNZIP=y +# CONFIG_ZSTD is not set + +# +# Parser Features +# +CONFIG_LIBCONFIG=y +CONFIG_PARSERROOT="" +# CONFIG_JSON is not set +# CONFIG_LUAEXTERNAL is not set +# CONFIG_SETSWDESCRIPTION is not set + +# +# Image Handlers +# +# CONFIG_UBIVOL is not set +CONFIG_CFI=y +# CONFIG_CFIHAMMING1 is not set +# CONFIG_DISKPART is not set +CONFIG_RAW=y +# CONFIG_RDIFFHANDLER is not set +CONFIG_LUASCRIPTHANDLER=y +CONFIG_SHELLSCRIPTHANDLER=y +# CONFIG_HANDLER_IN_LUA is not set +CONFIG_ARCHIVE=y +# CONFIG_REMOTE_HANDLER is not set +# CONFIG_SWUFORWARDER_HANDLER is not set +CONFIG_BOOTLOADERHANDLER=y +# CONFIG_SSBLSWITCH is not set +# CONFIG_UCFWHANDLER is not set diff --git a/recipes-support/swupdate/swupdate/swupdate.cfg b/recipes-support/swupdate/swupdate/swupdate.cfg new file mode 100644 index 0000000..b57309c --- /dev/null +++ b/recipes-support/swupdate/swupdate/swupdate.cfg @@ -0,0 +1,6 @@ +globals : +{ + verbose = true; + loglevel = 5; + syslog = true; +}; diff --git a/recipes-support/swupdate/swupdate_%.bbappend b/recipes-support/swupdate/swupdate_%.bbappend new file mode 100644 index 0000000..416deb6 --- /dev/null +++ b/recipes-support/swupdate/swupdate_%.bbappend @@ -0,0 +1,18 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append = " \ + file://defconfig \ + file://swupdate.cfg \ + file://99-hvmpd-args.in \ +" + +do_install:append() { + install -d ${D}${libdir}/swupdate/conf.d/ + + sed -e s/@ROOT_PART_A_ID@/${ROOT_PART_A_ID}/ \ + -e s/@ROOT_PART_B_ID@/${ROOT_PART_B_ID}/ \ + ${WORKDIR}/99-hvmpd-args.in > ${WORKDIR}/99-hvmpd-args + install -m 644 ${WORKDIR}/99-hvmpd-args ${D}${libdir}/swupdate/conf.d/ + + install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}/ +}