diff mbox series

[meta-swupdate-boards,2/2] support modular config and systemd

Message ID 20191114222135.15635-3-adrian.freihofer@siemens.com
State Accepted
Headers show
Series simplify swupdate config | expand

Commit Message

Freihofer, Adrian Nov. 14, 2019, 10:21 p.m. UTC
Latest meta-swupdate provides a shell script wrapper to start swupdate.
This allows to put shell code snippets into the folder
/usr/lib/swupdate/conf.d to generate the parameters for swupdate at
run-time, in a very flexible way. Based on that meta-swupdate-boards
is now generic enough to work for systemd and sysv based DISTROs.

Note: For the beaglebone board swupdate 2019.11 is highly recommended.
      This version provides proper support for force_ro protection.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 .../swupdate/beaglebone-yocto/09-swupdate-args     |  16 ++
 .../swupdate/beaglebone-yocto/10-remove-force-ro   |   2 +
 .../swupdate/swupdate/beaglebone-yocto/defconfig   |  42 +++--
 .../swupdate/swupdate/beaglebone-yocto/swupdate    | 193 ---------------------
 .../swupdate/raspberrypi3/09-swupdate-args         |  16 ++
 .../swupdate/swupdate/raspberrypi3/swupdate        | 191 --------------------
 .../swupdate/swupdate/wandboard/09-swupdate-args   |  16 ++
 .../swupdate/swupdate/wandboard/swupdate           | 191 --------------------
 recipes-support/swupdate/swupdate_%.bbappend       |  16 +-
 9 files changed, 87 insertions(+), 596 deletions(-)
 create mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args
 create mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro
 delete mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate
 create mode 100644 recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args
 delete mode 100644 recipes-support/swupdate/swupdate/raspberrypi3/swupdate
 create mode 100644 recipes-support/swupdate/swupdate/wandboard/09-swupdate-args
 delete mode 100644 recipes-support/swupdate/swupdate/wandboard/swupdate
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args b/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args
new file mode 100644
index 0000000..ceb4d77
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args
@@ -0,0 +1,16 @@ 
+rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
+
+if [ $rootfs == '/dev/mmcblk1p2' ];then
+	selection="-e stable,copy2"
+else
+	selection="-e stable,copy1"
+fi
+
+state=`fw_printenv ustate | cut -f 2 -d'='`
+if [ $state == 1 ];then
+	SWUPDATE_SURICATTA_ARGS="-c 2"
+else
+	SWUPDATE_SURICATTA_ARGS=" "
+fi
+
+SWUPDATE_ARGS="-H beaglebone:1.0 ${selection} -f /etc/swupdate.cfg"
diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro b/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro
new file mode 100644
index 0000000..33a9b9c
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro
@@ -0,0 +1,2 @@ 
+# be sure that we can change U-Boot ENV (not needed with swupdate >2019.11)
+echo 0 > /sys/block/mmcblk1boot1/force_ro
diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig b/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig
index ff8ab7c..5c2cd08 100644
--- a/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig
+++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig
@@ -11,10 +11,20 @@  CONFIG_HAVE_DOT_CONFIG=y
 #
 # General Configuration
 #
+CONFIG_CURL=y
+# CONFIG_CURL_SSL is not set
+# CONFIG_SYSTEMD is not set
 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 is not set
 CONFIG_LUA=y
 CONFIG_LUAPKG="lua"
@@ -35,22 +45,25 @@  CONFIG_EXTRA_LDLIBS=""
 # CONFIG_DEBUG is not set
 # CONFIG_WERROR is not set
 # CONFIG_NOCLEANUP is not set
-# CONFIG_BOOTLOADER 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_NEWAPI=y
+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=y
+# CONFIG_DOWNLOAD_SSL is not set
+CONFIG_CHANNEL_CURL=y
 CONFIG_HASH_VERIFY=y
 # CONFIG_SIGNED_IMAGES is not set
 CONFIG_ENCRYPTED_IMAGES=y
 CONFIG_SURICATTA=y
 
 #
-# Suricatta
-#
-
-#
 # Features
 #
 CONFIG_SURICATTA_SSL=y
