--- /dev/null
+#!/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}"
--- /dev/null
+
+
+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
--- /dev/null
+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}/
+}