Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use own namespace #13

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,46 @@ ifeq ($(shell cd $(KERNELPATH) && pwd),)
$(warning $(KERNELPATH) is missing, please set KERNELPATH)
endif

OBJCOPY ?= objcopy
OBJDUMP ?= objdump

export KERNELPATH
RM ?= rm -f
RMDIR ?= rm -rf

REVISION= $(shell if [ -d "$(PWD)/.git" ]; then \
echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
fi)

CONFIG_BATMAN_ADV=m
batman-adv-y += compat.o
batman-adv-legacy-y += compat.o
ifneq ($(REVISION),)
ccflags-y += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
endif
include $(PWD)/Makefile.kbuild

all: config
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) modules
all: batman-adv-legacy.ko

build:
mkdir -p "$@"

build/Makefile: build
touch "$@"

build/batman-adv-legacy.ko: config build/Makefile
$(MAKE) -C $(KERNELPATH) M=$(PWD)/build PWD=$(PWD) src=$(PWD) modules

build/updated-syms.txt: build/batman-adv-legacy.ko
$(OBJDUMP) -t $(PWD)/build/batman-adv-legacy.ko | grep batadv_ | \
sed "s/.* \([^ ]*\)batadv_\([^ ]*\)$$/\1batadv_\2 \1batadv_legacy_\2/" | \
sort | uniq > $(PWD)/build/updated-syms.txt

batman-adv-legacy.ko: build/batman-adv-legacy.ko build/updated-syms.txt
$(OBJCOPY) --redefine-syms=$(PWD)/build/updated-syms.txt $(PWD)/build/batman-adv-legacy.ko $(PWD)/batman-adv-legacy.ko

clean:
$(RM) compat-autoconf.h*
$(RMDIR) build
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean

install: config
Expand Down
42 changes: 21 additions & 21 deletions Makefile.kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@
# 02110-1301, USA
#

obj-$(CONFIG_BATMAN_ADV) += batman-adv.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bitarray.o
batman-adv-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
batman-adv-y += debugfs.o
batman-adv-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o
batman-adv-y += gateway_client.o
batman-adv-y += gateway_common.o
batman-adv-y += hard-interface.o
batman-adv-y += hash.o
batman-adv-y += icmp_socket.o
batman-adv-y += main.o
batman-adv-y += netlink.o
batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
batman-adv-y += originator.o
batman-adv-y += routing.o
batman-adv-y += send.o
batman-adv-y += soft-interface.o
batman-adv-y += sysfs.o
batman-adv-y += translation-table.o
batman-adv-y += unicast.o
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not touch this file and generate a batman-adv.ko from this build step.

obj-$(CONFIG_BATMAN_ADV) += batman-adv-legacy.o
batman-adv-legacy-y += bat_iv_ogm.o
batman-adv-legacy-y += bitarray.o
batman-adv-legacy-$(CONFIG_BATMAN_ADV_BLA) += bridge_loop_avoidance.o
batman-adv-legacy-y += debugfs.o
batman-adv-legacy-$(CONFIG_BATMAN_ADV_DAT) += distributed-arp-table.o
batman-adv-legacy-y += gateway_client.o
batman-adv-legacy-y += gateway_common.o
batman-adv-legacy-y += hard-interface.o
batman-adv-legacy-y += hash.o
batman-adv-legacy-y += icmp_socket.o
batman-adv-legacy-y += main.o
batman-adv-legacy-y += netlink.o
batman-adv-legacy-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
batman-adv-legacy-y += originator.o
batman-adv-legacy-y += routing.o
batman-adv-legacy-y += send.o
batman-adv-legacy-y += soft-interface.o
batman-adv-legacy-y += sysfs.o
batman-adv-legacy-y += translation-table.o
batman-adv-legacy-y += unicast.o
2 changes: 1 addition & 1 deletion debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef _NET_BATMAN_ADV_DEBUGFS_H_
#define _NET_BATMAN_ADV_DEBUGFS_H_

#define BATADV_DEBUGFS_SUBDIR "batman_adv"
#define BATADV_DEBUGFS_SUBDIR "batman_adv_legacy"

void batadv_debugfs_init(void);
void batadv_debugfs_destroy(void);
Expand Down
4 changes: 2 additions & 2 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#define BATADV_DRIVER_AUTHOR "Marek Lindner <[email protected]>, " \
"Simon Wunderlich <[email protected]>"
#define BATADV_DRIVER_DESC "B.A.T.M.A.N. advanced"
#define BATADV_DRIVER_DEVICE "batman-adv"
#define BATADV_DRIVER_DESC "B.A.T.M.A.N. advanced legacy (compat 14)"
#define BATADV_DRIVER_DEVICE "batman-adv-legacy"

#ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION "2013.4.0"
Expand Down
2 changes: 1 addition & 1 deletion soft-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ int batadv_softif_is_valid(const struct net_device *net_dev)
}

struct rtnl_link_ops batadv_link_ops __read_mostly = {
.kind = "batadv",
.kind = "batadv-legacy",
.priv_size = sizeof(struct batadv_priv),
.setup = batadv_softif_init_early,
.dellink = batadv_softif_destroy_netlink,
Expand Down
2 changes: 1 addition & 1 deletion sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define _NET_BATMAN_ADV_SYSFS_H_

#define BATADV_SYSFS_IF_MESH_SUBDIR "mesh"
#define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv"
#define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv_legacy"

struct batadv_attribute {
struct attribute attr;
Expand Down
2 changes: 1 addition & 1 deletion uapi/linux/batman_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef _UAPI_LINUX_BATMAN_ADV_H_
#define _UAPI_LINUX_BATMAN_ADV_H_

#define BATADV_NL_NAME "batadv"
#define BATADV_NL_NAME "batadv_legacy"

#define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"

Expand Down