aboutsummaryrefslogtreecommitdiffstats
path: root/meta-sokol-flex-distro/conf/distro/sokol-flex.conf
blob: a7fc3f67769fb06ca80ef6612076ce8a3daf2f94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# ---------------------------------------------------------------------------------------------------------------------
# SPDX-License-Identifier: MIT
# ---------------------------------------------------------------------------------------------------------------------

## Vendor Integration {{{1
require conf/distro/include/vendor.inc
## }}}1
## Sokol Flex OS Base Configuration {{{1
DISTRO_NAME = "Sokol Flex OS"
DISTRO_CODENAME = "mickledore"
MAINTAINER = "Siemens Digital Industries Software <embedded_support@mentor.com>"
HOME_URL = "https://www.plm.automation.siemens.com/global/en/products/embedded/flex-os.html"
SUPPORT_URL = "https://support.sw.siemens.com/"
BUG_REPORT_URL = "https://support.sw.siemens.com/"

# Distro and release versioning
DISTRO_VERSION = "13"
ARCHIVE_RELEASE_VERSION = "${DISTRO_VERSION}.${BSP_VERSION}.${PATCH_VERSION}"
PDK_LICENSE_VERSION_DATE = "20230331"

# Version of the scripts artifact, including setup-flex
SCRIPTS_VERSION ?= "0"

# Default values for BSP and PATCH version, to be redefined in other layers
BSP_VERSION ?= "0"
PATCH_VERSION ?= "0"

SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('+snapshot-${DATE}', '')}.${SDK_TIMESTAMP}"
SDK_VERSION[vardepsexclude] += "SDK_TIMESTAMP"

SDK_TIMESTAMP = "${@d.getVar('DATETIME')[:-2]}"
SDK_TIMESTAMP[doc] = "The timestamp from the DATETIME variable, without seconds."

# This is a single libc DISTRO, so exclude it from tmpdir name
TCLIBCAPPEND = ""

FLEX_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot"
FLEX_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet"
DISTRO_EXTRA_RDEPENDS += " ${FLEX_DEFAULT_EXTRA_RDEPENDS}"
DISTRO_EXTRA_RRECOMMENDS += " ${FLEX_DEFAULT_EXTRA_RRECOMMENDS}"

# Easier adjustment of oe-core QA check defaults
WARN_TO_ERROR_QA ??= ""
WARN_QA:remove = "${WARN_TO_ERROR_QA}"
ERROR_QA:append = " ${WARN_TO_ERROR_QA}"

# Scale down jobs/threads when memory per CPU core is low
INHERIT += "mem-per-cpu-scaling"

# Default to the external toolchain if available
TCMODE = "${@bb.utils.contains('BBFILE_COLLECTIONS', 'sourcery', 'external-sourcery-rebuild-libc', bb.utils.contains('BBFILE_COLLECTIONS', 'external-toolchain', 'external', 'default', d), d)}"

# We want media to auto-mount
DISTRO_EXTRA_RRECOMMENDS += "udev-extraconf"

# Paths
FLEXDIR ?= "${COREBASE}/.."
TOOLCHAINS_PATH ?= "${@d.getVar('FLEXDIR') + '/toolchains' if os.path.exists(d.getVar('FLEXDIR') + '/toolchains') else ''}"

# Use a local PR server by default
PRSERV_HOST ?= "localhost:0"

# Default to ipk packaging
PACKAGE_CLASSES ?= "package_ipk"

# Sokol Flex OS's supported hosts
SANITY_TESTED_DISTROS = "\
    ubuntu-22.04 \n\
    rhel*-9* \n \
    redhatenterprise*-9* \n \
    sokolomnios-3.1 \n\
"

# Splash screen
SPLASH:sokol-flex ?= "psplash"

# Remove MACHINE from default volname
UBI_VOLNAME = "rootfs"

# Default locale for images
IMAGE_LINGUAS ?= "en-us"

# Also check for host user contamination in the rootfs
ROOTFS_POSTPROCESS_COMMAND:append = " rootfs_check_host_user_contaminated;"

# Default to systemd, not sysvinit
INIT_MANAGER ?= "systemd"

# Export path variables into the devshell for convenience
OE_TOPDIR = "${TOPDIR}"
OE_WORKDIR = "${WORKDIR}"
OE_TERMINAL_EXPORTS += "OE_TOPDIR OE_WORKDIR COREBASE"

require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc

INHERIT += "uninative"
## }}}1
## Mechanisms provided for user customization {{{1
# Support USER_FEATURES
INHERIT += "user_features"

