FreeCalypso > hg > fc-magnetite
annotate helpers/build-date.c @ 636:57e67ca2e1cb
pcmdata.c: default +CGMI to "FreeCalypso" and +CGMM to model
The present change has no effect whatsoever on Falconia-made and Openmoko-made
devices on which /pcm/CGMI and /pcm/CGMM files have been programmed in FFS
with sensible ID strings by the respective factories, but what should AT+CGMI
and AT+CGMM queries return when the device is a Huawei GTM900 or Tango modem
that has been converted to FreeCalypso with a firmware change? Before the
present change they would return compiled-in defaults of "<manufacturer>" and
"<model>", respectively; with the present change the firmware will self-identify
as "FreeCalypso GTM900-FC" or "FreeCalypso Tango" on the two respective targets.
This firmware identification will become important if someone incorporates an
FC-converted GTM900 or Tango modem into a ZeroPhone-style smartphone where some
high-level software like ofono will be talking to the modem and will need to
properly identify this modem as FreeCalypso, as opposed to some other AT command
modem flavor with different quirks.
In technical terms, the compiled-in default for the AT+CGMI query (which will
always be overridden by the /pcm/CGMI file in FFS if one is present) is now
"FreeCalypso" in all configs on all targets; the compiled-in default for the
AT+CGMM query (likewise always overridden by /pcm/CGMM if present) is
"GTM900-FC" if CONFIG_TARGET_GTM900 or "Tango" if CONFIG_TARGET_TANGO or the
original default of "<model>" otherwise.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Jan 2020 20:14:58 +0000 |
parents | adf7a4281fd7 |
children |
rev | line source |
---|---|
248
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program runs at firmware build time to produce a C file for the |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * fw build that includes the build date and time stamp. |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
577
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
8 #include <string.h> |
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
9 #include <strings.h> |
248
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <time.h> |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 main(argc, argv) |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char **argv; |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 time_t now; |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 struct tm *tm; |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
577
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
18 if (argc < 2 || argc > 4) { |
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
19 fprintf(stderr, |
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
20 "usage: %s config_name target_name src_version\n", |
572
074e24776948
helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents:
248
diff
changeset
|
21 argv[0]); |
248
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 exit(1); |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 time(&now); |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 tm = gmtime(&now); |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 printf("const char firmware_version_str[] =\n"); |
577
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
27 if (argc >= 3) |
572
074e24776948
helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents:
248
diff
changeset
|
28 printf("\"FreeCalypso Magnetite %s (%s), ", argv[1], argv[2]); |
074e24776948
helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents:
248
diff
changeset
|
29 else |
074e24776948
helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents:
248
diff
changeset
|
30 printf("\"FreeCalypso Magnetite %s, ", argv[1]); |
577
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
31 if (argc >= 4 && strcmp(argv[3], "unknown")) |
adf7a4281fd7
helpers/build-date.c: added support for including source version ID
Mychaela Falconia <falcon@freecalypso.org>
parents:
572
diff
changeset
|
32 printf("source version %s, ", argv[3]); |
248
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 printf("build date %d-%02d-%02dT%02d:%02d:%02dZ\";\n", |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 tm->tm_hour, tm->tm_min, tm->tm_sec); |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 exit(0); |
35b17d54773d
helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |