gpsd: upgrade to 3.24

Usually when upgrading packages, we just copy the upstream package and
adjust it slightly. I've looked at the upstream package here:
https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-navigation/gpsd
(HEAD at f3d14d41ad60d2d52a0ea795ae10fe0882146ed1)

But as I compared both packaging trees, I found ours is quite different
than upstream. We have a lot of additional patches, still use python2 and
have these extra files:

├── gpsd
│   ├── 60-gpsd.rules
│   ├── gpsd
│   ├── gpsd-default
│   ├── gpsd.service
│   ├── oc2g
│   │   ├── gpsd-default
│   │   └── gpsd.service
│   ├── sysmobts2100
│   │   └── gpsd-default
│   ├── sysmobts-v2
│   │   └── gpsd-default
│   └── sysmocom-idu
│       └── gpsd-default

Therefore I didn't start with the upstream packaging but instead
increased the gpsd version in our packaging and went through each patch
to see if it can be dropped or needs to be forward ported.

Change the version by renaming the .bb file. Reset the version of the
recipe (PR) back to "r0" again, as it is common practice after changing
the package version. The previous value "r3.20" looked a bit like a
package version, but it's not that.

Rebase patches:
* 0001-gps2udp-Add-a-label-timestamp-and-mac-address-to-eac.patch
* 0002-gps2udp-leave-argv-untouched.patch (leave-argv-untouched.patch)
* 0003-tsip-configure-and-enable-1PPS.patch (gpsd-tsip-pps.patch)

Add build fixes:
* 0004-SConscript-force-use-of-pthread.patch

Drop patches:
* 0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch:
  unused in previous version
* 0001-SConstruct-disable-html-and-man-docs-building-becaus.patch:
  doesn't apply, instead disable docs building via manbuild='no'
* 0002-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch:
  not needed anymore (no splintopts line in 3.24)
* gpsd-3.3-ldflags.patch:
  fixed upstream
* no-rpath-please.patch:
  doesn't apply, not needed anymore (see 5df2de36 in gpsd.git)

Related: https://docs.yoctoproject.org/bitbake/2.2/bitbake-user-manual/bitbake-user-manual-ref-variables.html#term-PR
Related: SYS#6222
Change-Id: I2debe481c5f1cc4ee8290ad0dc883d6a4ea73741
This commit is contained in:
Oliver Smith 2022-12-13 13:28:40 +01:00 committed by Pau Espin Pedrol
parent a5428afd3a
commit 6a8f914bc1
13 changed files with 311 additions and 385 deletions

View File

