From 64ceafc0b46facd4a9a1eada9debe3b01cb5815c Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 6 Apr 2017 12:44:43 +0200 Subject: Fix small bugs, fix WIC for minnowboard --- scripts/lib/wic/plugins/source/otaimage.py | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 scripts/lib/wic/plugins/source/otaimage.py (limited to 'scripts/lib/wic/plugins/source/otaimage.py') diff --git a/scripts/lib/wic/plugins/source/otaimage.py b/scripts/lib/wic/plugins/source/otaimage.py new file mode 100644 index 0000000..016c996 --- /dev/null +++ b/scripts/lib/wic/plugins/source/otaimage.py @@ -0,0 +1,69 @@ +# 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, "") + -- cgit v1.2.3-54-g00ecf From e36a7821467fe3ae3f22e0ca67b91ebb3e65d2cb Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 11 Apr 2017 11:18:02 +0200 Subject: Add tweaks for compatibility with AGL --- conf/include/local/sota_minnowboard.inc | 9 +++++---- conf/include/local/sota_porter.inc | 8 ++++---- conf/include/local/sota_qemux86-64.inc | 6 +----- conf/include/local/sota_raspberrypi.inc | 12 +++++------- scripts/lib/wic/plugins/source/otaimage.py | 5 ++--- templates/README.md | 10 ---------- templates/feature/agl-sota/50_bblayers.conf.inc | 7 ------- templates/feature/agl-sota/50_local.conf.inc | 15 --------------- 8 files changed, 17 insertions(+), 55 deletions(-) delete mode 100644 templates/README.md delete mode 100644 templates/feature/agl-sota/50_bblayers.conf.inc delete mode 100644 templates/feature/agl-sota/50_local.conf.inc (limited to 'scripts/lib/wic/plugins/source/otaimage.py') diff --git a/conf/include/local/sota_minnowboard.inc b/conf/include/local/sota_minnowboard.inc index 0bd4210..5a5b3f4 100644 --- a/conf/include/local/sota_minnowboard.inc +++ b/conf/include/local/sota_minnowboard.inc @@ -1,8 +1,9 @@ MACHINE = "intel-corei7-64" -PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ota" -UBOOT_MACHINE = "minnowmax_defconfig" +PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" +UBOOT_MACHINE_sota = "minnowmax_defconfig" -EXTRA_IMAGEDEPENDS_append = " minnowboard-bootfiles" -IMAGE_BOOT_FILES = "minnowboard-bootfiles/*" +EXTRA_IMAGEDEPENDS_append_sota = " minnowboard-bootfiles" +IMAGE_BOOT_FILES_sota += "minnowboard-bootfiles/*" +OSTREE_BOOTLOADER ?= "u-boot" diff --git a/conf/include/local/sota_porter.inc b/conf/include/local/sota_porter.inc index fcda041..64923f9 100644 --- a/conf/include/local/sota_porter.inc +++ b/conf/include/local/sota_porter.inc @@ -3,10 +3,10 @@ MACHINE = "porter" # Commit united image to OSTree, not just uImage OSTREE_KERNEL = "uImage+dtb" -EXTRA_IMAGEDEPENDS_append = " porter-bootfiles" -IMAGE_CLASSES_append = " image_types_uboot " -IMAGE_BOOT_FILES = "porter-bootfiles/*" +EXTRA_IMAGEDEPENDS_append_sota = " porter-bootfiles" +IMAGE_CLASSES_append_sota = " image_types_uboot " +IMAGE_BOOT_FILES_sota += "porter-bootfiles/*" OSTREE_BOOTLOADER ?= "u-boot" -UBOOT_MACHINE = "porter_vin_config" +UBOOT_MACHINE_sota = "porter_vin_config" diff --git a/conf/include/local/sota_qemux86-64.inc b/conf/include/local/sota_qemux86-64.inc index b72c29d..5fa1521 100644 --- a/conf/include/local/sota_qemux86-64.inc +++ b/conf/include/local/sota_qemux86-64.inc @@ -1,12 +1,8 @@ MACHINE = "qemux86-64" -PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "5.4%" -PREFERRED_VERSION_libgcc ?= "5.4%" -PREFERRED_VERSION_gcc-runtime ?= "5.4%" - # U-Boot support for SOTA PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" -UBOOT_MACHINE = "qemu-x86_defconfig" +UBOOT_MACHINE_sota = "qemu-x86_defconfig" OSTREE_BOOTLOADER ?= "u-boot" OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda" diff --git a/conf/include/local/sota_raspberrypi.inc b/conf/include/local/sota_raspberrypi.inc index 51919f0..ae13b8e 100644 --- a/conf/include/local/sota_raspberrypi.inc +++ b/conf/include/local/sota_raspberrypi.inc @@ -1,16 +1,14 @@ MACHINE ?= "raspberrypi3" -# normal image class is sdcard_image-rpi-gdp, for sota it is image_types_uboot & sdcard_image-rpi-ota -IMAGE_CLASSES += "image_types_uboot sdcard_image-rpi-ota" +IMAGE_CLASSES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'image_types_uboot sdcard_image-rpi-ota', '', d)}" +IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'rpi-sdimg-ota', 'rpi-sdimg', d)}" -# normal image is rpi-sdimg, for sota it is rpi-sdimg-ota -IMAGE_FSTYPES += "rpi-sdimg-ota" ### both rpi-sdimg and rpi-sdimg-ota broken IMAGE_FSTYPES += "ext4.xz ext4.bmap tar.xz" KERNEL_IMAGETYPE_sota = "uImage" -PREFERRED_PROVIDER_virtual/bootloader = "u-boot" -UBOOT_MACHINE_raspberrypi2 = "rpi_2_defconfig" -UBOOT_MACHINE_raspberrypi3 = "rpi_3_32b_defconfig" +PREFERRED_PROVIDER_virtual/bootloader_sota ?= "u-boot" +UBOOT_MACHINE_raspberrypi2_sota ?= "rpi_2_defconfig" +UBOOT_MACHINE_raspberrypi3_sota ?= "rpi_3_32b_defconfig" OSTREE_BOOTLOADER ?= "u-boot" diff --git a/scripts/lib/wic/plugins/source/otaimage.py b/scripts/lib/wic/plugins/source/otaimage.py index 016c996..dc507a8 100644 --- a/scripts/lib/wic/plugins/source/otaimage.py +++ b/scripts/lib/wic/plugins/source/otaimage.py @@ -55,10 +55,9 @@ class OTAImagePlugin(SourcePlugin): Called to do the actual content population for a partition i.e. it 'prepares' the partition to be incorporated into the image. """ + bootimg_dir = get_bitbake_var("DEPLOY_DIR_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.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") msger.debug('Bootimg dir: %s' % bootimg_dir) diff --git a/templates/README.md b/templates/README.md deleted file mode 100644 index f43a67e..0000000 --- a/templates/README.md +++ /dev/null @@ -1,10 +0,0 @@ -AGL templates -============= - -This directory contains templates for integration with AGL's aglsetup.sh. -To use meta-updater with AGL, 'agl-sota' to the list of features as in: - - source meta-agl/scripts/aglsetup.sh -m raspberrypi3 agl-demo agl-netboot agl-appfw-smack agl-sota - -For more information see [AGL documentation](https://wiki.automotivelinux.org/subsystem/agl-sota/ostree) - diff --git a/templates/feature/agl-sota/50_bblayers.conf.inc b/templates/feature/agl-sota/50_bblayers.conf.inc deleted file mode 100644 index 0a5440b..0000000 --- a/templates/feature/agl-sota/50_bblayers.conf.inc +++ /dev/null @@ -1,7 +0,0 @@ -BBLAYERS =+ " \ - ${METADIR}/meta-agl-extra/meta-sota \ - ${METADIR}/meta-openembedded/meta-filesystems \ - ${METADIR}/meta-openembedded/meta-ruby \ - ${METADIR}/meta-rust \ - " - diff --git a/templates/feature/agl-sota/50_local.conf.inc b/templates/feature/agl-sota/50_local.conf.inc deleted file mode 100644 index 8d21c17..0000000 --- a/templates/feature/agl-sota/50_local.conf.inc +++ /dev/null @@ -1,15 +0,0 @@ -DISTRO_FEATURES_append = " agl-ota" -OVERRIDES .= ":sota" - -IMAGE_INSTALL_append = " ostree" - -# live image for OSTree-enabled systems -IMAGE_CLASSES += "image_types_ostree image_types_ota" -IMAGE_FSTYPES += "ostreepush otaimg" - -# Please redefine OSTREE_REPO in order to have a persistent OSTree repo -OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" -OSTREE_BRANCHNAME ?= "ota-${MACHINE}" -OSTREE_OSNAME ?= "ota" -OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" - -- cgit v1.2.3-54-g00ecf