]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - net/bpfilter/Makefile
Merge tag 'for-linus-20180629' of git://git.kernel.dk/linux-block
[mirror_ubuntu-eoan-kernel.git] / net / bpfilter / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 #
3 # Makefile for the Linux BPFILTER layer.
4 #
5
6 hostprogs-y := bpfilter_umh
7 bpfilter_umh-objs := main.o
8 HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
9 HOSTCC := $(CC)
10
11 ifeq ($(CONFIG_BPFILTER_UMH), y)
12 # builtin bpfilter_umh should be compiled with -static
13 # since rootfs isn't mounted at the time of __init
14 # function is called and do_execv won't find elf interpreter
15 HOSTLDFLAGS += -static
16 endif
17
18 # a bit of elf magic to convert bpfilter_umh binary into a binary blob
19 # inside bpfilter_umh.o elf file referenced by
20 # _binary_net_bpfilter_bpfilter_umh_start symbol
21 # which bpfilter_kern.c passes further into umh blob loader at run-time
22 quiet_cmd_copy_umh = GEN $@
23 cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \
24 $(OBJCOPY) -I binary \
25 `LC_ALL=C $(OBJDUMP) -f net/bpfilter/bpfilter_umh \
26 |awk -F' |,' '/file format/{print "-O",$$NF} \
27 /^architecture:/{print "-B",$$2}'` \
28 --rename-section .data=.init.rodata $< $@
29
30 $(obj)/bpfilter_umh.o: $(obj)/bpfilter_umh
31 $(call cmd,copy_umh)
32
33 obj-$(CONFIG_BPFILTER_UMH) += bpfilter.o
34 bpfilter-objs += bpfilter_kern.o bpfilter_umh.o