diff options
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/container-bundle.bbclass | 36 | ||||
| -rw-r--r-- | classes/container-common.bbclass | 51 | ||||
| -rw-r--r-- | classes/container-cross-install.bbclass | 37 |
3 files changed, 58 insertions, 66 deletions
diff --git a/classes/container-bundle.bbclass b/classes/container-bundle.bbclass index fdd241ee..406e70cc 100644 --- a/classes/container-bundle.bbclass +++ b/classes/container-bundle.bbclass | |||
| @@ -157,45 +157,15 @@ def get_bundle_runtime(d): | |||
| 157 | 157 | ||
| 158 | CONTAINER_BUNDLE_RUNTIME ?= "${@get_bundle_runtime(d)}" | 158 | CONTAINER_BUNDLE_RUNTIME ?= "${@get_bundle_runtime(d)}" |
| 159 | 159 | ||
| 160 | # Inherit shared functions for multiconfig/machine/arch mapping | ||
| 161 | inherit container-common | ||
| 162 | |||
| 160 | # Dependencies on native tools | 163 | # Dependencies on native tools |
| 161 | # vcontainer-native provides vrunner.sh | 164 | # vcontainer-native provides vrunner.sh |
| 162 | # Blobs come from multiconfig builds (vdkr-initramfs-create, vpdmn-initramfs-create) | 165 | # Blobs come from multiconfig builds (vdkr-initramfs-create, vpdmn-initramfs-create) |
| 163 | DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" | 166 | DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" |
| 164 | DEPENDS += "vcontainer-native" | 167 | DEPENDS += "vcontainer-native" |
| 165 | 168 | ||
| 166 | # Determine multiconfig name for blob building based on target architecture | ||
| 167 | def get_vruntime_multiconfig(d): | ||
| 168 | arch = d.getVar('TARGET_ARCH') | ||
| 169 | if arch == 'aarch64': | ||
| 170 | return 'vruntime-aarch64' | ||
| 171 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 172 | return 'vruntime-x86-64' | ||
| 173 | else: | ||
| 174 | return None | ||
| 175 | |||
| 176 | # Get the MACHINE name used in the multiconfig (for deploy path) | ||
| 177 | def get_vruntime_machine(d): | ||
| 178 | arch = d.getVar('TARGET_ARCH') | ||
| 179 | if arch == 'aarch64': | ||
| 180 | return 'qemuarm64' | ||
| 181 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 182 | return 'qemux86-64' | ||
| 183 | else: | ||
| 184 | return None | ||
| 185 | |||
| 186 | # Map TARGET_ARCH to blob directory name (aarch64, x86_64) | ||
| 187 | def get_blob_arch(d): | ||
| 188 | """Map Yocto TARGET_ARCH to blob directory name""" | ||
| 189 | arch = d.getVar('TARGET_ARCH') | ||
| 190 | blob_map = { | ||
| 191 | 'aarch64': 'aarch64', | ||
| 192 | 'arm': 'aarch64', # Use aarch64 blobs for 32-bit ARM too | ||
| 193 | 'x86_64': 'x86_64', | ||
| 194 | 'i686': 'x86_64', | ||
| 195 | 'i586': 'x86_64', | ||
| 196 | } | ||
| 197 | return blob_map.get(arch, 'aarch64') | ||
| 198 | |||
| 199 | VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" | 169 | VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" |
| 200 | VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" | 170 | VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" |
| 201 | BLOB_ARCH = "${@get_blob_arch(d)}" | 171 | BLOB_ARCH = "${@get_blob_arch(d)}" |
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') | ||
diff --git a/classes/container-cross-install.bbclass b/classes/container-cross-install.bbclass index d6a38dad..e0fc63da 100644 --- a/classes/container-cross-install.bbclass +++ b/classes/container-cross-install.bbclass | |||
| @@ -100,32 +100,15 @@ | |||
| 100 | # | 100 | # |
| 101 | # See also: container-bundle.bbclass | 101 | # See also: container-bundle.bbclass |
| 102 | 102 | ||
| 103 | # Inherit shared functions for multiconfig/machine/arch mapping | ||
| 104 | inherit container-common | ||
| 105 | |||
| 103 | # Dependencies on native tools | 106 | # Dependencies on native tools |
| 104 | # vcontainer-native provides vrunner.sh | 107 | # vcontainer-native provides vrunner.sh |
| 105 | # Blobs come from multiconfig builds (vdkr-initramfs-create, vpdmn-initramfs-create) | 108 | # Blobs come from multiconfig builds (vdkr-initramfs-create, vpdmn-initramfs-create) |
| 106 | DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" | 109 | DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" |
| 107 | DEPENDS += "vcontainer-native coreutils-native" | 110 | DEPENDS += "vcontainer-native coreutils-native" |
| 108 | 111 | ||
| 109 | # Determine multiconfig name for blob building based on target architecture | ||
| 110 | def get_vruntime_multiconfig(d): | ||
| 111 | arch = d.getVar('TARGET_ARCH') | ||
| 112 | if arch == 'aarch64': | ||
| 113 | return 'vruntime-aarch64' | ||
| 114 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 115 | return 'vruntime-x86-64' | ||
| 116 | else: | ||
| 117 | return None | ||
| 118 | |||
| 119 | # Get the MACHINE name used in the multiconfig (for deploy path) | ||
| 120 | def get_vruntime_machine(d): | ||
| 121 | arch = d.getVar('TARGET_ARCH') | ||
| 122 | if arch == 'aarch64': | ||
| 123 | return 'qemuarm64' | ||
| 124 | elif arch in ['x86_64', 'i686', 'i586']: | ||
| 125 | return 'qemux86-64' | ||
| 126 | else: | ||
| 127 | return None | ||
| 128 | |||
| 129 | VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" | 112 | VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" |
| 130 | VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" | 113 | VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" |
| 131 | 114 | ||
| @@ -213,19 +196,7 @@ def get_kernel_name(d): | |||
| 213 | 196 | ||
| 214 | KERNEL_IMAGETYPE_QEMU = "${@get_kernel_name(d)}" | 197 | KERNEL_IMAGETYPE_QEMU = "${@get_kernel_name(d)}" |
| 215 | 198 | ||
| 216 | # Map TARGET_ARCH to blob directory name (aarch64, x86_64) | 199 | # BLOB_ARCH uses get_blob_arch() from container-common.bbclass |
| 217 | def get_blob_arch(d): | ||
| 218 | """Map Yocto TARGET_ARCH to blob directory name""" | ||
| 219 | arch = d.getVar('TARGET_ARCH') | ||
| 220 | blob_map = { | ||
| 221 | 'aarch64': 'aarch64', | ||
| 222 | 'arm': 'aarch64', # Use aarch64 blobs for 32-bit ARM too | ||
| 223 | 'x86_64': 'x86_64', | ||
| 224 | 'i686': 'x86_64', | ||
| 225 | 'i586': 'x86_64', | ||
| 226 | } | ||
| 227 | return blob_map.get(arch, 'aarch64') | ||
| 228 | |||
| 229 | BLOB_ARCH = "${@get_blob_arch(d)}" | 200 | BLOB_ARCH = "${@get_blob_arch(d)}" |
| 230 | 201 | ||
| 231 | # ============================================================================ | 202 | # ============================================================================ |
