armsrc check: skip if no src available; postpone warning

This commit is contained in:
Philippe Teuwen 2022-02-14 13:37:20 +01:00
commit 14f62eaa88
3 changed files with 15 additions and 7 deletions

View file

@ -287,6 +287,7 @@ static void SendVersion(void) {
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1); strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);
} }
FormatVersionInformation(temp, sizeof(temp), " os: ", &g_version_information); FormatVersionInformation(temp, sizeof(temp), " os: ", &g_version_information);
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1); strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1); strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);

View file

@ -1072,22 +1072,27 @@ void pm3_version(bool verbose, bool oneliner) {
struct p *payload = (struct p *)&resp.data.asBytes; struct p *payload = (struct p *)&resp.data.asBytes;
PrintAndLogEx(NORMAL, payload->versionstr); bool armsrc_mismatch = false;
char *ptr = strstr(payload->versionstr, " os: "); char *ptr = strstr(payload->versionstr, " os: ");
if (ptr != NULL) { if (ptr != NULL) {
ptr = strstr(ptr, "\n"); ptr = strstr(ptr, "\n");
if (ptr != NULL) { if ((ptr != NULL) && (strlen(g_version_information.armsrc) == 9)) {
if (strncmp(ptr-9, g_version_information.armsrc, 9) != 0) { if (strncmp(ptr-9, g_version_information.armsrc, 9) != 0) {
PrintAndLogEx(NORMAL, "\n:warning: " _RED_("ARM os does not match the source at the time the client was compiled") " :warning:"); armsrc_mismatch = true;
PrintAndLogEx(NORMAL, "Make sure to flash a correct and up-to-date version");
} }
} }
} }
PrintAndLogEx(NORMAL, payload->versionstr);
if (strstr(payload->versionstr, "2s30vq100") == NULL) { if (strstr(payload->versionstr, "2s30vq100") == NULL) {
PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch")); PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch"));
} }
lookupChipID(payload->id, payload->section_size); lookupChipID(payload->id, payload->section_size);
if (armsrc_mismatch) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, _RED_("ARM firmware does not match the source at the time the client was compiled"));
PrintAndLogEx(WARNING, "Make sure to flash a correct and up-to-date version");
}
} }
} }
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");

View file

@ -59,9 +59,11 @@ if [ "$fullgitinfoextra" != "$fullgitinfo" ]; then
fullgitinfo="${fullgitinfo46}..." fullgitinfo="${fullgitinfo46}..."
fi fi
sha=$( sha=$(
pm3path=$(dirname -- "$0")/.. pm3path=$(dirname -- "$0")/..
cd "$pm3path" || return cd "$pm3path" || return
ls armsrc/*.[ch] common_arm/*.[ch]|grep -v disabled|grep -v version_pm3|xargs sha256sum|sha256sum|grep -o '^.........' # did we find the src?
[ -f armsrc/appmain.c ] || return
ls armsrc/*.[ch] common_arm/*.[ch]|grep -v disabled|grep -v version_pm3|xargs sha256sum|sha256sum|grep -o '^.........'
) )
cat <<EOF cat <<EOF
#include "common.h" #include "common.h"