summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/container-bundle.bbclass36
-rw-r--r--classes/container-common.bbclass51
-rw-r--r--classes/container-cross-install.bbclass37
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
158CONTAINER_BUNDLE_RUNTIME ?= "${@get_bundle_runtime(d)}" 158CONTAINER_BUNDLE_RUNTIME ?= "${@get_bundle_runtime(d)}"
159 159
160# Inherit shared functions for multiconfig/machine/arch mapping
161inherit 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)
163DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" 166DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native"
164DEPENDS += "vcontainer-native" 167DEPENDS += "vcontainer-native"
165 168
166# Determine multiconfig name for blob building based on target architecture
167def 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)
177def 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)
187def 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
199VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" 169VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}"
200VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" 170VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}"
201BLOB_ARCH = "${@get_blob_arch(d)}" 171BLOB_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')
19def 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')
30def 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
41def 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
104inherit 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)
106DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native" 109DEPENDS += "qemuwrapper-cross qemu-system-native skopeo-native"
107DEPENDS += "vcontainer-native coreutils-native" 110DEPENDS += "vcontainer-native coreutils-native"
108 111
109# Determine multiconfig name for blob building based on target architecture
110def 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)
120def 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
129VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}" 112VRUNTIME_MULTICONFIG = "${@get_vruntime_multiconfig(d)}"
130VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}" 113VRUNTIME_MACHINE = "${@get_vruntime_machine(d)}"
131 114
@@ -213,19 +196,7 @@ def get_kernel_name(d):
213 196
214KERNEL_IMAGETYPE_QEMU = "${@get_kernel_name(d)}" 197KERNEL_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
217def 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
229BLOB_ARCH = "${@get_blob_arch(d)}" 200BLOB_ARCH = "${@get_blob_arch(d)}"
230 201
231# ============================================================================ 202# ============================================================================