mirror of https://github.com/sipwise/rtpengine.git
parent
1bf1067674
commit
ec01db25cb
@ -1,13 +1,21 @@
|
||||
PWD := $(shell pwd)
|
||||
KSRC ?= /lib/modules/$(shell uname -r)/build
|
||||
KBUILD := $(KSRC)
|
||||
MEDIAPROXY_VERSION = $(shell dpkg-parsechangelog -l$(M)/../debian/changelog | awk '/^Version: / {print $$2}')
|
||||
EXTRA_CFLAGS += -DMEDIAPROXY_VERSION="\"$(MEDIAPROXY_VERSION)\""
|
||||
ifeq ($(origin MEDIAPROXY_VERSION), undefined)
|
||||
MEDIAPROXY_VERSION := $(shell dpkg-parsechangelog -l../debian/changelog | awk '/^Version: / {print $$2}')
|
||||
export MEDIAPROXY_VERSION
|
||||
endif
|
||||
EXTRA_CFLAGS += -DMEDIAPROXY_VERSION="\"$(MEDIAPROXY_VERSION)\"" -D__MP_EXTERNAL
|
||||
|
||||
obj-m += xt_MEDIAPROXY.o
|
||||
|
||||
.PHONY: modules clean patch
|
||||
|
||||
modules:
|
||||
make -C $(KBUILD) M=$(PWD) O=$(KBUILD) modules
|
||||
|
||||
clean:
|
||||
make -C $(KBUILD) M=$(PWD) clean
|
||||
|
||||
patch:
|
||||
../utils/patch-kernel magic "$(PWD)" "$(KERNEL)" "$(MEDIAPROXY_VERSION)"
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
if test "$1" != magic; then
|
||||
echo
|
||||
echo "Don't run this script manually, instead run:"
|
||||
echo " make patch KERNEL=/path/to/kernel/sources"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$3"; then
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo " make patch KERNEL=/path/to/kernel/sources"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KERN=$3
|
||||
|
||||
for x in . include/linux/netfilter/ net/netfilter/Kconfig net/netfilter/Makefile; do
|
||||
if ! test -e "$KERN"/"$x"; then
|
||||
echo "I don't recognize $KERN as a kernel source tree"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
set -e
|
||||
|
||||
cp -v xt_MEDIAPROXY.h "$KERN"/include/linux/netfilter/
|
||||
cp -v xt_MEDIAPROXY.c "$KERN"/net/netfilter/
|
||||
|
||||
if ! grep -q CONFIG_NETFILTER_XT_TARGET_MEDIAPROXY "$KERN"/net/netfilter/Makefile; then
|
||||
(
|
||||
echo
|
||||
echo "EXTRA_CFLAGS += -DMEDIAPROXY_VERSION=\"\\\"$4\\\"\""
|
||||
echo 'obj-$(CONFIG_NETFILTER_XT_TARGET_MEDIAPROXY) += xt_MEDIAPROXY.o'
|
||||
) >> "$KERN"/net/netfilter/Makefile
|
||||
fi
|
||||
|
||||
if ! grep -q Kconfig\\.mediaproxy-ng "$KERN"/net/netfilter/Kconfig; then
|
||||
cat >> "$KERN"/net/netfilter/Kconfig.mediaproxy-ng << \__EOF
|
||||
config NETFILTER_XT_TARGET_MEDIAPROXY
|
||||
tristate "Sipwise NGCP MEDIAPROXY target support"
|
||||
depends on IP_NF_FILTER
|
||||
help
|
||||
Sipwise NGCP mediaproxy-ng kernel support
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
__EOF
|
||||
echo 'source "net/netfilter/Kconfig.mediaproxy-ng"' >> "$KERN"/net/netfilter/Kconfig
|
||||
fi
|
||||
Loading…
Reference in new issue