From 83e834567264d2e38ea6e184a809159e5a13f5a8 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 27 Apr 2017 11:56:14 +0200 Subject: Make layer inclusion a neutral operation Classes are and bbappends are reworked so that mere inclusion of this layer to bbappends.conf doesn't change anything. In addition class behavior can now be controlled by both inheriting sota.bblcass and enabling "sota" DISTRO_FEATURE. --- classes/sota.bbclass | 38 ++++++++++++++++++-------------------- classes/sota_minnowboard.bbclass | 6 +++--- classes/sota_minnowboard_uboot.inc | 8 ++++---- classes/sota_none.bbclass | 3 +++ 4 files changed, 28 insertions(+), 27 deletions(-) (limited to 'classes') diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 0697932..ab9611a 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -1,19 +1,19 @@ -DISTRO_FEATURES_append = " sota" -OVERRIDES .= ":sota" +python __anonymous() { + if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d): + d.appendVar("OVERRIDES", ":sota") + #d.appendVar("IMAGE_INSTALL", " ostree os-release") -IMAGE_INSTALL_append = " ostree os-release" + d.appendVarFlag("do_image_wic", "depends", " %s:do_image_otaimg" % d.getVar("IMAGE_BASENAME", True)) + #d.appendVar("EXTRA_IMAGEDEPENDS", " parted-native mtools-native dosfstools-native") +} -# live image for OSTree-enabled systems -IMAGE_CLASSES += "image_types_ostree image_types_ota" -IMAGE_FSTYPES += "ostreepush otaimg" +IMAGE_INSTALL_append_sota = " ostree os-release" +IMAGE_CLASSES += " image_types_ostree image_types_ota" +IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush otaimg wic', ' ', d)}" -# if don't build wic image unless IMAGE_BOOT_FILES is set. Prevents build from failing -# on machines that don't support updater yet -IMAGE_FSTYPES += "${@' wic' if (d.getVar("IMAGE_BOOT_FILES", True)) else ''}" -WKS_FILE ?= "sdimage-sota.wks" -do_image_wic[depends] += "${IMAGE_BASENAME}:do_image_otaimg" +WKS_FILE_sota ?= "sdimage-sota.wks" -EXTRA_IMAGEDEPENDS += " parted-native mtools-native dosfstools-native" +EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native" # Please redefine OSTREE_REPO in order to have a persistent OSTree repo OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" @@ -21,13 +21,11 @@ OSTREE_BRANCHNAME ?= "ota-${MACHINE}" OSTREE_OSNAME ?= "poky" OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" -# Prelinking increases the size of downloads and causes build errors -USER_CLASSES_remove = "image-prelink" +SOTA_MACHINE ??="none" +SOTA_MACHINE_raspberrypi2 ?= "raspberrypi" +SOTA_MACHINE_rarpberrypi3 ?= "raspberrypi" +SOTA_MACHINE_porter ?= "porter" +SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" +SOTA_MACHINE_qemux86-64 ?= "qemux86-64" -SOTA_MACHINE ?= "none" -SOTA_MACHINE_raspberrypi = "raspberrypi" -SOTA_MACHINE_raspberrypi3 = "raspberrypi" -SOTA_MACHINE_porter = "porter" -SOTA_MACHINE_intel-corei7-64 = "minnowboard" -SOTA_MACHINE_qemux86-64 = "qemux86-64" inherit sota_${SOTA_MACHINE} diff --git a/classes/sota_minnowboard.bbclass b/classes/sota_minnowboard.bbclass index 970bd6a..8417348 100644 --- a/classes/sota_minnowboard.bbclass +++ b/classes/sota_minnowboard.bbclass @@ -1,7 +1,7 @@ OSTREE_BOOTLOADER ?= "grub" -EFI_PROVIDER = "grub-efi" +EFI_PROVIDER_sota = "grub-efi" -WKS_FILE = "efiimage-sota.wks" -IMAGE_BOOT_FILES = "" +WKS_FILE_sota = "efiimage-sota.wks" +IMAGE_BOOT_FILES_sota = "" OSTREE_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 console=ttyS0,115200 console=tty0" diff --git a/classes/sota_minnowboard_uboot.inc b/classes/sota_minnowboard_uboot.inc index 5097e9d..85d6a60 100644 --- a/classes/sota_minnowboard_uboot.inc +++ b/classes/sota_minnowboard_uboot.inc @@ -1,8 +1,8 @@ -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_KERNEL_ARGS ?= "ramdisk_size=16384 rw rootfstype=ext4 rootwait rootdelay=2 ostree_root=/dev/hda console=ttyS0,115200 console=tty0" diff --git a/classes/sota_none.bbclass b/classes/sota_none.bbclass index dc72a07..86eaf0b 100644 --- a/classes/sota_none.bbclass +++ b/classes/sota_none.bbclass @@ -1 +1,4 @@ # null machine it's here to make bitbake happy when SOTA_MACHINE is undefined +python __anonymous() { + bb.warn("SOTA functionality is not yet supported for your machine") +} -- cgit v1.2.3-54-g00ecf