forked from buildroot/buildroot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement support for remote updates via hawkBit
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
- Loading branch information
1 parent
a7d0c59
commit be6bfee
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
board/stmicroelectronics/stm32mp157-dk/overlay/etc/init.d/S98swupdate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh | ||
|
||
DAEMON="swupdate" | ||
PIDFILE="/var/run/$DAEMON.pid" | ||
|
||
PART_STATUS=$(sgdisk -A 4:get:2 /dev/mmcblk0) | ||
if test "${PART_STATUS}" = "4:2:1" ; then | ||
ROOTFS=rootfs-2 | ||
else | ||
ROOTFS=rootfs-1 | ||
fi | ||
|
||
if test -f /update-ok ; then | ||
SURICATTA_ARGS="-c 2" | ||
rm -f /update-ok | ||
fi | ||
|
||
start() { | ||
printf 'Starting %s: ' "$DAEMON" | ||
# shellcheck disable=SC2086 # we need the word splitting | ||
start-stop-daemon -b -q -m -S -p "$PIDFILE" -x "/usr/bin/$DAEMON" \ | ||
-- -f /etc/swupdate/swupdate.cfg -L -e rootfs,${ROOTFS} -u "${SURICATTA_ARGS}" | ||
status=$? | ||
if [ "$status" -eq 0 ]; then | ||
echo "OK" | ||
else | ||
echo "FAIL" | ||
fi | ||
return "$status" | ||
} | ||
|
||
stop() { | ||
printf 'Stopping %s: ' "$DAEMON" | ||
start-stop-daemon -K -q -p "$PIDFILE" | ||
status=$? | ||
if [ "$status" -eq 0 ]; then | ||
rm -f "$PIDFILE" | ||
echo "OK" | ||
else | ||
echo "FAIL" | ||
fi | ||
return "$status" | ||
} | ||
|
||
restart() { | ||
stop | ||
sleep 1 | ||
start | ||
} | ||
|
||
case "$1" in | ||
start|stop|restart) | ||
"$1";; | ||
reload) | ||
# Restart, since there is no true "reload" feature. | ||
restart;; | ||
*) | ||
echo "Usage: $0 {start|stop|restart|reload}" | ||
exit 1 | ||
esac |
13 changes: 13 additions & 0 deletions
13
board/stmicroelectronics/stm32mp157-dk/overlay/etc/swupdate/postupdate.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
#!/bin/sh | ||
|
||
PART_STATUS=$(sgdisk -A 4:get:2 /dev/mmcblk0) | ||
if test "${PART_STATUS}" = "4:2:1" ; then | ||
NEXT_ROOTFS=/dev/mmcblk0p5 | ||
else | ||
NEXT_ROOTFS=/dev/mmcblk0p4 | ||
fi | ||
|
||
# Add update marker | ||
mount ${NEXT_ROOTFS} /mnt | ||
touch /mnt/update-ok | ||
umount /mnt | ||
|
||
sgdisk -A 4:toggle:2 -A 5:toggle:2 /dev/mmcblk0 | ||
reboot |
11 changes: 11 additions & 0 deletions
11
board/stmicroelectronics/stm32mp157-dk/overlay/etc/swupdate/swupdate.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
globals : | ||
{ | ||
postupdatecmd = "/etc/swupdate/postupdate.sh"; | ||
}; | ||
|
||
suricatta : | ||
{ | ||
tenant = "default"; | ||
id = "DEV001"; | ||
url = "http://192.168.42.1:8080"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOTLOADER_NONE=y | ||
CONFIG_SURICATTA=y | ||
CONFIG_WEBSERVER=y | ||
CONFIG_RAW=y |