1# SPDX-License-Identifier: GPL-2.0 2# 3# Makefile for the Linux BPFILTER layer. 4# 5 6hostprogs-y := bpfilter_umh 7bpfilter_umh-objs := main.o 8HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi 9HOSTCC := $(CC) 10 11ifeq ($(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 15HOSTLDFLAGS += -static 16endif 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 22quiet_cmd_copy_umh = GEN $@ 23 cmd_copy_umh = echo ':' > $(obj)/.bpfilter_umh.o.cmd; \ 24 $(OBJCOPY) -I binary -O `$(OBJDUMP) -f $<|grep format|cut -d' ' -f8` \ 25 -B `$(OBJDUMP) -f $<|grep architecture|cut -d, -f1|cut -d' ' -f2` \ 26 --rename-section .data=.init.rodata $< $@ 27 28$(obj)/bpfilter_umh.o: $(obj)/bpfilter_umh 29 $(call cmd,copy_umh) 30 31obj-$(CONFIG_BPFILTER_UMH) += bpfilter.o 32bpfilter-objs += bpfilter_kern.o bpfilter_umh.o 33