You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.8 KiB

diff -up rpm-4.9.1.3/lib/rpmrc.c.niagara rpm-4.9.1.3/lib/rpmrc.c
--- rpm-4.9.1.3/lib/rpmrc.c.niagara 2012-04-19 17:06:23.130595223 +0200
+++ rpm-4.9.1.3/lib/rpmrc.c 2012-04-19 17:06:23.134739249 +0200
@@ -718,6 +718,31 @@ exit:
return rc;
}
+#if defined(__linux__) && defined(__sparc__)
+static int is_sun4v()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
+ close(fd);
+ return 0;
+ }
+ close(fd);
+
+ p = strstr(buffer, "type");
+ p = strtok(p, "\n");
+ p = strstr(p, "sun");
+ if (p == NULL) {
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'type' line\n"));
+ return 0;
+ } else if (strcmp(p, "sun4v") == 0) {
+ return 1;
+ }
+ return 0;
+}
+#endif
+
# if defined(__linux__) && defined(__i386__)
#include <setjmp.h>
@@ -1178,6 +1203,13 @@ static void defaultMachine(const char **
personality(oldpers);
}
}
+ if (is_sun4v()){
+ if (strcmp(un.machine, "sparcv9") == 0 || strcmp(un.machine, "sparc") == 0 ) {
+ strcpy(un.machine, "sparcv9v");
+ } else if (strcmp(un.machine, "sparc64") == 0 ) {
+ strcpy(un.machine, "sparc64v");
+ }
+ }
# endif /* sparc*-linux */
# if defined(__linux__) && defined(__powerpc__)
diff -up rpm-4.9.1.3/rpmrc.in.niagara rpm-4.9.1.3/rpmrc.in
--- rpm-4.9.1.3/rpmrc.in.niagara 2012-04-19 17:06:23.131476769 +0200
+++ rpm-4.9.1.3/rpmrc.in 2012-04-19 17:06:23.135738996 +0200
@@ -316,7 +316,7 @@ arch_compat: sun4c: sparc
arch_compat: sun4d: sparc
arch_compat: sun4m: sparc
arch_compat: sun4u: sparc64
-arch_compat: sparc64v: sparc64
+arch_compat: sparc64v: sparc64 sparcv9v
arch_compat: sparc64: sparcv9
arch_compat: sparcv9v: sparcv9
arch_compat: sparcv9: sparcv8