mirror of
https://github.com/xcat2/confluent.git
synced 2026-11-19 08:52:20 +00:00
Merge pull request #371 from Obihoernchen/perf/imgutil-crossarch
Emulate aarch64 as a Neoverse N1 cpu in imgutil
This commit is contained in:
@@ -54,7 +54,10 @@
|
||||
with the F (fix-binary) flag; on Ubuntu this is provided by the
|
||||
qemu-user-static package (qemu-user-binfmt as of Ubuntu 26.04). For EL,
|
||||
the architecture is also detected automatically when building from a `-s`
|
||||
source tree.
|
||||
source tree. An aarch64 image is emulated as a Neoverse N1 cpu, which needs
|
||||
qemu 7.1 or later and is much faster to emulate than the default cpu of
|
||||
qemu. To emulate another cpu, set `QEMU_CPU`, for example
|
||||
`QEMU_CPU=cortex-a72` for older qemu. The same applies to `imgutil exec`.
|
||||
|
||||
* `-y`, `--non-interactive`:
|
||||
Avoid prompting for confirmation.
|
||||
|
||||
+10
-1
@@ -1366,7 +1366,7 @@ def main():
|
||||
buildp.add_argument('-a', '--addpackagelist', action='append', default=[],
|
||||
help='A list of additional packages to include, may be specified multiple times')
|
||||
buildp.add_argument('-s', '--source', help='Directory to pull installation from, typically a subdirectory of /var/lib/confluent/distributions. By default, the repositories for the build system are used. For Ubuntu, this is not supported, the build system repositories are always used.')
|
||||
buildp.add_argument('--arch', default=None, help='Target architecture to build for (e.g. aarch64). When it differs from the build host architecture, statically linked qemu-user emulator registered in binfmt_misc with the F flag is required')
|
||||
buildp.add_argument('--arch', default=None, help='Target architecture to build for (e.g. aarch64). When it differs from the build host architecture, statically linked qemu-user emulator registered in binfmt_misc with the F flag is required. aarch64 is emulated as a Neoverse N1 cpu (qemu 7.1 or later), set QEMU_CPU to choose another')
|
||||
buildp.add_argument('-y', '--non-interactive', help='Avoid prompting for confirmation', action='store_true')
|
||||
buildp.add_argument('--selinux', action='store_true',
|
||||
help='Install the targeted SELinux policy and leave SELinux enforcing '
|
||||
@@ -1425,6 +1425,7 @@ def exec_root(args):
|
||||
pass
|
||||
if imgarch and imgarch != os.uname().machine:
|
||||
check_binfmt(imgarch, args)
|
||||
set_qemu_cpu(imgarch)
|
||||
exitcode = run_constrained(exec_root_backend, args)
|
||||
if exitcode:
|
||||
sys.exit(exitcode)
|
||||
@@ -1558,6 +1559,13 @@ qemu_arch_map = {
|
||||
}
|
||||
|
||||
|
||||
def set_qemu_cpu(targetarch):
|
||||
# The default 'max' cpu of qemu-user emulates SVE and pointer
|
||||
# authentication, which slows down the image build considerably
|
||||
if targetarch == 'aarch64' and 'QEMU_CPU' not in os.environ:
|
||||
os.environ['QEMU_CPU'] = 'neoverse-n1'
|
||||
|
||||
|
||||
def check_binfmt(targetarch, args):
|
||||
qname = qemu_arch_map.get(targetarch, 'qemu-' + targetarch)
|
||||
binfmtdir = '/proc/sys/fs/binfmt_misc'
|
||||
@@ -1836,6 +1844,7 @@ def build_root(args):
|
||||
oshandler.arch, hostarch))
|
||||
sys.exit(1)
|
||||
check_binfmt(oshandler.arch, args)
|
||||
set_qemu_cpu(oshandler.arch)
|
||||
if args.selinux and not oshandler.selinuxsupport:
|
||||
sys.stderr.write('--selinux is not supported for {0} images\n'.format(oshandler.oscategory))
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user