@ -1,46 +0,0 @@
From ca1a781afbd68697ef2f573557f1f93ec7ab8d3c Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sun, 29 Apr 2012 00:05:59 +0200
Subject: [PATCH] SConstruct: disable html and man docs building because
xmlto-native from OE is broken
It will try to load dtd and fail:
| xmlto man gpsctl.xml; mv `basename gpsctl.1` gpsctl.1
| xmlto: /var/lib/jenkins/jobs/shr-core-branches/workspace/shr-core/tmp-eglibc/work/armv4t-oe-linux-gnueabi/gpsd-3.4-r2/gpsd-3.4/gpsctl.xml does not validate (status 3)
| xmlto: Fix document syntax or use --skip-validation option
| I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
| /var/lib/jenkins/jobs/shr-core-branches/workspace/shr-core/tmp-eglibc/work/armv4t-oe-linux-gnueabi/gpsd-3.4-r2/gpsd-3.4/gpsctl.xml:8: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
| "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
| ^
| I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
| warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
| validity error : Could not load the external subset "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
| Document /var/lib/jenkins/jobs/shr-core-branches/workspace/shr-core/tmp-eglibc/work/armv4t-oe-linux-gnueabi/gpsd-3.4-r2/gpsd-3.4/gpsctl.xml does not validate
| mv: cannot stat `gpsctl.1': No such file or directory
| scons: *** [gpsctl.1] Error 1
| scons: building terminated because of errors.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
SConstruct | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: gpsd-3.10/SConstruct
===================================================================
--- gpsd-3.10.orig/SConstruct
+++ gpsd-3.10/SConstruct
@@ -704,12 +704,12 @@ size_t strlcpy(/*@out@*/char *dst, /*@in
manbuilder = mangenerator = htmlbuilder = None
if env['manbuild']:
- if config.CheckXsltproc():
+ if False and config.CheckXsltproc():
mangenerator = 'xsltproc'
build = "xsltproc --nonet %s $SOURCE >$TARGET"
htmlbuilder = build % docbook_html_uri
manbuilder = build % docbook_man_uri
- elif WhereIs("xmlto"):
+ elif False and WhereIs("xmlto"):
mangenerator = 'xmlto'
xmlto = "xmlto %s $SOURCE || mv `basename $TARGET` `dirname $TARGET`"
htmlbuilder = xmlto % "html-nochunks"

View File

@ -1,72 +0,0 @@
From dd3ca38b27cce93f7e932abaa27b41371234fa90 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Tue, 24 Apr 2012 18:45:14 +0200
Subject: [PATCH] SConstruct: prefix includepy with sysroot and drop sysroot
from python_lib_dir
* without PYTHONPATH, distutil's sysconfig returns INCLUDEPY without sysroot prefix
and with PYTHONPATH from OE it's pointing to native python dir
$ export PYTHONPATH=/OE/shr-core/tmp-eglibc/sysroots/om-gta02/usr/lib/python2.7/
$ python
Python 2.7.2 (default, Apr 18 2012, 09:19:59)
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils import sysconfig
>>> sysconfig.get_config_vars('INCLUDEPY')
['/OE/shr-core/tmp-eglibc/sysroots/x86_64-linux/usr/include/python2.7']
>>>
$ unset PYTHONPATH
$ python
Python 2.7.2 (default, Apr 18 2012, 09:19:59)
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils import sysconfig
>>> sysconfig.get_config_vars('INCLUDEPY')
['/python2.7']
>>> import sysconfig
>>> sysconfig.get_config_vars('INCLUDEPY')
['/OE/shr-core/tmp-eglibc/sysroots/x86_64-linux/usr/include/python2.7']
* python_lib_dir = python_lib_dir.replace(env['sysroot'], '')
returns path to target sysroot
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
SConstruct | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/SConstruct b/SConstruct
index 3c919fc..8478181 100644
--- a/SConstruct
+++ b/SConstruct
@@ -932,6 +932,12 @@ else:
if vars[i] is None:
vars[i] = []
(cc, cxx, opt, basecflags, ccshared, ldshared, so_ext, includepy, ldflags) = vars
+
+ if env['sysroot']:
+ print "Prefixing includepy '%s' with sysroot prefix" % includepy
+ includepy = os.path.normpath("%s/%s/%s/%s" % (env['sysroot'], env['prefix'], env['includedir'], includepy))
+ print "'%s'" % includepy
+
# in case CC/CXX was set to the scan-build wrapper,
# ensure that we build the python modules with scan-build, too
if env['CC'] is None or env['CC'].find('scan-build') < 0:
@@ -1165,11 +1171,14 @@ if not env['python']:
python_install = []
else:
python_lib_dir = sysconfig.get_python_lib(plat_specific=1)
+ python_lib_dir = python_lib_dir.replace(env['sysroot'], '')
python_module_dir = python_lib_dir + os.sep + 'gps'
python_extensions_install = python_env.Install( DESTDIR + python_module_dir,
python_built_extensions)
if not env['debug'] and not env['profiling'] and env['strip']:
python_env.AddPostAction(python_extensions_install, '$STRIP $TARGET')
+ env.AddPostAction(python_extensions_install, '$CHRPATH -r "%s" "$TARGET"' \
+ % (python_lib_dir, ))
python_modules_install = python_env.Install( DESTDIR + python_module_dir,
python_modules)
--
1.7.8.5

View File

@ -1,140 +0,0 @@
From 19a55075d4e60e07d03d49937cd2a4d9239d00a4 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <hfreyther@sysmocom.de>
Date: Fri, 22 Aug 2014 09:55:19 +0200
Subject: [PATCH] gps2udp: Add a label, timestamp and mac address to each
report
---
gps2udp.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 60 insertions(+), 2 deletions(-)
diff --git a/gps2udp.c b/gps2udp.c
index 313ef36..e1bed05 100644
--- a/gps2udp.c
+++ b/gps2udp.c
@@ -38,6 +38,8 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
#endif /* S_SPLINT_S */
#define MAX_TIME_LEN 80
@@ -56,6 +58,9 @@ static struct fixsource_t gpsd_source;
static unsigned int flags;
static int debug = 0;
static bool aisonly = false;
+static const char *label;
+static const char *mac;
+static char *mac_string;
/*@-statictrans@*/
/*@observer@*/static char* time2string(void)
@@ -80,6 +85,7 @@ static bool aisonly = false;
static int send_udp (char *nmeastring, size_t ind)
{
+ char output[1024];
char message[255];
char *buffer;
int channel;
@@ -105,12 +111,23 @@ static int send_udp (char *nmeastring, size_t ind)
buffer[ind] = '\r'; ind++;
buffer[ind] = '\0';
+ /* copy once more for the label */
+ if (label)
+ snprintf(output, 1024, "%s,%llu,%s,%s",
+ label, (unsigned long long ) time(NULL), mac_string, buffer);
+ else
+ snprintf(output, 1024, "%s", buffer);
+
+ output[1023] = '\0';
+ ind = strlen(output);
+
+
/* send message on udp channel */
/*@-type@*/
for (channel=0; channel < udpchannel; channel ++) {
ssize_t status;
status = sendto(sock[channel],
- buffer,
+ output,
ind,
0,
&remote[channel],
@@ -182,6 +199,8 @@ static void usage(void)
"-c [count] exit after count packets.\n"
"-b Run in background as a daemon.\n"
"-d [0-2] 1 display sent packets, 2 ignored packets.\n"
+ "-l [NAME] A label to be used for the output\n"
+ "-m [IF_NAME] The interface to extract the mac from\n"
"-v Print version and exit.\n\n"
"You must specify one, or more, of -r, -R, or -w\n"
);
@@ -356,7 +375,7 @@ int main(int argc, char **argv)
char *udphostport[MAX_UDP_DEST];
flags = WATCH_ENABLE;
- while ((option = getopt(argc, argv, "?habnjcvl:u:d:")) != -1)
+ while ((option = getopt(argc, argv, "?habnjcvl:u:d:l:m:")) != -1)
{
switch (option) {
case 'd':
@@ -390,6 +409,12 @@ int main(int argc, char **argv)
udphostport[udpchannel++] = optarg;
}
break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'm':
+ mac = optarg;
+ break;
case 'v':
(void)fprintf(stderr, "%s: %s (revision %s)\n",
argv[0], VERSION, REVISION);
@@ -402,6 +427,39 @@ int main(int argc, char **argv)
}
}
+ if (label && !mac) {
+ fprintf(stderr, "Need to specify the ethernet device to find the mac.\n");
+ exit(EXIT_FAILURE);
+ }
+ if (mac && strlen(mac) >= IFNAMSIZ) {
+ fprintf(stderr, "Interface name is too long.\n");
+ exit(EXIT_FAILURE);
+ } else if (mac) {
+ struct ifreq addr = { };
+ int fd, rc;
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ fprintf(stderr, "Failed to open socket.\n");
+ exit(EXIT_FAILURE);
+ }
+ memcpy(&addr.ifr_name, mac, strlen(mac));
+ rc = ioctl(fd, SIOCGIFHWADDR, &addr);
+ close(fd);
+ if (rc < 0) {
+ fprintf(stderr, "Failed to query address.\n");
+ exit(EXIT_FAILURE);
+ }
+ mac_string = malloc(40 * sizeof(char));
+ snprintf(mac_string, 40,
+ "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
+ addr.ifr_hwaddr.sa_data[0] & 0xff,
+ addr.ifr_hwaddr.sa_data[1] & 0xff,
+ addr.ifr_hwaddr.sa_data[2] & 0xff,
+ addr.ifr_hwaddr.sa_data[3] & 0xff,
+ addr.ifr_hwaddr.sa_data[4] & 0xff,
+ addr.ifr_hwaddr.sa_data[5] & 0xff);
+ }
+
/* Grok the server, port, and device. */
if (optind < argc)
gpsd_source_spec(argv[optind], &gpsd_source);
--
1.7.10.4

View File

@ -1,27 +0,0 @@
From f5f262be8ae54bd0c0f52802f2007ec89163756f Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Tue, 24 Apr 2012 11:52:35 +0200
Subject: [PATCH 1/2] SConstruct: respect sysroot also in SPLINTOPTS
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
---
SConstruct | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
Index: gpsd-3.10/SConstruct
===================================================================
--- gpsd-3.10.orig/SConstruct
+++ gpsd-3.10/SConstruct
@@ -1414,7 +1414,10 @@ def Utility(target, source, action):
# Report splint warnings
# Note: test_bits.c is unsplintable because of the PRI64 macros.
# If you get preprocessor or fatal errors, add +showscan.
-splintopts = "-I/usr/include/libusb-1.0 +quiet"
+if not env['sysroot']:
+ splintopts = "-I/usr/include/libusb-1.0 +quiet"
+else:
+ splintopts = "-I%s/usr/include/libusb-1.0 +quiet" % env['sysroot']
# splint does not know about multi-arch, work around that
ma_status, ma = _getstatusoutput('dpkg-architecture -qDEB_HOST_MULTIARCH')
if ma_status == 0:

View File

@ -1,28 +0,0 @@
Index: gpsd-3.10/driver_tsip.c
===================================================================
--- gpsd-3.10.orig/driver_tsip.c
+++ gpsd-3.10/driver_tsip.c
@@ -1201,6 +1201,23 @@ void configuration_packets_generic(struc
/* Request Navigation Configuration */
putbyte(buf, 0, 0x03);
(void)tsip_write(session, 0xbb, buf, 1);
+
+ gpsd_report(session->context->debug,
+ LOG_PROG, "Configuring + Enabling 1PPS\n");
+ /* enable 1pps */
+ putbyte(buf, 0, 0x4a);
+ putbyte(buf, 1, 0x01);
+ (void)tsip_write(session, 0x8e, buf, 2);
+
+ /* request PPS only if at least one sat is visible */
+ putbyte(buf, 0, 0x4e);
+ putbyte(buf, 1, 0x03);
+ (void)tsip_write(session, 0x8e, buf, 2);
+
+ /* request PPS and TSIP to use UTC time, not GPS */
+ putbyte(buf, 0, 0xa2);
+ putbyte(buf, 1, 0x03);
+ (void)tsip_write(session, 0x8e, buf, 2);
}
void configuration_packets_accutime_gold(struct gps_device_t *session)

View File

@ -1,31 +0,0 @@
Index: gpsd-3.10/gps2udp.c
===================================================================
--- gpsd-3.10.orig/gps2udp.c
+++ gpsd-3.10/gps2udp.c
@@ -353,6 +353,7 @@ int main(int argc, char **argv)
bool daemonize = false;
long count = -1;
int option;
+ int i;
char *udphostport[MAX_UDP_DEST];
flags = WATCH_ENABLE;
@@ -387,7 +388,7 @@ int main(int argc, char **argv)
"gps2udp: too many UDP destinations (max=%d)\n",
MAX_UDP_DEST);
} else {
- udphostport[udpchannel++] = optarg;
+ udphostport[udpchannel++] = strdup(optarg);
}
break;
case 'v':
@@ -490,6 +491,9 @@ int main(int argc, char **argv)
} // end count
} // end len > 3
} // end for (;;)
+
+ for (i = 0; i < udpchannel; ++i)
+ free(udphostport[i]);
// This is an infinite loop, should never be here
/*@-unreachable@*/

View File

@ -1,12 +0,0 @@
Index: gpsd-3.9/SConstruct
===================================================================
--- gpsd-3.9.orig/SConstruct
+++ gpsd-3.9/SConstruct
@@ -223,6 +223,7 @@ env['PYTHON'] = sys.executable
env['STRIP'] = "strip"
env['PKG_CONFIG'] = "pkg-config"
env['CHRPATH'] = 'chrpath'
+env['_RPATH'] = ''
for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP", "PKG_CONFIG", "CHRPATH", "LD", "TAR"]:
if os.environ.has_key(i):
j = i

View File

@ -0,0 +1,156 @@
From cd89f0b340764e73de76f5297217caf61b3d3283 Mon Sep 17 00:00:00 2001
From: Oliver Smith <osmith@sysmocom.de>
Date: Tue, 13 Dec 2022 16:05:00 +0100
Subject: [PATCH] gps2udp: Add a label, timestamp and mac address to each
report
Rebase of 0001-gps2udp-Add-a-label-timestamp-and-mac-address-to-eac.patch
we have been carrying:
From 19a55075d4e60e07d03d49937cd2a4d9239d00a4 Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <hfreyther@sysmocom.de>
Date: Fri, 22 Aug 2014 09:55:19 +0200
Subject: [PATCH] gps2udp: Add a label, timestamp and mac address to each
report
---
clients/gps2udp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 59 insertions(+), 2 deletions(-)
diff --git a/clients/gps2udp.c b/clients/gps2udp.c
index 2d9c6033d..d27814f24 100644
--- a/clients/gps2udp.c
+++ b/clients/gps2udp.c
@@ -22,6 +22,7 @@
#include <getopt.h> // for getopt_long()
#endif
#include <netdb.h> /* for gethostbyname() */
+#include <net/if.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdio.h>
@@ -29,6 +30,7 @@
// do not use strsep() it is not POSIX
#include <string.h> /* for strlcpy(), strtok(), etc. */
#include <strings.h>
+#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -60,6 +62,9 @@ static unsigned int flags;
static unsigned int debug = 0;
static bool aisonly = false;
static bool tpvonly = false;
+static const char *label;
+static const char *mac;
+static char *mac_string;
// return local time hh:mm:ss
static char* time2string(void)
@@ -82,6 +87,7 @@ static char* time2string(void)
static int send_udp(char *nmeastring, size_t ind)
{
+ char output[1024];
char message[MAX_PACKET_LENGTH];
char *buffer;
int channel;
@@ -108,6 +114,16 @@ static int send_udp(char *nmeastring, size_t ind)
buffer[ind] = '\n'; ind++;
buffer[ind] = '\0';
+ /* copy once more for the label */
+ if (label)
+ snprintf(output, 1024, "%s,%llu,%s,%s",
+ label, (unsigned long long ) time(NULL), mac_string, buffer);
+ else
+ snprintf(output, 1024, "%s", buffer);
+
+ output[1023] = '\0';
+ ind = strlen(output);
+
if (0 == (flags & WATCH_JSON) &&
'{' == buffer[0]) {
// do not send JSON when not configured to do so
@@ -129,7 +145,7 @@ static int send_udp(char *nmeastring, size_t ind)
// send message on udp channel
for (channel=0; channel < udpchannel; channel ++) {
ssize_t status = sendto(sock[channel],
- buffer,
+ output,
ind,
0,
(struct sockaddr *)&remote[channel],
@@ -225,6 +241,8 @@ static void usage(void)
" -c COUNT Exit after count packets.\n"
" -d [0-2] 1 display sent packets, "
"2 display ignored packets.\n"
+ " -l [NAME] A label to be used for the output\n"
+ " -m [IF_NAME] The interface to extract the mac from\n"
" -h Show this help.\n"
" -j Feed JSON.\n"
" -n Feed NMEA.\n"
@@ -421,7 +439,7 @@ int main(int argc, char **argv)
bool daemonize = false;
long count = -1;
char *udphostport[MAX_UDP_DEST];
- const char *optstring = "?abc:d:hjntu:V";
+ const char *optstring = "?abc:d:l:m:hjntu:V";
#ifdef HAVE_GETOPT_LONG
int option_index = 0;
static struct option long_options[] = {
@@ -478,6 +496,12 @@ int main(int argc, char **argv)
if (0 < debug)
(void)fprintf(stdout, "Debug %u selected\n", debug);
break;
+ case 'l':
+ label = optarg;
+ break;
+ case 'm':
+ mac = optarg;
+ break;
case 'j':
if (0 < debug)
(void)fprintf(stdout, "JSON selected\n");
@@ -520,6 +544,39 @@ int main(int argc, char **argv)
}
}
+ if (label && !mac) {
+ fprintf(stderr, "Need to specify the ethernet device to find the mac.\n");
+ exit(EXIT_FAILURE);
+ }
+ if (mac && strlen(mac) >= IFNAMSIZ) {
+ fprintf(stderr, "Interface name is too long.\n");
+ exit(EXIT_FAILURE);
+ } else if (mac) {
+ struct ifreq addr = { };
+ int fd, rc;
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ fprintf(stderr, "Failed to open socket.\n");
+ exit(EXIT_FAILURE);
+ }
+ memcpy(&addr.ifr_name, mac, strlen(mac));
+ rc = ioctl(fd, SIOCGIFHWADDR, &addr);
+ close(fd);
+ if (rc < 0) {
+ fprintf(stderr, "Failed to query address.\n");
+ exit(EXIT_FAILURE);
+ }
+ mac_string = malloc(40 * sizeof(char));
+ snprintf(mac_string, 40,
+ "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
+ addr.ifr_hwaddr.sa_data[0] & 0xff,
+ addr.ifr_hwaddr.sa_data[1] & 0xff,
+ addr.ifr_hwaddr.sa_data[2] & 0xff,
+ addr.ifr_hwaddr.sa_data[3] & 0xff,
+ addr.ifr_hwaddr.sa_data[4] & 0xff,
+ addr.ifr_hwaddr.sa_data[5] & 0xff);
+ }
+
// Grok the server, port, and device.
if (optind < argc) {
gpsd_source_spec(argv[optind], &gpsd_source);
--
2.34.1

View File

@ -0,0 +1,58 @@
From 901b3f9b6747eca8893ecaae824be396a6a4b5db Mon Sep 17 00:00:00 2001
From: Oliver Smith <osmith@sysmocom.de>
Date: Tue, 13 Dec 2022 15:37:15 +0100
Subject: [PATCH] gps2udp: leave argv untouched
Rebase of leave-argv-untouched.patch we carried. Doesn't seem important,
but to keep the behavior consistent. Originally added with the following
commit message to meta-sysmocom-bsp.git:
commit 26d74189eb2023ce14af8dd41b36cd388ab8bebb
Author: Holger Hans Peter Freyther <holger@moiji-mobile.com>
Date: Tue Jul 15 08:28:42 2014 +0200
gpsd: Do not mess with the argv of the process
Henning got really confused that the "a.b.c:1234" he passed to
gps2udp showed up as "a.b.c 1234" in the kernel cmdline. Use
strdup to take a copy of it.
Fixes: SYS#424
---
clients/gps2udp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clients/gps2udp.c b/clients/gps2udp.c
index d27814f24..81d141fa2 100644
--- a/clients/gps2udp.c
+++ b/clients/gps2udp.c
@@ -436,6 +436,7 @@ static unsigned int AISGetInt(unsigned char *bitbytes, unsigned int sp,
int main(int argc, char **argv)
{
+ int i;
bool daemonize = false;
long count = -1;
char *udphostport[MAX_UDP_DEST];
@@ -526,7 +527,7 @@ int main(int argc, char **argv)
"gps2udp: too many UDP destinations (max=%d).\n",
MAX_UDP_DEST);
} else {
- udphostport[udpchannel++] = optarg;
+ udphostport[udpchannel++] = strdup(optarg);
if (0 < debug) {
(void)fprintf(stdout, "UDP %s added.\n", optarg);
}
@@ -686,6 +687,9 @@ int main(int argc, char **argv)
} // end len > 3
} // end for (;;)
+ for (i = 0; i < udpchannel; ++i)
+ free(udphostport[i]);
+
// This is an infinite loop, should never be here
(void)fprintf (stderr, "gpsd2udp ERROR abnormal exit\n");
exit (-1);
--
2.34.1

View File

@ -0,0 +1,49 @@
From 9b12594ed0ce769d923a3b4f4d42c3b25caa87d3 Mon Sep 17 00:00:00 2001
From: Oliver Smith <osmith@sysmocom.de>
Date: Tue, 13 Dec 2022 15:25:52 +0100
Subject: [PATCH] tsip: configure and enable 1PPS
Rebase of gpsd-tsip-pps.patch we have been carrying:
From www/time-service-intro.adoc:
> GPS enables receivers to generate a pulse-per-second
> signal ("1PPS" or just "PPS") accurate to the top of the current
> UTC second within 50 ns.
---
drivers/driver_tsip.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/driver_tsip.c b/drivers/driver_tsip.c
index 57b97513c..673bbef7e 100644
--- a/drivers/driver_tsip.c
+++ b/drivers/driver_tsip.c
@@ -4288,6 +4288,26 @@ void configuration_packets_generic(struct gps_device_t *session)
/* Primary Receiver Configuration Parameters Request (0xbb-00)
* returns Primary Receiver Configuration Block (0xbb-00) */
(void)tsip_write1(session, "\xbb\x00", 2);
+
+ GPSD_LOG(LOG_PROG, &session->context->errout,
+ "Configuring + Enabling 1PPS\n");
+ /* enable 1pps */
+ putbyte(buf, 0, 0x8e);
+ putbyte(buf, 1, 0x4a);
+ putbyte(buf, 2, 0x01);
+ (void)tsip_write1(session, buf, 3);
+
+ /* request PPS only if at least one sat is visible */
+ putbyte(buf, 0, 0x8e);
+ putbyte(buf, 1, 0x4e);
+ putbyte(buf, 2, 0x03);
+ (void)tsip_write1(session, buf, 3);
+
+ /* request PPS and TSIP to use UTC time, not GPS */
+ putbyte(buf, 0, 0x8e);
+ putbyte(buf, 1, 0xa2);
+ putbyte(buf, 2, 0x03);
+ (void)tsip_write1(session, buf, 3);
}
/* configure Acutime Gold to a known state */
--
2.34.1

View File

@ -0,0 +1,38 @@
From 221681eeebd621287bd7587475da27d4e7dd17fc Mon Sep 17 00:00:00 2001
From: Oliver Smith <osmith@sysmocom.de>
Date: Tue, 13 Dec 2022 17:53:41 +0100
Subject: [PATCH] SConscript: force use of -pthread
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With gpsd 3.24, the build system fails to properly detect that our GCC
supports -pthread. When attempting to build without it, the build fails
as follows.
…/ld: gpsd-3.24/libgpsd.a(ppsthread.o): undefined reference to symbol 'pthread_create@@GLIBC_2.4'
…/tmp/ERROR: scons build execution failed.
…/gpsd/3.24-r0/recipe-sysroot/lib/libpthread.so.0: error adding symbols: DSO missing from command line
| collect2: error: ld returned 1 exit status
---
SConscript | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/SConscript b/SConscript
index ddffe068d..ec660c458 100644
--- a/SConscript
+++ b/SConscript
@@ -942,9 +942,7 @@ if not cleaning and not helping:
if not config.CheckCC():
announce("ERROR: CC doesn't work")
- if ((config.CheckCompilerOption("-pthread") and
- not config.env['target_platform'].startswith('darwin'))):
- config.env.MergeFlags("-pthread")
+ config.env.MergeFlags("-pthread")
confdefs = ["/* gpsd_config.h generated by scons, do not hand-hack. */\n"]
--
2.34.1

View File

@ -1,17 +0,0 @@
https://bugs.gentoo.org/391299
split up linking flags into multiple arguments
Index: gpsd-3.10/SConstruct
===================================================================
--- gpsd-3.10.orig/SConstruct 2017-03-28 23:47:02.815665786 +0200
+++ gpsd-3.10/SConstruct 2017-03-28 23:47:40.463666285 +0200
@@ -250,7 +250,7 @@
env.Replace(**{j: os.getenv(i)})
for flag in ["LDFLAGS", "LINKFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
if os.environ.has_key(flag):
- env.MergeFlags({flag : [os.getenv(flag)]})
+ env.MergeFlags({flag : Split(os.getenv(flag))})
# Keep scan-build options in the environment

View File

@ -1,28 +1,25 @@
SUMMARY = "A TCP/IP Daemon simplifying the communication with GPS devices"
SECTION = "console/network"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=7a5d174db44ec45f9638b2c747806821"
DEPENDS = "ncurses python"
PROVIDES = "virtual/gpsd"
PR = "r3.20"
PR = "r0"
SRC_URI = "http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz \
file://0002-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch \
file://0001-SConstruct-disable-html-and-man-docs-building-becaus.patch \
file://gpsd-3.3-ldflags.patch \
file://no-rpath-please.patch \
file://gpsd-tsip-pps.patch \
file://leave-argv-untouched.patch \
file://0001-gps2udp-Add-a-label-timestamp-and-mac-address-to-eac.patch \
file://0002-gps2udp-leave-argv-untouched.patch \
file://0003-tsip-configure-and-enable-1PPS.patch \
file://0004-SConscript-force-use-of-pthread.patch \
file://gpsd-default \
file://gpsd \
file://60-gpsd.rules \
file://gpsd.service \
"
SRC_URI[md5sum] = "fc5b03aae38b9b5b6880b31924d0ace3"
SRC_URI[sha256sum] = "706fc2c1cf3dfbf87c941f543381bccc9c4dc9f8240eec407dcbf2f70b854320"
SRC_URI[md5sum] = "c4e743a507a137c00fdb28ef35b145d0"
SRC_URI[sha256sum] = "00ee13f615655284874a661be13553abe66128e6deb5cd648af9bc0cb345fe5c"
inherit scons update-rc.d systemd
@ -66,6 +63,7 @@ EXTRA_OESCONS = " \
chrpath='false' \
systemd='${SYSTEMD_OESCONS}' \
libdir='${libdir}' \
manbuild='false' \
${PACKAGECONFIG_CONFARGS} \
"
# this cannot be used, because then chrpath is not found and only static lib is built
@ -109,7 +107,7 @@ do_install_append() {
#support for systemd
install -d ${D}${systemd_system_unitdir}/
install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_system_unitdir}/${BPN}.service
install -m 0644 ${S}/systemd/${BPN}.socket ${D}${systemd_system_unitdir}/${BPN}.socket
install -m 0644 ${BPN}-${PV}/systemd/${BPN}.socket ${D}${systemd_system_unitdir}/${BPN}.socket
}
pkg_postinst_${PN}-conf() {