add swupdate to rootfs too

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-11-05 14:46:49 +01:00
parent d7b0cdedca
commit 0f408f3b63
8 changed files with 152 additions and 11 deletions

View File

@ -152,13 +152,13 @@ create_swap
notif "5/8 Enable swap"
enable_swap
notif "6/8 Create share partition"
notif "6/8 Create USB partition"
create_backing_store_partition
notif "7/8 Reload partition table"
reload_partition_table
notif "8/8 Format share partition"
notif "8/8 Format USB partition"
format_backing_store_partition
notif "First boot setup finished!"

View File

@ -50,12 +50,20 @@ mount_share () {
# Create the directory structure if required
(cd /mnt; mkdir -p "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
# Check if there is an update file
if [ -f /mnt/FunKey-*.swu ]; then
warn "found an update file, going into recovery mode"
# Check if there is a firmware update file
if [ -f /mnt/FunKey-*.fwu ]; then
warn "found a firmware update file, going into recovery mode"
notif "^^^^^^^^ UPDATING...^^^^^^^^"
recovery_mode
fi
# Check if there is a software update file
for file in $(ls /mnt/FunKey-*.swu); do
swupdate -i "${file}"
if [ $? -ne 0 ]; then
break
fi
done
return 0
}

View File

@ -0,0 +1,125 @@
#
# Automatically generated file; DO NOT EDIT.
# Swupdate Configuration
#
CONFIG_HAVE_DOT_CONFIG=y
#
# Swupdate Settings
#
#
# General Configuration
#
# CONFIG_CURL is not set
# 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="/tmp/sockinstctrl"
CONFIG_SOCKET_PROGRESS_PATH="/tmp/swupdateprog"
CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/"
#
# MTD support needs libmtd
#
#
# Lua support needs a Lua interpreter
#
# CONFIG_FEATURE_SYSLOG is not set
#
# Build Options
#
CONFIG_CROSS_COMPILE=""
CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
#
# Debugging Options
#
# CONFIG_DEBUG is not set
# CONFIG_WERROR is not set
# CONFIG_NOCLEANUP is not set
#
# EFI Boot Guard needs libebgenv and libz
#
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 is not set
CONFIG_SSL_IMPL_NONE=y
#
# Image downloading support needs libcurl
#
#
# Hash checking needs an SSL implementation
#
#
# Image signature verification needs an SSL implementation
#
#
# Image encryption needs an SSL implementation
#
# CONFIG_SURICATTA is not set
# CONFIG_WEBSERVER is not set
CONFIG_GUNZIP=y
#
# Parser Features
#
CONFIG_LIBCONFIG=y
CONFIG_PARSERROOT=""
#
# JSON config parser support needs json-c
#
# CONFIG_SETSWDESCRIPTION is not set
#
# Image Handlers
#
#
# ubivol support needs libubi
#
CONFIG_RAW=y
CONFIG_RDIFFHANDLER=y
CONFIG_SHELLSCRIPTHANDLER=y
CONFIG_ARCHIVE=y
#
# remote handler needs zeromq
#
#
# swuforward handler needs json-c and curl
#
#
# SWU forwarder requires libcurl
#
#
# swuforward handler needs json-c and curl
#
CONFIG_BOOTLOADERHANDLER=y
#
# Microcontroller handler depends on libgpiod
#

View File

@ -9,7 +9,7 @@ root_mount=/tmp/rootfs
do_preinst()
{
notif "1/5 Extract update"
notif "1/5 Extract firmware update..."
exit 0
}
@ -37,7 +37,7 @@ do_postinst()
notif "Cannot unmount root filesystem"
exit 1
fi
for file in $(ls /mnt/FunKey-rootfs-*.swu); do
for file in $(ls /mnt/FunKey-rootfs-*.fwu); do
notif "5/5 Erase update file"
rm -f "${file}"
done

View File

@ -63,12 +63,20 @@ BR2_PACKAGE_PARTED=y
BR2_PACKAGE_SYSSTAT=y
BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_LIBARCHIVE=y
BR2_PACKAGE_LIBARCHIVE_BSDTAR=y
BR2_PACKAGE_LIBARCHIVE_BSDCPIO=y
BR2_PACKAGE_LIBARCHIVE_BSDCAT=y
BR2_PACKAGE_LIBQRENCODE=y
BR2_PACKAGE_LIBQRENCODE_TOOLS=y
BR2_PACKAGE_LIBNL=y
BR2_PACKAGE_LIBRSYNC=y
BR2_PACKAGE_DHCPCD=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_PROCPS_NG=y
BR2_PACKAGE_SWUPDATE=y
BR2_PACKAGE_SWUPDATE_CONFIG="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/swupdate.config"
# BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE is not set
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y

View File

@ -94,7 +94,7 @@ update: fun
@cd tmp && \
echo sw-description rootfs.ext2.gz update_partition | \
tr " " "\n" | \
cpio -o -H crc --quiet > ../images/FunKey-rootfs-$(shell cat FunKey/board/funkey/rootfs-overlay/etc/sw-versions | cut -f 2).swu
cpio -o -H crc --quiet > ../images/FunKey-rootfs-$(shell cat FunKey/board/funkey/rootfs-overlay/etc/sw-versions | cut -f 2).fwu
@rm -rf tmp
defconfig:

View File

@ -9,8 +9,8 @@ case "$1" in
keys=$(devmem 0x01c20500 16)
if [ "${keys}" != "0xF83F" ]; then
# Automatic update requested
updates=$(ls /mnt/FunKey-*.swu)
# Automatic firmware update requested
updates=$(ls /mnt/FunKey-*.fwu)
if [ "x${updates}" = "x" ]; then
menu &
exit 1

View File

@ -96,7 +96,7 @@ menu_run () {
if [ $? -ne 0 ]; then
notif "${message}...^Cannot unmount USB!"
else
for file in $(ls /mnt/FunKey-*.swu); do
for file in $(ls /mnt/FunKey-*.fwu); do
swupdate -i "${file}"
if [ $? -ne 0 ]; then
notif "${message}...^Cannot update!"