OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / ntpclient / linksys.patch
1 Adapted from the version of ntpclient posted by Linksys
2 at http://www.linksys.com/support/gpl.asp .  They claim to
3 use their slightly hacked ntpclient_2000_339 in some of
4 their MIPS/Linux-based wireless routers.  It adds static
5 linking of resolv.o, changes the default measurement interval
6 from 10 minutes to 60 minutes, and includes a feeble attempt
7 to port ntpclient to vxWorks.
8
9 --- Makefile    Sun May 18 11:41:25 2003
10 +++ Makefile-linksys    Sat Jul  5 12:35:50 2003
11 @@ -1,10 +1,11 @@
12 -# Under Solaris, you need to 
13 +# Under Solaris, you need to
14  #    CFLAGS += -xO2 -Xc
15  #    LDLIBS += -lnsl -lsocket
16  # Some versions of Linux may need
17  #    CFLAGS += -D_GNU_SOURCE
18  # To cross-compile
19  #    CC = arm-linux-gcc
20 +CC=/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc
21  # To check for lint
22  # -Wundef not recognized by gcc-2.7.2.3
23  CFLAGS += -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow \
24 @@ -18,7 +19,8 @@
25  test: ntpclient
26         ./ntpclient -d -r <test.dat
27  
28 -ntpclient: ntpclient.o phaselock.o
29 +ntpclient: ntpclient.o phaselock.o resolv.o
30 +       $(CC) $(CFLAGS) $^ -o $@
31  
32  adjtimex: adjtimex.o
33  
34 --- ntpclient.c Sat Jul  5 12:30:17 2003
35 +++ ntpclient-linksys.c Sat Jul  5 12:33:00 2003
36 @@ -60,6 +60,7 @@
37  typedef u_int32_t __u32;
38  #include <sys/timex.h>
39  #else
40 +#define main ntpclient
41  extern struct hostent *gethostbyname(const char *name);
42  extern int h_errno;
43  #define herror(hostname) \
44 @@ -386,7 +387,7 @@
45                 if ((i!=1)||(!FD_ISSET(usd,&fds))) {
46                         if (i==EINTR) continue;
47                         if (i<0) perror("select");
48 -                       if (to.tv_sec == 0) {
49 +                       if ((to.tv_sec == 0)|| (to.tv_sec == interval)) {
50                                 if (probes_sent >= num_probes &&
51                                         num_probes != 0) break;
52                                 send_packet(usd);
53 @@ -462,7 +463,7 @@
54         /* These parameters are settable from the command line
55            the initializations here provide default behavior */
56         short int udp_local_port=0;   /* default of 0 means kernel chooses */
57 -       int cycle_time=600;           /* seconds */
58 +       int cycle_time=3600;          /* seconds */
59         int probe_count=0;            /* default of 0 means loop forever */
60         /* int debug=0; is a global above */
61         int goodness=0;
62 @@ -508,6 +509,12 @@
63                                 exit(1);
64                 }
65         }
66 +
67 +#ifdef vxworks
68 +       hostname = argv[0];
69 +       set_clock++;
70 +#endif
71 +
72         if (replay) {
73                 do_replay();
74                 exit(0);