diff options
author | Anton Gerasimov <anton@advancedtelematic.com> | 2017-04-03 12:05:53 +0200 |
---|---|---|
committer | Anton Gerasimov <anton@advancedtelematic.com> | 2017-04-03 12:10:27 +0200 |
commit | b49c2631b6bc48ead4d352e2bd00cdfbca7af5e8 (patch) | |
tree | 1493f6d046067c36a4059b26b690f5d8cae9f50d | |
parent | 501e07acd803df6f9264c4206b4b9529006f287a (diff) | |
download | meta-updater-b49c2631b6bc48ead4d352e2bd00cdfbca7af5e8.tar.gz |
Replace sdcard_image* classes with wic
-rw-r--r-- | classes/sdcard_image-dra7xx-evm-ota.bbclass | 75 | ||||
-rw-r--r-- | classes/sdcard_image-minnowboard-ota.bbclass | 78 | ||||
-rw-r--r-- | classes/sdcard_image-porter-ota.bbclass | 78 | ||||
-rw-r--r-- | conf/distro/sota.conf.inc | 48 | ||||
-rw-r--r-- | scripts/lib/wic/canned-wks/sdimage-sota.wks | 7 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/otaimage.py | 69 |
6 files changed, 88 insertions, 267 deletions
diff --git a/classes/sdcard_image-dra7xx-evm-ota.bbclass b/classes/sdcard_image-dra7xx-evm-ota.bbclass deleted file mode 100644 index 179ed10..0000000 --- a/classes/sdcard_image-dra7xx-evm-ota.bbclass +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | inherit image_types | ||
2 | |||
3 | # Boot partition volume id | ||
4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
5 | |||
6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
7 | BOOT_SPACE ?= "4096" | ||
8 | |||
9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
12 | |||
13 | IMAGE_TYPEDEP_dra7xx-evm-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
14 | IMAGE_DEPENDS_dra7xx-evm-sdimg-ota = " \ | ||
15 | parted-native \ | ||
16 | mtools-native \ | ||
17 | dosfstools-native \ | ||
18 | " | ||
19 | |||
20 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota" | ||
21 | |||
22 | IMAGE_CMD_dra7xx-evm-sdimg-ota () { | ||
23 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
24 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
25 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
27 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
28 | |||
29 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
30 | |||
31 | # Initialize sdcard image file | ||
32 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
33 | |||
34 | # Create partition table | ||
35 | parted -s ${SDIMG_OTA} mklabel msdos | ||
36 | # Create boot partition and mark it as bootable | ||
37 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
38 | parted -s ${SDIMG_OTA} set 1 boot on | ||
39 | # Create rootfs partition to the end of disk | ||
40 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
41 | parted ${SDIMG_OTA} print | ||
42 | |||
43 | # Create a vfat image with boot files | ||
44 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
45 | rm -f ${WORKDIR}/boot.img | ||
46 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
47 | sync | ||
48 | |||
49 | sync | ||
50 | #dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
51 | |||
52 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
53 | then | ||
54 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
55 | else | ||
56 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
57 | fi | ||
58 | |||
59 | # Optionally apply compression | ||
60 | case "${SDIMG_OTA_COMPRESSION}" in | ||
61 | "gzip") | ||
62 | gzip -k9 "${SDIMG_OTA}" | ||
63 | ;; | ||
64 | "bzip2") | ||
65 | bzip2 -k9 "${SDIMG_OTA}" | ||
66 | ;; | ||
67 | "xz") | ||
68 | xz -k "${SDIMG_OTA}" | ||
69 | ;; | ||
70 | esac | ||
71 | |||
72 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota | ||
73 | ln -s ${IMAGE_NAME}.rootfs.dra7xx-evm-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.dra7xx-evm-sdimg-ota | ||
74 | } | ||
75 | |||
diff --git a/classes/sdcard_image-minnowboard-ota.bbclass b/classes/sdcard_image-minnowboard-ota.bbclass deleted file mode 100644 index c49b3cd..0000000 --- a/classes/sdcard_image-minnowboard-ota.bbclass +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | inherit image_types | ||
2 | |||
3 | # Boot partition volume id | ||
4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
5 | |||
6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
7 | BOOT_SPACE ?= "4096" | ||
8 | |||
9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
12 | |||
13 | IMAGE_TYPEDEP_minnowboard-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
14 | IMAGE_DEPENDS_minnowboard-sdimg-ota = " \ | ||
15 | parted-native \ | ||
16 | mtools-native \ | ||
17 | dosfstools-native \ | ||
18 | minnowboard-bootfiles \ | ||
19 | " | ||
20 | |||
21 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.minnowboard-sdimg-ota" | ||
22 | |||
23 | IMAGE_CMD_minnowboard-sdimg-ota () { | ||
24 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
25 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
27 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
28 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
29 | |||
30 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
31 | |||
32 | # Initialize sdcard image file | ||
33 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
34 | |||
35 | # Create partition table | ||
36 | parted -s ${SDIMG_OTA} mklabel msdos | ||
37 | # Create boot partition and mark it as bootable | ||
38 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
39 | parted -s ${SDIMG_OTA} set 1 boot on | ||
40 | # Create rootfs partition to the end of disk | ||
41 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
42 | parted ${SDIMG_OTA} print | ||
43 | |||
44 | # Create a vfat image with boot files | ||
45 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
46 | rm -f ${WORKDIR}/boot.img | ||
47 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
48 | sync | ||
49 | |||
50 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/minnowboard-bootfiles/* ::/ | ||
51 | |||
52 | sync | ||
53 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
54 | |||
55 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
56 | then | ||
57 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
58 | else | ||
59 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
60 | fi | ||
61 | |||
62 | # Optionally apply compression | ||
63 | case "${SDIMG_OTA_COMPRESSION}" in | ||
64 | "gzip") | ||
65 | gzip -k9 "${SDIMG_OTA}" | ||
66 | ;; | ||
67 | "bzip2") | ||
68 | bzip2 -k9 "${SDIMG_OTA}" | ||
69 | ;; | ||
70 | "xz") | ||
71 | xz -k "${SDIMG_OTA}" | ||
72 | ;; | ||
73 | esac | ||
74 | |||
75 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota | ||
76 | ln -s ${IMAGE_NAME}.minnowboard-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.minnowboard-sdimg-ota | ||
77 | } | ||
78 | |||
diff --git a/classes/sdcard_image-porter-ota.bbclass b/classes/sdcard_image-porter-ota.bbclass deleted file mode 100644 index a9619dc..0000000 --- a/classes/sdcard_image-porter-ota.bbclass +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | inherit image_types | ||
2 | |||
3 | # Boot partition volume id | ||
4 | BOOTDD_VOLUME_ID ?= "${MACHINE}" | ||
5 | |||
6 | # Boot partition size [in KiB] (will be rounded up to IMAGE_ROOTFS_ALIGNMENT) | ||
7 | BOOT_SPACE ?= "4096" | ||
8 | |||
9 | IMAGE_ROOTFS_ALIGNMENT = "4096" | ||
10 | SDIMG_OTA_ROOTFS_TYPE ?= "otaimg" | ||
11 | SDIMG_OTA_ROOTFS = "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${SDIMG_OTA_ROOTFS_TYPE}" | ||
12 | |||
13 | IMAGE_TYPEDEP_porter-sdimg-ota = "${SDIMG_OTA_ROOTFS_TYPE}" | ||
14 | IMAGE_DEPENDS_porter-sdimg-ota = " \ | ||
15 | parted-native \ | ||
16 | mtools-native \ | ||
17 | dosfstools-native \ | ||
18 | porter-bootfiles \ | ||
19 | " | ||
20 | |||
21 | SDIMG_OTA = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.porter-sdimg-ota" | ||
22 | |||
23 | IMAGE_CMD_porter-sdimg-ota () { | ||
24 | OTAROOT_SIZE=`du -Lb ${SDIMG_OTA_ROOTFS} | cut -f1` | ||
25 | OTAROOT_SIZE=$(expr ${OTAROOT_SIZE} / 1024 + 1) | ||
26 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) | ||
27 | BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) | ||
28 | SDIMG_OTA_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $OTAROOT_SIZE) | ||
29 | |||
30 | echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $OTAROOT_SIZE KiB" | ||
31 | |||
32 | # Initialize sdcard image file | ||
33 | dd if=/dev/zero of=${SDIMG_OTA} bs=1024 count=0 seek=${SDIMG_OTA_SIZE} | ||
34 | |||
35 | # Create partition table | ||
36 | parted -s ${SDIMG_OTA} mklabel msdos | ||
37 | # Create boot partition and mark it as bootable | ||
38 | parted -s ${SDIMG_OTA} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) | ||
39 | parted -s ${SDIMG_OTA} set 1 boot on | ||
40 | # Create rootfs partition to the end of disk | ||
41 | parted -s ${SDIMG_OTA} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s | ||
42 | parted ${SDIMG_OTA} print | ||
43 | |||
44 | # Create a vfat image with boot files | ||
45 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG_OTA} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') | ||
46 | rm -f ${WORKDIR}/boot.img | ||
47 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
48 | sync | ||
49 | |||
50 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/porter-bootfiles/* ::/ | ||
51 | |||
52 | sync | ||
53 | dd if=${WORKDIR}/boot.img of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
54 | |||
55 | if echo "${SDIMG_OTA_ROOTFS_TYPE}" | egrep -q "*\.xz" | ||
56 | then | ||
57 | xzcat ${SDIMG_OTA_ROOTFS} | dd of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
58 | else | ||
59 | dd if=${SDIMG_OTA_ROOTFS} of=${SDIMG_OTA} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync | ||
60 | fi | ||
61 | |||
62 | # Optionally apply compression | ||
63 | case "${SDIMG_OTA_COMPRESSION}" in | ||
64 | "gzip") | ||
65 | gzip -k9 "${SDIMG_OTA}" | ||
66 | ;; | ||
67 | "bzip2") | ||
68 | bzip2 -k9 "${SDIMG_OTA}" | ||
69 | ;; | ||
70 | "xz") | ||
71 | xz -k "${SDIMG_OTA}" | ||
72 | ;; | ||
73 | esac | ||
74 | |||
75 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.porter-sdimg-ota | ||
76 | ln -s ${IMAGE_NAME}.rootfs.porter-sdimg-ota ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.porter-sdimg-ota | ||
77 | } | ||
78 | |||
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 23e5a43..c8b4388 100644 --- a/conf/distro/sota.conf.inc +++ b/conf/distro/sota.conf.inc | |||
@@ -1,8 +1,17 @@ | |||
1 | IMAGE_INSTALL_append = " ostree rvi-sota-client" | 1 | DISTRO_FEATURES_append = " sota" |
2 | OVERRIDES .= ":sota" | ||
3 | |||
4 | IMAGE_INSTALL_append = " ostree" | ||
2 | 5 | ||
3 | # live image for OSTree-enabled systems | 6 | # live image for OSTree-enabled systems |
4 | IMAGE_CLASSES_append = " image_types_ostree image_types_ota" | 7 | IMAGE_CLASSES += "image_types_ostree image_types_ota" |
5 | IMAGE_FSTYPES += "ostreepush otaimg" | 8 | IMAGE_FSTYPES += "ostreepush otaimg wic" |
9 | WKS_FILE = "sdimage-sota.wks" | ||
10 | do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_otaimg" | ||
11 | |||
12 | # No working WKS for Raspberry Pi yet | ||
13 | IMAGE_FSTYPES_remove_raspberrypi3 = "wic" | ||
14 | IMAGE_FSTYPES_remove_raspberrypi2 = "wic" | ||
6 | 15 | ||
7 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo | 16 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo |
8 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" | 17 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" |
@@ -10,36 +19,3 @@ OSTREE_BRANCHNAME ?= "ota-${MACHINE}" | |||
10 | OSTREE_OSNAME ?= "poky" | 19 | OSTREE_OSNAME ?= "poky" |
11 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" | 20 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" |
12 | 21 | ||
13 | # Platform-specific configurations | ||
14 | |||
15 | ## RaspberryPi | ||
16 | IMAGE_CLASSES_append_raspberrypi2 = " image_types_uboot sdcard_image-rpi-ota" | ||
17 | IMAGE_CLASSES_append_raspberrypi3 = " image_types_uboot sdcard_image-rpi-ota" | ||
18 | IMAGE_FSTYPES += "${@'rpi-sdimg-ota' if d.getVar('MACHINE', True).startswith('raspberrypi') else ''}" | ||
19 | IMAGE_FSTYPES_remove = "rpi-sdimg" | ||
20 | |||
21 | KERNEL_IMAGETYPE_raspberrypi2 = "uImage" | ||
22 | KERNEL_IMAGETYPE_raspberrypi3 = "uImage" | ||
23 | |||
24 | UBOOT_MACHINE_raspberrypi2 = "rpi_2_defconfig" | ||
25 | UBOOT_MACHINE_raspberrypi3 = "rpi_3_32b_defconfig" | ||
26 | PREFERRED_PROVIDER_virtual/bootloader_raspberrypi2 = "u-boot" | ||
27 | PREFERRED_PROVIDER_virtual/bootloader_raspberrypi3 = "u-boot" | ||
28 | |||
29 | # Some BSPs (e.g. meta-raspberrypi) use this variable to turn debug on/off | ||
30 | DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "release",d)}" | ||
31 | |||
32 | ## Minnowboard | ||
33 | PREFERRED_PROVIDER_virtual/bootloader_intel-corei7-64 = "u-boot-ota" | ||
34 | UBOOT_MACHINE_intel-corei7-64 = "minnowmax_defconfig" | ||
35 | IMAGE_CLASSES_append_intel-corei7-64 = " sdcard_image-minnowboard-ota" | ||
36 | IMAGE_FSTYPES += "${@'minnowboard-sdimg-ota' if d.getVar('MACHINE', True).startswith('intel-corei7-64') else ''}" | ||
37 | |||
38 | ## QEMU | ||
39 | PREFERRED_PROVIDER_virtual/bootloader_qemux86 = "u-boot-ota" | ||
40 | UBOOT_MACHINE_qemux86 = "qemu-x86_defconfig" | ||
41 | PREFERRED_PROVIDER_virtual/bootloader_qemux86-64= "u-boot-ota" | ||
42 | UBOOT_MACHINE_qemux86-64 = "qemu-x86_defconfig" | ||
43 | |||
44 | DISTROOVERRIDES_append = ":sota" | ||
45 | DISTRO_FEATURES_append = " sota" | ||
diff --git a/scripts/lib/wic/canned-wks/sdimage-sota.wks b/scripts/lib/wic/canned-wks/sdimage-sota.wks new file mode 100644 index 0000000..c31c3a5 --- /dev/null +++ b/scripts/lib/wic/canned-wks/sdimage-sota.wks | |||
@@ -0,0 +1,7 @@ | |||
1 | # short-description: Create OTA-enabled SD card image | ||
2 | # long-description: Creates a partitioned SD card image with OSTree | ||
3 | # physical sysroot as a payload. Boot files are located in the | ||
4 | # first vfat partition. | ||
5 | |||
6 | part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 20 | ||
7 | part / --source otaimage --ondisk mmcblk --fstype=ext4 --label root --align 4096 | ||
diff --git a/scripts/lib/wic/plugins/otaimage.py b/scripts/lib/wic/plugins/otaimage.py new file mode 100644 index 0000000..016c996 --- /dev/null +++ b/scripts/lib/wic/plugins/otaimage.py | |||
@@ -0,0 +1,69 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # This program is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License version 2 as | ||
6 | # published by the Free Software Foundation. | ||
7 | # | ||
8 | # This program is distributed in the hope that it will be useful, | ||
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | # GNU General Public License for more details. | ||
12 | # | ||
13 | # You should have received a copy of the GNU General Public License along | ||
14 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
15 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
16 | # | ||
17 | |||
18 | import os | ||
19 | |||
20 | from wic import msger | ||
21 | from wic.pluginbase import SourcePlugin | ||
22 | from wic.utils.oe.misc import get_bitbake_var | ||
23 | |||
24 | class OTAImagePlugin(SourcePlugin): | ||
25 | """ | ||
26 | Add an already existing filesystem image to the partition layout. | ||
27 | """ | ||
28 | |||
29 | name = 'otaimage' | ||
30 | |||
31 | @classmethod | ||
32 | def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir, | ||
33 | bootimg_dir, kernel_dir, native_sysroot): | ||
34 | """ | ||
35 | Called after all partitions have been prepared and assembled into a | ||
36 | disk image. Do nothing. | ||
37 | """ | ||
38 | pass | ||
39 | |||
40 | @classmethod | ||
41 | def do_configure_partition(cls, part, source_params, cr, cr_workdir, | ||
42 | oe_builddir, bootimg_dir, kernel_dir, | ||
43 | native_sysroot): | ||
44 | """ | ||
45 | Called before do_prepare_partition(). Possibly prepare | ||
46 | configuration files of some sort. | ||
47 | """ | ||
48 | pass | ||
49 | |||
50 | @classmethod | ||
51 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, | ||
52 | oe_builddir, bootimg_dir, kernel_dir, | ||
53 | rootfs_dir, native_sysroot): | ||
54 | """ | ||
55 | Called to do the actual content population for a partition i.e. it | ||
56 | 'prepares' the partition to be incorporated into the image. | ||
57 | """ | ||
58 | if not bootimg_dir: | ||
59 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | ||
60 | if not bootimg_dir: | ||
61 | msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") | ||
62 | |||
63 | msger.debug('Bootimg dir: %s' % bootimg_dir) | ||
64 | |||
65 | src = bootimg_dir + "/" + get_bitbake_var("IMAGE_LINK_NAME") + ".otaimg" | ||
66 | |||
67 | msger.debug('Preparing partition using image %s' % (src)) | ||
68 | part.prepare_rootfs_from_fs_image(cr_workdir, src, "") | ||
69 | |||