]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setarch: add arm and aarch64 architectures to transition rules
authorAlexey Gladkov <gladkov.alexey@gmail.com>
Tue, 23 Jun 2020 14:56:20 +0000 (16:56 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 24 Jun 2020 13:05:53 +0000 (15:05 +0200)
Since aarch64 kernel can be configured with compat 32-bit support
enabled, extend translation rules in a way similar to x86/x86_64.

Suggested-by: "Dmitry V. Levin" <ldv@altlinux.org>
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
sys-utils/setarch.c

index b057b4df80e3214f483aa93d21127b3198e52fed..6914d791b446bb98c777fffbf17ef3d3d0ea5aad 100644 (file)
@@ -206,6 +206,19 @@ static struct arch_domain *init_arch_domains(void)
                {PER_LINUX,     "e2k12c",       "e2k"},
                {PER_LINUX,     "e2k16c",       "e2k"},
                {PER_LINUX,     "e2k2c3",       "e2k"},
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+# ifdef __BIG_ENDIAN__
+               {PER_LINUX32,   "armv7b",       "arm"},
+               {PER_LINUX32,   "armv8b",       "arm"},
+# else
+               {PER_LINUX32,   "armv7l",       "arm"},
+               {PER_LINUX32,   "armv8l",       "arm"},
+# endif
+               {PER_LINUX32,   "armh",         "arm"},
+               {PER_LINUX32,   "arm",          "arm"},
+               {PER_LINUX,     "arm64",        "aarch64"},
+               {PER_LINUX,     "aarch64",      "aarch64"},
 #endif
                /* place holder, will be filled up at runtime */
                {-1,            NULL,           NULL},
@@ -266,7 +279,8 @@ static void verify_arch_domain(struct arch_domain *doms, struct arch_domain *tar
        if (!strcmp(un.machine, target->result_arch))
                return;
 
-       if (!strcmp(target->result_arch, "i386")) {
+       if (!strcmp(target->result_arch, "i386") ||
+           !strcmp(target->result_arch, "arm")) {
                struct arch_domain *dom;
                for (dom = doms; dom->target_arch != NULL; dom++) {
                        if (!dom->result_arch || strcmp(dom->result_arch, target->result_arch))