diff options
Diffstat (limited to 'classes/container-common.bbclass')
| -rw-r--r-- | classes/container-common.bbclass | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/classes/container-common.bbclass b/classes/container-common.bbclass new file mode 100644 index 00000000..21c8e998 --- /dev/null +++ b/classes/container-common.bbclass | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | # SPDX-FileCopyrightText: Copyright (C) 2025 Bruce Ashfield | ||
| 2 | # | ||
| 3 | # SPDX-License-Identifier: MIT | ||
| 4 | # | ||
| 5 | # container-common.bbclass | ||
| 6 | # =========================================================================== | ||
| 7 | # Shared functions for container bundling and cross-installation | ||
| 8 | # =========================================================================== | ||
| 9 | # | ||
| 10 | # This class provides common helper functions used by both: | ||
| 11 | # - container-bundle.bbclass | ||
| 12 | # - container-cross-install.bbclass | ||
| 13 | # | ||
| 14 | # These functions map target architecture to multiconfig names, machine names, | ||
| 15 | # and blob directory names used by vdkr/vpdmn. | ||
| 16 | |||
| 17 | # Determine multiconfig name for blob building based on target architecture | ||
| 18 | # Returns the multiconfig name (e.g., 'vruntime-aarch64' or 'vruntime-x86-64') | ||
| 19 | def get_vruntime_multiconfig(d): | ||
| 20 | arch = d.getVar('TARGET_ARCH') | ||
| 21 | if arch == 'aarch64': | ||
| 22 | return 'vruntime-aarch64' | ||
| 23 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 24 | return 'vruntime-x86-64' | ||
| 25 | else: | ||
| 26 | return None | ||
| 27 | |||
| 28 | # Get the MACHINE name used in the multiconfig (for deploy path) | ||
| 29 | # Returns the machine name (e.g., 'qemuarm64' or 'qemux86-64') | ||
| 30 | def get_vruntime_machine(d): | ||
| 31 | arch = d.getVar('TARGET_ARCH') | ||
| 32 | if arch == 'aarch64': | ||
| 33 | return 'qemuarm64' | ||
| 34 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 35 | return 'qemux86-64' | ||
| 36 | else: | ||
| 37 | return None | ||
| 38 | |||
| 39 | # Map TARGET_ARCH to blob directory name (aarch64, x86_64) | ||
| 40 | # The blob directories contain pre-built kernel and initramfs for vdkr/vpdmn | ||
| 41 | def get_blob_arch(d): | ||
| 42 | """Map Yocto TARGET_ARCH to blob directory name""" | ||
| 43 | arch = d.getVar('TARGET_ARCH') | ||
| 44 | blob_map = { | ||
| 45 | 'aarch64': 'aarch64', | ||
| 46 | 'arm': 'aarch64', # Use aarch64 blobs for 32-bit ARM too | ||
| 47 | 'x86_64': 'x86_64', | ||
| 48 | 'i686': 'x86_64', | ||
| 49 | 'i586': 'x86_64', | ||
| 50 | } | ||
| 51 | return blob_map.get(arch, 'aarch64') | ||
