diff options
Diffstat (limited to 'recipes-sota/ota-u-boot-script/ota-u-boot-script.bb')
-rw-r--r-- | recipes-sota/ota-u-boot-script/ota-u-boot-script.bb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/recipes-sota/ota-u-boot-script/ota-u-boot-script.bb b/recipes-sota/ota-u-boot-script/ota-u-boot-script.bb new file mode 100644 index 0000000..5c7ed57 --- /dev/null +++ b/recipes-sota/ota-u-boot-script/ota-u-boot-script.bb | |||
@@ -0,0 +1,50 @@ | |||
1 | DESCRIPTION = "Boot script template for OTA-enabled image" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | |||
5 | inherit deploy | ||
6 | |||
7 | SRC_URI = "file://uEnv-fileenv.txt \ | ||
8 | file://uEnv-fit.txt \ | ||
9 | file://uEnv-rollback.txt \ | ||
10 | file://uEnv.txt" | ||
11 | |||
12 | do_deploy() { | ||
13 | |||
14 | UENV_TEMPLATE=$(mktemp) | ||
15 | # Initialization portion | ||
16 | sed -n '0,/%%INITFINISHED%%/p' < ${WORKDIR}/uEnv.txt | head -n -1 > $UENV_TEMPLATE | ||
17 | |||
18 | # Support for FIT images | ||
19 | if [ "${KERNEL_IMAGETYPE_SOTA}" = "fitImage"]; then | ||
20 | cat ${WORKDIR}/uEnv-fit.txt >> $UENV_TEMPLATE | ||
21 | fi | ||
22 | |||
23 | # Rollback support | ||
24 | if [ -n "${SOTA_ROLLBACK_MECHANISM}" ]; then | ||
25 | cat ${WORKDIR}/uEnv-rollback.txt >> $UENV_TEMPLATE | ||
26 | |||
27 | if [ "${SOTA_ROLLBACK_MECHANISM}" = "file-env" ]; | ||
28 | cat ${WORKDIR}/uEnv-fileenv.txt >> $UENV_TEMPLATE | ||
29 | fi | ||
30 | fi | ||
31 | |||
32 | # The rest of the base template | ||
33 | sed -n '/%%INITFINISHED%%/,$p' < ${WORKDIR}/uEnv.txt | sed -n '2,$p' >> $UENV_TEMPLATE | ||
34 | |||
35 | # Substitute the variables | ||
36 | sed -e 's/@@SOTA_BOOTLOADER_EXTRA_PARAMS@@/${SOTA_BOOTLOADER_EXTRA_PARAMS}' \ | ||
37 | -e 's/@@SOTA_BOOTLOADER_BOOTCOMMAND@@/${SOTA_BOOTLOADER_BOOTCOMMAND}' \ | ||
38 | -e 's/@@SOTA_BOOTLOADER_KERNEL_ADDR@@/${SOTA_BOOTLOADER_KERNEL_ADDR}' \ | ||
39 | -e 's/@@SOTA_BOOTLOADER_RAMDISK_ADDR@@/${SOTA_BOOTLOADER_RAMDISK_ADDR}' \ | ||
40 | -e 's/@@SOTA_BOOTLOADER_FDT_ADDR@@/${SOTA_BOOTLOADER_FDT_ADDR}' \ | ||
41 | -e 's/@@SOTA_BOOTLOADER_BOOT_PART@@/${SOTA_BOOTLOADER_BOOT_PART}' \ | ||
42 | -e 's/@@SOTA_BOOTLOADER_MAIN_PART@@/${SOTA_BOOTLOADER_KERNEL_MAIN_PART}' \ | ||
43 | -e 's/@@SOTA_BOOTLOADER_ROOT_DEVICE@@/${SOTA_BOOTLOADER_ROOT_DEVICE}' \ | ||
44 | "$UENV_TEMPLATE" > ${DEPLOY_DIR_IMAGE}/uEnv.txt | ||
45 | |||
46 | |||
47 | if [ -n ""] | ||
48 | } | ||
49 | |||
50 | addtask deploy before do_package | ||