]> git.proxmox.com Git - pve-container.git/commitdiff
allow riscv32/64 containers
authorWolfgang Bumiller <w.bumiller@errno.eu>
Thu, 12 Jan 2023 10:50:47 +0000 (11:50 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 12 Jan 2023 12:02:13 +0000 (13:02 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/Config.pm
src/PVE/LXC/Create.pm

index c2bec1f6b24a8ee0f01c564f39a3356f44e3e3c8..af25a96e96144ec832e61ff1d3042c15b103dff1 100644 (file)
@@ -465,7 +465,7 @@ my $confdesc = {
     arch => {
        optional => 1,
        type => 'string',
-       enum => ['amd64', 'i386', 'arm64', 'armhf'],
+       enum => ['amd64', 'i386', 'arm64', 'armhf', 'riscv32', 'riscv64'],
        description => "OS architecture type.",
        default => 'amd64',
     },
index 460df5726eb10d042dc6f89c0867dc828d27993b..b2e3d00a0d24248197177aff09282b26d5da8ec8 100644 (file)
@@ -26,6 +26,7 @@ sub detect_architecture {
        0x3e => 'amd64',
        0x28 => 'armhf',
        0xb7 => 'arm64',
+       0xf3 => 'riscv',
     };
 
     my $elf_fn = '/bin/sh'; # '/bin/sh' is POSIX mandatory
@@ -50,6 +51,16 @@ sub detect_architecture {
        die "'$elf_fn' has unknown ELF machine '$machine'!\n"
            if !defined($arch);
 
+       if ($arch eq 'riscv') {
+           if ($class eq 1) {
+               $arch = 'riscv32';
+           } elsif ($class eq 2) {
+               $arch = 'riscv64';
+           } else {
+               die "'$elf_fn' has invalid class '$class'!\n";
+           }
+       }
+
        return $arch;
     };