forked from mirakonta/OpenWrt-lora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openwrt-add-lora-gateway.patch
90 lines (88 loc) · 2.77 KB
/
openwrt-add-lora-gateway.patch
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
commit c2449a6917b2080f14bf96c690ea2c5d91799fdf
Author: JiapengLi <[email protected]>
Date: Mon Apr 7 00:39:41 2014 +0800
Add lora-gateway support.
diff --git a/utils/lora-gateway/Makefile b/utils/lora-gateway/Makefile
new file mode 100644
index 0000000..53236b1
--- /dev/null
+++ b/utils/lora-gateway/Makefile
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lora_gateway
+PKG_VERSION:=3.1.0a
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/mirakonta/lora_gateway.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=a01a504e004bbe2e6a18c169fb9e2de2f617cb94
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lora-gateway/Default
+ TITLE:=Semtech lora-gateway package
+ URL:=http://www.semtech.com/wireless-rf/lora.html
+endef
+
+define Package/lora-gateway
+$(call Package/lora-gateway/Default)
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=+libmpsse libftdi
+endef
+
+define Package/lora-gateway/description
+ lora-gateway is a library to build a gateway based on
+ a Semtech LoRa multi-channel RF receiver (a.k.a. concentrator).
+endef
+
+TARGET_CFLAGS += $(FPIC) -O2 -Wall -Wextra -std=c99 -Iinc -I. -lm
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include/lora-gateway
+ $(CP) $(PKG_BUILD_DIR)/libloragw/inc/* $(1)/usr/include/lora-gateway
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_BUILD_DIR)/libloragw/libloragw.a $(1)/usr/lib/
+endef
+
+define Package/lora-gateway/install
+ $(INSTALL_DIR) $(1)/root/lora
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/libloragw/test* $(1)/root/lora
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/util_pkt_logger/util_pkt_logger $(1)/root/lora
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/util_tx_continuous/util_tx_continuous $(1)/root/lora
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/util_spi_stress/util_spi_stress $(1)/root/lora
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/util_tx_test/util_tx_test $(1)/root/lora
+endef
+
+$(eval $(call BuildPackage,lora-gateway))
diff --git a/utils/lora-gateway/patches/000-add-missing-header.patch b/utils/lora-gateway/patches/000-add-missing-header.patch
new file mode 100644
index 0000000..d8ce411
--- /dev/null
+++ b/utils/lora-gateway/patches/000-add-missing-header.patch
@@ -0,0 +1,12 @@
+--- a/libloragw/src/loragw_spi.ftdi.c
++++ b/libloragw/src/loragw_spi.ftdi.c
+@@ -26,6 +26,9 @@ Maintainer: Sylvain Miermont
+ #include <stdlib.h> /* malloc free */
+ #include <string.h> /* memcpy */
+
++#include <sys/types.h>
++#include <linux/limits.h>
++
+ #include <mpsse.h>
+
+ #include "loragw_spi.h"