Compare commits
39 Commits
Author | SHA1 | Date |
---|---|---|
Matteo Cypriani | 03b4105f13 | |
Matteo Cypriani | eb403319b0 | |
Matteo Cypriani | db5d2cd686 | |
Matteo Cypriani | 7b7766ab5b | |
Matteo Cypriani | b62987efb0 | |
Matteo Cypriani | 7ce171b2ef | |
Matteo Cypriani | b2b24ed551 | |
Matteo Cypriani | 5284120632 | |
Matteo Cypriani | c079ee14ca | |
Matteo Cypriani | fe8846cca9 | |
Matteo Cypriani | 2c91f5b976 | |
Matteo Cypriani | dc3ba41222 | |
Matteo Cypriani | e823014708 | |
Florian Taillard | e57e4cfc8d | |
Florian Taillard | 5126894634 | |
Florian Taillard | 82e65d375d | |
Florian Taillard | f14ae6e351 | |
Florian Taillard | 4ac4216ce0 | |
Florian Taillard | d6598c52a1 | |
Florian Taillard | ad284d0b56 | |
Florian Taillard | 3ba38df483 | |
Florian Taillard | 10e38bfc0b | |
Florian Taillard | 2bbe114c4b | |
Florian Taillard | c3da81bb77 | |
Florian Taillard | 9380678782 | |
Florian Taillard | 6023295880 | |
François Spies | e093dcd7e3 | |
Florian Taillard | c18209545c | |
Florian Taillard | 46292cfe8c | |
Florian Taillard | 3b2823fef9 | |
Florian Taillard | 80a6439205 | |
Florian Taillard | 92e08673ca | |
Florian Taillard | e45c199130 | |
Florian Taillard | 9f77c6c91b | |
Florian Taillard | 9eb3e02b2c | |
Florian Taillard | b33aadd8ad | |
Florian Taillard | 207e815192 | |
Florian Taillard | 290fcfa49b | |
Florian Taillard | 12b52d9365 |
|
@ -0,0 +1,80 @@
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc/usr
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Autres outils
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
# Variables générales
|
||||||
|
LIB_CIBLE=libowlps-client
|
||||||
|
VERSION=1.0
|
||||||
|
|
||||||
|
# Cibles à construire
|
||||||
|
STATIC=$(LIB_CIBLE).a
|
||||||
|
HEADER=owlps-client.h
|
||||||
|
|
||||||
|
# Composition de la bibliothèque
|
||||||
|
OBJS=$(LIB_CIBLE).o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
CFLAGS=-O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR) -I.
|
||||||
|
DEPFLAGS=-MMD
|
||||||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG=-fPIC
|
||||||
|
LIBS=-liw
|
||||||
|
#STRIPFLAGS= -Wl,-s
|
||||||
|
#LDFLAGS=
|
||||||
|
LATHEROS=-L$(TOOLCHAIN_USR_2)/lib/
|
||||||
|
IATHEROS=-I$(TOOLCHAIN_USR)/include/
|
||||||
|
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all static clean purge help
|
||||||
|
|
||||||
|
all : static
|
||||||
|
static : $(STATIC)
|
||||||
|
|
||||||
|
%.o : %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC) : $(OBJS)
|
||||||
|
$(RM) $@
|
||||||
|
$(AR) cru $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(STATIC)
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libowlps-dev\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
static (cible par défaut) : Compile la bibliothèque statique (.a).\n\
|
||||||
|
\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\"
|
||||||
|
|
||||||
|
|
||||||
|
# Local Variables: *
|
||||||
|
# mode: makefile-gmake *
|
||||||
|
# End: *
|
|
@ -0,0 +1,82 @@
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc/usr
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Autres outils
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
# Variables générales
|
||||||
|
LIB_CIBLE = libowlps-resultreader
|
||||||
|
VERSION = 1.0
|
||||||
|
|
||||||
|
# Cibles à construire
|
||||||
|
STATIC = $(LIB_CIBLE).a
|
||||||
|
HEADER = owlps-resultreader.h
|
||||||
|
EXAMPLE = owlps-resultreader-udp
|
||||||
|
|
||||||
|
# Composition de la bibliothèque
|
||||||
|
OBJS = $(LIB_CIBLE).o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR) -I.
|
||||||
|
#CFLAGS += -g -O0
|
||||||
|
CFLAGS += -D DEBUG
|
||||||
|
DEPFLAGS = -MMD
|
||||||
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG = -fPIC
|
||||||
|
#STRIPFLAGS = -Wl,-s
|
||||||
|
#LDFLAGS =
|
||||||
|
LATHEROS = -L$(TOOLCHAIN_USR_2)/lib/
|
||||||
|
IATHEROS = -I$(TOOLCHAIN_USR)/include/
|
||||||
|
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all static clean purge help
|
||||||
|
|
||||||
|
all : static example
|
||||||
|
static : $(STATIC)
|
||||||
|
example : $(EXAMPLE)
|
||||||
|
|
||||||
|
# Cancel implicit make rule
|
||||||
|
%: %.c
|
||||||
|
|
||||||
|
%.o : %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
|
||||||
|
|
||||||
|
% : %.o $(HEADER) $(STATIC)
|
||||||
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) $(IATHEROS) -o $@ $< \
|
||||||
|
$(STATIC) -L$(LIBOWLPS_DIR) -lowlps -lrt
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC) : $(OBJS)
|
||||||
|
$(RM) $@
|
||||||
|
$(AR) cru $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(STATIC) $(EXAMPLE)
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@make help
|
||||||
|
|
||||||
|
# Local Variables: *
|
||||||
|
# mode: makefile-gmake *
|
||||||
|
# End: *
|
|
@ -0,0 +1,148 @@
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc/usr
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX_CC=/arm/arm-none-linux-gnueabi
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX_CC)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Autres outils
|
||||||
|
AR = ar
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
# Commandes d'installation et de désinstallation
|
||||||
|
RM = rm -f
|
||||||
|
CP = cp
|
||||||
|
SYMLINK = ln -sf
|
||||||
|
|
||||||
|
# Variables générales
|
||||||
|
LIB_CIBLE=libowlps
|
||||||
|
VERSION=1.0
|
||||||
|
|
||||||
|
# Cibles à construire
|
||||||
|
STATIC=$(LIB_CIBLE).a
|
||||||
|
DYNAMIC=$(LIB_CIBLE).so.$(VERSION)
|
||||||
|
#PROGS=
|
||||||
|
HEADER=owlps.h
|
||||||
|
#HEADERS=
|
||||||
|
|
||||||
|
# Composition de la bibliothèque
|
||||||
|
OBJS=$(LIB_CIBLE).o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I.
|
||||||
|
DEPFLAGS=-MMD
|
||||||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG=-fPIC
|
||||||
|
LIBS = -liw -lrt
|
||||||
|
#STRIPFLAGS= -Wl,-s
|
||||||
|
#LDFLAGS=
|
||||||
|
LATHEROS=-L$(TOOLCHAIN_USR_2)/lib/
|
||||||
|
IATHEROS=-I$(TOOLCHAIN_USR)/include/
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all dynamic static install install-dynamic install-static install-header uninstall uninstall-dynamic uninstall-static uninstall-header clean purge help
|
||||||
|
|
||||||
|
all : dynamic static
|
||||||
|
dynamic : $(DYNAMIC)
|
||||||
|
static : $(STATIC)
|
||||||
|
|
||||||
|
%.o: %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) $(PICFLAG) -c -o $@ $<
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque dynamique
|
||||||
|
$(DYNAMIC): $(OBJS)
|
||||||
|
$(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(IATHEROS) $(LATHEROS) -lc $^
|
||||||
|
$(SYMLINK) $@ $(LIB_CIBLE).so
|
||||||
|
chmod a-x $@
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC): $(OBJS)
|
||||||
|
$(RM) $@
|
||||||
|
$(AR) cru $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
|
||||||
|
## Installation ##
|
||||||
|
|
||||||
|
install : install-static install-dynamic
|
||||||
|
|
||||||
|
install-dynamic : install-header $(DYNAMIC)
|
||||||
|
@$(CP) $(DYNAMIC) $(INSTALL_LIB) &&\
|
||||||
|
chmod 644 $(INSTALL_LIB)/$(DYNAMIC) &&\
|
||||||
|
chown root:root $(INSTALL_LIB)/$(DYNAMIC) &&\
|
||||||
|
cd $(INSTALL_LIB) && $(SYMLINK) $(DYNAMIC) $(LIB_CIBLE).so &&\
|
||||||
|
echo "Reconstruction du cache pour ld.so : ldconfig $(INSTALL_LIB)" ; ldconfig $(INSTALL_LIB)
|
||||||
|
|
||||||
|
install-static : install-header $(STATIC)
|
||||||
|
@$(CP) $(STATIC) $(INSTALL_LIB) &&\
|
||||||
|
chmod 644 $(INSTALL_LIB)/$(STATIC) &&\
|
||||||
|
chown root:root $(INSTALL_LIB)/$(STATIC)
|
||||||
|
|
||||||
|
install-header : $(HEADER)
|
||||||
|
@$(CP) $(HEADER) $(INSTALL_INC) &&\
|
||||||
|
chmod 644 $(INSTALL_INC)/$(HEADER) &&\
|
||||||
|
chown root:root $(INSTALL_INC)/$(HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
## Désinstallation ##
|
||||||
|
|
||||||
|
uninstall : uninstall-dynamic uninstall-static
|
||||||
|
|
||||||
|
uninstall-dynamic : uninstall-header
|
||||||
|
@$(RM) $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(LIB_CIBLE).so
|
||||||
|
@echo "Reconstruction du cache pour ld.so : ldconfig" ; ldconfig
|
||||||
|
|
||||||
|
uninstall-static : uninstall-header
|
||||||
|
@$(RM) $(INSTALL_LIB)/$(STATIC)
|
||||||
|
|
||||||
|
uninstall-header :
|
||||||
|
@$(RM) $(INSTALL_INC)/$(HEADER)
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(DYNAMIC) *.so $(STATIC) $(PROGS)
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libiw-dev\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
all (cible par défaut) : Compile la bibliothèque et le programme d'exemple (tx).\n\
|
||||||
|
dynamic : Compile la bibilothèque partagée (.so).\n\
|
||||||
|
static : Compile la bibliothèque statique (.a).\n\
|
||||||
|
\n\
|
||||||
|
install : Installe la bibliothèque partagée et statique.\n\
|
||||||
|
install-dynamic : N'installe que la bibliothèque partagée.\n\
|
||||||
|
install-static : N'installe que la bibliothèque statique.\n\
|
||||||
|
\n\
|
||||||
|
uninstall : Désinstalle tout ce qu'il est possible de désinstaller.\n\
|
||||||
|
uninstall-dynamic : Désinstalle la bibliothèque partagée.\n\
|
||||||
|
uninstall-static : Désinstalle la bibliothèque statique.\n\
|
||||||
|
\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\
|
||||||
|
\n\
|
||||||
|
Note : l'installation se fait dans l'arborescence $(PREFIX). Modifiez la variable PREFIX du Makefile pour changer ce comportement."
|
||||||
|
|
||||||
|
|
||||||
|
# Local Variables: *
|
||||||
|
# mode: makefile-gmake *
|
||||||
|
# End: *
|
|
@ -0,0 +1,111 @@
|
||||||
|
# Source version
|
||||||
|
ifndef OWLPS_VERSION
|
||||||
|
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_DIR= $(PREFIX)/bin
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?)
|
||||||
|
ifeq ($(COLORGCC), 0)
|
||||||
|
CC = colorgcc
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Commandes d'installation et de désinstallation
|
||||||
|
RM = rm -f
|
||||||
|
CP = cp
|
||||||
|
|
||||||
|
# Cible
|
||||||
|
TARGET=owlps-drone
|
||||||
|
DEPS = oc.o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
LIBOWLPSCLIENT_DIR = ../libowlps-client
|
||||||
|
LIBOWLPSRESULTREADER_DIR = ../libowlps-resultreader
|
||||||
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes \
|
||||||
|
-I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) \
|
||||||
|
-I$(LIBOWLPSRESULTREADER_DIR)
|
||||||
|
#CFLAGS += -g -O0
|
||||||
|
DEPFLAGS = -MMD
|
||||||
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG = -fPIC
|
||||||
|
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\"
|
||||||
|
OWLPSFLAGS += -D DEBUG
|
||||||
|
LIBS = -L$(LIBOWLPS_DIR) -lowlps \
|
||||||
|
-L$(LIBOWLPSCLIENT_DIR) -lowlps-client \
|
||||||
|
-L$(LIBOWLPSRESULTREADER_DIR) -lowlps-resultreader \
|
||||||
|
-lm -pthread
|
||||||
|
|
||||||
|
OS := $(shell uname)
|
||||||
|
ifeq ("$(OS)", "Linux")
|
||||||
|
LIBS += -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
|
STATIC_LIBS =
|
||||||
|
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY : all dynamic static install uninstall clean purge help
|
||||||
|
|
||||||
|
dynamic : $(TARGET)
|
||||||
|
static : $(TARGET).static
|
||||||
|
all : dynamic static
|
||||||
|
|
||||||
|
%.o : %.c %.h
|
||||||
|
$(CC) $(XCFLAGS) $(OWLPSFLAGS) -c $<
|
||||||
|
|
||||||
|
# Compilation du programme
|
||||||
|
$(TARGET) : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
$(TARGET).static : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
## Installation / désinstallation ##
|
||||||
|
|
||||||
|
install : $(TARGET)
|
||||||
|
@$(CP) $(TARGET) $(INSTALL_DIR)
|
||||||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET) ; chmod 755 $(TARGET)
|
||||||
|
|
||||||
|
install-static : $(TARGET).static
|
||||||
|
@$(CP) $(TARGET).static $(INSTALL_DIR)
|
||||||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET).static ; chmod 755 $(TARGET).static
|
||||||
|
|
||||||
|
uninstall :
|
||||||
|
@$(RM) $(INSTALL_DIR)/{$(TARGET),$(TARGET).static}
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) -fv *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) -fv $(TARGET) $(TARGET).static
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo -e "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libowlps1.0 (fournie)\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
|
||||||
|
$(TARGET).static : Compile le programme $(TARGET).static \
|
||||||
|
(version sans lien dynamique).\n\
|
||||||
|
install : Installe le programme $(TARGET).\n\
|
||||||
|
uninstall : Désinstalle le programme $(TARGET).\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\
|
||||||
|
\n\
|
||||||
|
Note : l'installation se fait dans l'arborescence $(PREFIX). \
|
||||||
|
Modifiez la variable PREFIX du Makefile pour changer ce comportement."
|
|
@ -0,0 +1,125 @@
|
||||||
|
# Source version
|
||||||
|
ifndef OWLPS_VERSION
|
||||||
|
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_DIR= $(PREFIX)/bin
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Commandes d'installation et de désinstallation
|
||||||
|
RM = rm -f
|
||||||
|
CP = cp
|
||||||
|
|
||||||
|
# Cible
|
||||||
|
TARGET=owlps-drone
|
||||||
|
DEPS = oc.o
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
LIBOWLPSCLIENT_DIR = ../libowlps-client
|
||||||
|
LIBOWLPSRESULTREADER_DIR = ../libowlps-resultreader
|
||||||
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes \
|
||||||
|
-I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR) \
|
||||||
|
-I$(LIBOWLPSRESULTREADER_DIR)
|
||||||
|
#CFLAGS += -g -O0
|
||||||
|
DEPFLAGS = -MMD
|
||||||
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG = -fPIC
|
||||||
|
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\"
|
||||||
|
OWLPSFLAGS += -D DEBUG
|
||||||
|
LOWLPS = -L$(LIBOWLPS_DIR) -lowlps
|
||||||
|
LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a
|
||||||
|
LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
|
||||||
|
LOWLPSRESULTREADERA = $(LIBOWLPSRESULTREADER_DIR)/libowlps-resultreader.a
|
||||||
|
LIBS = $(LOWLPSCLIENTA) $(LOWLPSRESULTREADERA) -lrt -lm -pthread
|
||||||
|
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
|
||||||
|
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
|
||||||
|
STATIC_LIBS = $(LOWLPSA) $(LIBS)
|
||||||
|
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
|
||||||
|
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
|
||||||
|
LDFLAGS = $(IATHEROS) $(LATHEROS)
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY: all semistatic static install uninstall clean purge help
|
||||||
|
|
||||||
|
#dynamic: $(TARGET)
|
||||||
|
semistatic: $(TARGET).semistatic
|
||||||
|
static: $(TARGET).static
|
||||||
|
all: semistatic static
|
||||||
|
|
||||||
|
# Cancel implicit make rule
|
||||||
|
%: %.c
|
||||||
|
|
||||||
|
%.o: %.c %.h
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) $(OWLPSFLAGS) -c $<
|
||||||
|
|
||||||
|
# Compilation du programme
|
||||||
|
$(TARGET) : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
|
$(TARGET).semistatic : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||||
|
|
||||||
|
$(TARGET).static : $(TARGET).o $(DEPS)
|
||||||
|
$(CC) $(LDFLAGS) -static $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(STATIC_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
## Installation / désinstallation ##
|
||||||
|
|
||||||
|
install : $(TARGET)
|
||||||
|
@$(CP) $(TARGET) $(INSTALL_DIR)
|
||||||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET) ; chmod 755 $(TARGET)
|
||||||
|
|
||||||
|
install-static : $(TARGET).static
|
||||||
|
@$(CP) $(TARGET).static $(INSTALL_DIR)
|
||||||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET).static ; chmod 755 $(TARGET).static
|
||||||
|
|
||||||
|
uninstall :
|
||||||
|
@$(RM) $(INSTALL_DIR)/{$(TARGET),$(TARGET).static}
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) -fv *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) -fv $(TARGET) $(TARGET).static
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo -e "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libowlps1.0 (fournie)\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
|
||||||
|
$(TARGET).static : Compile le programme $(TARGET).static \
|
||||||
|
(version sans lien dynamique).\n\
|
||||||
|
install : Installe le programme $(TARGET).\n\
|
||||||
|
uninstall : Désinstalle le programme $(TARGET).\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\
|
||||||
|
\n\
|
||||||
|
Note : l'installation se fait dans l'arborescence $(PREFIX). \
|
||||||
|
Modifiez la variable PREFIX du Makefile pour changer ce comportement."
|
||||||
|
|
||||||
|
|
||||||
|
# Local Variables: *
|
||||||
|
# mode: makefile-gmake *
|
||||||
|
# End: *
|
|
@ -0,0 +1,79 @@
|
||||||
|
// Bibliotheque OpenCoordinate : fonctions coordonnees geographiques
|
||||||
|
|
||||||
|
#include "oc.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
|
double oc_distance_between(struct point a, struct point b) {
|
||||||
|
// retourne la distance entre les 2 points en metres
|
||||||
|
double R = 6378137; // metres
|
||||||
|
double d_lat = (b.lat-a.lat)/180*M_PI;
|
||||||
|
double d_lon = (b.lon-a.lon)/180*M_PI;
|
||||||
|
double alpha = sin(d_lat/2) * sin(d_lat/2) +
|
||||||
|
cos(a.lat/180*M_PI) * cos(b.lat/180*M_PI) *
|
||||||
|
sin(d_lon/2) * sin(d_lon/2);
|
||||||
|
double c = 2 * atan2(sqrt(alpha), sqrt(1-alpha));
|
||||||
|
return R * c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct point_relatif oc_convert(struct point o, struct point a) {
|
||||||
|
//convert transforme des coordonnes WGS84 en metres par rapport au referentiel r
|
||||||
|
struct point proj_x, proj_y;
|
||||||
|
struct point_relatif pr;
|
||||||
|
proj_x.lat=a.lat;
|
||||||
|
proj_x.lon=o.lon;
|
||||||
|
proj_y.lat=o.lat;
|
||||||
|
proj_y.lon=a.lon;
|
||||||
|
pr.x=oc_distance_between(proj_y,o);
|
||||||
|
pr.y=oc_distance_between(proj_x,o);
|
||||||
|
pr.z=0;
|
||||||
|
if (proj_y.lon > o.lon) pr.x=-pr.x;
|
||||||
|
if (proj_x.lat > o.lat) pr.y=-pr.y;
|
||||||
|
return pr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
function unconvert(x,y) {
|
||||||
|
if (origine==null) return null;
|
||||||
|
else {
|
||||||
|
var R = 6378137; // metres
|
||||||
|
var lat1 = origine.lat()/180*Math.PI;
|
||||||
|
var lon1 = origine.lng()/180*Math.PI;
|
||||||
|
var d = Math.sqrt(x*x + y*y);
|
||||||
|
var brng = Math.acos( y / d);
|
||||||
|
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) +
|
||||||
|
Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
|
||||||
|
var lon2 = lon1 +
|
||||||
|
Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),
|
||||||
|
Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));
|
||||||
|
return new google.maps.LatLng(lat2*180/Math.PI, lon2*180/Math.PI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
double oc_cap(struct point o, struct point a) {
|
||||||
|
struct point_relatif pr=oc_convert(a, o);
|
||||||
|
double alpha;
|
||||||
|
printf("cap x=%f et y=%f\n",pr.x, pr.y);
|
||||||
|
if (pr.x==0)
|
||||||
|
if (pr.y>=0) return 360.0;
|
||||||
|
else return 180.0;
|
||||||
|
else {
|
||||||
|
alpha=atan(pr.y/pr.x) * 180 / M_PI;
|
||||||
|
printf("%f\n",alpha);
|
||||||
|
if (pr.x>0)
|
||||||
|
return ((450 - alpha)/360 - round((450 - alpha)/360))*360;
|
||||||
|
else {
|
||||||
|
//alpha=atan(-pr.y/pr.x) * 180 / PI;
|
||||||
|
//printf("%f\n",alpha);
|
||||||
|
return 270-alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef _LIBOPENCOORDINATES_
|
||||||
|
#define _LIBOPENCOORDINATES_
|
||||||
|
|
||||||
|
|
||||||
|
/* Define M_PI if it is not defined */
|
||||||
|
#ifndef M_PI
|
||||||
|
# define M_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct point
|
||||||
|
{
|
||||||
|
int date;
|
||||||
|
float time;
|
||||||
|
double lat, lon, alt, cap;
|
||||||
|
} point;
|
||||||
|
|
||||||
|
|
||||||
|
struct point_relatif
|
||||||
|
{
|
||||||
|
double x, y, z;
|
||||||
|
} point_relatif;
|
||||||
|
|
||||||
|
|
||||||
|
double oc_distance_between(struct point a, struct point b) ;
|
||||||
|
struct point_relatif oc_convert(struct point o, struct point a) ;
|
||||||
|
double oc_cap(struct point o, struct point a) ;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _LIBOPENCOORDINATES_
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,120 @@
|
||||||
|
#ifndef _OWLPS_ARDRONE_H_
|
||||||
|
#define _OWLPS_ARDRONE_H_
|
||||||
|
|
||||||
|
#include "oc.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Program arguments (getopt string) */
|
||||||
|
#define OPTIONS "d:hi:l::n:p:t:V"
|
||||||
|
|
||||||
|
/* Number of packets to send */
|
||||||
|
#define DEFAULT_NBPKT_CALIB 20 // 20 packets when calibrating
|
||||||
|
#define DEFAULT_NBPKT_NORMAL 10 // 10 packets when requesting the position
|
||||||
|
|
||||||
|
/* Delay between two packet transmissions (in microseconds) */
|
||||||
|
#define DEFAULT_DELAY_CALIB 50000 // Calibration request
|
||||||
|
#define DEFAULT_DELAY_NORMAL 25000 // Localisation request
|
||||||
|
|
||||||
|
/* Maximum length of the algorithm & area names */
|
||||||
|
#define ALGO_STRLEN 15
|
||||||
|
#define AREA_STRLEN 50
|
||||||
|
|
||||||
|
/* GPS inputs */
|
||||||
|
#define SEPARATOR ','
|
||||||
|
#define EOL '$'
|
||||||
|
#define TYPE "GPS"
|
||||||
|
|
||||||
|
/* Drone commands */
|
||||||
|
#define LENSTR 1000
|
||||||
|
#define ATREF "AT*REF="
|
||||||
|
#define LANDING ",290717696"
|
||||||
|
#define TAKEOFF ",290718208"
|
||||||
|
|
||||||
|
/* Socket parameters */
|
||||||
|
#define IP "192.168.1.1"
|
||||||
|
#define PORT 5556
|
||||||
|
|
||||||
|
|
||||||
|
/* Error codes */
|
||||||
|
#define ERR_BAD_USAGE 1 // Bad program call (bad number of arguments)
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _gps
|
||||||
|
{
|
||||||
|
float time;
|
||||||
|
char state;
|
||||||
|
double latitude;
|
||||||
|
char orilat;
|
||||||
|
double longitude;
|
||||||
|
char orilon;
|
||||||
|
float speed;
|
||||||
|
float cap;
|
||||||
|
int date;
|
||||||
|
float decmag;
|
||||||
|
} gps ;
|
||||||
|
|
||||||
|
typedef struct _consigne
|
||||||
|
{
|
||||||
|
double lat;
|
||||||
|
double lon;
|
||||||
|
double alt;
|
||||||
|
|
||||||
|
struct _consigne *next;
|
||||||
|
} consigne ;
|
||||||
|
|
||||||
|
typedef struct _point_consigne
|
||||||
|
{
|
||||||
|
double lat;
|
||||||
|
double lon;
|
||||||
|
double alt;
|
||||||
|
} point_consigne ;
|
||||||
|
|
||||||
|
|
||||||
|
/* Function headers */
|
||||||
|
void parse_command_line(int argc, char **argv) ;
|
||||||
|
void parse_main_options(int argc, char **argv) ;
|
||||||
|
void check_destination_ip(void) ;
|
||||||
|
void parse_calibration_data(int argc, char **argv) ;
|
||||||
|
void check_configuration(void) ;
|
||||||
|
#ifdef DEBUG
|
||||||
|
void print_configuration(void) ;
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
void print_usage(void) ;
|
||||||
|
void print_version(void) ;
|
||||||
|
|
||||||
|
void drone_handler_sigint(const int) ;
|
||||||
|
|
||||||
|
void create_socket(void) ;
|
||||||
|
void make_packet(void) ;
|
||||||
|
void send_request(void) ;
|
||||||
|
void* receive_position(void*) ;
|
||||||
|
|
||||||
|
void string2data(char*) ;
|
||||||
|
void traficGPS(int);
|
||||||
|
void* thread_gps(void*) ;
|
||||||
|
void* thread_send(void*) ;
|
||||||
|
void* thread_control(void*) ;
|
||||||
|
void print_error(char*) ;
|
||||||
|
|
||||||
|
void drone_err(int);
|
||||||
|
int read_position(char*);
|
||||||
|
int drone_socket_create(void);
|
||||||
|
void* drone_socket_watchdog(void*);
|
||||||
|
int drone_socket_close(void);
|
||||||
|
|
||||||
|
int cmd_drone_take_off(void); //Add socket
|
||||||
|
int cmd_drone_landing(void); //Add socket
|
||||||
|
int cmd_drone_move(float, int);
|
||||||
|
int cmd_drone_init_direction(void); //Add socket
|
||||||
|
|
||||||
|
void calcul_trajectory(float*, float*);
|
||||||
|
float calcul_speed(float);
|
||||||
|
int check_destination(struct point, struct point);
|
||||||
|
float calcul_angle(void);
|
||||||
|
|
||||||
|
consigne* list_add_front(consigne*, double, double, double);
|
||||||
|
consigne* list_add_back(consigne*, double, double, double);
|
||||||
|
void list_print(consigne*);
|
||||||
|
|
||||||
|
#endif //_OWLPS_ARDRONE_H_
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copie du fichier wifi_setup.sh pour un mode recovery en cas de pb reseau
|
||||||
|
#cp /bin/wifi_setup.sh.orig /bin/wifi_setup.sh
|
||||||
|
|
||||||
|
export LD_PRELOAD=/data/libioctl_arm.so
|
||||||
|
|
||||||
|
UPDATE_PATH=/update/ardrone_update.plf
|
||||||
|
VERSION_PATH=/update/version.txt
|
||||||
|
ERR_PATH=/update/err.log
|
||||||
|
|
||||||
|
echo "Copy version.txt file in ftp directory"
|
||||||
|
cp /firmware/version.txt $VERSION_PATH
|
||||||
|
|
||||||
|
echo "Check if update is necessary ..."
|
||||||
|
if [ -e $UPDATE_PATH ] ; then
|
||||||
|
VERSION=`cat $VERSION_PATH`
|
||||||
|
|
||||||
|
if [ -e $ERR_PATH ] ; then
|
||||||
|
CHECK_ERR=`cat $ERR_PATH`
|
||||||
|
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||||
|
CHECK_PLF=`/bin/checkplf $UPDATE_PATH $VERSION`
|
||||||
|
if [ "$CHECK_PLF" = "NEED_TO_FLASH" ] ; then
|
||||||
|
echo "ERR=FLASH_KO" > $ERR_PATH
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHECK_ERR=`cat $ERR_PATH`
|
||||||
|
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||||
|
echo "File $UPDATE_PATH exists... Start updating..."
|
||||||
|
pinst_trigger
|
||||||
|
echo "Rebooting..."
|
||||||
|
reboot
|
||||||
|
else
|
||||||
|
if [ "$CHECK_ERR" = "VERSION_OK" ] ; then
|
||||||
|
echo "Version OK"
|
||||||
|
elif [ "$CHECK_ERR" = "ERR=FLASH_KO" ] ; then
|
||||||
|
echo "Error during Updating... Removing..."
|
||||||
|
else
|
||||||
|
echo "File $UPDATE_PATH not valid... Removing..."
|
||||||
|
fi
|
||||||
|
rm -Rf $UPDATE_PATH
|
||||||
|
echo "Start Drone software..."
|
||||||
|
inetd
|
||||||
|
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "File $UPDATE_PATH doesn't exists... Start Drone software..."
|
||||||
|
if [ -e $ERR_PATH ] ; then
|
||||||
|
rm -Rf $ERR_PATH
|
||||||
|
fi
|
||||||
|
inetd
|
||||||
|
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||||
|
fi
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Script to setup drone pairing
|
||||||
|
#
|
||||||
|
|
||||||
|
# Getting Iphone's MAC address from config.ini file.
|
||||||
|
NULL_MAC=00:00:00:00:00:00
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
if [ -s /data/config.ini ]
|
||||||
|
then
|
||||||
|
MAC_ADDR=`grep owner_mac /data/config.ini | awk -F "=" '{print $2}'`
|
||||||
|
else
|
||||||
|
MAC_ADDR=$NULL_MAC
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
MAC_ADDR=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Owner's MAC address is: $MAC_ADDR"
|
||||||
|
|
||||||
|
# [Stephane] Exits if owner MAC address is already being filtered
|
||||||
|
# (changing iptables rules too often may crash the drone for a undetermined reason)
|
||||||
|
CURRENTLY_ALLOWED_MAC_ADDR=`iptables -L | grep MAC | awk -F " " '{print $7}'`
|
||||||
|
if [ "$CURRENTLY_ALLOWED_MAC_ADDR" = "$MAC_ADDR" ]
|
||||||
|
then
|
||||||
|
echo "Drone is already paired with $MAC_ADDR"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $MAC_ADDR != $NULL_MAC ]
|
||||||
|
then
|
||||||
|
echo "Setting pairing for: $MAC_ADDR"
|
||||||
|
# Clearing all rules
|
||||||
|
iptables -P INPUT ACCEPT
|
||||||
|
iptables -F
|
||||||
|
# Allowing only owner's traffic
|
||||||
|
iptables -A INPUT -m mac --mac-source $MAC_ADDR -j ACCEPT
|
||||||
|
# allowing ICMP (ping), ftp, nfs and telnet traffic for everyone.
|
||||||
|
iptables -A INPUT --protocol icmp -j ACCEPT
|
||||||
|
#iptables -A INPUT --protocol tcp --dport 23 -j ACCEPT
|
||||||
|
iptables -A INPUT --protocol tcp --dport 21 -j ACCEPT
|
||||||
|
iptables -A INPUT --protocol tcp --dport 2049 -j ACCEPT
|
||||||
|
# Blocking all incoming traffic by default
|
||||||
|
iptables -P INPUT DROP
|
||||||
|
else
|
||||||
|
echo "Clearing pairing rule"
|
||||||
|
# Switching rad LED on
|
||||||
|
gpio 63 -d ho 1
|
||||||
|
|
||||||
|
# Clearing all rules
|
||||||
|
iptables -F
|
||||||
|
# Allows incoming connections from anywhere outside
|
||||||
|
iptables -P INPUT ACCEPT
|
||||||
|
|
||||||
|
# Switching rad LED off
|
||||||
|
gpio 63 -d ho 0
|
||||||
|
fi
|
|
@ -0,0 +1,110 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Script to see if an IP adress is already used or not
|
||||||
|
#
|
||||||
|
# Getting SSID from config.ini file.
|
||||||
|
|
||||||
|
#initializing random generator
|
||||||
|
cat /data/random_mac.txt > /dev/urandom
|
||||||
|
/bin/random_mac > /data/random_mac.txt
|
||||||
|
|
||||||
|
|
||||||
|
#echo 2 > /proc/cpu/alignment
|
||||||
|
#export WORKAREA=/
|
||||||
|
#export ATH_PLATFORM=ardrone
|
||||||
|
#/usr/sbin/recEvent /data/athdbg.log&
|
||||||
|
|
||||||
|
|
||||||
|
if [ -s /factory/mac_address.txt ]
|
||||||
|
then
|
||||||
|
MAC_ADDR=`cat /factory/mac_address.txt`
|
||||||
|
else
|
||||||
|
MAC_ADDR=`cat /data/random_mac.txt`
|
||||||
|
fi
|
||||||
|
|
||||||
|
loadAR6k.sh --setmac $MAC_ADDR
|
||||||
|
#loadtestcmd.sh
|
||||||
|
|
||||||
|
# Waiting 2s for the wifi chip to be ready
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Increasing scan time to help detecting wifi networks
|
||||||
|
wmiconfig -i ath0 --scan --maxact=80
|
||||||
|
# Setting retry limits to 6
|
||||||
|
wmiconfig -i ath0 --setretrylimits 2 0 6 off
|
||||||
|
# Limiting available rates to 11, 24 or 54 Mb/s
|
||||||
|
wmiconfig -i ath0 --setfixrates 3 8 11
|
||||||
|
# Disabling powersaving
|
||||||
|
wmiconfig -i ath0 --power maxperf
|
||||||
|
|
||||||
|
|
||||||
|
SSID=`grep ssid_single_player /data/config.ini | awk -F "=" '{print $2}'`
|
||||||
|
|
||||||
|
if [ $SSID ]
|
||||||
|
then
|
||||||
|
echo "SSID=$SSID"
|
||||||
|
else
|
||||||
|
#default SSID.
|
||||||
|
SSID=ardrone_wifi
|
||||||
|
echo "SSID=$SSID"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
export NETIF=ath0
|
||||||
|
RANDOM_CHAN=`/bin/channelselector`
|
||||||
|
|
||||||
|
echo "Creating/Joining Network $SSID"
|
||||||
|
|
||||||
|
#iwconfig ath0 mode ad-hoc
|
||||||
|
#iwconfig ath0 channel $RANDOM_CHAN
|
||||||
|
#iwconfig ath0 essid $SSID
|
||||||
|
#iwconfig ath0 channel 1
|
||||||
|
|
||||||
|
iwconfig ath0 mode ad-hoc essid owl channel auto
|
||||||
|
|
||||||
|
OK=0
|
||||||
|
BASE_ADRESS=192.168.1.
|
||||||
|
PROBE=1
|
||||||
|
|
||||||
|
while [ $OK -eq 0 ]
|
||||||
|
do
|
||||||
|
#configuring interface.
|
||||||
|
ifconfig ath0 $BASE_ADRESS$PROBE
|
||||||
|
ifconfig ath0:0 192.168.11.1
|
||||||
|
arping -I ath0 -q -f -D -w 2 $BASE_ADRESS$PROBE
|
||||||
|
|
||||||
|
if [ $? -eq 1 ]
|
||||||
|
then
|
||||||
|
#generating random odd IP address
|
||||||
|
PROBE=`/bin/random_ip`
|
||||||
|
else
|
||||||
|
OK=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
#Configuring DHCP server.
|
||||||
|
echo "Using address $BASE_ADRESS$PROBE"
|
||||||
|
echo "start $BASE_ADRESS`expr $PROBE + 1`" > /tmp/udhcpd.conf
|
||||||
|
echo "end $BASE_ADRESS`expr $PROBE + 4`" >> /tmp/udhcpd.conf
|
||||||
|
echo "interface ath0" >> /tmp/udhcpd.conf
|
||||||
|
echo "decline_time 1" >> /tmp/udhcpd.conf
|
||||||
|
echo "conflict_time 1" >> /tmp/udhcpd.conf
|
||||||
|
echo "opt subnet 255.255.255.0" >> /tmp/udhcpd.conf
|
||||||
|
echo "opt router $BASE_ADRESS$PROBE" >> /tmp/udhcpd.conf
|
||||||
|
echo "opt lease 1200" >> /tmp/udhcpd.conf
|
||||||
|
|
||||||
|
/bin/pairing_setup.sh
|
||||||
|
# Saving random info for initialization at next reboot
|
||||||
|
date > /dev/urandom
|
||||||
|
/bin/random_mac > /data/random_mac.txt
|
||||||
|
|
||||||
|
iwconfig ath0 rate 54M
|
||||||
|
iwconfig ath0 rate auto
|
||||||
|
|
||||||
|
telnetd -l /bin/sh
|
||||||
|
udhcpd /tmp/udhcpd.conf
|
||||||
|
iptables -t nat -A POSTROUTING -p UDP --sport 8884 -j SNAT --to 192.168.1.254:5554
|
||||||
|
iptables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5554 -j DNAT --to 192.168.1.1:8884
|
||||||
|
iptables -t nat -A POSTROUTING -p UDP --sport 8886 -j SNAT --to 192.168.1.254:5556
|
||||||
|
iptables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5556 -j DNAT --to 192.168.1.1:8886
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Initialization script for Arduino stuff
|
||||||
|
#
|
||||||
|
# Loads modules and launches proxy server application
|
||||||
|
# required for communication with Arduino module.
|
||||||
|
#
|
||||||
|
|
||||||
|
echo Enabling 5V
|
||||||
|
|
||||||
|
echo Enabling USB Port
|
||||||
|
gpio 127 -d ho 1
|
||||||
|
gpio 127 -d i
|
||||||
|
|
||||||
|
echo Loading dwc_otg.ko
|
||||||
|
insmod /data/dwc_otg.ko
|
||||||
|
|
||||||
|
echo Waiting 3s for the device to be ready
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
echo Setting correct baud rate of 38400 for /dev/ttyPA0
|
||||||
|
stty -F /dev/ttyPA0 raw speed 38400 -crtscts cs8 -cstopb -parenb
|
||||||
|
|
||||||
|
#echo Activate log
|
||||||
|
#cat /dev/ttyPA0 >> /data/video/gps.log.0 &
|
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# IP_ADDR - this target IP address using CIDR notation:
|
||||||
|
# <target-ip>/<target-bitmask>
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
echo init started...
|
||||||
|
|
||||||
|
/bin/mount -t tmpfs tmp /tmp
|
||||||
|
/bin/mount -t proc proc /proc
|
||||||
|
/bin/mount -o remount,rw /
|
||||||
|
/bin/mount -t tmpfs dev /dev
|
||||||
|
/bin/mkdir -p /dev/shm /dev/pts
|
||||||
|
/bin/mount -t devpts devpts /dev/pts
|
||||||
|
/bin/mount -t sysfs sys /sys
|
||||||
|
|
||||||
|
#don't allow overcommit (allocate more memory that the physical one)
|
||||||
|
echo 2 > /proc/sys/vm/overcommit_memory
|
||||||
|
echo 90 > /proc/sys/vm/overcommit_ratio
|
||||||
|
|
||||||
|
#in case of unaligned access print a message and send a SIGBUS
|
||||||
|
echo 5 > /proc/cpu/alignment
|
||||||
|
|
||||||
|
#reboot after 1s after a panic
|
||||||
|
echo 1 > /proc/sys/kernel/panic
|
||||||
|
|
||||||
|
#panic when an oops or BUG is encountered
|
||||||
|
#disable this for developer
|
||||||
|
echo 1 > /proc/sys/kernel/panic_on_oops
|
||||||
|
|
||||||
|
echo 4 > /sys/module/p6_camif/parameters/lines_per_irq
|
||||||
|
echo -1 > /proc/sys/kernel/sched_rt_runtime_us
|
||||||
|
|
||||||
|
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
|
||||||
|
/sbin/mdev -s
|
||||||
|
|
||||||
|
# Don't show kernel messages
|
||||||
|
dmesg -n1
|
||||||
|
|
||||||
|
/bin/mkdir -p /update
|
||||||
|
/bin/mount -a
|
||||||
|
/bin/mkdir -p /data/video
|
||||||
|
|
||||||
|
/bin/hostname -F /etc/hostname
|
||||||
|
/sbin/ifconfig lo 127.0.0.1 up
|
||||||
|
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
|
||||||
|
/bin/factory_reset_cb&
|
||||||
|
modprobe p6_sdhci
|
||||||
|
/bin/wifi_setup.sh
|
||||||
|
|
||||||
|
# Patch to enable button management.
|
||||||
|
ln -s /dev /dev/input
|
||||||
|
|
||||||
|
/data/gps.sh
|
||||||
|
|
||||||
|
#mount -o nolock,proto=tcp -t nfs 192.168.0.11:/mnt/video /home/default
|
||||||
|
/bin/check_update.sh
|
||||||
|
|
||||||
|
echo init exit
|
||||||
|
echo if you want to customize init look at target/generic/target_skeleton/etc files
|
||||||
|
echo if crtl+c does not work look at the Linux FAQ section.
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copie du fichier wifi_setup.sh pour un mode recovery en cas de pb reseau
|
||||||
|
#cp /bin/wifi_setup.sh.orig /bin/wifi_setup.sh
|
||||||
|
|
||||||
|
export LD_PRELOAD=/data/libioctl_arm.so
|
||||||
|
|
||||||
|
UPDATE_PATH=/update/ardrone_update.plf
|
||||||
|
VERSION_PATH=/update/version.txt
|
||||||
|
ERR_PATH=/update/err.log
|
||||||
|
|
||||||
|
echo "Copy version.txt file in ftp directory"
|
||||||
|
cp /firmware/version.txt $VERSION_PATH
|
||||||
|
|
||||||
|
echo "Check if update is necessary ..."
|
||||||
|
if [ -e $UPDATE_PATH ] ; then
|
||||||
|
VERSION=`cat $VERSION_PATH`
|
||||||
|
|
||||||
|
if [ -e $ERR_PATH ] ; then
|
||||||
|
CHECK_ERR=`cat $ERR_PATH`
|
||||||
|
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||||
|
CHECK_PLF=`/bin/checkplf $UPDATE_PATH $VERSION`
|
||||||
|
if [ "$CHECK_PLF" = "NEED_TO_FLASH" ] ; then
|
||||||
|
echo "ERR=FLASH_KO" > $ERR_PATH
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/bin/checkplf $UPDATE_PATH $VERSION > $ERR_PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHECK_ERR=`cat $ERR_PATH`
|
||||||
|
if [ "$CHECK_ERR" = "NEED_TO_FLASH" ] ; then
|
||||||
|
echo "File $UPDATE_PATH exists... Start updating..."
|
||||||
|
pinst_trigger
|
||||||
|
echo "Rebooting..."
|
||||||
|
reboot
|
||||||
|
else
|
||||||
|
if [ "$CHECK_ERR" = "VERSION_OK" ] ; then
|
||||||
|
echo "Version OK"
|
||||||
|
elif [ "$CHECK_ERR" = "ERR=FLASH_KO" ] ; then
|
||||||
|
echo "Error during Updating... Removing..."
|
||||||
|
else
|
||||||
|
echo "File $UPDATE_PATH not valid... Removing..."
|
||||||
|
fi
|
||||||
|
rm -Rf $UPDATE_PATH
|
||||||
|
echo "Start Drone software..."
|
||||||
|
inetd
|
||||||
|
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "File $UPDATE_PATH doesn't exists... Start Drone software..."
|
||||||
|
if [ -e $ERR_PATH ] ; then
|
||||||
|
rm -Rf $ERR_PATH
|
||||||
|
fi
|
||||||
|
inetd
|
||||||
|
(/bin/program.elf ; gpio 63 -d ho 1) &
|
||||||
|
fi
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Script to setup drone pairing
|
||||||
|
#
|
||||||
|
|
||||||
|
# Getting Iphone's MAC address from config.ini file.
|
||||||
|
NULL_MAC=00:00:00:00:00:00
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
if [ -s /data/config.ini ]
|
||||||
|
then
|
||||||
|
MAC_ADDR=`grep owner_mac /data/config.ini | awk -F "=" '{print $2}'`
|
||||||
|
else
|
||||||
|
MAC_ADDR=$NULL_MAC
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
MAC_ADDR=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Owner's MAC address is: $MAC_ADDR"
|
||||||
|
|
||||||
|
# [Stephane] Exits if owner MAC address is already being filtered
|
||||||
|
# (changing iptables rules too often may crash the drone for a undetermined reason)
|
||||||
|
CURRENTLY_ALLOWED_MAC_ADDR=`iptables -L | grep MAC | awk -F " " '{print $7}'`
|
||||||
|
if [ "$CURRENTLY_ALLOWED_MAC_ADDR" = "$MAC_ADDR" ]
|
||||||
|
then
|
||||||
|
echo "Drone is already paired with $MAC_ADDR"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $MAC_ADDR != $NULL_MAC ]
|
||||||
|
then
|
||||||
|
echo "Setting pairing for: $MAC_ADDR"
|
||||||
|
# Clearing all rules
|
||||||
|
iptables -P INPUT ACCEPT
|
||||||
|
iptables -F
|
||||||
|
# Allowing only owner's traffic
|
||||||
|
iptables -A INPUT -m mac --mac-source $MAC_ADDR -j ACCEPT
|
||||||
|
# allowing ICMP (ping), ftp, nfs and telnet traffic for everyone.
|
||||||
|
iptables -A INPUT --protocol icmp -j ACCEPT
|
||||||
|
#iptables -A INPUT --protocol tcp --dport 23 -j ACCEPT
|
||||||
|
iptables -A INPUT --protocol tcp --dport 21 -j ACCEPT
|
||||||
|
iptables -A INPUT --protocol tcp --dport 2049 -j ACCEPT
|
||||||
|
# Blocking all incoming traffic by default
|
||||||
|
iptables -P INPUT DROP
|
||||||
|
else
|
||||||
|
echo "Clearing pairing rule"
|
||||||
|
# Switching rad LED on
|
||||||
|
gpio 63 -d ho 1
|
||||||
|
|
||||||
|
# Clearing all rules
|
||||||
|
iptables -F
|
||||||
|
# Allows incoming connections from anywhere outside
|
||||||
|
iptables -P INPUT ACCEPT
|
||||||
|
|
||||||
|
# Switching rad LED off
|
||||||
|
gpio 63 -d ho 0
|
||||||
|
fi
|
|
@ -0,0 +1,127 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Script to see if an IP adress is already used or not
|
||||||
|
#
|
||||||
|
# Getting SSID from config.ini file.
|
||||||
|
|
||||||
|
#initializing random generator
|
||||||
|
cat /data/random_mac.txt > /dev/urandom
|
||||||
|
/bin/random_mac > /data/random_mac.txt
|
||||||
|
|
||||||
|
|
||||||
|
#echo 2 > /proc/cpu/alignment
|
||||||
|
#export WORKAREA=/
|
||||||
|
#export ATH_PLATFORM=ardrone
|
||||||
|
#/usr/sbin/recEvent /data/athdbg.log&
|
||||||
|
|
||||||
|
|
||||||
|
if [ -s /factory/mac_address.txt ]
|
||||||
|
then
|
||||||
|
MAC_ADDR=`cat /factory/mac_address.txt`
|
||||||
|
else
|
||||||
|
MAC_ADDR=`cat /data/random_mac.txt`
|
||||||
|
fi
|
||||||
|
|
||||||
|
loadAR6k.sh --setmac $MAC_ADDR
|
||||||
|
#loadtestcmd.sh
|
||||||
|
|
||||||
|
# Waiting 2s for the wifi chip to be ready
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Increasing scan time to help detecting wifi networks
|
||||||
|
wmiconfig -i ath0 --scan --maxact=80
|
||||||
|
# Setting retry limits to 6
|
||||||
|
wmiconfig -i ath0 --setretrylimits 2 0 6 off
|
||||||
|
# Limiting available rates to 11, 24 or 54 Mb/s
|
||||||
|
wmiconfig -i ath0 --setfixrates 3 8 11
|
||||||
|
# Disabling powersaving
|
||||||
|
wmiconfig -i ath0 --power maxperf
|
||||||
|
|
||||||
|
|
||||||
|
SSID=`grep ssid_single_player /data/config.ini | awk -F "=" '{print $2}'`
|
||||||
|
|
||||||
|
# Removing leading and trailing spaces
|
||||||
|
SSID=`echo $SSID`
|
||||||
|
if [ -n "$SSID" ]
|
||||||
|
then
|
||||||
|
echo "SSID=$SSID"
|
||||||
|
else
|
||||||
|
#default SSID.
|
||||||
|
SSID=ardrone_wifi
|
||||||
|
echo "SSID=\"$SSID\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
export NETIF=ath0
|
||||||
|
RANDOM_CHAN=`/bin/channelselector`
|
||||||
|
|
||||||
|
echo "Create/Join Ad-Hoc Network $SSID"
|
||||||
|
|
||||||
|
#iwconfig ath0 mode ad-hoc
|
||||||
|
#iwconfig ath0 channel $RANDOM_CHAN
|
||||||
|
#iwconfig ath0 essid "$SSID"
|
||||||
|
|
||||||
|
iwconfig ath0 mode ad-hoc essid owl_2 channel auto
|
||||||
|
|
||||||
|
OK=0
|
||||||
|
BASE_ADRESS=192.168.1.
|
||||||
|
PROBE=1
|
||||||
|
|
||||||
|
while [ $OK -eq 0 ]
|
||||||
|
do
|
||||||
|
#configuring interface.
|
||||||
|
ifconfig ath0 $BASE_ADRESS$PROBE
|
||||||
|
ifconfig ath0:0 192.168.11.1
|
||||||
|
arping -I ath0 -q -f -D -w 2 $BASE_ADRESS$PROBE
|
||||||
|
|
||||||
|
if [ $? -eq 1 ]
|
||||||
|
then
|
||||||
|
if [ -s /data/old_adress.txt ]
|
||||||
|
then
|
||||||
|
# Testing previously given adress.
|
||||||
|
PROBE=`cat /data/old_adress.txt`
|
||||||
|
else
|
||||||
|
#generating random odd IP address
|
||||||
|
PROBE=`/bin/random_ip`
|
||||||
|
fi
|
||||||
|
/bin/random_ip > /data/old_adress.txt
|
||||||
|
else
|
||||||
|
echo $PROBE > /data/old_adress.txt
|
||||||
|
OK=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
#Configuring DHCP server.
|
||||||
|
echo "Using address $BASE_ADRESS$PROBE"
|
||||||
|
echo "start $BASE_ADRESS`expr $PROBE + 1`" > /tmp/udhcpd.conf
|
||||||
|
echo "end $BASE_ADRESS`expr $PROBE + 4`" >> /tmp/udhcpd.conf
|
||||||
|
echo "interface ath0" >> /tmp/udhcpd.conf
|
||||||
|
echo "decline_time 1" >> /tmp/udhcpd.conf
|
||||||
|
echo "conflict_time 1" >> /tmp/udhcpd.conf
|
||||||
|
echo "opt subnet 255.255.255.0" >> /tmp/udhcpd.conf
|
||||||
|
#echo "opt router $BASE_ADRESS$PROBE" >> /tmp/udhcpd.conf
|
||||||
|
echo "opt lease 1200" >> /tmp/udhcpd.conf
|
||||||
|
|
||||||
|
/bin/pairing_setup.sh
|
||||||
|
|
||||||
|
# Saving random info for initialization at next reboot
|
||||||
|
date > /dev/urandom
|
||||||
|
/bin/random_mac > /data/random_mac.txt
|
||||||
|
|
||||||
|
iwconfig ath0 rate 54M
|
||||||
|
iwconfig ath0 rate auto
|
||||||
|
|
||||||
|
telnetd -l /bin/sh
|
||||||
|
udhcpd /tmp/udhcpd.conf
|
||||||
|
#diversity&
|
||||||
|
|
||||||
|
# Adding route for multicast-packet
|
||||||
|
# note : ! should be runned after hostapd is initialized !
|
||||||
|
route add -net 224.0.0.0 netmask 240.0.0.0 dev ath0
|
||||||
|
|
||||||
|
#Adding routing table iptable
|
||||||
|
iptables -t nat -A POSTROUTING -p UDP --sport 8884 -j SNAT --to 192.168.1.254:5554
|
||||||
|
iptables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5554 -j DNAT --to 192.168.1.1:8884
|
||||||
|
iptables -t nat -A POSTROUTING -p UDP --sport 8886 -j SNAT --to 192.168.1.254:5556
|
||||||
|
optables -t nat -A PREROUTING -p UDP -d 192.168.1.254 --dport 5556 -j DNAT --to 192.168.1.1:8886
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Switch Wifi mode depending on value into /data/config.ini
|
||||||
|
#
|
||||||
|
|
||||||
|
WIFI_MODE=`grep wifi_mode /data/config.ini | awk -F "=" '{ gsub(/ */,"",$2); print $2}'`
|
||||||
|
|
||||||
|
case $WIFI_MODE in
|
||||||
|
0)
|
||||||
|
/bin/wifi_adhoc.sh
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
/bin/wifi_infra.sh
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
/bin/wifi_managed.sh
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
/bin/wifi_adhoc.sh
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Initialization script for Arduino stuff
|
||||||
|
#
|
||||||
|
# Loads modules and launches proxy server application
|
||||||
|
# required for communication with Arduino module.
|
||||||
|
#
|
||||||
|
|
||||||
|
echo Enabling 5V
|
||||||
|
|
||||||
|
echo Enabling USB Port
|
||||||
|
gpio 127 -d ho 1
|
||||||
|
gpio 127 -d i
|
||||||
|
|
||||||
|
echo Loading dwc_otg.ko
|
||||||
|
insmod /data/dwc_otg.ko
|
||||||
|
|
||||||
|
echo Waiting 3s for the device to be ready
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
echo Setting correct baud rate of 38400 for /dev/ttyPA0
|
||||||
|
stty -F /dev/ttyPA0 raw speed 38400 -crtscts cs8 -cstopb -parenb
|
||||||
|
|
||||||
|
#echo Activate log
|
||||||
|
#cat /dev/ttyPA0 >> /data/video/gps.log.0 &
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# IP_ADDR - this target IP address using CIDR notation:
|
||||||
|
# <target-ip>/<target-bitmask>
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
echo init started...
|
||||||
|
|
||||||
|
/bin/mount -t tmpfs tmp /tmp
|
||||||
|
/bin/mount -t proc proc /proc
|
||||||
|
/bin/mount -o remount,rw /
|
||||||
|
/bin/mount -t tmpfs dev /dev
|
||||||
|
/bin/mkdir -p /dev/shm /dev/pts
|
||||||
|
/bin/mount -t devpts devpts /dev/pts
|
||||||
|
/bin/mount -t sysfs sys /sys
|
||||||
|
|
||||||
|
#don't allow overcommit (allocate more memory that the physical one)
|
||||||
|
echo 2 > /proc/sys/vm/overcommit_memory
|
||||||
|
echo 90 > /proc/sys/vm/overcommit_ratio
|
||||||
|
|
||||||
|
#in case of unaligned access print a message and send a SIGBUS
|
||||||
|
echo 5 > /proc/cpu/alignment
|
||||||
|
|
||||||
|
#reboot after 1s after a panic
|
||||||
|
echo 1 > /proc/sys/kernel/panic
|
||||||
|
|
||||||
|
#panic when an oops or BUG is encountered
|
||||||
|
#disable this for developer
|
||||||
|
echo 1 > /proc/sys/kernel/panic_on_oops
|
||||||
|
|
||||||
|
echo 4 > /sys/module/p6_camif/parameters/lines_per_irq
|
||||||
|
echo -1 > /proc/sys/kernel/sched_rt_runtime_us
|
||||||
|
|
||||||
|
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
|
||||||
|
/sbin/mdev -s
|
||||||
|
|
||||||
|
# Don't show kernel messages
|
||||||
|
dmesg -n1
|
||||||
|
|
||||||
|
/bin/mkdir -p /update
|
||||||
|
/bin/mount -a
|
||||||
|
/bin/mkdir -p /data/video
|
||||||
|
|
||||||
|
/bin/hostname -F /etc/hostname
|
||||||
|
/sbin/ifconfig lo 127.0.0.1 up
|
||||||
|
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
|
||||||
|
/bin/factory_reset_cb&
|
||||||
|
modprobe p6_sdhci
|
||||||
|
/bin/wifi_setup.sh
|
||||||
|
|
||||||
|
#Copy the licenses.txt file to the ftp directory so users can find it.
|
||||||
|
cp /licenses/licenses.txt /data/video
|
||||||
|
|
||||||
|
# Patch to enable button management.
|
||||||
|
ln -s /dev /dev/input
|
||||||
|
|
||||||
|
/data/gps.sh
|
||||||
|
|
||||||
|
#mount -o nolock,proto=tcp -t nfs 192.168.0.11:/mnt/video /home/default
|
||||||
|
/bin/check_update.sh
|
||||||
|
|
||||||
|
echo init exit
|
||||||
|
echo if you want to customize init look at target/generic/target_skeleton/etc files
|
||||||
|
echo if crtl+c does not work look at the Linux FAQ section.
|
|
@ -0,0 +1,117 @@
|
||||||
|
# Source version
|
||||||
|
ifndef OWLPS_VERSION
|
||||||
|
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN_PREFIX = /arm
|
||||||
|
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/bin
|
||||||
|
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi
|
||||||
|
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/arm-none-linux-gnueabi/libc
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN_BIN)/arm-none-linux-gnueabi-gcc
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_DIR= $(PREFIX)/bin
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Commandes d'installation et de désinstallation
|
||||||
|
RM=rm -fv
|
||||||
|
CP=cp -v
|
||||||
|
|
||||||
|
# Cible
|
||||||
|
TARGET=owlps-client
|
||||||
|
HEADER=
|
||||||
|
|
||||||
|
# Flags
|
||||||
|
LIBOWLPS_DIR = ../libowlps
|
||||||
|
LIBOWLPSCLIENT_DIR = ../libowlps-client
|
||||||
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -I.
|
||||||
|
DEPFLAGS = -MMD
|
||||||
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG = -fPIC
|
||||||
|
LOWLPS = -L$(LIBOWLPS_DIR) -lowlps
|
||||||
|
LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a
|
||||||
|
LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
|
||||||
|
LIBS = $(LOWLPSCLIENTA) -liw -lm -lrt
|
||||||
|
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
|
||||||
|
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
|
||||||
|
STATIC_LIBS = $(LOWLPSA) $(LIBS)
|
||||||
|
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
|
||||||
|
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
|
||||||
|
LDFLAGS = $(IATHEROS) $(LATHEROS)
|
||||||
|
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\"
|
||||||
|
OWLPSFLAGS += -D DEBUG
|
||||||
|
|
||||||
|
## Cibles de compilation standard ##
|
||||||
|
|
||||||
|
.PHONY: all semistatic static install uninstall clean purge help
|
||||||
|
|
||||||
|
semistatic: $(TARGET)
|
||||||
|
static: $(TARGET).static
|
||||||
|
all: semistatic static
|
||||||
|
|
||||||
|
# Cancel implicit make rule
|
||||||
|
%: %.c
|
||||||
|
|
||||||
|
#%: %.o
|
||||||
|
# $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(DYNAMIC_LIBS)
|
||||||
|
|
||||||
|
%: %.o
|
||||||
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) $(OWLPSFLAGS) -o $@ $^ $(LDFLAGS) $(SEMISTATIC_LIBS)
|
||||||
|
|
||||||
|
%.static: %.o
|
||||||
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(STATIC_LIBS) \
|
||||||
|
-static
|
||||||
|
|
||||||
|
%.o: %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) $(OWLPSFLAGS) -c $<
|
||||||
|
|
||||||
|
|
||||||
|
## Installation / désinstallation ##
|
||||||
|
|
||||||
|
install : $(TARGET)
|
||||||
|
@$(CP) $(TARGET) $(INSTALL_DIR)
|
||||||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET) ; chmod 755 $(TARGET)
|
||||||
|
|
||||||
|
uninstall :
|
||||||
|
@$(RM) $(INSTALL_DIR)/$(TARGET)
|
||||||
|
|
||||||
|
|
||||||
|
## Nettoyage ##
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@$(RM) -fv *~ *.o *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) -fv $(TARGET) $(TARGET).static $(TARGET)-drone
|
||||||
|
|
||||||
|
|
||||||
|
## Aide ##
|
||||||
|
|
||||||
|
help :
|
||||||
|
@echo -e "Bibliothèques nécessaires à la compilation :\n\
|
||||||
|
libowlps1.0 (fournie)\n\
|
||||||
|
\n\
|
||||||
|
Cibles possibles :\n\
|
||||||
|
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
|
||||||
|
$(TARGET).static : Compile le programme $(TARGET).static \
|
||||||
|
(version sans lien dynamique).\n\
|
||||||
|
$(TARGET).semistatic : Compile le programme $(TARGET).semistatic \
|
||||||
|
(version sans lien dynamique vers libowlps).\n\
|
||||||
|
install : Installe le programme $(TARGET).\n\
|
||||||
|
uninstall : Désinstalle le programme $(TARGET).\n\
|
||||||
|
clean : Supprime les fichiers temporaires.\n\
|
||||||
|
purge : Supprime le résultat de la compilation.\n\
|
||||||
|
\n\
|
||||||
|
Note : l'installation se fait dans l'arborescence $(PREFIX). \
|
||||||
|
Modifiez la variable PREFIX du Makefile pour changer ce comportement."
|
||||||
|
|
||||||
|
|
||||||
|
# Local Variables: *
|
||||||
|
# mode: makefile-gmake *
|
||||||
|
# End: *
|
Loading…
Reference in New Issue