diff --git a/build.xml b/build.xml index 7007f750f..e4e313b36 100644 --- a/build.xml +++ b/build.xml @@ -505,8 +505,11 @@ - - + + + + + diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index 312babe83..d90ca32c2 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -9,6 +9,7 @@ package net.i2p.util; */ import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -28,6 +29,7 @@ import freenet.support.CPUInformation.VIACPUInfo; import freenet.support.CPUInformation.UnknownCPUException; import net.i2p.I2PAppContext; +import net.i2p.data.DataHelper; /** *

BigInteger that takes advantage of the jbigi library for the modPow operation, @@ -629,6 +631,35 @@ public class NativeBigInteger extends BigInteger { // athlon64_64 is always a fallback for 64 bit rv.add(_libPrefix + getMiddleName1() + JBIGI_OPTIMIZATION_ATHLON64 + "_64" + _libSuffix); } + + if (_isArm) { + InputStream in = null; + try { + in = new FileInputStream("/proc/cpuinfo"); + while (true) { + String line = DataHelper.readLine(in); + if (line == null) + break; + if (!line.startsWith("CPU architecture")) + continue; + //CPU architecture: 5TEJ + //CPU architecture: 7 + int colon = line.indexOf(": "); + String sver = line.substring(colon + 2, colon + 3); + int ver = Integer.parseInt(sver); + // add libjbigi-linux-armv7.so, libjbigi-linux-armv6.so, ... + for (int i = ver; i >= 3; i--) { + rv.add(_libPrefix + getMiddleName1() + primary + 'v' + i + _libSuffix); + } + break; + } + } catch (NumberFormatException nfe) { + } catch (IOException ioe) { + } finally { + if (in != null) try { in.close(); } catch (IOException ioe) {} + } + } + // the preferred selection rv.add(_libPrefix + getMiddleName1() + primary + _libSuffix); diff --git a/history.txt b/history.txt index d207ca1e9..9c5f2ecf0 100644 --- a/history.txt +++ b/history.txt @@ -1,5 +1,7 @@ 2011-07-26 zzz * Installer: The previous wrapper files only work on armv7 + * NativeBigInteger: Move libjbigi-linux-arm.so to libjbigi-linux-armv7.so, + do ARM version detection in NBI. * NetDB: - Explore even more aggressively at startup - Increase SingleSearchJob timeout diff --git a/installer/lib/jbigi/libjbigi-linux-arm.so b/installer/lib/jbigi/libjbigi-linux-armv7.so similarity index 100% rename from installer/lib/jbigi/libjbigi-linux-arm.so rename to installer/lib/jbigi/libjbigi-linux-armv7.so