batman-adv-legacy: fix applying batctl patches and fix musl build
This commit is contained in:
parent
fd5e16160a
commit
1faf424b35
|
@ -11,6 +11,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=batman-adv-legacy
|
PKG_NAME:=batman-adv-legacy
|
||||||
|
|
||||||
PKG_VERSION:=2015-01-11
|
PKG_VERSION:=2015-01-11
|
||||||
|
PKG_RELEASE:=2
|
||||||
BATCTL_VERSION:=2013.4.0
|
BATCTL_VERSION:=2013.4.0
|
||||||
BATCTL_MD5SUM:=42e269cc710bbc9a8fd17628201d4258
|
BATCTL_MD5SUM:=42e269cc710bbc9a8fd17628201d4258
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ endef
|
||||||
$(eval $(call Download,batctl-legacy))
|
$(eval $(call Download,batctl-legacy))
|
||||||
|
|
||||||
BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
|
BATCTL_EXTRACT = tar xzf "$(DL_DIR)/batctl-$(BATCTL_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
|
||||||
BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)",".*batctl.*")
|
BATCTL_PATCH = $(call Build/DoPatch,"$(PKG_BATCTL_BUILD_DIR)","$(PATCH_DIR)",batctl)
|
||||||
BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
|
BATCTL_BUILD = $(MAKE_BATCTL_ENV) $(MAKE) -C $(PKG_BATCTL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
|
||||||
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
|
BATCTL_INSTALL = $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/sbin/batctl $(1)/usr/sbin/
|
||||||
endif
|
endif
|
||||||
|
@ -103,14 +104,14 @@ endif
|
||||||
KPATCH ?= $(PATCH)
|
KPATCH ?= $(PATCH)
|
||||||
define Build/DoPatch
|
define Build/DoPatch
|
||||||
@if [ -d "$(2)" ]; then \
|
@if [ -d "$(2)" ]; then \
|
||||||
if [ "$$$$(ls $(2) | grep -Ec $(3))" -gt 0 ]; then \
|
if [ "$$$$(ls $(2) | grep -Ec ',*$(3).*')" -gt 0 ]; then \
|
||||||
$(KPATCH) "$(1)" "$(2)" "$(3)"; \
|
$(KPATCH) "$(1)" "$(2)" "*$(3)*"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Patch
|
define Build/Patch
|
||||||
$(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)",".*batman.*")
|
$(call Build/DoPatch,"$(PKG_BUILD_DIR)","$(PATCH_DIR)",batman)
|
||||||
$(BATCTL_EXTRACT)
|
$(BATCTL_EXTRACT)
|
||||||
$(BATCTL_PATCH)
|
$(BATCTL_PATCH)
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
From f9b50cd48c8cca1b9c7e8b8f6611265cc62674e1 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <f9b50cd48c8cca1b9c7e8b8f6611265cc62674e1.1435782705.git.mschiffer@universe-factory.net>
|
||||||
|
In-Reply-To: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435782705.git.mschiffer@universe-factory.net>
|
||||||
|
References: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435782705.git.mschiffer@universe-factory.net>
|
||||||
|
From: Sven Eckelmann <sven@narfation.org>
|
||||||
|
Date: Fri, 17 Apr 2015 19:40:28 +0200
|
||||||
|
Subject: [PATCH 2/2] batctl: Add required includes to all files
|
||||||
|
|
||||||
|
The header files could not be build indepdent from each other. This is happened
|
||||||
|
because headers didn't include the files for things they've used. This was
|
||||||
|
problematic because the success of a build depended on the knowledge about the
|
||||||
|
right order of local includes.
|
||||||
|
|
||||||
|
Also source files were not including everything they've used explicitly.
|
||||||
|
Instead they required that transitive includes are always stable. This is
|
||||||
|
problematic because some transitive includes are not obvious, depend on config
|
||||||
|
settings and may not be stable in the future.
|
||||||
|
|
||||||
|
The order for include blocks are:
|
||||||
|
|
||||||
|
* primary headers (main.h and the *.h file of a *.c file)
|
||||||
|
* global linux headers
|
||||||
|
* required local headers
|
||||||
|
* extra forward declarations for pointers in function/struct declarations
|
||||||
|
|
||||||
|
The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h. This
|
||||||
|
header file is shared with userspace applications like batctl and must
|
||||||
|
therefore build together with userspace applications. The header linux/bitops.h
|
||||||
|
is not part of the uapi headers and linux/if_ether.h conflicts with the musl
|
||||||
|
implementation of netinet/if_ether.h. The maintainers rejected the use of
|
||||||
|
__KERNEL__ preprocessor checks and thus these two headers are only in main.h.
|
||||||
|
All files using packet.h first have to include main.h to work correctly.
|
||||||
|
|
||||||
|
Reported-by: Markus Pargmann <mpa@pengutronix.de>
|
||||||
|
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||||
|
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
|
||||||
|
---
|
||||||
|
packet.h | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/packet.h b/packet.h
|
||||||
|
index a51ccfc..3767a86 100644
|
||||||
|
--- a/packet.h
|
||||||
|
+++ b/packet.h
|
||||||
|
@@ -20,6 +20,9 @@
|
||||||
|
#ifndef _NET_BATMAN_ADV_PACKET_H_
|
||||||
|
#define _NET_BATMAN_ADV_PACKET_H_
|
||||||
|
|
||||||
|
+#include <asm/byteorder.h>
|
||||||
|
+#include <linux/types.h>
|
||||||
|
+
|
||||||
|
enum batadv_packettype {
|
||||||
|
BATADV_IV_OGM = 0x01,
|
||||||
|
BATADV_ICMP = 0x02,
|
||||||
|
--
|
||||||
|
2.4.5
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
From e718de23e6cf05c75d3cd352de3ae50ff40adbef Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <e718de23e6cf05c75d3cd352de3ae50ff40adbef.1435784617.git.mschiffer@universe-factory.net>
|
||||||
|
In-Reply-To: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435784617.git.mschiffer@universe-factory.net>
|
||||||
|
References: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435784617.git.mschiffer@universe-factory.net>
|
||||||
|
From: Sven Eckelmann <sven@narfation.org>
|
||||||
|
Date: Tue, 10 Sep 2013 23:11:53 +0200
|
||||||
|
Subject: [PATCH 3/3] batctl: Fix inconsistent use of _GNU_SOURCE
|
||||||
|
|
||||||
|
Either all or no source file should define _GNU_SOURCE to avoid incompatible
|
||||||
|
types or function declarations.
|
||||||
|
|
||||||
|
Signed-off-by: Sven Eckelmann <sven@narfation.org>
|
||||||
|
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
|
||||||
|
---
|
||||||
|
Makefile | 1 +
|
||||||
|
bat-hosts.c | 1 -
|
||||||
|
functions.c | 1 -
|
||||||
|
vis.c | 1 -
|
||||||
|
4 files changed, 1 insertion(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 233f453..9e7c5be 100755
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -30,6 +30,7 @@ MANPAGE = man/batctl.8
|
||||||
|
|
||||||
|
# batctl flags and options
|
||||||
|
CFLAGS += -pedantic -Wall -W -std=gnu99 -fno-strict-aliasing -MD
|
||||||
|
+CPPFLAGS += -D_GNU_SOURCE
|
||||||
|
LDLIBS += -lm
|
||||||
|
|
||||||
|
# disable verbose output
|
||||||
|
diff --git a/bat-hosts.c b/bat-hosts.c
|
||||||
|
index 04e7a9b..053c26f 100644
|
||||||
|
--- a/bat-hosts.c
|
||||||
|
+++ b/bat-hosts.c
|
||||||
|
@@ -21,7 +21,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-#define _GNU_SOURCE
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
diff --git a/functions.c b/functions.c
|
||||||
|
index cc05a48..66f9a7d 100644
|
||||||
|
--- a/functions.c
|
||||||
|
+++ b/functions.c
|
||||||
|
@@ -20,7 +20,6 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
-#define _GNU_SOURCE
|
||||||
|
#include <netinet/ether.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
diff --git a/vis.c b/vis.c
|
||||||
|
index 33c7a7f..add93fd 100644
|
||||||
|
--- a/vis.c
|
||||||
|
+++ b/vis.c
|
||||||
|
@@ -19,7 +19,6 @@
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
-#define _GNU_SOURCE
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
--
|
||||||
|
2.4.5
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
From b6d87da52915aec1f012e9f048dfedb3fc61a824 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <b6d87da52915aec1f012e9f048dfedb3fc61a824.1435784837.git.mschiffer@universe-factory.net>
|
||||||
|
In-Reply-To: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435784837.git.mschiffer@universe-factory.net>
|
||||||
|
References: <704e64165f8d37c42fd13652cf8b1c0f56f37cd6.1435784837.git.mschiffer@universe-factory.net>
|
||||||
|
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
||||||
|
Date: Wed, 1 Jul 2015 23:06:48 +0200
|
||||||
|
Subject: [PATCH 4/4] batctl: Include <sys/types.h> for caddr_t definition
|
||||||
|
|
||||||
|
---
|
||||||
|
ioctl.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/ioctl.c b/ioctl.c
|
||||||
|
index 26bb482..393521c 100644
|
||||||
|
--- a/ioctl.c
|
||||||
|
+++ b/ioctl.c
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
--
|
||||||
|
2.4.5
|
||||||
|
|
Loading…
Reference in New Issue