Skip to content

Commit

Permalink
firmware-update-package: Add making FWU package option
Browse files Browse the repository at this point in the history
Firmware update package is good to generate within building time,
so add an image type to make the FWU package.

Signed-off-by: Li Hua Qian <[email protected]>
  • Loading branch information
huaqianli authored and BaochengSu committed Dec 14, 2023
1 parent fb360c9 commit 09906e0
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Authors:
# Jan Kiszka <[email protected]>
# Li Hua Qian <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
Expand Down Expand Up @@ -42,13 +43,21 @@ config IMAGE_BOOT
that it fits AND you have an external flash programmer at hand that
allows to recover. Otherwise you risk to BRICK THE IOT2050!

config IMAGE_FWU_PKG
bool "Firmware update package for all devices"
help
This is the official firmware update package in
IOT2050-FW-Update-PKG-Vx.x.x.tar.xz format, which includes firmware bins,
and update criteria, and builtin env, and it is for all IOT2050 devices.

endchoice

config KAS_INCLUDE_MAIN
string
default "kas-iot2050-example.yml" if IMAGE_EXAMPLE
default "kas-iot2050-swupdate.yml" if IMAGE_SWUPDATE
default "kas-iot2050-boot.yml" if IMAGE_BOOT
default "kas-iot2050-fwu-package.yml" if IMAGE_FWU_PKG

comment "Image features"

Expand Down
18 changes: 18 additions & 0 deletions kas-iot2050-fwu-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (c) Siemens AG, 2023
#
# Authors:
# Li Hua Qian <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

header:
version: 10
includes:
- kas/iot2050.yml

build_system: isar

target: firmware-update-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh
#
# Copyright (c) Siemens AG, 2023
#
# Authors:
# Li Hua Qian <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

update_json()
{
version_letter="$(echo $2 | head -c 1)"
sed -i '/"version": ".*"/s/"V.*"/"'$2'"/g' $1
sed -i '/"description": ".*"/s/V.*["$]/'$2\"'/g' $1
sed -i '/"min_version": ".*"/s/"V/"'$version_letter'/g' $1
}

generate_fwu_tarball()
{
echo "Generating the firmware tarball..."

if [ ! -e $2/iot2050-pg1-image-boot.bin ] || \
[ ! -e $2/iot2050-pg2-image-boot.bin ]; then
echo "Error: iot2050-pg1/2-image-boot.bin doesn't exist!"
exit 2
fi

if [ ! -e $2/u-boot-initial-env ]; then
echo "Error: u-boot-initial-env doesn't exist!"
exit 2
fi

mkdir -p $2/.tarball

cp $1/update.conf.json.tmpl $2/.tarball/update.conf.json
update_json $2/.tarball/update.conf.json $3
cp $2/iot2050-pg*-image-boot.bin $2/.tarball
cp $2/u-boot-initial-env $2/.tarball

cd $2/.tarball
tar -cJvf $2/IOT2050-FW-Update-PKG-$3.tar.xz *
cd - && rm -rf $2/.tarball
}

generate_fwu_tarball $*
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"firmware": [
{
"description": "IOT2050 PG1 Bootloader Release V01.01.01",
"name": "iot2050-pg1-image-boot.bin",
"version": "V01.01.01",
"type": "uboot",
"target_boards": [
"SIMATIC IOT2050-BASIC",
"SIMATIC IOT2050 Basic",
"SIMATIC IOT2050-ADVANCED",
"SIMATIC IOT2050 Advanced"
]
},
{
"description": "IOT2050 PG2 Bootloader Release V01.01.01",
"name": "iot2050-pg2-image-boot.bin",
"version": "V01.01.01",
"type": "uboot",
"target_boards": [
"SIMATIC IOT2050 Basic PG2",
"SIMATIC IOT2050 Advanced PG2",
"SIMATIC IOT2050 Advanced M2",
"SIMATIC IOT2050 Advanced SM"
]
}
],
"target_os": [
{
"type": "Example Image",
"key": "BUILD_ID",
"min_version": "V01.01.01"
}
],
"suggest_preserved_uboot_env": [
"boot_targets"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright (c) Siemens AG, 2023
#
# Authors:
# Li Hua Qian <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#
DESCRIPTION = "Generate The Firmware Update Package"
MAINTAINER = "[email protected]"

SRC_URI = "file://iot2050-generate-fwu-tarball.sh \
file://update.conf.json.tmpl"

addtask create_tarball after do_deploy before do_build

do_create_tarball[depends] += "u-boot-iot2050:do_deploy"

do_create_tarball() {
cp -rf ${THISDIR}/files/* ${WORKDIR}

# Generate the firmware update package
sh ${WORKDIR}/iot2050-generate-fwu-tarball.sh ${WORKDIR} \
${DEPLOY_DIR_IMAGE} $(${ISAR_RELEASE_CMD})
}

0 comments on commit 09906e0

Please sign in to comment.