From 4d610e9f230dd23589b18588446c2368f3a99446 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Tue, 25 Apr 2017 15:21:07 +0200 Subject: Replace includes with bblcasses They are more flexible and allow tricks like conditionally inheriting machine-related classes from the main one which makes things easier for external users like AGL --- classes/sota.bbclass | 33 +++++++++++++++++++++++++++++++++ classes/sota_bleeding.inc | 1 + classes/sota_minnowboard.bbclass | 7 +++++++ classes/sota_minnowboard_uboot.inc | 8 ++++++++ classes/sota_none.bbclass | 1 + classes/sota_porter.bbclass | 10 ++++++++++ classes/sota_qemux86-64.bbclass | 9 +++++++++ classes/sota_raspberrypi.bbclass | 12 ++++++++++++ 8 files changed, 81 insertions(+) create mode 100644 classes/sota.bbclass create mode 100644 classes/sota_bleeding.inc create mode 100644 classes/sota_minnowboard.bbclass create mode 100644 classes/sota_minnowboard_uboot.inc create mode 100644 classes/sota_none.bbclass create mode 100644 classes/sota_porter.bbclass create mode 100644 classes/sota_qemux86-64.bbclass create mode 100644 classes/sota_raspberrypi.bbclass (limited to 'classes') diff --git a/classes/sota.bbclass b/classes/sota.bbclass new file mode 100644 index 0000000..0697932 --- /dev/null +++ b/classes/sota.bbclass @@ -0,0 +1,33 @@ +DISTRO_FEATURES_append = " sota" +OVERRIDES .= ":sota" + +IMAGE_INSTALL_append = " ostree os-release" + +# live image for OSTree-enabled systems +IMAGE_CLASSES += "image_types_ostree image_types_ota" +IMAGE_FSTYPES += "ostreepush otaimg" + +# 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" + +EXTRA_IMAGEDEPENDS += " 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" +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_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_bleeding.inc b/classes/sota_bleeding.inc new file mode 100644 index 0000000..fc5947d --- /dev/null +++ b/classes/sota_bleeding.inc @@ -0,0 +1 @@ +SRCREV_pn-aktualizr ?= "${AUTOREV}" diff --git a/classes/sota_minnowboard.bbclass b/classes/sota_minnowboard.bbclass new file mode 100644 index 0000000..970bd6a --- /dev/null +++ b/classes/sota_minnowboard.bbclass @@ -0,0 +1,7 @@ +OSTREE_BOOTLOADER ?= "grub" +EFI_PROVIDER = "grub-efi" + +WKS_FILE = "efiimage-sota.wks" +IMAGE_BOOT_FILES = "" + +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 new file mode 100644 index 0000000..5097e9d --- /dev/null +++ b/classes/sota_minnowboard_uboot.inc @@ -0,0 +1,8 @@ +PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ota" +UBOOT_MACHINE = "minnowmax_defconfig" + +EXTRA_IMAGEDEPENDS_append = " minnowboard-bootfiles" +IMAGE_BOOT_FILES = "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 new file mode 100644 index 0000000..dc72a07 --- /dev/null +++ b/classes/sota_none.bbclass @@ -0,0 +1 @@ +# null machine it's here to make bitbake happy when SOTA_MACHINE is undefined diff --git a/classes/sota_porter.bbclass b/classes/sota_porter.bbclass new file mode 100644 index 0000000..a8f5ba1 --- /dev/null +++ b/classes/sota_porter.bbclass @@ -0,0 +1,10 @@ +# Commit united image to OSTree, not just uImage +OSTREE_KERNEL = "uImage+dtb" + +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_sota = "porter_config" + diff --git a/classes/sota_qemux86-64.bbclass b/classes/sota_qemux86-64.bbclass new file mode 100644 index 0000000..533c11c --- /dev/null +++ b/classes/sota_qemux86-64.bbclass @@ -0,0 +1,9 @@ +# See https://advancedtelematic.atlassian.net/browse/PRO-2693 +PREFERRED_VERSION_linux-yocto_qemux86-64_sota = "4.4%" + +# U-Boot support for SOTA +PREFERRED_PROVIDER_virtual/bootloader_sota = "u-boot-ota" +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/classes/sota_raspberrypi.bbclass b/classes/sota_raspberrypi.bbclass new file mode 100644 index 0000000..1d23d1f --- /dev/null +++ b/classes/sota_raspberrypi.bbclass @@ -0,0 +1,12 @@ +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)}" + +### both rpi-sdimg and rpi-sdimg-ota broken +IMAGE_FSTYPES += "ext4.xz ext4.bmap tar.xz" + +KERNEL_IMAGETYPE_sota = "uImage" +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" -- cgit v1.2.3-54-g00ecf