Skip to content

Commit

Permalink
support modular config and systemd
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Adrian Freihofer authored and sbabic committed Nov 15, 2019
1 parent 0a559c6 commit 61047c6
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 596 deletions.
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
42 changes: 23 additions & 19 deletions recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -35,21 +45,24 @@ 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
#
Expand All @@ -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
Expand All @@ -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
193 changes: 0 additions & 193 deletions recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate

This file was deleted.

16 changes: 16 additions & 0 deletions recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args
Original file line number Diff line number Diff line change
@@ -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"
Loading

0 comments on commit 61047c6

Please sign in to comment.