wireguard: rename wireguard lib

The wireguard library's purpose is having a separate INC_DIR setting for the
files that need Linux include paths that would clash with Genode include paths.
Therefore, the name wireguard_lx_inc_dirs is more descriptive. Furthermore,
this allows us to create a new arch-specific wireguard lib in a future commit
in the course of preventing arch-specific target.mk's (a commonly used
approach in Genode).

Ref #4519
This commit is contained in:
Martin Stein 2022-05-23 12:48:30 +02:00 committed by Christian Helmuth
parent 823d0d5360
commit 83408ef35c
4 changed files with 30 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#
# For documentation see $(REP_DIR)/lib/mk/wireguard.inc .
# For documentation see $(REP_DIR)/lib/mk/wireguard_lx_inc_dirs.inc .
#
PRG_DIR := $(REP_DIR)/src/app/wireguard/spec/arm_64
@ -20,4 +20,5 @@ arch/arm64/crypto/poly1305-core.S:
CC_OPT_arch/arm64/crypto/poly1305-core += -Dpoly1305_init=poly1305_init_arm64
include $(REP_DIR)/lib/mk/wireguard.inc
include $(REP_DIR)/lib/mk/wireguard_lx_inc_dirs.inc

View File

@ -1,5 +1,5 @@
#
# For documentation see $(REP_DIR)/lib/mk/wireguard.inc .
# For documentation see $(REP_DIR)/lib/mk/wireguard_lx_inc_dirs.inc .
#
PRG_DIR := $(REP_DIR)/src/app/wireguard/spec/x86_64
@ -9,4 +9,4 @@ SRC_S += arch/x86/crypto/poly1305-x86_64-cryptogams.S
arch/x86/crypto/poly1305-x86_64-cryptogams.S:
perl $(LX_SRC_DIR)/arch/x86/crypto/poly1305-x86_64-cryptogams.pl > $@
include $(REP_DIR)/lib/mk/wireguard.inc
include $(REP_DIR)/lib/mk/wireguard_lx_inc_dirs.inc

View File

@ -1,7 +1,7 @@
#
# This library is for avoiding clashes between Linux and Genode includes.
# If we were to compile all the *.c files of this library directly with the
# Wireguard target there would be only one INC_DIR applied to *.cc files as
# WireGuard target there would be only one INC_DIR applied to *.cc files as
# well as to *.c files. Some Genode headers, however (e.g. 'net/udp.h' or
# 'net/dhcp.h') exist with the same include identifier in both Linux and
# Genode, and we would have the problem that we want the Linux variant in *.c
@ -18,29 +18,42 @@ SRC_C += lx_emul.c
SRC_C += wireguard.c
SRC_C += genode_c_api_arch.c
vpath lx_emul/alloc.cc $(GEN_PRG_DIR)
vpath lx_kit/memory.cc $(GEN_PRG_DIR)
vpath wireguard.c $(GEN_PRG_DIR)/genode_c_api
vpath %.c $(PRG_DIR)
vpath %.c $(GEN_PRG_DIR)
vpath wireguard.c $(GEN_PRG_DIR)/genode_c_api
vpath %.c $(PRG_DIR)
vpath %.c $(GEN_PRG_DIR)
INC_DIR += $(PRG_DIR)
INC_DIR += $(GEN_PRG_DIR)
LIBS += lx_emul virt_linux_generated
#
# We shadow some files of lx_emul and lx_kit in order to locally apply
# modifications.
#
vpath lx_emul/alloc.cc $(GEN_PRG_DIR)
vpath lx_kit/memory.cc $(GEN_PRG_DIR)
#
# Some local files include linux headers that expect the KBUILD_* symbols to
# be defined. However, the lx_emul mechanism for adding the definitions doesn't
# apply to these local files, which is why we have to add them manually.
#
CC_OPT_wireguard += -DKBUILD_MODFILE='"wireguard"' \
-DKBUILD_BASENAME='"wireguard"' \
-DKBUILD_MODNAME='"wireguard"'
CC_OPT_lx_emul += -DKBUILD_MODFILE='"lx_emul"' \
-DKBUILD_BASENAME='"lx_emul"' \
-DKBUILD_MODNAME='"lx_emul"'
CC_OPT_lx_emul += -DKBUILD_MODFILE='"lx_emul"' \
-DKBUILD_BASENAME='"lx_emul"' \
-DKBUILD_MODNAME='"lx_emul"'
#
# The lx_emul Makefiles have a generic mechanism for defining the
# KBUILD_MODNAME for each Linux unit to be the filename of that unit
# (without suffix). However, some Wireguard units expect
# KBUILD_MODNAME to be the same for all Wireguard units.
# (without suffix). However, some WireGuard units expect
# KBUILD_MODNAME to be the same for all WireGuard units.
# Therefore, we do a pattern substition on the CC_OPT_* variables of
# those units, changing their KBUILD_MODNAME def to "wireguard".
#

View File

@ -1,5 +1,5 @@
TARGET = wireguard
LIBS += base net jitterentropy wireguard
LIBS += base net jitterentropy wireguard_lx_inc_dirs
GEN_DIR := $(PRG_DIR)/../..
INC_DIR += $(GEN_DIR)
INC_DIR += $(REP_DIR)/src/include