@@ -62,25 +75,13 @@  CONFIG_SURICATTA_STATE_BOOTLOADER="ustate"
 # Server
 #
 CONFIG_SURICATTA_HAWKBIT=y
-# CONFIG_SURICATTA_SERVER_NONE is not set
+# CONFIG_SURICATTA_GENERAL is not set
 CONFIG_WEBSERVER=y
-
-#
-# Webserver Features
-#
 CONFIG_MONGOOSE=y
-
-#
-# Mongoose Feature
-#
-CONFIG_MONGOOSELUA=y
 # CONFIG_MONGOOSEIPV6 is not set
 CONFIG_MONGOOSESSL=y
-
-#
-# Archival Features
-#
 CONFIG_GUNZIP=y
+# CONFIG_ZSTD is not set
 
 #
 # Parser Features
@@ -95,9 +96,12 @@  CONFIG_JSON=y
 # Image Handlers
 #
 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=y
+# CONFIG_SWUFORWARDER_HANDLER is not set
 CONFIG_BOOTLOADERHANDLER=y
+# CONFIG_UCFWHANDLER is not set
diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate b/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate
deleted file mode 100644
index aba2e84..0000000
--- a/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate
+++ /dev/null
@@ -1,193 +0,0 @@ 
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          swupdate
-# Required-Start:    $local_fs
-# Should-Start:
-# Required-Stop:     $local_fs
-# Should-Stop:
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start swupdate application
-### END INIT INFO
-
-# The definition of actions: (From LSB 3.1.0)
-# start         start the service
-# stop          stop the service
-# restart       stop and restart the service if the service is already running,
-#               otherwise start the service
-# try-restart	restart the service if the service is already running
-# reload	cause the configuration of the service to be reloaded without
-#               actually stopping and restarting the service
-# force-reload	cause the configuration to be reloaded if the service supports
-#               this, otherwise restart the service if it is running
-# status	print the current status of the service
-
-# The start, stop, restart, force-reload, and status actions shall be supported
-# by all init scripts; the reload and the try-restart actions are optional
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-DESC="swupdate"
-NAME="swupdate"
-DAEMON=/usr/bin/swupdate
-PIDFILE=/var/run/$NAME.pid
-
-. /etc/init.d/functions || exit 1
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-#
-# Function that starts the daemon/service
-#
-do_start() {
-	local status pid
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC already running ($pid)."
-		exit 1
-		;;
-	*)
-		rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
-
-		if [ $rootfs == '/dev/mmcblk1p2' ];then
-			selection="-e stable,copy2"
-		else
-			selection="-e stable,copy1"
-		fi
-
-		state=`fw_printenv ustate | cut -f 2 -d'='`
-		if [ $state == 1 ];then
-			EXTRA_ARGS="-c 2"
-		else
-			EXTRA_ARGS=""
-		fi
-
-		cd /home/root
-		# be sure that we can change U-Boot ENV
-		echo 0 > /sys/block/mmcblk1boot1/force_ro
-		echo "Starting $DESC ..."
-		exec /usr/bin/swupdate-progress -w -p -r &
-		exec $DAEMON -v -H beaglebone:1.0 ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" &
-		exit 0
-		;;
-	esac
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop() {
-	local pid status
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		# Exit when fail to stop, the kill would complain when fail
-		kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
-			echo "Stopped $DESC ($pid)." || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none killed." >&2
-		;;
-	esac
-
-	# Wait for children to finish too if this is a daemon that forks
-	# and if the daemon is only ever run from this initscript.
-	# If the above conditions are not satisfied then add some other code
-	# that waits for the process to drop all resources that could be
-	# needed by services started subsequently.  A last resort is to
-	# sleep for some time.
-	return $status
-}
-
-#
-# Function that sends a SIGHUP to the daemon/service
-#
-do_reload() {
-	local pid status
-
-	status=0
-        # If the daemon can reload its configuration without
-        # restarting (for example, when it is sent a SIGHUP),
-        # then implement that here.
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "Reloading $DESC ..."
-		kill -s 1 $pid || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none reloaded." >&2
-		;;
-	esac
-	exit $status
-}
-
-
-#
-# Function that shows the daemon/service status
-#
-status_of_proc () {
-	local pid status
-
-	status=0
-	# pidof output null when no program is running, so no "2>/dev/null".
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC is running ($pid)."
-		exit 0
-		;;
-	*)
-		echo "$DESC is not running." >&2
-		exit $status
-		;;
-	esac
-}
-
-case "$1" in
-start)
-	do_start
-	;;
-stop)
-	do_stop || exit $?
-	;;
-status)
-	status_of_proc
-	;;
-restart)
-	# Always start the service regardless the status of do_stop
-	do_stop
-	do_start
-	;;
-try-restart|force-reload)
-	# force-reload is the same as reload or try-restart according
-	# to its definition, the reload is not implemented here, so
-	# force-reload is the alias of try-restart here, but it should
-	# be the alias of reload if reload is implemented.
-	#
-	# Only start the service when do_stop succeeds
-	do_stop && do_start
-	;;
-#reload)
-	# If the "reload" action is implemented properly, then let the
-	# force-reload be the alias of reload, and remove it from
-	# try-restart|force-reload)
-	#
-	#do_reload
-	#;;
-*)
-	echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2
-	exit 3
-	;;
-esac
-
diff --git a/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args b/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args
new file mode 100644
index 0000000..1bad677
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args
@@ -0,0 +1,16 @@ 
+rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
+
+if [ $rootfs == '/dev/mmcblk0p2' ];then
+	selection="-e stable,copy2"
+else
+	selection="-e stable,copy1"
+fi
+
+state=`fw_printenv ustate | cut -f 2 -d'='`
+if [ $state == 1 ];then
+	SWUPDATE_SURICATTA_ARGS="-c 2"
+else
+	SWUPDATE_SURICATTA_ARGS=" "
+fi
+
+SWUPDATE_ARGS="-H raspberrypi3:1.0 ${selection} -f /etc/swupdate.cfg"
diff --git a/recipes-support/swupdate/swupdate/raspberrypi3/swupdate b/recipes-support/swupdate/swupdate/raspberrypi3/swupdate
deleted file mode 100644
index 85b12ae..0000000
--- a/recipes-support/swupdate/swupdate/raspberrypi3/swupdate
+++ /dev/null
@@ -1,191 +0,0 @@ 
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          swupdate
-# Required-Start:    $local_fs
-# Should-Start:
-# Required-Stop:     $local_fs
-# Should-Stop:
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start swupdate application
-### END INIT INFO
-
-# The definition of actions: (From LSB 3.1.0)
-# start         start the service
-# stop          stop the service
-# restart       stop and restart the service if the service is already running,
-#               otherwise start the service
-# try-restart	restart the service if the service is already running
-# reload	cause the configuration of the service to be reloaded without
-#               actually stopping and restarting the service
-# force-reload	cause the configuration to be reloaded if the service supports
-#               this, otherwise restart the service if it is running
-# status	print the current status of the service
-
-# The start, stop, restart, force-reload, and status actions shall be supported
-# by all init scripts; the reload and the try-restart actions are optional
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-DESC="swupdate"
-NAME="swupdate"
-DAEMON=/usr/bin/swupdate
-PIDFILE=/var/run/$NAME.pid
-
-. /etc/init.d/functions || exit 1
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-#
-# Function that starts the daemon/service
-#
-do_start() {
-	local status pid
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC already running ($pid)."
-		exit 1
-		;;
-	*)
-		rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
-
-		if [ $rootfs == '/dev/mmcblk0p2' ];then
-			selection="-e stable,copy2"
-		else
-			selection="-e stable,copy1"
-		fi
-
-		state=`fw_printenv ustate | cut -f 2 -d'='`
-		if [ $state == 1 ];then
-			EXTRA_ARGS="-c 2"
-		else
-			EXTRA_ARGS=""
-		fi
-
-		cd /home/root
-		echo "Starting $DESC ..."
-		exec /usr/bin/swupdate-progress -w -p -r &
-		exec $DAEMON -v -H raspberrypi3:1.0 ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" &
-		exit 0
-		;;
-	esac
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop() {
-	local pid status
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		# Exit when fail to stop, the kill would complain when fail
-		kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
-			echo "Stopped $DESC ($pid)." || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none killed." >&2
-		;;
-	esac
-
-	# Wait for children to finish too if this is a daemon that forks
-	# and if the daemon is only ever run from this initscript.
-	# If the above conditions are not satisfied then add some other code
-	# that waits for the process to drop all resources that could be
-	# needed by services started subsequently.  A last resort is to
-	# sleep for some time.
-	return $status
-}
-
-#
-# Function that sends a SIGHUP to the daemon/service
-#
-do_reload() {
-	local pid status
-
-	status=0
-        # If the daemon can reload its configuration without
-        # restarting (for example, when it is sent a SIGHUP),
-        # then implement that here.
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "Reloading $DESC ..."
-		kill -s 1 $pid || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none reloaded." >&2
-		;;
-	esac
-	exit $status
-}
-
-
-#
-# Function that shows the daemon/service status
-#
-status_of_proc () {
-	local pid status
-
-	status=0
-	# pidof output null when no program is running, so no "2>/dev/null".
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC is running ($pid)."
-		exit 0
-		;;
-	*)
-		echo "$DESC is not running." >&2
-		exit $status
-		;;
-	esac
-}
-
-case "$1" in
-start)
-	do_start
-	;;
-stop)
-	do_stop || exit $?
-	;;
-status)
-	status_of_proc
-	;;
-restart)
-	# Always start the service regardless the status of do_stop
-	do_stop
-	do_start
-	;;
-try-restart|force-reload)
-	# force-reload is the same as reload or try-restart according
-	# to its definition, the reload is not implemented here, so
-	# force-reload is the alias of try-restart here, but it should
-	# be the alias of reload if reload is implemented.
-	#
-	# Only start the service when do_stop succeeds
-	do_stop && do_start
-	;;
-#reload)
-	# If the "reload" action is implemented properly, then let the
-	# force-reload be the alias of reload, and remove it from
-	# try-restart|force-reload)
-	#
-	#do_reload
-	#;;
-*)
-	echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2
-	exit 3
-	;;
-esac
-
diff --git a/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args b/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args
new file mode 100644
index 0000000..0855d23
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args
@@ -0,0 +1,16 @@ 
+rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
+
+if [ $rootfs == '/dev/mmcblk2p1' ];then
+	selection="-e stable,copy2"
+else
+	selection="-e stable,copy1"
+fi
+
+state=`fw_printenv ustate | cut -f 2 -d'='`
+if [ $state == 1 ];then
+	SWUPDATE_SURICATTA_ARGS="-c 2"
+else
+	SWUPDATE_SURICATTA_ARGS=" "
+fi
+
+SWUPDATE_ARGS="-H wandboard:revC ${selection} -f /etc/swupdate.cfg"
diff --git a/recipes-support/swupdate/swupdate/wandboard/swupdate b/recipes-support/swupdate/swupdate/wandboard/swupdate
deleted file mode 100644
index 845ae43..0000000
--- a/recipes-support/swupdate/swupdate/wandboard/swupdate
+++ /dev/null
@@ -1,191 +0,0 @@ 
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          swupdate
-# Required-Start:    $local_fs
-# Should-Start:
-# Required-Stop:     $local_fs
-# Should-Stop:
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start swupdate application
-### END INIT INFO
-
-# The definition of actions: (From LSB 3.1.0)
-# start         start the service
-# stop          stop the service
-# restart       stop and restart the service if the service is already running,
-#               otherwise start the service
-# try-restart	restart the service if the service is already running
-# reload	cause the configuration of the service to be reloaded without
-#               actually stopping and restarting the service
-# force-reload	cause the configuration to be reloaded if the service supports
-#               this, otherwise restart the service if it is running
-# status	print the current status of the service
-
-# The start, stop, restart, force-reload, and status actions shall be supported
-# by all init scripts; the reload and the try-restart actions are optional
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-DESC="swupdate"
-NAME="swupdate"
-DAEMON=/usr/bin/swupdate
-PIDFILE=/var/run/$NAME.pid
-
-. /etc/init.d/functions || exit 1
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-#
-# Function that starts the daemon/service
-#
-do_start() {
-	local status pid
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC already running ($pid)."
-		exit 1
-		;;
-	*)
-		rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1`
-
-		if [ $rootfs == '/dev/mmcblk2p1' ];then
-			selection="-e stable,copy2"
-		else
-			selection="-e stable,copy1"
-		fi
-
-		state=`fw_printenv ustate | cut -f 2 -d'='`
-		if [ $state == 1 ];then
-			EXTRA_ARGS="-c 2"
-		else
-			EXTRA_ARGS=""
-		fi
-
-		cd /home/root
-		echo "Starting $DESC ..."
-		exec /usr/bin/swupdate-progress -w -p -r &
-		exec $DAEMON -v -H wandboard:revC ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" &
-		exit 0
-		;;
-	esac
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop() {
-	local pid status
-
-	status=0
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		# Exit when fail to stop, the kill would complain when fail
-		kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
-			echo "Stopped $DESC ($pid)." || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none killed." >&2
-		;;
-	esac
-
-	# Wait for children to finish too if this is a daemon that forks
-	# and if the daemon is only ever run from this initscript.
-	# If the above conditions are not satisfied then add some other code
-	# that waits for the process to drop all resources that could be
-	# needed by services started subsequently.  A last resort is to
-	# sleep for some time.
-	return $status
-}
-
-#
-# Function that sends a SIGHUP to the daemon/service
-#
-do_reload() {
-	local pid status
-
-	status=0
-        # If the daemon can reload its configuration without
-        # restarting (for example, when it is sent a SIGHUP),
-        # then implement that here.
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "Reloading $DESC ..."
-		kill -s 1 $pid || exit $?
-		;;
-	*)
-		echo "$DESC is not running; none reloaded." >&2
-		;;
-	esac
-	exit $status
-}
-
-
-#
-# Function that shows the daemon/service status
-#
-status_of_proc () {
-	local pid status
-
-	status=0
-	# pidof output null when no program is running, so no "2>/dev/null".
-	pid=`pidofproc $NAME` || status=$?
-	case $status in
-	0)
-		echo "$DESC is running ($pid)."
-		exit 0
-		;;
-	*)
-		echo "$DESC is not running." >&2
-		exit $status
-		;;
-	esac
-}
-
-case "$1" in
-start)
-	do_start
-	;;
-stop)
-	do_stop || exit $?
-	;;
-status)
-	status_of_proc
-	;;
-restart)
-	# Always start the service regardless the status of do_stop
-	do_stop
-	do_start
-	;;
-try-restart|force-reload)
-	# force-reload is the same as reload or try-restart according
-	# to its definition, the reload is not implemented here, so
-	# force-reload is the alias of try-restart here, but it should
-	# be the alias of reload if reload is implemented.
-	#
-	# Only start the service when do_stop succeeds
-	do_stop && do_start
-	;;
-#reload)
-	# If the "reload" action is implemented properly, then let the
-	# force-reload be the alias of reload, and remove it from
-	# try-restart|force-reload)
-	#
-	#do_reload
-	#;;
-*)
-	echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2
-	exit 3
-	;;
-esac
-
diff --git a/recipes-support/swupdate/swupdate_%.bbappend b/recipes-support/swupdate/swupdate_%.bbappend
index 62d9b58..c8bae04 100644
--- a/recipes-support/swupdate/swupdate_%.bbappend
+++ b/recipes-support/swupdate/swupdate_%.bbappend
@@ -3,10 +3,22 @@  FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
 PACKAGECONFIG_CONFARGS = ""
 
 SRC_URI += " \
-     file://swupdate.cfg \
-     "
+    file://09-swupdate-args \
+    file://swupdate.cfg \
+    "
+
+SRC_URI_append_beaglebone-yocto = " file://10-remove-force-ro"
 
 do_install_append() {
+    install -m 0644 ${WORKDIR}/09-swupdate-args ${D}${libdir}/swupdate/conf.d/
+
     install -d ${D}${sysconfdir}
     install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir}
 }
+
+do_install_append_beaglebone-yocto() {
+    # Recent swupdate as well as libubootenv handles force_ro flags automatically
+    if ${@bb.utils.contains('DEPENDS','libubootenv','false','true',d)}; then
+        install -m 0644 ${WORKDIR}/10-remove-force-ro ${D}${libdir}/swupdate/conf.d/
+    fi
+}
\ No newline at end of file