Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | ################################################################## |
| 8 | # Specific image creation and rootfs population info. |
| 9 | ################################################################## |
| 10 | |
| 11 | IMAGE_BASENAME ?= "${PN}" |
| 12 | IMAGE_VERSION_SUFFIX ?= "-${DATETIME}" |
| 13 | IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH" |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 14 | IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}" |
Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 15 | IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}" |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 16 | |
| 17 | # This needs to stay in sync with IMAGE_LINK_NAME, but with INITRAMFS_IMAGE instead of IMAGE_BASENAME |
Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 18 | # and without ${IMAGE_NAME_SUFFIX} which all initramfs images should set to empty |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 19 | INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}${IMAGE_MACHINE_SUFFIX}', ''][d.getVar('INITRAMFS_IMAGE') == '']}" |
| 20 | |
| 21 | # The default DEPLOY_DIR_IMAGE is ${MACHINE} directory: |
| 22 | # meta/conf/bitbake.conf:DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}" |
| 23 | # so many people find it unnecessary to include this suffix to every image |
| 24 | # stored there, but other people often fetch various images for different |
| 25 | # MACHINEs to the same downloads directory and then the suffix is very helpful |
| 26 | # add separate variable for projects to decide which scheme works best for them |
| 27 | # without understanding the IMAGE_NAME/IMAGE_LINK_NAME structure. |
| 28 | IMAGE_MACHINE_SUFFIX ??= "-${MACHINE}" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 29 | |
| 30 | # IMAGE_NAME is the base name for everything produced when building images. |
| 31 | # The actual image that contains the rootfs has an additional suffix (.rootfs |
| 32 | # by default) followed by additional suffices which describe the format (.ext4, |
| 33 | # .ext4.xz, etc.). |
| 34 | IMAGE_NAME_SUFFIX ??= ".rootfs" |
| 35 | |
| 36 | python () { |
| 37 | if bb.data.inherits_class('deploy', d) and d.getVar("IMAGE_VERSION_SUFFIX") == "-${DATETIME}": |
| 38 | import datetime |
| 39 | d.setVar("IMAGE_VERSION_SUFFIX", "-" + datetime.datetime.fromtimestamp(int(d.getVar("SOURCE_DATE_EPOCH")), datetime.timezone.utc).strftime('%Y%m%d%H%M%S')) |
| 40 | d.setVarFlag("IMAGE_VERSION_SUFFIX", "vardepvalue", "") |
| 41 | } |