1 # SPDX-License-Identifier: GPL-2.0 1 # SPDX-License-Identifier: GPL-2.0 2 # 2 # 3 # Copyright (C) 2015-2019 Jason A. Donenfeld <J 3 # Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. 4 4 5 PWD := $(shell pwd) 5 PWD := $(shell pwd) 6 6 7 # Set these from the environment to override 7 # Set these from the environment to override 8 KERNEL_PATH ?= $(PWD)/../../../../.. 8 KERNEL_PATH ?= $(PWD)/../../../../.. 9 BUILD_PATH ?= $(PWD)/build/$(ARCH) 9 BUILD_PATH ?= $(PWD)/build/$(ARCH) 10 DISTFILES_PATH ?= $(PWD)/distfiles 10 DISTFILES_PATH ?= $(PWD)/distfiles 11 NR_CPUS ?= 4 11 NR_CPUS ?= 4 12 ARCH ?= 12 ARCH ?= 13 CBUILD := $(shell gcc -dumpmachine) 13 CBUILD := $(shell gcc -dumpmachine) 14 HOST_ARCH := $(firstword $(subst -, ,$(CBUILD) 14 HOST_ARCH := $(firstword $(subst -, ,$(CBUILD))) 15 ifeq ($(ARCH),) 15 ifeq ($(ARCH),) 16 ARCH := $(HOST_ARCH) 16 ARCH := $(HOST_ARCH) 17 endif 17 endif 18 18 19 MIRROR := https://download.wireguard.com/qemu- 19 MIRROR := https://download.wireguard.com/qemu-test/distfiles/ 20 20 21 KERNEL_BUILD_PATH := $(BUILD_PATH)/kernel$(if 21 KERNEL_BUILD_PATH := $(BUILD_PATH)/kernel$(if $(findstring yes,$(DEBUG_KERNEL)),-debug) 22 22 23 default: qemu 23 default: qemu 24 24 25 # variable name, tarball project name, version 25 # variable name, tarball project name, version, tarball extension, default URI base 26 define tar_download = 26 define tar_download = 27 $(1)_VERSION := $(3) 27 $(1)_VERSION := $(3) 28 $(1)_NAME := $(2)-$$($(1)_VERSION) 28 $(1)_NAME := $(2)-$$($(1)_VERSION) 29 $(1)_TAR := $(DISTFILES_PATH)/$$($(1)_NAME)$(4 29 $(1)_TAR := $(DISTFILES_PATH)/$$($(1)_NAME)$(4) 30 $(1)_PATH := $(BUILD_PATH)/$$($(1)_NAME) 30 $(1)_PATH := $(BUILD_PATH)/$$($(1)_NAME) 31 $(call file_download,$$($(1)_NAME)$(4),$(5),$( 31 $(call file_download,$$($(1)_NAME)$(4),$(5),$(6)) 32 endef 32 endef 33 33 34 define file_download = 34 define file_download = 35 $(DISTFILES_PATH)/$(1): | $(4) 35 $(DISTFILES_PATH)/$(1): | $(4) 36 mkdir -p $(DISTFILES_PATH) 36 mkdir -p $(DISTFILES_PATH) 37 flock -x $$@.lock -c '[ -f $$@ ] && ex 37 flock -x $$@.lock -c '[ -f $$@ ] && exit 0; wget -O $$@.tmp $(MIRROR)$(1) || wget -O $$@.tmp $(2)$(1) || rm -f $$@.tmp; [ -f $$@.tmp ] || exit 1; if ([ -n "$(4)" ] && sed -n "s#^\([a-f0-9]\{64\}\) \($(1)\)\$$$$#\1 $(DISTFILES_PATH)/\2.tmp#p" "$(4)" || echo "$(3) $$@.tmp") | sha256sum -c -; then mv $$@.tmp $$@; else rm -f $$@.tmp; exit 71; fi' 38 endef 38 endef 39 39 40 $(eval $(call tar_download,IPERF,iperf,3.11,.t 40 $(eval $(call tar_download,IPERF,iperf,3.11,.tar.gz,https://downloads.es.net/pub/iperf/,de8cb409fad61a0574f4cb07eb19ce1159707403ac2dc01b5d175e91240b7e5f)) 41 $(eval $(call tar_download,BASH,bash,5.1.16,.t 41 $(eval $(call tar_download,BASH,bash,5.1.16,.tar.gz,https://ftp.gnu.org/gnu/bash/,5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558)) 42 $(eval $(call tar_download,IPROUTE2,iproute2,5 42 $(eval $(call tar_download,IPROUTE2,iproute2,5.17.0,.tar.gz,https://www.kernel.org/pub/linux/utils/net/iproute2/,bda331d5c4606138892f23a565d78fca18919b4d508a0b7ca8391c2da2db68b9)) 43 $(eval $(call tar_download,IPTABLES,iptables,1 43 $(eval $(call tar_download,IPTABLES,iptables,1.8.7,.tar.bz2,https://www.netfilter.org/projects/iptables/files/,c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0)) 44 $(eval $(call tar_download,NMAP,nmap,7.92,.tgz 44 $(eval $(call tar_download,NMAP,nmap,7.92,.tgz,https://nmap.org/dist/,064183ea642dc4c12b1ab3b5358ce1cef7d2e7e11ffa2849f16d339f5b717117)) 45 $(eval $(call tar_download,IPUTILS,iputils,s20 45 $(eval $(call tar_download,IPUTILS,iputils,s20190709,.tar.gz,https://github.com/iputils/iputils/archive/s20190709.tar.gz/#,a15720dd741d7538dd2645f9f516d193636ae4300ff7dbc8bfca757bf166490a)) 46 $(eval $(call tar_download,WIREGUARD_TOOLS,wir 46 $(eval $(call tar_download,WIREGUARD_TOOLS,wireguard-tools,1.0.20210914,.tar.xz,https://git.zx2c4.com/wireguard-tools/snapshot/,97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac)) 47 47 48 export CFLAGS := -O3 -pipe 48 export CFLAGS := -O3 -pipe 49 ifeq ($(HOST_ARCH),$(ARCH)) 49 ifeq ($(HOST_ARCH),$(ARCH)) 50 CFLAGS += -march=native 50 CFLAGS += -march=native 51 endif 51 endif 52 export LDFLAGS := 52 export LDFLAGS := 53 export CPPFLAGS := 53 export CPPFLAGS := 54 54 55 QEMU_VPORT_RESULT := 55 QEMU_VPORT_RESULT := 56 ifeq ($(ARCH),aarch64) 56 ifeq ($(ARCH),aarch64) 57 CHOST := aarch64-linux-musl 57 CHOST := aarch64-linux-musl 58 QEMU_ARCH := aarch64 58 QEMU_ARCH := aarch64 59 KERNEL_ARCH := arm64 59 KERNEL_ARCH := arm64 60 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ar 60 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/arm64/boot/Image 61 QEMU_VPORT_RESULT := virtio-serial-device 61 QEMU_VPORT_RESULT := virtio-serial-device 62 ifeq ($(HOST_ARCH),$(ARCH)) 62 ifeq ($(HOST_ARCH),$(ARCH)) 63 QEMU_MACHINE := -cpu host -machine virt,gic_ve 63 QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm 64 else 64 else 65 QEMU_MACHINE := -cpu max -machine virt !! 65 QEMU_MACHINE := -cpu cortex-a53 -machine virt 66 CFLAGS += -march=armv8-a !! 66 CFLAGS += -march=armv8-a -mtune=cortex-a53 67 endif 67 endif 68 else ifeq ($(ARCH),aarch64_be) 68 else ifeq ($(ARCH),aarch64_be) 69 CHOST := aarch64_be-linux-musl 69 CHOST := aarch64_be-linux-musl 70 QEMU_ARCH := aarch64 70 QEMU_ARCH := aarch64 71 KERNEL_ARCH := arm64 71 KERNEL_ARCH := arm64 72 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ar 72 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/arm64/boot/Image 73 QEMU_VPORT_RESULT := virtio-serial-device 73 QEMU_VPORT_RESULT := virtio-serial-device 74 ifeq ($(HOST_ARCH),$(ARCH)) 74 ifeq ($(HOST_ARCH),$(ARCH)) 75 QEMU_MACHINE := -cpu host -machine virt,gic_ve 75 QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm 76 else 76 else 77 QEMU_MACHINE := -cpu max -machine virt !! 77 QEMU_MACHINE := -cpu cortex-a53 -machine virt 78 CFLAGS += -march=armv8-a !! 78 CFLAGS += -march=armv8-a -mtune=cortex-a53 79 endif 79 endif 80 else ifeq ($(ARCH),arm) 80 else ifeq ($(ARCH),arm) 81 CHOST := arm-linux-musleabi 81 CHOST := arm-linux-musleabi 82 QEMU_ARCH := arm 82 QEMU_ARCH := arm 83 KERNEL_ARCH := arm 83 KERNEL_ARCH := arm 84 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ar 84 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/arm/boot/zImage 85 QEMU_VPORT_RESULT := virtio-serial-device 85 QEMU_VPORT_RESULT := virtio-serial-device 86 ifeq ($(HOST_ARCH),$(ARCH)) 86 ifeq ($(HOST_ARCH),$(ARCH)) 87 QEMU_MACHINE := -cpu host -machine virt,gic_ve 87 QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm 88 else 88 else 89 QEMU_MACHINE := -cpu max -machine virt !! 89 QEMU_MACHINE := -cpu cortex-a15 -machine virt 90 CFLAGS += -march=armv7-a -mabi=aapcs-linux !! 90 CFLAGS += -march=armv7-a -mtune=cortex-a15 -mabi=aapcs-linux 91 endif 91 endif 92 else ifeq ($(ARCH),armeb) 92 else ifeq ($(ARCH),armeb) 93 CHOST := armeb-linux-musleabi 93 CHOST := armeb-linux-musleabi 94 QEMU_ARCH := arm 94 QEMU_ARCH := arm 95 KERNEL_ARCH := arm 95 KERNEL_ARCH := arm 96 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ar 96 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/arm/boot/zImage 97 QEMU_VPORT_RESULT := virtio-serial-device 97 QEMU_VPORT_RESULT := virtio-serial-device 98 ifeq ($(HOST_ARCH),$(ARCH)) 98 ifeq ($(HOST_ARCH),$(ARCH)) 99 QEMU_MACHINE := -cpu host -machine virt,gic_ve 99 QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm 100 else 100 else 101 QEMU_MACHINE := -cpu max -machine virt !! 101 QEMU_MACHINE := -cpu cortex-a15 -machine virt 102 CFLAGS += -march=armv7-a -mabi=aapcs-linux !! 102 CFLAGS += -march=armv7-a -mabi=aapcs-linux # We don't pass -mtune=cortex-a15 due to a compiler bug on big endian. 103 LDFLAGS += -Wl,--be8 103 LDFLAGS += -Wl,--be8 104 endif 104 endif 105 else ifeq ($(ARCH),x86_64) 105 else ifeq ($(ARCH),x86_64) 106 CHOST := x86_64-linux-musl 106 CHOST := x86_64-linux-musl 107 QEMU_ARCH := x86_64 107 QEMU_ARCH := x86_64 108 KERNEL_ARCH := x86_64 108 KERNEL_ARCH := x86_64 109 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x8 109 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x86/boot/bzImage 110 QEMU_VPORT_RESULT := virtio-serial-device << 111 ifeq ($(HOST_ARCH),$(ARCH)) 110 ifeq ($(HOST_ARCH),$(ARCH)) 112 QEMU_MACHINE := -cpu host -machine microvm,acc !! 111 QEMU_MACHINE := -cpu host -machine q35,accel=kvm 113 else 112 else 114 QEMU_MACHINE := -cpu max -machine microvm,acpi !! 113 QEMU_MACHINE := -cpu Skylake-Server -machine q35 >> 114 CFLAGS += -march=skylake-avx512 115 endif 115 endif 116 else ifeq ($(ARCH),i686) 116 else ifeq ($(ARCH),i686) 117 CHOST := i686-linux-musl 117 CHOST := i686-linux-musl 118 QEMU_ARCH := i386 118 QEMU_ARCH := i386 119 KERNEL_ARCH := x86 119 KERNEL_ARCH := x86 120 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x8 120 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x86/boot/bzImage 121 QEMU_VPORT_RESULT := virtio-serial-device << 122 ifeq ($(subst x86_64,i686,$(HOST_ARCH)),$(ARCH 121 ifeq ($(subst x86_64,i686,$(HOST_ARCH)),$(ARCH)) 123 QEMU_MACHINE := -cpu host -machine microvm,acc !! 122 QEMU_MACHINE := -cpu host -machine q35,accel=kvm 124 else 123 else 125 QEMU_MACHINE := -cpu coreduo -machine microvm, !! 124 QEMU_MACHINE := -cpu coreduo -machine q35 >> 125 CFLAGS += -march=prescott 126 endif 126 endif 127 else ifeq ($(ARCH),mips64) 127 else ifeq ($(ARCH),mips64) 128 CHOST := mips64-linux-musl 128 CHOST := mips64-linux-musl 129 QEMU_ARCH := mips64 129 QEMU_ARCH := mips64 130 KERNEL_ARCH := mips 130 KERNEL_ARCH := mips 131 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 131 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 132 ifeq ($(HOST_ARCH),$(ARCH)) 132 ifeq ($(HOST_ARCH),$(ARCH)) 133 QEMU_MACHINE := -cpu host -machine malta,accel 133 QEMU_MACHINE := -cpu host -machine malta,accel=kvm 134 CFLAGS += -EB 134 CFLAGS += -EB 135 else 135 else 136 QEMU_MACHINE := -cpu MIPS64R2-generic -machine 136 QEMU_MACHINE := -cpu MIPS64R2-generic -machine malta -smp 1 137 CFLAGS += -march=mips64r2 -EB 137 CFLAGS += -march=mips64r2 -EB 138 endif 138 endif 139 else ifeq ($(ARCH),mips64el) 139 else ifeq ($(ARCH),mips64el) 140 CHOST := mips64el-linux-musl 140 CHOST := mips64el-linux-musl 141 QEMU_ARCH := mips64el 141 QEMU_ARCH := mips64el 142 KERNEL_ARCH := mips 142 KERNEL_ARCH := mips 143 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 143 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 144 ifeq ($(HOST_ARCH),$(ARCH)) 144 ifeq ($(HOST_ARCH),$(ARCH)) 145 QEMU_MACHINE := -cpu host -machine malta,accel 145 QEMU_MACHINE := -cpu host -machine malta,accel=kvm 146 CFLAGS += -EL 146 CFLAGS += -EL 147 else 147 else 148 QEMU_MACHINE := -cpu MIPS64R2-generic -machine 148 QEMU_MACHINE := -cpu MIPS64R2-generic -machine malta -smp 1 149 CFLAGS += -march=mips64r2 -EL 149 CFLAGS += -march=mips64r2 -EL 150 endif 150 endif 151 else ifeq ($(ARCH),mips) 151 else ifeq ($(ARCH),mips) 152 CHOST := mips-linux-musl 152 CHOST := mips-linux-musl 153 QEMU_ARCH := mips 153 QEMU_ARCH := mips 154 KERNEL_ARCH := mips 154 KERNEL_ARCH := mips 155 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 155 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 156 ifeq ($(HOST_ARCH),$(ARCH)) 156 ifeq ($(HOST_ARCH),$(ARCH)) 157 QEMU_MACHINE := -cpu host -machine malta,accel 157 QEMU_MACHINE := -cpu host -machine malta,accel=kvm 158 CFLAGS += -EB 158 CFLAGS += -EB 159 else 159 else 160 QEMU_MACHINE := -cpu 24Kf -machine malta -smp 160 QEMU_MACHINE := -cpu 24Kf -machine malta -smp 1 161 CFLAGS += -march=mips32r2 -EB 161 CFLAGS += -march=mips32r2 -EB 162 endif 162 endif 163 else ifeq ($(ARCH),mipsel) 163 else ifeq ($(ARCH),mipsel) 164 CHOST := mipsel-linux-musl 164 CHOST := mipsel-linux-musl 165 QEMU_ARCH := mipsel 165 QEMU_ARCH := mipsel 166 KERNEL_ARCH := mips 166 KERNEL_ARCH := mips 167 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 167 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 168 ifeq ($(HOST_ARCH),$(ARCH)) 168 ifeq ($(HOST_ARCH),$(ARCH)) 169 QEMU_MACHINE := -cpu host -machine malta,accel 169 QEMU_MACHINE := -cpu host -machine malta,accel=kvm 170 CFLAGS += -EL 170 CFLAGS += -EL 171 else 171 else 172 QEMU_MACHINE := -cpu 24Kf -machine malta -smp 172 QEMU_MACHINE := -cpu 24Kf -machine malta -smp 1 173 CFLAGS += -march=mips32r2 -EL 173 CFLAGS += -march=mips32r2 -EL 174 endif 174 endif 175 else ifeq ($(ARCH),powerpc64) 175 else ifeq ($(ARCH),powerpc64) 176 CHOST := powerpc64-linux-musl 176 CHOST := powerpc64-linux-musl 177 QEMU_ARCH := ppc64 177 QEMU_ARCH := ppc64 178 KERNEL_ARCH := powerpc 178 KERNEL_ARCH := powerpc 179 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 179 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 180 ifeq ($(HOST_ARCH),$(ARCH)) 180 ifeq ($(HOST_ARCH),$(ARCH)) 181 QEMU_MACHINE := -cpu host,accel=kvm -machine p 181 QEMU_MACHINE := -cpu host,accel=kvm -machine pseries 182 else 182 else 183 QEMU_MACHINE := -machine pseries -device spapr !! 183 QEMU_MACHINE := -machine pseries 184 endif 184 endif 185 else ifeq ($(ARCH),powerpc64le) 185 else ifeq ($(ARCH),powerpc64le) 186 CHOST := powerpc64le-linux-musl 186 CHOST := powerpc64le-linux-musl 187 QEMU_ARCH := ppc64 187 QEMU_ARCH := ppc64 188 KERNEL_ARCH := powerpc 188 KERNEL_ARCH := powerpc 189 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 189 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 190 ifeq ($(HOST_ARCH),$(ARCH)) 190 ifeq ($(HOST_ARCH),$(ARCH)) 191 QEMU_MACHINE := -cpu host,accel=kvm -machine p 191 QEMU_MACHINE := -cpu host,accel=kvm -machine pseries 192 else 192 else 193 QEMU_MACHINE := -machine pseries -device spapr !! 193 QEMU_MACHINE := -machine pseries 194 endif 194 endif 195 else ifeq ($(ARCH),powerpc) 195 else ifeq ($(ARCH),powerpc) 196 CHOST := powerpc-linux-musl 196 CHOST := powerpc-linux-musl 197 QEMU_ARCH := ppc 197 QEMU_ARCH := ppc 198 KERNEL_ARCH := powerpc 198 KERNEL_ARCH := powerpc 199 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/po 199 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/powerpc/boot/uImage 200 ifeq ($(HOST_ARCH),$(ARCH)) 200 ifeq ($(HOST_ARCH),$(ARCH)) 201 QEMU_MACHINE := -cpu host,accel=kvm -machine p 201 QEMU_MACHINE := -cpu host,accel=kvm -machine ppce500 202 else 202 else 203 QEMU_MACHINE := -machine ppce500 203 QEMU_MACHINE := -machine ppce500 204 endif 204 endif 205 else ifeq ($(ARCH),m68k) 205 else ifeq ($(ARCH),m68k) 206 CHOST := m68k-linux-musl 206 CHOST := m68k-linux-musl 207 QEMU_ARCH := m68k 207 QEMU_ARCH := m68k 208 KERNEL_ARCH := m68k 208 KERNEL_ARCH := m68k 209 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 209 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux 210 KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMD 210 KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMDLINE=\(.*\)/\1/p' arch/m68k.config) 211 QEMU_VPORT_RESULT := virtio-serial-device << 212 ifeq ($(HOST_ARCH),$(ARCH)) 211 ifeq ($(HOST_ARCH),$(ARCH)) 213 QEMU_MACHINE := -cpu host,accel=kvm -machine v !! 212 QEMU_MACHINE := -cpu host,accel=kvm -machine q800 -append $(KERNEL_CMDLINE) 214 else 213 else 215 QEMU_MACHINE := -machine virt -smp 1 -append $ !! 214 QEMU_MACHINE := -machine q800 -smp 1 -append $(KERNEL_CMDLINE) 216 endif 215 endif 217 else ifeq ($(ARCH),riscv64) 216 else ifeq ($(ARCH),riscv64) 218 CHOST := riscv64-linux-musl 217 CHOST := riscv64-linux-musl 219 QEMU_ARCH := riscv64 218 QEMU_ARCH := riscv64 220 KERNEL_ARCH := riscv 219 KERNEL_ARCH := riscv 221 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ri 220 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/riscv/boot/Image 222 QEMU_VPORT_RESULT := virtio-serial-device 221 QEMU_VPORT_RESULT := virtio-serial-device 223 ifeq ($(HOST_ARCH),$(ARCH)) 222 ifeq ($(HOST_ARCH),$(ARCH)) 224 QEMU_MACHINE := -cpu host,accel=kvm -machine v 223 QEMU_MACHINE := -cpu host,accel=kvm -machine virt 225 else 224 else 226 QEMU_MACHINE := -cpu rv64 -machine virt 225 QEMU_MACHINE := -cpu rv64 -machine virt 227 endif 226 endif 228 else ifeq ($(ARCH),riscv32) 227 else ifeq ($(ARCH),riscv32) 229 CHOST := riscv32-linux-musl 228 CHOST := riscv32-linux-musl 230 QEMU_ARCH := riscv32 229 QEMU_ARCH := riscv32 231 KERNEL_ARCH := riscv 230 KERNEL_ARCH := riscv 232 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/ri 231 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/riscv/boot/Image 233 QEMU_VPORT_RESULT := virtio-serial-device 232 QEMU_VPORT_RESULT := virtio-serial-device 234 ifeq ($(HOST_ARCH),$(ARCH)) 233 ifeq ($(HOST_ARCH),$(ARCH)) 235 QEMU_MACHINE := -cpu host,accel=kvm -machine v 234 QEMU_MACHINE := -cpu host,accel=kvm -machine virt 236 else 235 else 237 QEMU_MACHINE := -cpu rv32 -machine virt 236 QEMU_MACHINE := -cpu rv32 -machine virt 238 endif 237 endif 239 else ifeq ($(ARCH),s390x) 238 else ifeq ($(ARCH),s390x) 240 CHOST := s390x-linux-musl 239 CHOST := s390x-linux-musl 241 QEMU_ARCH := s390x 240 QEMU_ARCH := s390x 242 KERNEL_ARCH := s390 241 KERNEL_ARCH := s390 243 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/s3 242 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/s390/boot/bzImage 244 KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMD 243 KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMDLINE=\(.*\)/\1/p' arch/s390x.config) 245 QEMU_VPORT_RESULT := virtio-serial-ccw 244 QEMU_VPORT_RESULT := virtio-serial-ccw 246 ifeq ($(HOST_ARCH),$(ARCH)) 245 ifeq ($(HOST_ARCH),$(ARCH)) 247 QEMU_MACHINE := -cpu host,accel=kvm -machine s 246 QEMU_MACHINE := -cpu host,accel=kvm -machine s390-ccw-virtio -append $(KERNEL_CMDLINE) 248 else 247 else 249 QEMU_MACHINE := -cpu max -machine s390-ccw-vir !! 248 QEMU_MACHINE := -machine s390-ccw-virtio -append $(KERNEL_CMDLINE) 250 endif 249 endif 251 else ifeq ($(ARCH),um) << 252 CHOST := $(HOST_ARCH)-linux-musl << 253 KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux << 254 KERNEL_ARCH := um << 255 KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMD << 256 else 250 else 257 $(error I only build: x86_64, i686, arm, armeb !! 251 $(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x) 258 endif 252 endif 259 253 260 TOOLCHAIN_FILENAME := $(CHOST)-cross.tgz 254 TOOLCHAIN_FILENAME := $(CHOST)-cross.tgz 261 TOOLCHAIN_TAR := $(DISTFILES_PATH)/$(TOOLCHAIN 255 TOOLCHAIN_TAR := $(DISTFILES_PATH)/$(TOOLCHAIN_FILENAME) 262 TOOLCHAIN_PATH := $(BUILD_PATH)/$(CHOST)-cross 256 TOOLCHAIN_PATH := $(BUILD_PATH)/$(CHOST)-cross 263 TOOLCHAIN_DIR := https://download.wireguard.co 257 TOOLCHAIN_DIR := https://download.wireguard.com/qemu-test/toolchains/20211123/ 264 $(eval $(call file_download,toolchain-sha256su 258 $(eval $(call file_download,toolchain-sha256sums-20211123,$(TOOLCHAIN_DIR)SHA256SUMS#,83da033fd8c798df476c21d9612da2dfb896ec62fbed4ceec5eefc0e56b3f0c8)) 265 $(eval $(call file_download,$(TOOLCHAIN_FILENA 259 $(eval $(call file_download,$(TOOLCHAIN_FILENAME),$(TOOLCHAIN_DIR),,$(DISTFILES_PATH)/toolchain-sha256sums-20211123)) 266 260 267 STRIP := $(CHOST)-strip 261 STRIP := $(CHOST)-strip 268 CROSS_COMPILE_FLAG := --build=$(CBUILD) --host 262 CROSS_COMPILE_FLAG := --build=$(CBUILD) --host=$(CHOST) 269 $(info Building for $(CHOST) using $(CBUILD)) 263 $(info Building for $(CHOST) using $(CBUILD)) 270 ifneq ($(ARCH),um) << 271 export CROSS_COMPILE := $(CHOST)- 264 export CROSS_COMPILE := $(CHOST)- 272 endif << 273 export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH) 265 export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH) 274 export CC := $(CHOST)-gcc 266 export CC := $(CHOST)-gcc 275 CCACHE_PATH := $(shell which ccache 2>/dev/nul 267 CCACHE_PATH := $(shell which ccache 2>/dev/null) 276 ifneq ($(CCACHE_PATH),) 268 ifneq ($(CCACHE_PATH),) 277 export KBUILD_BUILD_TIMESTAMP := Fri Jun 5 15 269 export KBUILD_BUILD_TIMESTAMP := Fri Jun 5 15:58:00 CEST 2015 278 export PATH := $(TOOLCHAIN_PATH)/bin/ccache:$( 270 export PATH := $(TOOLCHAIN_PATH)/bin/ccache:$(PATH) 279 export CCACHE_SLOPPINESS := file_macro,time_ma 271 export CCACHE_SLOPPINESS := file_macro,time_macros 280 export CCACHE_DIR ?= $(PWD)/ccache 272 export CCACHE_DIR ?= $(PWD)/ccache 281 endif 273 endif 282 274 283 USERSPACE_DEPS := $(TOOLCHAIN_PATH)/.installed 275 USERSPACE_DEPS := $(TOOLCHAIN_PATH)/.installed $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed 284 276 285 comma := , 277 comma := , 286 build: $(KERNEL_BZIMAGE) 278 build: $(KERNEL_BZIMAGE) 287 qemu: $(KERNEL_BZIMAGE) 279 qemu: $(KERNEL_BZIMAGE) 288 rm -f $(BUILD_PATH)/result 280 rm -f $(BUILD_PATH)/result 289 ifneq ($(ARCH),um) << 290 timeout --foreground 20m qemu-system-$ 281 timeout --foreground 20m qemu-system-$(QEMU_ARCH) \ 291 -nodefaults \ 282 -nodefaults \ 292 -nographic \ 283 -nographic \ 293 -smp $(NR_CPUS) \ 284 -smp $(NR_CPUS) \ 294 $(QEMU_MACHINE) \ 285 $(QEMU_MACHINE) \ 295 -m $$(grep -q CONFIG_DEBUG_KME 286 -m $$(grep -q CONFIG_DEBUG_KMEMLEAK=y $(KERNEL_BUILD_PATH)/.config && echo 1G || echo 256M) \ 296 -serial stdio \ 287 -serial stdio \ 297 -chardev file,path=$(BUILD_PAT 288 -chardev file,path=$(BUILD_PATH)/result,id=result \ 298 $(if $(QEMU_VPORT_RESULT),-dev 289 $(if $(QEMU_VPORT_RESULT),-device $(QEMU_VPORT_RESULT) -device virtserialport$(comma)chardev=result,-serial chardev:result) \ 299 -no-reboot \ 290 -no-reboot \ 300 -monitor none \ 291 -monitor none \ 301 -kernel $< 292 -kernel $< 302 else << 303 timeout --foreground 20m $< \ << 304 $(KERNEL_CMDLINE) \ << 305 mem=$$(grep -q CONFIG_DEBUG_KM << 306 noreboot \ << 307 con1=fd:51 51>$(BUILD_PATH)/re << 308 endif << 309 grep -Fq success $(BUILD_PATH)/result 293 grep -Fq success $(BUILD_PATH)/result 310 294 311 $(BUILD_PATH)/init-cpio-spec.txt: $(TOOLCHAIN_ 295 $(BUILD_PATH)/init-cpio-spec.txt: $(TOOLCHAIN_PATH)/.installed $(BUILD_PATH)/init 312 mkdir -p $(BUILD_PATH) 296 mkdir -p $(BUILD_PATH) 313 echo "file /init $(BUILD_PATH)/init 75 297 echo "file /init $(BUILD_PATH)/init 755 0 0" > $@ 314 echo "file /init.sh $(PWD)/../netns.sh 298 echo "file /init.sh $(PWD)/../netns.sh 755 0 0" >> $@ 315 echo "dir /dev 755 0 0" >> $@ 299 echo "dir /dev 755 0 0" >> $@ 316 echo "nod /dev/console 644 0 0 c 5 1" 300 echo "nod /dev/console 644 0 0 c 5 1" >> $@ 317 echo "dir /bin 755 0 0" >> $@ 301 echo "dir /bin 755 0 0" >> $@ 318 echo "file /bin/iperf3 $(IPERF_PATH)/s 302 echo "file /bin/iperf3 $(IPERF_PATH)/src/iperf3 755 0 0" >> $@ 319 echo "file /bin/wg $(WIREGUARD_TOOLS_P 303 echo "file /bin/wg $(WIREGUARD_TOOLS_PATH)/src/wg 755 0 0" >> $@ 320 echo "file /bin/bash $(BASH_PATH)/bash 304 echo "file /bin/bash $(BASH_PATH)/bash 755 0 0" >> $@ 321 echo "file /bin/ip $(IPROUTE2_PATH)/ip 305 echo "file /bin/ip $(IPROUTE2_PATH)/ip/ip 755 0 0" >> $@ 322 echo "file /bin/ss $(IPROUTE2_PATH)/mi 306 echo "file /bin/ss $(IPROUTE2_PATH)/misc/ss 755 0 0" >> $@ 323 echo "file /bin/ping $(IPUTILS_PATH)/p 307 echo "file /bin/ping $(IPUTILS_PATH)/ping 755 0 0" >> $@ 324 echo "file /bin/ncat $(NMAP_PATH)/ncat 308 echo "file /bin/ncat $(NMAP_PATH)/ncat/ncat 755 0 0" >> $@ 325 echo "file /bin/xtables-legacy-multi $ 309 echo "file /bin/xtables-legacy-multi $(IPTABLES_PATH)/iptables/xtables-legacy-multi 755 0 0" >> $@ 326 echo "slink /bin/iptables xtables-lega 310 echo "slink /bin/iptables xtables-legacy-multi 777 0 0" >> $@ 327 echo "slink /bin/ping6 ping 777 0 0" > 311 echo "slink /bin/ping6 ping 777 0 0" >> $@ 328 echo "dir /lib 755 0 0" >> $@ 312 echo "dir /lib 755 0 0" >> $@ 329 echo "file /lib/libc.so $(TOOLCHAIN_PA 313 echo "file /lib/libc.so $(TOOLCHAIN_PATH)/$(CHOST)/lib/libc.so 755 0 0" >> $@ 330 echo "slink $$($(CHOST)-readelf -p .in 314 echo "slink $$($(CHOST)-readelf -p .interp '$(BUILD_PATH)/init'| grep -o '/lib/.*') libc.so 777 0 0" >> $@ 331 315 332 $(KERNEL_BUILD_PATH)/.config: $(TOOLCHAIN_PATH 316 $(KERNEL_BUILD_PATH)/.config: $(TOOLCHAIN_PATH)/.installed kernel.config arch/$(ARCH).config 333 mkdir -p $(KERNEL_BUILD_PATH) 317 mkdir -p $(KERNEL_BUILD_PATH) 334 cp kernel.config $(KERNEL_BUILD_PATH)/ 318 cp kernel.config $(KERNEL_BUILD_PATH)/minimal.config 335 printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCON 319 printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_BUILD_PATH)/minimal.config 336 cat arch/$(ARCH).config >> $(KERNEL_BU 320 cat arch/$(ARCH).config >> $(KERNEL_BUILD_PATH)/minimal.config 337 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_B 321 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) allnoconfig 338 cd $(KERNEL_BUILD_PATH) && ARCH=$(KERN 322 cd $(KERNEL_BUILD_PATH) && ARCH=$(KERNEL_ARCH) $(KERNEL_PATH)/scripts/kconfig/merge_config.sh -n $(KERNEL_BUILD_PATH)/.config $(KERNEL_BUILD_PATH)/minimal.config 339 $(if $(findstring yes,$(DEBUG_KERNEL)) 323 $(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,) 340 324 341 $(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installe 325 $(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(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 342 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_B 326 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 343 .PHONY: $(KERNEL_BZIMAGE) 327 .PHONY: $(KERNEL_BZIMAGE) 344 328 345 $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.inst 329 $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed: | $(KERNEL_BUILD_PATH)/.config $(TOOLCHAIN_PATH)/.installed 346 ifneq ($(ARCH),um) << 347 rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/incl 330 rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/include/linux 348 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_B 331 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) INSTALL_HDR_PATH=$(TOOLCHAIN_PATH)/$(CHOST) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) headers_install 349 endif << 350 touch $@ 332 touch $@ 351 333 352 $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR) 334 $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR) 353 mkdir -p $(BUILD_PATH) 335 mkdir -p $(BUILD_PATH) 354 flock -s $<.lock tar -C $(BUILD_PATH) 336 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 355 $(STRIP) -s $(TOOLCHAIN_PATH)/$(CHOST) 337 $(STRIP) -s $(TOOLCHAIN_PATH)/$(CHOST)/lib/libc.so 356 ifneq ($(CCACHE_PATH),) 338 ifneq ($(CCACHE_PATH),) 357 mkdir -p $(TOOLCHAIN_PATH)/bin/ccache 339 mkdir -p $(TOOLCHAIN_PATH)/bin/ccache 358 ln -s $(CCACHE_PATH) $(TOOLCHAIN_PATH) 340 ln -s $(CCACHE_PATH) $(TOOLCHAIN_PATH)/bin/ccache/$(CC) 359 endif 341 endif 360 touch $@ 342 touch $@ 361 343 362 $(IPERF_PATH)/.installed: $(IPERF_TAR) 344 $(IPERF_PATH)/.installed: $(IPERF_TAR) 363 mkdir -p $(BUILD_PATH) 345 mkdir -p $(BUILD_PATH) 364 flock -s $<.lock tar -C $(BUILD_PATH) 346 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 365 sed -i '1s/^/#include <stdint.h>/' $(I 347 sed -i '1s/^/#include <stdint.h>/' $(IPERF_PATH)/src/cjson.h $(IPERF_PATH)/src/timer.h 366 sed -i -r 's/-p?g//g' $(IPERF_PATH)/sr 348 sed -i -r 's/-p?g//g' $(IPERF_PATH)/src/Makefile* 367 touch $@ 349 touch $@ 368 350 369 $(IPERF_PATH)/src/iperf3: | $(IPERF_PATH)/.ins 351 $(IPERF_PATH)/src/iperf3: | $(IPERF_PATH)/.installed $(USERSPACE_DEPS) 370 cd $(IPERF_PATH) && autoreconf -fi 352 cd $(IPERF_PATH) && autoreconf -fi 371 cd $(IPERF_PATH) && CFLAGS="$(CFLAGS) 353 cd $(IPERF_PATH) && CFLAGS="$(CFLAGS) -D_GNU_SOURCE" ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --enable-static --disable-shared --with-openssl=no 372 $(MAKE) -C $(IPERF_PATH) 354 $(MAKE) -C $(IPERF_PATH) 373 $(STRIP) -s $@ 355 $(STRIP) -s $@ 374 356 375 $(WIREGUARD_TOOLS_PATH)/.installed: $(WIREGUAR 357 $(WIREGUARD_TOOLS_PATH)/.installed: $(WIREGUARD_TOOLS_TAR) 376 mkdir -p $(BUILD_PATH) 358 mkdir -p $(BUILD_PATH) 377 flock -s $<.lock tar -C $(BUILD_PATH) 359 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 378 touch $@ 360 touch $@ 379 361 380 $(WIREGUARD_TOOLS_PATH)/src/wg: | $(WIREGUARD_ 362 $(WIREGUARD_TOOLS_PATH)/src/wg: | $(WIREGUARD_TOOLS_PATH)/.installed $(USERSPACE_DEPS) 381 $(MAKE) -C $(WIREGUARD_TOOLS_PATH)/src 363 $(MAKE) -C $(WIREGUARD_TOOLS_PATH)/src wg 382 $(STRIP) -s $@ 364 $(STRIP) -s $@ 383 365 384 $(BUILD_PATH)/init: init.c | $(USERSPACE_DEPS) 366 $(BUILD_PATH)/init: init.c | $(USERSPACE_DEPS) 385 mkdir -p $(BUILD_PATH) 367 mkdir -p $(BUILD_PATH) 386 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) -std= 368 $(CC) -o $@ $(CFLAGS) $(LDFLAGS) -std=gnu11 $< 387 $(STRIP) -s $@ 369 $(STRIP) -s $@ 388 370 389 $(IPUTILS_PATH)/.installed: $(IPUTILS_TAR) 371 $(IPUTILS_PATH)/.installed: $(IPUTILS_TAR) 390 mkdir -p $(BUILD_PATH) 372 mkdir -p $(BUILD_PATH) 391 flock -s $<.lock tar -C $(BUILD_PATH) 373 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 392 touch $@ 374 touch $@ 393 375 394 $(IPUTILS_PATH)/ping: | $(IPUTILS_PATH)/.insta 376 $(IPUTILS_PATH)/ping: | $(IPUTILS_PATH)/.installed $(USERSPACE_DEPS) 395 sed -i /atexit/d $(IPUTILS_PATH)/ping. 377 sed -i /atexit/d $(IPUTILS_PATH)/ping.c 396 cd $(IPUTILS_PATH) && $(CC) $(CFLAGS) 378 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) 397 $(STRIP) -s $@ 379 $(STRIP) -s $@ 398 380 399 $(BASH_PATH)/.installed: $(BASH_TAR) 381 $(BASH_PATH)/.installed: $(BASH_TAR) 400 mkdir -p $(BUILD_PATH) 382 mkdir -p $(BUILD_PATH) 401 flock -s $<.lock tar -C $(BUILD_PATH) 383 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 402 touch $@ 384 touch $@ 403 385 404 $(BASH_PATH)/bash: | $(BASH_PATH)/.installed $ 386 $(BASH_PATH)/bash: | $(BASH_PATH)/.installed $(USERSPACE_DEPS) 405 cd $(BASH_PATH) && ./configure --prefi 387 cd $(BASH_PATH) && ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --without-bash-malloc --disable-debugger --disable-help-builtin --disable-history --disable-progcomp --disable-readline --disable-mem-scramble 406 $(MAKE) -C $(BASH_PATH) 388 $(MAKE) -C $(BASH_PATH) 407 $(STRIP) -s $@ 389 $(STRIP) -s $@ 408 390 409 $(IPROUTE2_PATH)/.installed: $(IPROUTE2_TAR) 391 $(IPROUTE2_PATH)/.installed: $(IPROUTE2_TAR) 410 mkdir -p $(BUILD_PATH) 392 mkdir -p $(BUILD_PATH) 411 flock -s $<.lock tar -C $(BUILD_PATH) 393 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 412 printf 'CC:=$(CC)\nPKG_CONFIG:=pkg-con 394 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:=n\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCFLAGS+=-DHAVE_SETNS -DHAVE_HANDLE_AT\n' > $(IPROUTE2_PATH)/config.mk 413 printf 'libutil.a.done:\n\tflock -x $$ 395 printf 'libutil.a.done:\n\tflock -x $$@.lock $$(MAKE) -C lib\n\ttouch $$@\nip/ip: libutil.a.done\n\t$$(MAKE) -C ip ip\nmisc/ss: libutil.a.done\n\t$$(MAKE) -C misc ss\n' >> $(IPROUTE2_PATH)/Makefile 414 touch $@ 396 touch $@ 415 397 416 $(IPROUTE2_PATH)/ip/ip: | $(IPROUTE2_PATH)/.in 398 $(IPROUTE2_PATH)/ip/ip: | $(IPROUTE2_PATH)/.installed $(USERSPACE_DEPS) 417 $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ i 399 $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ ip/ip 418 $(STRIP) -s $@ 400 $(STRIP) -s $@ 419 401 420 $(IPROUTE2_PATH)/misc/ss: | $(IPROUTE2_PATH)/. 402 $(IPROUTE2_PATH)/misc/ss: | $(IPROUTE2_PATH)/.installed $(USERSPACE_DEPS) 421 $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ m 403 $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ misc/ss 422 $(STRIP) -s $@ 404 $(STRIP) -s $@ 423 405 424 $(IPTABLES_PATH)/.installed: $(IPTABLES_TAR) 406 $(IPTABLES_PATH)/.installed: $(IPTABLES_TAR) 425 mkdir -p $(BUILD_PATH) 407 mkdir -p $(BUILD_PATH) 426 flock -s $<.lock tar -C $(BUILD_PATH) 408 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 427 sed -i -e "/nfnetlink=[01]/s:=[01]:=0: 409 sed -i -e "/nfnetlink=[01]/s:=[01]:=0:" -e "/nfconntrack=[01]/s:=[01]:=0:" $(IPTABLES_PATH)/configure 428 touch $@ 410 touch $@ 429 411 430 $(IPTABLES_PATH)/iptables/xtables-legacy-multi 412 $(IPTABLES_PATH)/iptables/xtables-legacy-multi: | $(IPTABLES_PATH)/.installed $(USERSPACE_DEPS) 431 cd $(IPTABLES_PATH) && ./configure --p 413 cd $(IPTABLES_PATH) && ./configure --prefix=/ $(CROSS_COMPILE_FLAG) --enable-static --disable-shared --disable-nftables --disable-bpf-compiler --disable-nfsynproxy --disable-libipq --disable-connlabel --with-kernel=$(BUILD_PATH)/include 432 $(MAKE) -C $(IPTABLES_PATH) 414 $(MAKE) -C $(IPTABLES_PATH) 433 $(STRIP) -s $@ 415 $(STRIP) -s $@ 434 416 435 $(NMAP_PATH)/.installed: $(NMAP_TAR) 417 $(NMAP_PATH)/.installed: $(NMAP_TAR) 436 mkdir -p $(BUILD_PATH) 418 mkdir -p $(BUILD_PATH) 437 flock -s $<.lock tar -C $(BUILD_PATH) 419 flock -s $<.lock tar -C $(BUILD_PATH) -xf $< 438 touch $@ 420 touch $@ 439 421 440 $(NMAP_PATH)/ncat/ncat: | $(NMAP_PATH)/.instal 422 $(NMAP_PATH)/ncat/ncat: | $(NMAP_PATH)/.installed $(USERSPACE_DEPS) 441 cd $(NMAP_PATH) && ./configure --prefi 423 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 442 $(MAKE) -C $(NMAP_PATH)/libpcap 424 $(MAKE) -C $(NMAP_PATH)/libpcap 443 $(MAKE) -C $(NMAP_PATH)/ncat 425 $(MAKE) -C $(NMAP_PATH)/ncat 444 $(STRIP) -s $@ 426 $(STRIP) -s $@ 445 427 446 clean: 428 clean: 447 rm -rf $(BUILD_PATH) 429 rm -rf $(BUILD_PATH) 448 430 449 distclean: clean 431 distclean: clean 450 rm -rf $(DISTFILES_PATH) 432 rm -rf $(DISTFILES_PATH) 451 433 452 cacheclean: clean 434 cacheclean: clean 453 ifneq ($(CCACHE_DIR),) 435 ifneq ($(CCACHE_DIR),) 454 rm -rf $(CCACHE_DIR) 436 rm -rf $(CCACHE_DIR) 455 endif 437 endif 456 438 457 menuconfig: $(KERNEL_BUILD_PATH)/.config 439 menuconfig: $(KERNEL_BUILD_PATH)/.config 458 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_B 440 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) menuconfig 459 441 460 .PHONY: qemu build clean distclean cacheclean 442 .PHONY: qemu build clean distclean cacheclean menuconfig 461 .DELETE_ON_ERROR: 443 .DELETE_ON_ERROR:
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.