diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2017-04-06 19:21:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2017-04-06 19:21:25 +0000 |
commit | 0ce00dac113c83456bdacbf711b08a2f19244f55 (patch) | |
tree | 6cb7ee56ed725e5a1b30d5b96f018b73582b8c33 | |
parent | 1c2571e37c6fa5e0ac3bb035173ae07a187648c5 (diff) | |
parent | 607029521eb71dcf873ed911eae4a721a1d2605f (diff) |
Merge "Add WKS for OTA-enabled bootable SD cards."
-rw-r--r-- | meta-sota/conf/include/agl-sota.inc | 20 | ||||
-rw-r--r-- | meta-sota/scripts/lib/wic/canned-wks/sdimage-sota.wks | 7 | ||||
-rw-r--r-- | meta-sota/scripts/lib/wic/plugins/source/otaimage.py | 68 |
3 files changed, 94 insertions, 1 deletions
diff --git a/meta-sota/conf/include/agl-sota.inc b/meta-sota/conf/include/agl-sota.inc index 4960e1a..700d36a 100644 --- a/meta-sota/conf/include/agl-sota.inc +++ b/meta-sota/conf/include/agl-sota.inc @@ -5,7 +5,25 @@ IMAGE_INSTALL_append = " ostree" # live image for OSTree-enabled systems IMAGE_CLASSES += "image_types_ostree image_types_ota" -IMAGE_FSTYPES += "ostreepush otaimg" +IMAGE_FSTYPES += "ostreepush otaimg wic" +WKS_FILE = "sdimage-sota.wks" +do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_otaimg" + +# required by wic's partitions.py, but is not pulled properly by bitbake +EXTRA_IMAGEDEPENDS += " dosfstools-native mtools-native" + +# No working WKS for Raspberry Pi yet +IMAGE_FSTYPES_remove_raspberrypi3 = "wic" +IMAGE_FSTYPES_remove_raspberrypi2 = "wic" + +# Still to be integrared +IMAGE_FSTYPES_remove_cyclone5 = "wic" +IMAGE_FSTYPES_remove_dra7xx-evm = "wic" +IMAGE_FSTYPES_remove_h3ulcb = "wic" +IMAGE_FSTYPES_remove_intel-corei7-64 = "wic" +IMAGE_FSTYPES_remove_joule = "wic" +IMAGE_FSTYPES_remove_qemux86-64 = "wic" +IMAGE_FSTYPES_remove_qemux86 = "wic" # Please redefine OSTREE_REPO in order to have a persistent OSTree repo OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" diff --git a/meta-sota/scripts/lib/wic/canned-wks/sdimage-sota.wks b/meta-sota/scripts/lib/wic/canned-wks/sdimage-sota.wks new file mode 100644 index 0000000..c31c3a5 --- /dev/null +++ b/meta-sota/scripts/lib/wic/canned-wks/sdimage-sota.wks @@ -0,0 +1,7 @@ +# short-description: Create OTA-enabled SD card image +# long-description: Creates a partitioned SD card image with OSTree +# physical sysroot as a payload. Boot files are located in the +# first vfat partition. + +part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 20 +part / --source otaimage --ondisk mmcblk --fstype=ext4 --label root --align 4096 diff --git a/meta-sota/scripts/lib/wic/plugins/source/otaimage.py b/meta-sota/scripts/lib/wic/plugins/source/otaimage.py new file mode 100644 index 0000000..4ef3b69 --- /dev/null +++ b/meta-sota/scripts/lib/wic/plugins/source/otaimage.py @@ -0,0 +1,68 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +import os + +from wic import msger +from wic.pluginbase import SourcePlugin +from wic.utils.oe.misc import get_bitbake_var + +class OTAImagePlugin(SourcePlugin): + """ + Add an already existing filesystem image to the partition layout. + """ + + name = 'otaimage' + + @classmethod + def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. Do nothing. + """ + pass + + @classmethod + def do_configure_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(). Possibly prepare + configuration files of some sort. + """ + pass + + @classmethod + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + """ + if not bootimg_dir: + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + + msger.debug('Bootimg dir: %s' % bootimg_dir) + + src = bootimg_dir + "/" + get_bitbake_var("IMAGE_LINK_NAME") + ".otaimg" + + msger.debug('Preparing partition using image %s' % (src)) + part.prepare_rootfs_from_fs_image(cr_workdir, src, "") |