-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware-update-package: Add making FWU package option
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
1 parent
fb360c9
commit 09906e0
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -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. | ||
|
@@ -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" | ||
|
||
|
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,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 |
47 changes: 47 additions & 0 deletions
47
recipes-devtools/firmware-update-package/files/iot2050-generate-fwu-tarball.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 |
---|---|---|
@@ -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 $* |
38 changes: 38 additions & 0 deletions
38
recipes-devtools/firmware-update-package/files/update.conf.json.tmpl
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,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" | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
recipes-devtools/firmware-update-package/firmware-update-package_0.1.bb
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,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}) | ||
} |