-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
410 lines (307 loc) · 16.5 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
= GPSD Installation Instructions =
:title: GPSD Installation Instructions
:description: Steps for installing GPSD and verifying its performance.
:keywords: GPSD, GPS, installation
:author: Eric S. Raymond <[email protected]>
:robots:index,follow
Here are the steps for installing GPSD and verifying its performance.
They assume you have GPSD available as an installable binary package,
Instructions for building GPSD from source (including cross-building)
are in the file "build.txt" in the source distribution.
Most of these installation instructions are generic to Linux (inc
There are some special notes on installation for OS X and the Raspberry Pi
near the end of this file.
== Check that your GPS is live and you can get data from it ==
Start by making sure you can get data from your GPS, otherwise the later
steps will be very frustrating. In this command
stty -F /dev/ttyXXX ispeed 4800 && cat </dev/ttyXXX
replace ttyXXX with the filename of the port. This will probably be
either /dev/ttyUSB0 or /dev/ttyS0. If you are on a *BSD Unix or MacOS X,
replace -F with -f.
When you run this command, you should see text lines beginning with $
come to stdout (possibly after a short initial burst of binary
garbage). If you don't see this, you may have OS-level problems with
your serial support, but more likely have the wrong device. Look
again.
If you have trouble with the preceding step, check your cabling
first. Verify that the device is connected and that its power LED
(if it has one) is lit.
If you seem to have some sort of serial-device problem, check that
your kernel properly supports the device you are using. For GPSes
using an RS-232 port (which is no longer common) you will need
serial-port support compiled into your kernel. Various USB-to-serial
adapter chips found in GPSes require specific drivers.
Under a stock Linux kernel these will all be loaded on demand when
the USB system sees the appropriate vendor/product ID combinations.
See build.txt for instructions relating to custom kernels.
== Check that your system configuration will allow GPSD to work ==
Ensure that device permissions will enable gpsd to read from and write
to GPS devices even after it drops root privileges. If you are
running Fedora Core, Ubuntu, or stock Debian you can skip this step,
as the stock configuration has the right properties.
gpsd requires two things: (1) that GPS devices have group read and
write enabled, and (2) all of them have the same group ID as a
prototypical device, typically /dev/ttyS0 under Linux or /dev/tty00
under *BSD. It does not actually matter what the owning group is, as
gpsd will look this up on startup. Alternatively, (3), you can set a
fallback group with the gpsd-group option in case the prototype is not
found: this should be the group that has write access to serial
devices. On Debian and derivatives including Ubuntu this is "dialout";
on Gentoo/Fedora/openSuse it is "uucp".
Before dropping privileges, gpsd will ensure that it has access to
devices given to it on the command line by forcing their group read
and write permissions on.
On a Linux with udev, check the files in /etc/udev/permissions.d to
ensure that /dev/tty* devices are all created with the same group
and with 0660 permissions.
When gpsd drops privileges, its default is to set uid to 'nobody' and
group to the owning group of the prototype device (the configure
option gpsd-user=foo will cause gpsd to change to 'foo'
instead).
If your system has the Linux hotplug facility installed you can skip
the permission-setting part; the hotplug scripts will force the
permissions for you. You still have to make sure all the tty devices
are in the same group.
== Check your installation prerequisites ==
A minimum build of GPSD can run pretty close to the metal; all it
absolutely needs is the C runtime support. The test clients and
various additional features have additional prerequisites:
|===============================================================================
|pthreads library | support for PPS timekeeping on serial GPSes
|DBUS | gpsd will issue DBUS notifications
|ncurses | a test client and the GPS monitor depend on this
|libtinfo5 | shared low-level terminfo library (see below)
|libusb-1.0.x or later | better USB device discovery
|Qt + qmake | libQgpsmm depends on this
|python2.x(x>=6) or 3.y(y>=2) | required for various clients and utilities
|python-GI bindings | the test clients xgps and xgpsspeed, need this
|pyserial | ubxtool and zerk need this
|===============================================================================
Some ncurses packages contain the terminfo library; some break it out
separately as libtinfo5 or libtinfo.
== Installing gpsd ==
=== Install your distributions package(s) ===
Up-to-date gpsd packages are generally available for Linux distributions
including Debian and derivatives (including Ubuntu and Mint), Fedora and
derivatives (including CentOS), openSUSE, PCLinuxOS, Mageia, Gentoo, and
Slackware. In the embedded space, CeroWRT and Yocto carry GPSD. The
GPSD package in the FreeBSD ports tree is also reliably up to date.
Even if your distribution is not on this list, it is quite likely GPSD
has already been packaged for it.
Whatever distribution you are running, the name of the core GPSD
package containing the service daemon is almost certainly "gpsd".
However, many distributions break up GPSD into separate installable
packages for the core daemon and clients; you should search your
repository index for anything with gpsd as a prefix.
=== Install from source code ===
Directions for installing from source are in the file build.txt found
in the source distribution.
== How to test the software ==
1. Start gpsd. You'll need to give it as an argument a path to
a serial or USB port with a GPS attached to it. Your test command
should look something like this:
gpsd -D 5 -N -n /dev/ttyUSB0
2. Once gpsd is running, telnet to port 2947. You should see a
greeting line that's a JSON object describing GPSD's version.
Now plug in your GPS (or AIS receiver, or RTCM2 receiver).
3. Type '?WATCH={"enable":true,"json":true};' to start raw and
watcher modes. You should see lines beginning with '{' that are
JSON objects representing reports from your GPS; these are reports
in GPSD protocol.
4. Start the xgps or cgps client. Calling it with no arguments
should do the right thing. You should see a display panel with
position/velocity-time information, and a satellite display. The
displays won't look very interesting until the GPS acquires satellite
lock.
5. Have patience. If you are cold-starting a new GPS, it may take
15-20 minutes after it gets a skyview for it to download an ephemeris
and begin delivering fixes.
6. A FAQ and troubleshooting instructions can be found at the GPSD
project site.
== Once you have verified correct operation ==
1. If you installed from a .deb under Debian or a Debian-derived
system, you may need to `dpkg-reconfigure -plow gpsd' to enable the
hotplug magic ("Start gpsd automatically").
2. Check out the list of supported hardware at the Hardware page on
the GPSD project's website. If your GPS isn't on the list, please send
us information to add a new line to the table. Directions are
included on that page. We can also use updates of the latest version
number known to work with hardware already supported.
3. GPSD includes gpsd.php, a PHP script, that you can use to generate
a PHP status page for your GPS if you wish. (It may not be in the
core package.) It should be manually copied to your HTTP document
directory. The first time it's invoked, it will generate a file
called 'gpsd_config.inc' in that directory containing configuration
information; edit to taste.
4. There are other non-essential scripts that may be useful; these
are in the contrib/ directory of the source. They may not be available
in the packages available from distributions.
For special instructions related to using GPSD for time service, see the
GPSD Time Service HOWTO in the distribution or on the web.
== Special Notes for OS X Installation ==
gpsd will build, install and run on OS X. The easiest way to do so is
to first install the MacPorts package. Follow their install procedure
at: http://www.macports.org/install.php
Then use their port command to install scons, and optionally git if you
want to access the development source.
--------------------------------------------------------------
# port install scons
# port install git
--------------------------------------------------------------
While running gpsd, or scons check, you may run out of shared memory
segments. If so, you will see this error message:
--------------------------------------------------------------
gpsd:ERROR: shmat failed: Too many open files
--------------------------------------------------------------
By default OS X allows a very small number of shared segments. You
can check your allowed maximum number of shared segments, then increase
the maximum number, with these commands:
--------------------------------------------------------------
# sysctl kern.sysv.shmseg=8
kern.sysv.shmseg: 32 -> 8
# sysctl -a | fgrep shmseg
kern.sysv.shmseg: 8
# sysctl kern.sysv.shmseg=16
kern.sysv.shmseg: 8 -> 16
# sysctl -a | fgrep shmseg
kern.sysv.shmseg: 16
--------------------------------------------------------------
If you are using a USB based GPS you will likely need the Prolific
PL2303 driver. You can find it here:
http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41
== Special Notes for Raspberry Pi Installation ==
gpsd will build, install and run on the Raspberry Pi (RasPi) and Pi 2
using Debian jessie. Other distributions based on
Debian (raspbian, etc) will work fine as well. The gpsd
package in Debian Wheezy is known to be flaky, be sure to update to a
new version of gpsd from source.
=== Raspbian ===
Before compiling gpsd from source, you will need to update your system
as root. Switching to the latest raspbian distribution (jessie)
is strongly recommended.
--------------------------------------------------------------
# apt-get update
# apt-get dist-upgrade
# rpi-update
# reboot
--------------------------------------------------------------
--------------------------------------------------------------
# apt-get install scons libncurses5-dev python-dev pps-tools
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
=== Other Debian derivatives (including stock) ===
==== Jessie ====
--------------------------------------------------------------
# apt-get install scons libncurses5-dev python-dev pps-tools
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
==== Wheezy ====
Wheezy, being older, requires updating the tools for compiling
and testing gpsd:
You need scons at 2.3.0 or higher to build.
If your scons is less than 2.3.0 you will need to get a newer scons
from wheezy-backport. Partial instructions are detailed here:
http://backports.debian.org/Instructions/
Basically you need to add this line to /etc/apt/sources.list:
--------------------------------------------------------------
deb http://http.debian.net/debian wheezy-backports main
--------------------------------------------------------------
Then do another update:
--------------------------------------------------------------
apt-get update
--------------------------------------------------------------
Which may lead you to this error if you lack a full set of debian keys:
--------------------------------------------------------------
W: GPG error: http://http.debian.net wheezy-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553
--------------------------------------------------------------
Partial but detailed instructions to fix that are here:
--------------------------------------------------------------
https://wiki.debian.org/SecureApt
--------------------------------------------------------------
Use either of the following code blocks. The first is more robust:
--------------------------------------------------------------
apt-get install debian-archive-keyring
--------------------------------------------------------------
--------------------------------------------------------------
gpg --keyserver pgpkeys.mit.edu --recv 8B48AD6246925553
gpg -a --export 46925553 | apt-key add -
apt-get update
--------------------------------------------------------------
You can now install scons from the wheezy-backports repository:
--------------------------------------------------------------
apt-get -t wheezy-backports install scons
--------------------------------------------------------------
and other tools:
--------------------------------------------------------------
# apt-get install scons libncurses5-dev python-dev pps-tools
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
=== Other Raspberry Pi tips ===
Any USB connected GPS that is known to work with gpsd will work fine on
the RasPi. No special instructions apply.
A very popular option is to install the AdaFruit Ultimate GPS HAT. With
this GPS you also get a good 1PPS signal. This works as any other GPS
with gpsd, but there are two things to note. The GPS takes over the
serial console: /dev/ttyAMA0. The PPS signal will be on GPIO Pin #4.
Only three specific changes need to be made to make the HAT work. First
in the file /boot/cmdline.txt, remove this part "console=ttyAMA0,115200
kgdboc=ttyAMA0,115200)". That frees the serial port from console use so
the GPS can use it.
Second you need to tell the boot process to load the pps_gpio module
and attach /dev/pps0 to GPIO pin 4. Do that by adding this line
to the bottom of /boot/config.txt: dtoverlay=pps-gpio,gpiopin=4
Reboot so those changes take effect.
Run gpsd like this:
--------------------------------------------------------------
~ # gpsd -D 5 -N -n /dev/ttyAMA0 /dev/pps0
--------------------------------------------------------------
If you are on the RasPi with gpsd version 3.17, or above, /dev/pps0 can
be autodetected. and used for PPS if available.
gpsd 3.17 and up only:
--------------------------------------------------------------
~ # gpsd -D 5 -N -n /dev/ttyAMA0
--------------------------------------------------------------
You can verify gpsd is using the PPS by running ntpshmmon:
--------------------------------------------------------------
~ # ntpshmmon
# Name Seen@ Clock Real L Prec
sample NTP0 1461619703.641899335 1461619703.445224418 1461619703.000000000 0 -1
sample NTP2 1461619703.642203397 1461619702.999262204 1461619703.000000000 0 -20
sample NTP0 1461619704.142097363 1461619703.445224418 1461619703.000000000 0 -1
sample NTP2 1461619704.142204134 1461619703.999258157 1461619704.000000000 0 -20
--------------------------------------------------------------
If you do not see NTP2 then you misconfigured the pps_gpio driver.
The serial time is provided to ntpd on NTP0, the PPS time is on NTP2, not
on NTP1 like described earlier. So your ntp.conf will need to be adjusted
from:
--------------------------------------------------------------
# GPS PPS reference (NTP1)
server 127.127.28.1 prefer
fudge 127.127.28.1 refid PPS
--------------------------------------------------------------
To:
--------------------------------------------------------------
# GPS PPS reference (NTP2)
server 127.127.28.2 prefer
fudge 127.127.28.2 refid PPS
--------------------------------------------------------------
Now proceed as for any other operating system to use gpsd.
Warning, the pps_gpio driver in all linux kernels up to the current
3.19 only reports one edge. Be sure to validate that your PPS signal
is not offset by the pulse width.
Detailed instructions are available from their web site:
https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/
You will need to dig deeper to make the PPS work, here is a good reference:
http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html