# Ease adding to the SDK from a global context
TOOLCHAIN_HOST_TASK_EXTRA ?= ""
TOOLCHAIN_HOST_TASK:append = " ${TOOLCHAIN_HOST_TASK_EXTRA}"
TOOLCHAIN_TARGET_TASK_EXTRA ?= ""
TOOLCHAIN_TARGET_TASK_EXTRA:pn-buildtools-tarball = ""
TOOLCHAIN_TARGET_TASK:append = " ${TOOLCHAIN_TARGET_TASK_EXTRA}"

# Easier addition of shared state mirrors
SSTATE_MIRROR_SITES ?= ""
SSTATE_MIRRORS += "${@''.join(r'file://.* %s/PATH;downloadfilename=PATH \n' % u for u in '${SSTATE_MIRROR_SITES}'.split())}"
## }}}1
## BitBake Configuration and Behavior {{{1
# Disk Space Monitoring during the build
#
# Monitor the disk space during the build. If there is less that 1GB of space or less
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
# shutdown the build. If there is less than 100MB or 1K inodes, perform a hard halt
# of the build. The reason for this is that running completely out of space can corrupt
# files and damages the build in ways which may not be easily recoverable.
# It's necessary to monitor /tmp, if there is no space left the build will fail
# with very exotic errors.
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    HALT,${TMPDIR},100M,1K \
    HALT,${DL_DIR},100M,1K \
    HALT,${SSTATE_DIR},100M,1K \
    HALT,/tmp,10M,1K"

# Support shallow git tarballs
BB_GENERATE_SHALLOW_TARBALLS ?= "1"
BB_GIT_SHALLOW ?= "1"
BB_GIT_SHALLOW_DEPTH_DEFAULT ?= "1"
BB_GIT_SHALLOW_DEPTH ??= "${@'${BB_GIT_SHALLOW_DEPTH_DEFAULT}' if not '${BB_GIT_SHALLOW_REVS}' else '0'}"
BB_GIT_SHALLOW_REVS ??= ""
## }}}1
## Distro Features & Recipe Configuration {{{1
FLEX_DEFAULT_DISTRO_FEATURES = "opengl multiarch pam"

# This violates typical MACHINE/DISTRO boundaries, but is part of Sokol Flex OS's
# supported features. If the vendor supports x11 and not wayland for its
# machines, so do we.
DISTRO_FEATURES_DEFAULT:remove = "x11"
FLEX_DEFAULT_DISTRO_FEATURES += "${@bb.utils.contains('MACHINE_FEATURES', 'x11', \
                                   bb.utils.contains('MACHINE_FEATURES', 'wayland', 'wayland', 'x11', d), 'wayland', d)}"

DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${FLEX_DEFAULT_DISTRO_FEATURES}"

# Enable our staged fixes that are on their way upstream
DISTRO_FEATURES:append = " sokol-flex-staging"

# Since many embedded systems don't have non-root users, allow autospawn for
# root as well.
PACKAGECONFIG:append:pn-pulseaudio = " autospawn-for-root"
## }}}1
### Inherits {{{1
# We want information and history about build output
INHERIT += "buildhistory"

# Copy the image license manifest into DEPLOY_DIR_IMAGE
INHERIT += "deploy-license-manifest"

# Warn if there are available update layers which are not included in the
# current configuration
INHERIT += "flex-updates-check"

# Check PDK license
INHERIT += "${@bb.utils.contains('BBFILE_COLLECTIONS', 'flex-private', 'pdk-license', '', d)}"

# Ensure that our DISTRO_CODENAME aligns with LAYERSERIES_CORENAMES
INHERIT += "codename_is_corename"

# Ensure we're building the toolchain in a supported configuration
ERROR_QA:append = " disallowed-tuning"
ALLOWED_TUNING:flex-bsp = "armv5te armv7ahf-neon armv7a-neon armv7at armv8a i686 riscv64 x86_64"
INHERIT += "required_toolchain_config"

# Use our toolchain relocation scripts
INHERIT += "${@bb.utils.contains('BBFILE_COLLECTIONS', 'sokol-flex-staging', 'toolchain_ship_relocate_sdk', '', d)}"
TOOLCHAIN_SHAR_REL_TMPL = "${LAYERDIR_sokol-flex-staging}/files/toolchain-shar-relocate.sh"
TOOLCHAIN_SHAR_EXT_TMPL = "${LAYERDIR_sokol-flex-staging}/files/toolchain-shar-extract.sh"
RELOCATE_SDK_SH ?= "${LAYERDIR_sokol-flex-staging}/files/relocate_sdk.sh"
## }}}1
## Preferences & Package Selection {{{1
# Obey our graphics image feature
SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains_any("IMAGE_FEATURES", ["x11-base", "graphics", "weston"], "graphical.target", "multi-user.target", d)}'

