Skip to content
Snippets Groups Projects
Commit 43f1cf2d authored by Martin Jansa's avatar Martin Jansa Committed by Richard Purdie
Browse files

image-artifact-names: introduce new bbclass and move some variables into it

* similar to kernel-artifact-names for other recipes/bbclasses which
  need to use some deployed artifacts

* bitbake.conf: move IMAGE_BASENAME, IMAGE_VERSION_SUFFIX, IMAGE_NAME,
  IMAGE_LINK_NAME variables

* image_types.bbclass: move IMAGE_NAME_SUFFIX variable

* currently IMAGE_NAME_SUFFIX is used only by image.bbclass,
  image_types.bbclass and meta/recipes-core/images/build-appliance-image_15.0.0.bb
  but if it's needed by some recipe which isn't itself an image, then
  it's useful in bitbake.conf, e.g. we have a recipe for creating
  VirtualBox appliances which combines .wic.vmdk with .ovf file to
  create .zip with appliance, but for that we need the filename of
  .wic.vmdk which now contains IMAGE_NAME_SUFFIX
  https://github.com/webOS-ports/meta-webos-ports/blob/4980ce52a43ac6897657602810313af359f0b839/meta-luneos/recipes-core/images/luneos-emulator-appliance.inc#L24



* we were hardcoding .rootfs suffix where needed, but for quite long
  time it's configurable with IMAGE_NAME_SUFFIX since:

  commit 380ee36811939d947024bf78de907e3c071b834f
  Author: Patrick Ohly <patrick.ohly@intel.com>
  Date:   Mon Mar 7 18:07:52 2016 +0100

    image creation: allow overriding .rootfs suffix

  and might not match with hardcoded .rootfs, so make it easier to
  use IMAGE_NAME_SUFFIX where needed even without inheritting whole
  image_types.bbclass

[YOCTO #12937]

(From OE-Core rev: 456b700d51a5052a285a8477304f902c335223be)

Signed-off-by: default avatarMartin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: default avatarRichard Purdie <richard.purdie@linuxfoundation.org>
parent 565d243a
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
# Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> # Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org>
# #
inherit image-artifact-names
BUILDHISTORY_FEATURES ?= "image package sdk" BUILDHISTORY_FEATURES ?= "image package sdk"
BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory"
BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}"
......
##################################################################
# Specific image creation and rootfs population info.
##################################################################
IMAGE_BASENAME = "${PN}"
IMAGE_VERSION_SUFFIX = "-${DATETIME}"
IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME"
IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
IMAGE_LINK_NAME = "${IMAGE_BASENAME}-${MACHINE}"
# IMAGE_NAME is the base name for everything produced when building images.
# The actual image that contains the rootfs has an additional suffix (.rootfs
# by default) followed by additional suffices which describe the format (.ext4,
# .ext4.xz, etc.).
IMAGE_NAME_SUFFIX ??= ".rootfs"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# ${HDDIMG_ID} - FAT image volume-id # ${HDDIMG_ID} - FAT image volume-id
# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
inherit live-vm-common inherit live-vm-common image-artifact-names
do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
mtools-native:do_populate_sysroot \ mtools-native:do_populate_sysroot \
......
# IMAGE_NAME is the base name for everything produced when building images.
# The actual image that contains the rootfs has an additional suffix (.rootfs
# by default) followed by additional suffices which describe the format (.ext4,
# .ext4.xz, etc.).
IMAGE_NAME_SUFFIX ??= ".rootfs"
# The default aligment of the size of the rootfs is set to 1KiB. In case # The default aligment of the size of the rootfs is set to 1KiB. In case
# you're using the SD card emulation of a QEMU system simulator you may # you're using the SD card emulation of a QEMU system simulator you may
# set this value to 2048 (2MiB alignment). # set this value to 2048 (2MiB alignment).
...@@ -231,7 +225,8 @@ IMAGE_CMD_f2fs () { ...@@ -231,7 +225,8 @@ IMAGE_CMD_f2fs () {
EXTRA_IMAGECMD = "" EXTRA_IMAGECMD = ""
inherit siteinfo kernel-arch inherit siteinfo kernel-arch image-artifact-names
JFFS2_ENDIANNESS ?= "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}" JFFS2_ENDIANNESS ?= "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
JFFS2_ERASEBLOCK ?= "0x40000" JFFS2_ERASEBLOCK ?= "0x40000"
EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers" EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers"
......
##################################################################
# Specific kernel creation info
# for recipes/bbclasses which need to reuse some of the kernel
# artifacts, but aren't kernel recipes themselves
##################################################################
inherit image-artifact-names
KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}" KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}" KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}"
......
...@@ -86,6 +86,8 @@ QB_ROOTFS_EXTRA_OPT ?= "" ...@@ -86,6 +86,8 @@ QB_ROOTFS_EXTRA_OPT ?= ""
# This should be kept align with ROOT_VM # This should be kept align with ROOT_VM
QB_DRIVE_TYPE ?= "/dev/sd" QB_DRIVE_TYPE ?= "/dev/sd"
inherit image-artifact-names
# Create qemuboot.conf # Create qemuboot.conf
addtask do_write_qemuboot_conf after do_rootfs before do_image addtask do_write_qemuboot_conf after do_rootfs before do_image
......
...@@ -39,6 +39,8 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd" ...@@ -39,6 +39,8 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd"
ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;' ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
inherit image-artifact-names
# Sort the user and group entries in /etc by ID in order to make the content # Sort the user and group entries in /etc by ID in order to make the content
# deterministic. Package installs are not deterministic, causing the ordering # deterministic. Package installs are not deterministic, causing the ordering
# of entries to change between builds. In case that this isn't desired, # of entries to change between builds. In case that this isn't desired,
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Released under the MIT license (see COPYING.MIT) # Released under the MIT license (see COPYING.MIT)
inherit metadata_scm inherit metadata_scm
inherit image-artifact-names
# testimage.bbclass enables testing of qemu images using python unittests. # testimage.bbclass enables testing of qemu images using python unittests.
# Most of the tests are commands run on target image over ssh. # Most of the tests are commands run on target image over ssh.
# To use it add testimage to global inherit and call your target image with -c testimage # To use it add testimage to global inherit and call your target image with -c testimage
......
...@@ -452,11 +452,6 @@ STAGING_KERNEL_BUILDDIR = "${TMPDIR}/work-shared/${MACHINE}/kernel-build-artifac ...@@ -452,11 +452,6 @@ STAGING_KERNEL_BUILDDIR = "${TMPDIR}/work-shared/${MACHINE}/kernel-build-artifac
################################################################## ##################################################################
IMAGE_ROOTFS = "${WORKDIR}/rootfs" IMAGE_ROOTFS = "${WORKDIR}/rootfs"
IMAGE_BASENAME = "${PN}"
IMAGE_VERSION_SUFFIX = "-${DATETIME}"
IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME"
IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
IMAGE_LINK_NAME = "${IMAGE_BASENAME}-${MACHINE}"
# This option allows for a percentage overage of the actual image size rather than a # This option allows for a percentage overage of the actual image size rather than a
# fixed extra space, this is space needed for initial startup and basic operations. # fixed extra space, this is space needed for initial startup and basic operations.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment