[pve-devel] [RFC pve-container 2/2] enable emulation of arm64 based containers

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Sep 14 14:12:39 CEST 2018


On 9/14/18 1:31 PM, Dietmar Maurer wrote:
> You need to install package qemu-user-static which provides
> the emulation toolkit.
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  src/PVE/LXC/Setup.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
> index 1b89f28..7d522cc 100644
> --- a/src/PVE/LXC/Setup.pm
> +++ b/src/PVE/LXC/Setup.pm
> @@ -285,7 +285,19 @@ sub pre_start_hook {
>  
>      return if !$self->{plugin}; # unmanaged
>  
> +    my $emul;
> +    my $emul_data;
> +    if ($self->{conf}->{arch} eq 'arm64') {
> +	$emul = "/usr/bin/qemu-aarch64-static";
> +	$emul_data = PVE::Tools::file_get_contents($emul, 10*1024*1024) if -f $emul;
> +    }
> +
>      my $code = sub {
> +
> +	if ($emul && $emul_data) {
> +	    $self->{plugin}->ct_file_set_contents($emul, $emul_data, 0755);
> +	}
> +
>  	# Create /fastboot to skip run fsck
>  	$self->{plugin}->ct_file_set_contents('/fastboot', '');
>  
> 

I'd like to see a more general approach. This breaks my native aarch64 on aarch64
container.
It could be nice to have a general mapping of arch => emulator which is used if
target arch is not host arch (32/64 bit agnostic, where possible). Then we could
also go easily the other way and have x86 CT on aarch6e - as example.




More information about the pve-devel mailing list