# Prefer docker-moby to docker-ce by default
PREFERRED_PROVIDER_virtual/docker = "docker-moby"

# Additional package groups
#
# We prefer wayland/weston, unless the vendor supports x11 but not wayland.
FEATURE_PACKAGES_flex-weston = "packagegroup-core-weston"
FEATURE_PACKAGES_x11-base ?= "packagegroup-core-x11-base"
FEATURE_PACKAGES_flex-x11 = "${FEATURE_PACKAGES_x11-base}"
FEATURE_PACKAGES_graphics += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '${FEATURE_PACKAGES_flex-weston}', '', d)}"
FEATURE_PACKAGES_graphics += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${FEATURE_PACKAGES_flex-x11}', '', d)}"
FEATURE_PACKAGES_tools-audio     ?= "packagegroup-tools-audio"
FEATURE_PACKAGES_tools-benchmark ?= "packagegroup-tools-benchmark"
FEATURE_PACKAGES_multimedia      ?= "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad"
FEATURE_PACKAGES_virtualization  ?= "docker-moby python3-docker-compose"
FEATURE_PACKAGES_codebench-debug ?= "gdbserver strace openssh-sftp-server"

# Baseline runtime for third party multilib executables.
# libc/libgcc/libstdc++, plus lttng for tracing. Only applies to images
# without MLPREFIX set (i.e. development-image, not lib32-development-image).
MULTILIB_RUNTIME_PACKAGES = "glibc libgcc libstdc++ ${@bb.utils.contains('IMAGE_FEATURES', 'tools-profile', 'lttng-ust', '', d)}"
MULTILIB_RUNTIME_FEATURE_PACKAGES = "${@' '.join(multilib_pkg_extend(d, pkg) for pkg in d.getVar('MULTILIB_RUNTIME_PACKAGES').split())}"
FEATURE_PACKAGES_multilib-runtime ?= "${@d.getVar('MULTILIB_RUNTIME_FEATURE_PACKAGES') if not d.getVar('MLPREFIX') else ''}"

# Include nss-myhostname for sysvinit, so the hostname resolves. systemd
# includes myhostname itself.
DISTRO_EXTRA_RRECOMMENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'nss-myhostname', d)}"
## }}}1
## Workarounds & Overrides {{{1
# Re-export and exclude from checksums
export WSL_INTEROP
BB_BASEHASH_IGNORE_VARS:append = " WSL_INTEROP"

# Reduce tuning specificity and increase reuse.
require conf/distro/include/flex-tuning.inc

# Ensure that the output directory always exists, this fixes use of meta-sca
# with certain meta-imx recipes.
do_sca_tracefiles[dirs] =+ "${SCA_SOURCES_DIR}"

# Disable the meta-virtualization layer inclusion warning
SKIP_META_VIRT_SANITY_CHECK = "1"
## }}}1
## Images {{{1
# We have it here because we use upstream virtualization layer without any changes
EXTRA_IMAGE_FEATURES += "${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'virtualization', '', d)}"

# Variables to include in /etc/build in our images
IMAGE_BUILDINFO_VARS ?= "\
    DISTRO DISTRO_VERSION \
    MACHINE \
    DATETIME \
    IMAGE_BASENAME IMAGE_FEATURES CORE_IMAGE_EXTRA_INSTALL \
"

# Encrypted FS
EXTRA_IMAGE_FEATURES:append:feature-encrypted-fs = " encrypted-fs"
## }}}1
## SDK & Application Development Environment {{{1
# Use DEPLOY_DIR_ naming for consistency
SDK_DEPLOY:sokol-flex = "${DEPLOY_DIR_SDK}"
DEPLOY_DIR_SDK ?= "${DEPLOY_DIR}/sdk"

# Use distro rather than oecore
SDK_NAME_PREFIX = "${DISTRO}"

# Adjust installer name and default install path
SDK_NAME = "${SDK_NAME_PREFIX}-${SDK_VERSION}-${IMAGE_BASENAME}-${MACHINE}"
SDKPATHINSTALL = "~/${DISTRO}/sdk/${SDK_VERSION}/${IMAGE_BASENAME}-${MACHINE}"

# Current multilib prefix, for non-multilib images. Ex. the lib32
# environment-setup within a non-lib32 image SDK.
MLPREFIX_SECONDARY = "${@d.getVar('MLPREFIX') if not d.getVar('PN').startswith(d.getVar('MLPREFIX')) else ''}"

