diff options
author | Anton Gerasimov <anton.gerasimov@here.com> | 2019-02-21 15:54:39 +0100 |
---|---|---|
committer | Anton Gerasimov <anton.gerasimov@here.com> | 2019-02-25 15:35:01 +0100 |
commit | 690262acdba2511b14798c04b19d9dcc7df2d538 (patch) | |
tree | cdf2890f58fb10431fa9adf6c0bb1319c34816bf /recipes-sota/ota-u-boot-script/ota-u-boot-script.bb | |
parent | 3b9b75140ea58f546829cb3cf1b234e5b650de77 (diff) | |
download | meta-updater-690262acdba2511b14798c04b19d9dcc7df2d538.tar.gz |
Add universal uEnv recipefeat/universaluenv
Signed-off-by: Anton Gerasimov <anton.gerasimov@here.com>
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 | 63 |
1 files changed, 63 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..de00148 --- /dev/null +++ b/recipes-sota/ota-u-boot-script/ota-u-boot-script.bb | |||
@@ -0,0 +1,63 @@ | |||
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 | python () { | ||
13 | d.setVar('SOTA_BOOTLOADER_EXTRA_PARAMS', d.getVar('SOTA_BOOTLOADER_EXTRA_PARAMS').replace('/', '\/')) | ||
14 | d.setVar('SOTA_BOOTLOADER_BOOTCOMMAND', d.getVar('SOTA_BOOTLOADER_BOOTCOMMAND').replace('/', '\/')) | ||
15 | d.setVar('SOTA_BOOTLOADER_KERNEL_ADDR', d.getVar('SOTA_BOOTLOADER_KERNEL_ADDR').replace('/', '\/')) | ||
16 | d.setVar('SOTA_BOOTLOADER_RAMDISK_ADDR', d.getVar('SOTA_BOOTLOADER_RAMDISK_ADDR').replace('/', '\/')) | ||
17 | d.setVar('SOTA_BOOTLOADER_FDT_ADDR', d.getVar('SOTA_BOOTLOADER_FDT_ADDR').replace('/', '\/')) | ||
18 | d.setVar('SOTA_BOOTLOADER_BOOT_PART', d.getVar('SOTA_BOOTLOADER_BOOT_PART').replace('/', '\/')) | ||
19 | d.setVar('SOTA_BOOTLOADER_MAIN_PART', d.getVar('SOTA_BOOTLOADER_MAIN_PART').replace('/', '\/')) | ||
20 | d.setVar('SOTA_BOOTLOADER_ROOT_DEVICE', d.getVar('SOTA_BOOTLOADER_ROOT_DEVICE').replace('/', '\/')) | ||
21 | } | ||
22 | |||
23 | do_compile() { | ||
24 | |||
25 | UENV_TEMPLATE="${WORKDIR}/uEnv.template" | ||
26 | # Initialization portion | ||
27 | sed -n '0,/@@INITFINISHED@@/p' < ${WORKDIR}/uEnv.txt | head -n -1 > $UENV_TEMPLATE | ||
28 | |||
29 | # Support for FIT images | ||
30 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | ||
31 | cat ${WORKDIR}/uEnv-fit.txt >> $UENV_TEMPLATE | ||
32 | fi | ||
33 | |||
34 | # Rollback support | ||
35 | if [ -n "${SOTA_ROLLBACK_MECHANISM}" ]; then | ||
36 | cat ${WORKDIR}/uEnv-rollback.txt >> $UENV_TEMPLATE | ||
37 | |||
38 | if [ "${SOTA_ROLLBACK_MECHANISM}" = "file-env" ]; then | ||
39 | cat ${WORKDIR}/uEnv-fileenv.txt >> $UENV_TEMPLATE | ||
40 | fi | ||
41 | fi | ||
42 | |||
43 | # The rest of the base template | ||
44 | sed -n '/@@INITFINISHED@@/,$p' < ${WORKDIR}/uEnv.txt | sed -n '2,$p' >> $UENV_TEMPLATE | ||
45 | |||
46 | # Substitute the variables | ||
47 | sed -e 's/@@SOTA_BOOTLOADER_EXTRA_PARAMS@@/${SOTA_BOOTLOADER_EXTRA_PARAMS}/' \ | ||
48 | -e 's/@@SOTA_BOOTLOADER_BOOTCOMMAND@@/${SOTA_BOOTLOADER_BOOTCOMMAND}/' \ | ||
49 | -e 's/@@SOTA_BOOTLOADER_KERNEL_ADDR@@/${SOTA_BOOTLOADER_KERNEL_ADDR}/' \ | ||
50 | -e 's/@@SOTA_BOOTLOADER_RAMDISK_ADDR@@/${SOTA_BOOTLOADER_RAMDISK_ADDR}/' \ | ||
51 | -e 's/@@SOTA_BOOTLOADER_FDT_ADDR@@/${SOTA_BOOTLOADER_FDT_ADDR}/' \ | ||
52 | -e 's/@@SOTA_BOOTLOADER_BOOT_PART@@/${SOTA_BOOTLOADER_BOOT_PART}/' \ | ||
53 | -e 's/@@SOTA_BOOTLOADER_MAIN_PART@@/${SOTA_BOOTLOADER_MAIN_PART}/' \ | ||
54 | -e 's/@@SOTA_BOOTLOADER_ROOT_DEVICE@@/${SOTA_BOOTLOADER_ROOT_DEVICE}/' \ | ||
55 | "$UENV_TEMPLATE" > ${WORKDIR}/uEnv-final.txt | ||
56 | } | ||
57 | |||
58 | do_deploy() { | ||
59 | install -d ${DEPLOYDIR} | ||
60 | install -m 0644 ${WORKDIR}/uEnv-final.txt ${DEPLOYDIR}/uEnv.txt | ||
61 | } | ||
62 | |||
63 | addtask deploy after do_compile before do_build | ||