1 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
7 CHOST
:= $(shell gcc
-dumpmachine
)
8 HOST_ARCH
:= $(firstword $(subst -, ,$(CHOST
)))
10 CBUILD
:= $(subst -gcc
,,$(lastword
$(subst /, ,$(firstword $(wildcard $(foreach bindir,$(subst :, ,$(PATH
)),$(bindir)/$(ARCH
)-*-gcc
))))))
12 $(error The toolchain for
$(ARCH
) is not installed
)
16 ARCH
:= $(firstword $(subst -, ,$(CBUILD
)))
19 # Set these from the environment to override
20 KERNEL_PATH ?
= $(PWD
)/..
/..
/..
/..
/..
21 BUILD_PATH ?
= $(PWD
)/build
/$(ARCH
)
22 DISTFILES_PATH ?
= $(PWD
)/distfiles
25 MIRROR
:= https
://download.wireguard.com
/qemu-test
/distfiles
/
29 # variable name, tarball project name, version, tarball extension, default URI base
32 $(1)_NAME
:= $(2)-$$($(1)_VERSION
)
33 $(1)_TAR
:= $(DISTFILES_PATH
)/$$($(1)_NAME
)$(4)
34 $(1)_PATH
:= $(BUILD_PATH
)/$$($(1)_NAME
)
35 $(call file_download
,$$($(1)_NAME
)$(4),$(5),$(6))
38 define file_download
=
39 $(DISTFILES_PATH
)/$(1):
40 mkdir
-p
$(DISTFILES_PATH
)
41 flock
-x
$$@.lock
-c
'[ -f $$@ ] && exit 0; wget -O $$@.tmp $(MIRROR)$(1) || wget -O $$@.tmp $(2)$(1) || rm -f $$@.tmp'
42 if echo
"$(3) $$@.tmp" | sha256sum
-c
-; then mv
$$@.tmp
$$@
; else rm -f
$$@.tmp
; exit
71; fi
45 $(eval
$(call tar_download
,MUSL
,musl
,1.1.24,.
tar.gz
,https
://www.musl-libc.org
/releases
/,1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3
))
46 $(eval
$(call tar_download
,LIBMNL
,libmnl
,1.0.4,.
tar.bz2
,https
://www.netfilter.org
/projects
/libmnl
/files
/,171f89699f286a5854b72b91d06e8f8e3683064c5901fb09d954a9ab6f551f81
))
47 $(eval
$(call tar_download
,IPERF
,iperf
,3.7,.
tar.gz
,https
://downloads.es.net
/pub
/iperf
/,d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c
))
48 $(eval
$(call tar_download
,BASH
,bash
,5.0,.
tar.gz
,https
://ftp.gnu.org
/gnu
/bash
/,b4a80f2ac66170b2913efbfb9f2594f1f76c7b1afd11f799e22035d63077fb4d
))
49 $(eval
$(call tar_download
,IPROUTE2
,iproute2
,5.4.0,.
tar.xz
,https
://www.kernel.org
/pub
/linux
/utils
/net
/iproute2
/,fe97aa60a0d4c5ac830be18937e18dc3400ca713a33a89ad896ff1e3d46086ae
))
50 $(eval
$(call tar_download
,IPTABLES
,iptables
,1.8.4,.
tar.bz2
,https
://www.netfilter.org
/projects
/iptables
/files
/,993a3a5490a544c2cbf2ef15cf7e7ed21af1845baf228318d5c36ef8827e157c
))
51 $(eval
$(call tar_download
,NMAP
,nmap
,7.80,.
tar.bz2
,https
://nmap.org
/dist/,fcfa5a0e42099e12e4bf7a68ebe6fde05553383a682e816a7ec9256ab4773faa
))
52 $(eval
$(call tar_download
,IPUTILS
,iputils
,s20190709
,.
tar.gz
,https
://github.com
/iputils
/iputils
/archive
/s20190709.
tar.gz
/#,a15720dd741d7538dd2645f9f516d193636ae4300ff7dbc8bfca757bf166490a))
53 $(eval
$(call tar_download
,WIREGUARD_TOOLS
,wireguard-tools
,1.0.20191226,.
tar.xz
,https
://git.zx2c4.com
/wireguard-tools
/snapshot
/,aa8af0fdc9872d369d8c890a84dbc2a2466b55795dccd5b47721b2d97644b04f
))
55 KERNEL_BUILD_PATH
:= $(BUILD_PATH
)/kernel
$(if
$(findstring yes
,$(DEBUG_KERNEL
)),-debug
)
56 rwildcard
=$(foreach d
,$(wildcard $1*),$(call rwildcard
,$d/,$2) $(filter $(subst *,%,$2),$d))
57 WIREGUARD_SOURCES
:= $(call rwildcard
,$(KERNEL_PATH
)/drivers
/net
/wireguard
/,*)
59 export CFLAGS ?
= -O3
-pipe
61 export CPPFLAGS
:= -I
$(BUILD_PATH
)/include
63 ifeq ($(HOST_ARCH
),$(ARCH
))
64 CROSS_COMPILE_FLAG
:= --host
=$(CHOST
)
65 CFLAGS
+= -march
=native
68 $(info Cross compilation
: building for
$(CBUILD
) using
$(CHOST
))
69 CROSS_COMPILE_FLAG
:= --build
=$(CBUILD
) --host
=$(CHOST
)
70 export CROSS_COMPILE
=$(CBUILD
)-
71 STRIP
:= $(CBUILD
)-strip
73 ifeq ($(ARCH
),aarch64
)
76 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/arm64
/boot
/Image
77 ifeq ($(HOST_ARCH
),$(ARCH
))
78 QEMU_MACHINE
:= -cpu host
-machine virt
,gic_version
=host
,accel
=kvm
80 QEMU_MACHINE
:= -cpu cortex-a53
-machine virt
81 CFLAGS
+= -march
=armv8-a
-mtune
=cortex-a53
83 else ifeq ($(ARCH
),aarch64_be
)
86 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/arm64
/boot
/Image
87 ifeq ($(HOST_ARCH
),$(ARCH
))
88 QEMU_MACHINE
:= -cpu host
-machine virt
,gic_version
=host
,accel
=kvm
90 QEMU_MACHINE
:= -cpu cortex-a53
-machine virt
91 CFLAGS
+= -march
=armv8-a
-mtune
=cortex-a53
93 else ifeq ($(ARCH
),arm
)
96 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/arm
/boot
/zImage
97 ifeq ($(HOST_ARCH
),$(ARCH
))
98 QEMU_MACHINE
:= -cpu host
-machine virt
,gic_version
=host
,accel
=kvm
100 QEMU_MACHINE
:= -cpu cortex-a15
-machine virt
101 CFLAGS
+= -march
=armv7-a
-mtune
=cortex-a15
-mabi
=aapcs-linux
103 else ifeq ($(ARCH
),armeb
)
106 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/arm
/boot
/zImage
107 ifeq ($(HOST_ARCH
),$(ARCH
))
108 QEMU_MACHINE
:= -cpu host
-machine virt
,gic_version
=host
,accel
=kvm
110 QEMU_MACHINE
:= -cpu cortex-a15
-machine virt
111 CFLAGS
+= -march
=armv7-a
-mabi
=aapcs-linux
# We don't pass -mtune=cortex-a15 due to a compiler bug on big endian.
114 else ifeq ($(ARCH
),x86_64
)
116 KERNEL_ARCH
:= x86_64
117 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/x86
/boot
/bzImage
118 ifeq ($(HOST_ARCH
),$(ARCH
))
119 QEMU_MACHINE
:= -cpu host
-machine q35
,accel
=kvm
121 QEMU_MACHINE
:= -cpu Skylake-Server
-machine q35
122 CFLAGS
+= -march
=skylake-avx512
124 else ifeq ($(ARCH
),i686
)
127 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/x86
/boot
/bzImage
128 ifeq ($(subst x86_64
,i686
,$(HOST_ARCH
)),$(ARCH
))
129 QEMU_MACHINE
:= -cpu host
-machine q35
,accel
=kvm
131 QEMU_MACHINE
:= -cpu coreduo
-machine q35
132 CFLAGS
+= -march
=prescott
134 else ifeq ($(ARCH
),mips64
)
137 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
138 ifeq ($(HOST_ARCH
),$(ARCH
))
139 QEMU_MACHINE
:= -cpu host
-machine malta
,accel
=kvm
142 QEMU_MACHINE
:= -cpu MIPS64R2-generic
-machine malta
-smp
1
143 CFLAGS
+= -march
=mips64r2
-EB
145 else ifeq ($(ARCH
),mips64el
)
146 QEMU_ARCH
:= mips64el
148 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
149 ifeq ($(HOST_ARCH
),$(ARCH
))
150 QEMU_MACHINE
:= -cpu host
-machine malta
,accel
=kvm
153 QEMU_MACHINE
:= -cpu MIPS64R2-generic
-machine malta
-smp
1
154 CFLAGS
+= -march
=mips64r2
-EL
156 else ifeq ($(ARCH
),mips
)
159 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
160 ifeq ($(HOST_ARCH
),$(ARCH
))
161 QEMU_MACHINE
:= -cpu host
-machine malta
,accel
=kvm
164 QEMU_MACHINE
:= -cpu
24Kf
-machine malta
-smp
1
165 CFLAGS
+= -march
=mips32r2
-EB
167 else ifeq ($(ARCH
),mipsel
)
170 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
171 ifeq ($(HOST_ARCH
),$(ARCH
))
172 QEMU_MACHINE
:= -cpu host
-machine malta
,accel
=kvm
175 QEMU_MACHINE
:= -cpu
24Kf
-machine malta
-smp
1
176 CFLAGS
+= -march
=mips32r2
-EL
178 else ifeq ($(ARCH
),powerpc64le
)
180 KERNEL_ARCH
:= powerpc
181 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
182 ifeq ($(HOST_ARCH
),$(ARCH
))
183 QEMU_MACHINE
:= -cpu host
,accel
=kvm
-machine pseries
185 QEMU_MACHINE
:= -machine pseries
187 CFLAGS
+= -mcpu
=powerpc64le
-mlong-double-64
188 else ifeq ($(ARCH
),powerpc
)
190 KERNEL_ARCH
:= powerpc
191 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/arch
/powerpc
/boot
/uImage
192 ifeq ($(HOST_ARCH
),$(ARCH
))
193 QEMU_MACHINE
:= -cpu host
,accel
=kvm
-machine ppce500
195 QEMU_MACHINE
:= -machine ppce500
197 CFLAGS
+= -mcpu
=powerpc
-mlong-double-64
-msecure-plt
198 else ifeq ($(ARCH
),m68k
)
201 KERNEL_BZIMAGE
:= $(KERNEL_BUILD_PATH
)/vmlinux
202 KERNEL_CMDLINE
:= $(shell sed
-n
's/CONFIG_CMDLINE=\(.*\)/\1/p' arch
/m68k.config
)
203 ifeq ($(HOST_ARCH
),$(ARCH
))
204 QEMU_MACHINE
:= -cpu host
,accel
=kvm
-machine q800
-smp
1 -append
$(KERNEL_CMDLINE
)
206 QEMU_MACHINE
:= -machine q800
-smp
1 -append
$(KERNEL_CMDLINE
)
209 $(error I only build
: x86_64
, i686
, arm
, armeb
, aarch64
, aarch64_be
, mips
, mipsel
, mips64
, mips64el
, powerpc64le
, powerpc
, m68k
)
212 REAL_CC
:= $(CBUILD
)-gcc
213 MUSL_CC
:= $(BUILD_PATH
)/musl-gcc
214 export CC
:= $(MUSL_CC
)
215 USERSPACE_DEPS
:= $(MUSL_CC
) $(BUILD_PATH
)/include/.installed
$(BUILD_PATH
)/include/linux
/.installed
217 build
: $(KERNEL_BZIMAGE
)
218 qemu
: $(KERNEL_BZIMAGE
)
219 rm -f
$(BUILD_PATH
)/result
220 timeout
--foreground
20m qemu-system-
$(QEMU_ARCH
) \
225 -m
$$(grep
-q CONFIG_DEBUG_KMEMLEAK
=y
$(KERNEL_BUILD_PATH
)/.config
&& echo
1G || echo
256M
) \
227 -serial file
:$(BUILD_PATH
)/result \
231 grep
-Fq success
$(BUILD_PATH
)/result
233 $(BUILD_PATH
)/init-cpio-spec.txt
:
234 mkdir
-p
$(BUILD_PATH
)
235 echo
"file /init $(BUILD_PATH)/init 755 0 0" > $@
236 echo
"file /init.sh $(PWD)/../netns.sh 755 0 0" >> $@
237 echo
"dir /dev 755 0 0" >> $@
238 echo
"nod /dev/console 644 0 0 c 5 1" >> $@
239 echo
"dir /bin 755 0 0" >> $@
240 echo
"file /bin/iperf3 $(IPERF_PATH)/src/iperf3 755 0 0" >> $@
241 echo
"file /bin/wg $(WIREGUARD_TOOLS_PATH)/src/wg 755 0 0" >> $@
242 echo
"file /bin/bash $(BASH_PATH)/bash 755 0 0" >> $@
243 echo
"file /bin/ip $(IPROUTE2_PATH)/ip/ip 755 0 0" >> $@
244 echo
"file /bin/ss $(IPROUTE2_PATH)/misc/ss 755 0 0" >> $@
245 echo
"file /bin/ping $(IPUTILS_PATH)/ping 755 0 0" >> $@
246 echo
"file /bin/ncat $(NMAP_PATH)/ncat/ncat 755 0 0" >> $@
247 echo
"file /bin/xtables-legacy-multi $(IPTABLES_PATH)/iptables/xtables-legacy-multi 755 0 0" >> $@
248 echo
"slink /bin/iptables xtables-legacy-multi 777 0 0" >> $@
249 echo
"slink /bin/ping6 ping 777 0 0" >> $@
250 echo
"dir /lib 755 0 0" >> $@
251 echo
"file /lib/libc.so $(MUSL_PATH)/lib/libc.so 755 0 0" >> $@
252 echo
"slink /lib/ld-linux.so.1 libc.so 777 0 0" >> $@
254 $(KERNEL_BUILD_PATH
)/.config
: kernel.config arch
/$(ARCH
).config
255 mkdir
-p
$(KERNEL_BUILD_PATH
)
256 cp kernel.config
$(KERNEL_BUILD_PATH
)/minimal.config
257 printf
'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_BUILD_PATH
)/minimal.config
258 cat arch
/$(ARCH
).config
>> $(KERNEL_BUILD_PATH
)/minimal.config
259 $(MAKE
) -C
$(KERNEL_PATH
) O
=$(KERNEL_BUILD_PATH
) ARCH
=$(KERNEL_ARCH
) allnoconfig
260 cd
$(KERNEL_BUILD_PATH
) && ARCH
=$(KERNEL_ARCH
) $(KERNEL_PATH
)/scripts
/kconfig
/merge_config.sh
-n
$(KERNEL_BUILD_PATH
)/.config
$(KERNEL_BUILD_PATH
)/minimal.config
261 $(if
$(findstring yes
,$(DEBUG_KERNEL
)),cp debug.config
$(KERNEL_BUILD_PATH
) && cd
$(KERNEL_BUILD_PATH
) && ARCH
=$(KERNEL_ARCH
) $(KERNEL_PATH
)/scripts
/kconfig
/merge_config.sh
-n
$(KERNEL_BUILD_PATH
)/.config debug.config
,)
263 $(KERNEL_BZIMAGE
): $(KERNEL_BUILD_PATH
)/.config
$(BUILD_PATH
)/init-cpio-spec.txt
$(MUSL_PATH
)/lib
/libc.so
$(IPERF_PATH
)/src
/iperf3
$(IPUTILS_PATH
)/ping
$(BASH_PATH
)/bash
$(IPROUTE2_PATH
)/misc
/ss
$(IPROUTE2_PATH
)/ip
/ip
$(IPTABLES_PATH
)/iptables
/xtables-legacy-multi
$(NMAP_PATH
)/ncat
/ncat
$(WIREGUARD_TOOLS_PATH
)/src
/wg
$(BUILD_PATH
)/init ..
/netns.sh
$(WIREGUARD_SOURCES
)
264 $(MAKE
) -C
$(KERNEL_PATH
) O
=$(KERNEL_BUILD_PATH
) ARCH
=$(KERNEL_ARCH
) CROSS_COMPILE
=$(CROSS_COMPILE
)
266 $(BUILD_PATH
)/include/linux
/.installed
: |
$(KERNEL_BUILD_PATH
)/.config
267 $(MAKE
) -C
$(KERNEL_PATH
) O
=$(KERNEL_BUILD_PATH
) INSTALL_HDR_PATH
=$(BUILD_PATH
) ARCH
=$(KERNEL_ARCH
) CROSS_COMPILE
=$(CROSS_COMPILE
) headers_install
270 $(MUSL_PATH
)/lib
/libc.so
: $(MUSL_TAR
)
271 mkdir
-p
$(BUILD_PATH
)
272 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
273 cd
$(MUSL_PATH
) && CC
=$(REAL_CC
) .
/configure
--prefix=/ --disable-static
--build
=$(CBUILD
)
274 $(MAKE
) -C
$(MUSL_PATH
)
277 $(BUILD_PATH
)/include/.installed
: $(MUSL_PATH
)/lib
/libc.so
278 $(MAKE
) -C
$(MUSL_PATH
) DESTDIR
=$(BUILD_PATH
) install-headers
281 $(MUSL_CC
): $(MUSL_PATH
)/lib
/libc.so
282 sh
$(MUSL_PATH
)/tools
/musl-gcc.specs.sh
$(BUILD_PATH
)/include $(MUSL_PATH
)/lib
/lib
/ld-linux.so
.1 > $(BUILD_PATH
)/musl-gcc.specs
283 printf
'#!/bin/sh\nexec "$(REAL_CC)" --specs="$(BUILD_PATH)/musl-gcc.specs" "$$@"\n' > $(BUILD_PATH
)/musl-gcc
284 chmod
+x
$(BUILD_PATH
)/musl-gcc
286 $(IPERF_PATH
)/.installed
: $(IPERF_TAR
)
287 mkdir
-p
$(BUILD_PATH
)
288 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
289 sed
-i
'1s/^/#include <stdint.h>/' $(IPERF_PATH
)/src
/cjson.h
$(IPERF_PATH
)/src
/timer.h
290 sed
-i
-r
's/-p?g//g' $(IPERF_PATH
)/src
/Makefile
*
293 $(IPERF_PATH
)/src
/iperf3
: |
$(IPERF_PATH
)/.installed
$(USERSPACE_DEPS
)
294 cd
$(IPERF_PATH
) && CFLAGS
="$(CFLAGS) -D_GNU_SOURCE" .
/configure
--prefix=/ $(CROSS_COMPILE_FLAG
) --enable-static
--disable-shared
--with-openssl
=no
295 $(MAKE
) -C
$(IPERF_PATH
)
298 $(LIBMNL_PATH
)/.installed
: $(LIBMNL_TAR
)
299 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
302 $(LIBMNL_PATH
)/src
/.libs
/libmnl.a
: |
$(LIBMNL_PATH
)/.installed
$(USERSPACE_DEPS
)
303 cd
$(LIBMNL_PATH
) && .
/configure
--prefix=/ $(CROSS_COMPILE_FLAG
) --enable-static
--disable-shared
304 $(MAKE
) -C
$(LIBMNL_PATH
)
305 sed
-i
's:prefix=.*:prefix=$(LIBMNL_PATH):' $(LIBMNL_PATH
)/libmnl.
pc
307 $(WIREGUARD_TOOLS_PATH
)/.installed
: $(WIREGUARD_TOOLS_TAR
)
308 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
311 $(WIREGUARD_TOOLS_PATH
)/src
/wg
: |
$(WIREGUARD_TOOLS_PATH
)/.installed
$(LIBMNL_PATH
)/src
/.libs
/libmnl.a
$(USERSPACE_DEPS
)
312 LDFLAGS
="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" $(MAKE
) -C
$(WIREGUARD_TOOLS_PATH
)/src LIBMNL_CFLAGS
="-I$(LIBMNL_PATH)/include" LIBMNL_LDLIBS
="-lmnl" wg
315 $(BUILD_PATH
)/init
: init.c |
$(USERSPACE_DEPS
)
316 mkdir
-p
$(BUILD_PATH
)
317 $(MUSL_CC
) -o
$@
$(CFLAGS
) $(LDFLAGS
) -std
=gnu11
$<
320 $(IPUTILS_PATH
)/.installed
: $(IPUTILS_TAR
)
321 mkdir
-p
$(BUILD_PATH
)
322 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
325 $(IPUTILS_PATH
)/ping
: |
$(IPUTILS_PATH
)/.installed
$(USERSPACE_DEPS
)
326 sed
-i
/atexit
/d
$(IPUTILS_PATH
)/ping.c
327 cd
$(IPUTILS_PATH
) && $(CC
) $(CFLAGS
) -std
=c99
-o
$@ ping.c ping_common.c ping6_common.c iputils_common.c
-D_GNU_SOURCE
-D
'IPUTILS_VERSION(f)=f' -lresolv
$(LDFLAGS
)
330 $(BASH_PATH
)/.installed
: $(BASH_TAR
)
331 mkdir
-p
$(BUILD_PATH
)
332 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
335 $(BASH_PATH
)/bash
: |
$(BASH_PATH
)/.installed
$(USERSPACE_DEPS
)
336 cd
$(BASH_PATH
) && .
/configure
--prefix=/ $(CROSS_COMPILE_FLAG
) --without-bash-malloc
--disable-debugger
--disable-help-builtin
--disable-history
--disable-multibyte
--disable-progcomp
--disable-readline
--disable-mem-scramble
337 $(MAKE
) -C
$(BASH_PATH
)
340 $(IPROUTE2_PATH
)/.installed
: $(IPROUTE2_TAR
)
341 mkdir
-p
$(BUILD_PATH
)
342 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
343 printf
'CC:=$(CC)\nPKG_CONFIG:=pkg-config\nTC_CONFIG_XT:=n\nTC_CONFIG_ATM:=n\nTC_CONFIG_IPSET:=n\nIP_CONFIG_SETNS:=y\nHAVE_ELF:=n\nHAVE_MNL:=y\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCFLAGS+=-DHAVE_SETNS -DHAVE_LIBMNL -I$(LIBMNL_PATH)/include\nLDLIBS+=-lmnl' > $(IPROUTE2_PATH
)/config.mk
344 printf
'lib: snapshot\n\t$$(MAKE) -C lib\nip/ip: lib\n\t$$(MAKE) -C ip ip\nmisc/ss: lib\n\t$$(MAKE) -C misc ss\n' >> $(IPROUTE2_PATH
)/Makefile
347 $(IPROUTE2_PATH
)/ip
/ip
: |
$(IPROUTE2_PATH
)/.installed
$(LIBMNL_PATH
)/src
/.libs
/libmnl.a
$(USERSPACE_DEPS
)
348 LDFLAGS
="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" PKG_CONFIG_LIBDIR
="$(LIBMNL_PATH)" $(MAKE
) -C
$(IPROUTE2_PATH
) PREFIX
=/ ip
/ip
349 $(STRIP
) -s
$(IPROUTE2_PATH
)/ip
/ip
351 $(IPROUTE2_PATH
)/misc
/ss
: |
$(IPROUTE2_PATH
)/.installed
$(LIBMNL_PATH
)/src
/.libs
/libmnl.a
$(USERSPACE_DEPS
)
352 LDFLAGS
="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" PKG_CONFIG_LIBDIR
="$(LIBMNL_PATH)" $(MAKE
) -C
$(IPROUTE2_PATH
) PREFIX
=/ misc
/ss
353 $(STRIP
) -s
$(IPROUTE2_PATH
)/misc
/ss
355 $(IPTABLES_PATH
)/.installed
: $(IPTABLES_TAR
)
356 mkdir
-p
$(BUILD_PATH
)
357 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
358 sed
-i
-e
"/nfnetlink=[01]/s:=[01]:=0:" -e
"/nfconntrack=[01]/s:=[01]:=0:" $(IPTABLES_PATH
)/configure
361 $(IPTABLES_PATH
)/iptables
/xtables-legacy-multi
: |
$(IPTABLES_PATH
)/.installed
$(LIBMNL_PATH
)/src
/.libs
/libmnl.a
$(USERSPACE_DEPS
)
362 cd
$(IPTABLES_PATH
) && PKG_CONFIG_LIBDIR
="$(LIBMNL_PATH)" .
/configure
--prefix=/ $(CROSS_COMPILE_FLAG
) --enable-static
--disable-shared
--disable-nftables
--disable-bpf-compiler
--disable-nfsynproxy
--disable-libipq
--with-kernel
=$(BUILD_PATH
)/include
363 $(MAKE
) -C
$(IPTABLES_PATH
)
366 $(NMAP_PATH
)/.installed
: $(NMAP_TAR
)
367 mkdir
-p
$(BUILD_PATH
)
368 flock
-s
$<.lock
tar -C
$(BUILD_PATH
) -xf
$<
371 $(NMAP_PATH
)/ncat
/ncat
: |
$(NMAP_PATH
)/.installed
$(USERSPACE_DEPS
)
372 cd
$(NMAP_PATH
) && .
/configure
--prefix=/ $(CROSS_COMPILE_FLAG
) --enable-static
--disable-shared
--without-ndiff
--without-zenmap
--without-nping
--with-libpcap
=included
--with-libpcre
=included
--with-libdnet
=included
--without-liblua
--with-liblinear
=included
--without-nmap-update
--without-openssl
--with-pcap
=linux
--without-libssh
373 $(MAKE
) -C
$(NMAP_PATH
)/libpcap
374 $(MAKE
) -C
$(NMAP_PATH
)/ncat
381 rm -rf
$(DISTFILES_PATH
)
383 menuconfig
: $(KERNEL_BUILD_PATH
)/.config
384 $(MAKE
) -C
$(KERNEL_PATH
) O
=$(KERNEL_BUILD_PATH
) ARCH
=$(KERNEL_ARCH
) CROSS_COMPILE
=$(CROSS_COMPILE
) menuconfig
386 .PHONY
: qemu build
clean distclean menuconfig