# Set the SDK title. SDK_VERSION is left out, as it's explicitly shown in the installer
SDK_TITLE ?= "${DISTRO_NAME} ${MLPREFIX_SECONDARY}${IMAGE_BASENAME} SDK for ${MACHINE}"
SDK_TITLE:task-populate-sdk-ext:sokol-flex = "${DISTRO_NAME} ${MLPREFIX_SECONDARY}${IMAGE_BASENAME} Extensible SDK for ${MACHINE}"

# Define a common identifier for a unique SDK, to be set in CodeBench metadata
SDK_IDENTIFIER ?= "${SDKMACHINE}-${MLPREFIX_SECONDARY}${IMAGE_BASENAME}-${MACHINE}-${SDK_VERSION}"

# As we remove the toolchain from the sdk, naming it 'toolchain' is not
# accurate, and sdk better describes what it is anyway. We also include
# SDK_VERSION in our SDK_NAME, so no need to duplicate it here.
TOOLCHAIN_OUTPUTNAME ?= "sdk-${SDKMACHINE}-${SDK_NAME}"

# Restore the default to buildtools-tarball, as that recipe sets it with ?=
TOOLCHAIN_OUTPUTNAME:pn-buildtools-tarball = "${SDK_ARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"

# Add KERNEL_* to the SDK environment (unexported) for use by the user
TOOLCHAIN_TARGET_TASK_EXTRA += " sdk-env-kernelvars"

# Set this so the SDK can set the right Yocto multilib display option
EXTERNAL_SETUP_SCRIPT_VARS += "REAL_MULTIMACH_TARGET_SYS"
EXTERNAL_REAL_MULTIMACH_TARGET_SYS ??= "${REAL_MULTIMACH_TARGET_SYS}"
CB_MBS_OPTIONS[general.yocto.sdk.value] = "${EXTERNAL_REAL_MULTIMACH_TARGET_SYS}"

# Include metadata for CodeBench in the SDK
SDKIMAGE_FEATURES:append = " codebench-metadata"
IMAGE_CLASSES += "sdk_codebench_metadata"

# This allows us to control what base target packages are installed for the
# configured multilibs, by altering SDK_MULTILIB_VARIANTS to differ from
# MULTILIB_VARIANTS. We also append meta-environment to obey
# SDK_MULTILIB_VARIANTS as well.
IMAGE_CLASSES += "image-sdk-multilib-variants"

# We need to ensure we can distribute downloads for SDK builds
IMAGE_CLASSES += "archive_sdk_downloads"

# Create a 'latest' symlink for the SDK
IMAGE_CLASSES += "sdk_latest_link"
## }}}1
## Sokol Flex OS Releases {{{1
# Default image for our installers
RELEASE_IMAGE ?= "development-image"
RELEASE_ARTIFACTS ?= "layers downloads images"

# Apply any release-time srcrev lockdowns for AUTOREV recipes
include ${FLEXDIR}/${MACHINE}/conf/autorevs.conf

# LAYERDIRs for our layers, by name
INHERIT += "layerdirs"

# Populate a tree of downloads organized by layer
ARCHIVE_RELEASE_DL_DIR ?= "${DEPLOY_DIR}/release-downloads"
DL_LICENSE_INCLUDE ?= "*"
INHERIT += "archive-release-downloads"

# For our forks, also point an 'upstream' remote at upstream
FORKED_REPOS ?= ""

# Our public layers should use non-ssh URIs for their remotes
PUBLIC_REPOS ?= "meta-sokol-flex meta-sourcery ${FORKED_REPOS}"

# Define a location for placing external artifacts to be used by the build
FLEX_EXTERNAL_ARTIFACTS ?= "${TOPDIR}/flex-external-artifacts"
## }}}1
## Includes {{{1

# Support for SOURCERY_VERSION_REQUIRED
require conf/distro/include/sourcery-version-check.inc

# QT configuration. These are includes rather than requires, as they live in
# other layers.
include conf/distro/include/flex-qt6.conf

# Security configuration.
include conf/distro/include/flex-security.conf

# SWUpdate configuration.
include conf/distro/include/flex-swupdate.conf

# iot configuration.
include conf/distro/include/flex-iot.conf

# MCF configuration
include conf/distro/include/flex-mcf.conf

# INITRAMFS
INITRAMFS_IMAGE ?= "flex-initramfs-image"
INITRAMFS_IMAGE_BUNDLE ?= "${@bb.utils.contains('KERNEL_IMAGETYPES', 'fitImage', '', '1', d)}"
## }}}1
# vim: set fdm=marker fdl=0 :