David Brazdil | e8ebf27 | 2020-07-24 10:00:31 +0000 | [diff] [blame] | 1 | # Copyright 2020 The Android KVM Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 15 | SELF := $(abspath $(lastword $(MAKEFILE_LIST))) |
| 16 | |
Elena Petrova | 467cfd9 | 2021-01-15 14:56:04 +0000 | [diff] [blame] | 17 | CPUS ?= $(shell nproc) |
| 18 | MAKEFLAGS += --jobs=$(CPUS) |
David Brazdil | 94acb6f | 2021-08-23 08:35:03 +0000 | [diff] [blame] | 19 | SHELL ?= $(shell which bash) |
Elena Petrova | 467cfd9 | 2021-01-15 14:56:04 +0000 | [diff] [blame] | 20 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 21 | ## |
| 22 | ## Folders |
| 23 | ## |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 24 | ROOT_DIR := $(CURDIR) |
Fuad Tabba | d99cc75 | 2020-08-17 11:31:56 +0000 | [diff] [blame] | 25 | |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 26 | OUT_DIR := $(ROOT_DIR)/out |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 27 | |
| 28 | # DIST_DIR: target directory for artifacts and logs. |
| 29 | # The CI build (pKVM Busytown) uses it to separate artifacts from other |
| 30 | # temporary build files, which are placed in in OUT_DIR. |
| 31 | # For other users, OUT_DIR and DIST_DIR are typically the same. |
| 32 | DIST_DIR ?= $(OUT_DIR) |
| 33 | |
| 34 | # Copy specified file or directory only if OUT_DIR and DIST_DIR aren't the same. |
| 35 | # |
| 36 | # Parameters: |
| 37 | # $(1): Source files or directories (to be copied recursively) |
| 38 | # $(2): Destination directory (is created if it doesn't exist) |
| 39 | ifneq ($(abspath $(OUT_DIR)), $(abspath $(DIST_DIR))) |
| 40 | define copy_to_dist |
| 41 | mkdir -p $(2) && cp -r $(1) $(2) |
| 42 | endef |
Fuad Tabba | d99cc75 | 2020-08-17 11:31:56 +0000 | [diff] [blame] | 43 | endif |
| 44 | |
Fuad Tabba | a74ba08 | 2020-05-29 11:56:18 +0100 | [diff] [blame] | 45 | LINUX_OUT := $(OUT_DIR)/linux |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 46 | LINUX_DIST := $(DIST_DIR)/linux |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 47 | SCRIPTS_DIR := $(ROOT_DIR)/build |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 48 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 49 | ## |
| 50 | ## Common options |
| 51 | ## |
| 52 | VERBOSE ?= 0 |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 53 | ARCH = arm64 |
Fuad Tabba | a74ba08 | 2020-05-29 11:56:18 +0100 | [diff] [blame] | 54 | |
Pierre-Clément Tosi | 5133e85 | 2021-08-03 12:25:08 +0000 | [diff] [blame] | 55 | DEFAULT_KERNEL_IMAGE := $(LINUX_OUT)/arch/arm64/boot/Image |
Fuad Tabba | a74ba08 | 2020-05-29 11:56:18 +0100 | [diff] [blame] | 56 | # KERNEL_IMAGE can be set to use own custom kernel image. |
Pierre-Clément Tosi | 5133e85 | 2021-08-03 12:25:08 +0000 | [diff] [blame] | 57 | KERNEL_IMAGE ?= $(DEFAULT_KERNEL_IMAGE) |
Fuad Tabba | a74ba08 | 2020-05-29 11:56:18 +0100 | [diff] [blame] | 58 | |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 59 | ## |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 60 | ## Toolchain options and variables |
| 61 | ## |
| 62 | |
| 63 | # Specifies which toolchain of the prebuilt toolchains to use. |
David Brazdil | 53a7030 | 2021-08-20 13:32:11 +0000 | [diff] [blame] | 64 | # Can be either clang, gcc-5.1, or gcc-9.2. |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 65 | # GCC will always use the latest version for building everything else other |
| 66 | # than the kernel. |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 67 | TOOLCHAIN ?= clang |
| 68 | |
| 69 | # Find the toolchain path for the current OS. |
| 70 | UNNAME_S := $(shell uname -s | tr '[:upper:]' '[:lower:]') |
Fuad Tabba | 3aeba79 | 2021-04-27 10:30:08 +0100 | [diff] [blame] | 71 | TOOLCHAIN_CLANG := $(ROOT_DIR)/toolchains/$(UNNAME_S)-x86/clang/clang-r416183b/ |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 72 | TOOLCHAIN_GCC_49 := $(ROOT_DIR)/toolchains/$(UNNAME_S)-x86/gcc/aarch64-linux-gnu-4.9/ |
Fuad Tabba | aa07f1e | 2021-02-04 14:14:19 +0000 | [diff] [blame] | 73 | TOOLCHAIN_GCC_51 := $(ROOT_DIR)/toolchains/$(UNNAME_S)-x86/gcc/aarch64-linux-gnu-5.1/ |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 74 | TOOLCHAIN_GCC_92 := $(ROOT_DIR)/toolchains/$(UNNAME_S)-x86/gcc/aarch64-linux-gnu-9.2/ |
| 75 | |
| 76 | # Set the toolchain build binary paths and prefixes. |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 77 | TARGET = aarch64-linux-gnu |
| 78 | TARGET_GCC_92 = aarch64-none-linux-gnu |
| 79 | |
David Brazdil | 53a7030 | 2021-08-20 13:32:11 +0000 | [diff] [blame] | 80 | ifeq ($(TOOLCHAIN), gcc-5.1) |
Fuad Tabba | aa07f1e | 2021-02-04 14:14:19 +0000 | [diff] [blame] | 81 | TOOLCHAIN_BIN := $(TOOLCHAIN_GCC_51)/bin |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 82 | else ifeq ($(TOOLCHAIN), gcc-9.2) |
| 83 | TOOLCHAIN_BIN := $(TOOLCHAIN_GCC_92)/bin |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 84 | TARGET = $(TARGET_GCC_92) |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 85 | else ifeq ($(TOOLCHAIN), clang) |
| 86 | TOOLCHAIN_BIN := $(TOOLCHAIN_CLANG)/bin |
| 87 | CC := $(TOOLCHAIN_BIN)/clang |
| 88 | LD := $(TOOLCHAIN_BIN)/ld.lld |
| 89 | OBJCOPY := $(TOOLCHAIN_BIN)/llvm-objcopy |
| 90 | OBJDUMP := $(TOOLCHAIN_BIN)/llvm-objdump |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 91 | # The GCC toolchain is needed when building kvm-unit-tests and Linux with Clang. |
Fuad Tabba | eac7ff6 | 2021-02-10 17:30:19 +0000 | [diff] [blame] | 92 | GCC_TOOLCHAIN_DIR = $(TOOLCHAIN_GCC_49) |
Fuad Tabba | 72cc5fd | 2020-11-03 13:01:51 +0000 | [diff] [blame] | 93 | GCC_TOOLCHAIN_BIN = $(GCC_TOOLCHAIN_DIR)/bin/ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 94 | LINUX_EXTRA = LLVM=1 LLVM_IAS=1 GCC_TOOLCHAIN_DIR="$(GCC_TOOLCHAIN_BIN)" |
Fuad Tabba | 72cc5fd | 2020-11-03 13:01:51 +0000 | [diff] [blame] | 95 | # Some targets require additional flags to build with Clang. |
| 96 | COMMON_CFLAGS := -Qunused-arguments --target=$(TARGET) -fno-integrated-as -Wno-asm-operand-widths -fpic --gcc-toolchain=$(GCC_TOOLCHAIN_DIR) --sysroot=$(GCC_TOOLCHAIN_DIR)/$(TARGET)/libc --prefix=$(GCC_TOOLCHAIN_BIN)/$(TARGET)- |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 97 | else |
| 98 | $(error Unrecognized toolchain: TOOLCHAIN=$(TOOLCHAIN)) |
| 99 | endif |
| 100 | |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 101 | LINUX_TOOLCHAIN_BIN := $(TOOLCHAIN_BIN) |
| 102 | LINUX_TARGET := $(TARGET) |
| 103 | |
| 104 | # Common to all GCC versions: |
| 105 | # Use the latest GCC toolchain to build everything other than the kernel |
| 106 | # because kvm-unit-tests as well as u-boot require recent versions. |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 107 | ifneq ($(TOOLCHAIN), clang) |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 108 | TARGET = $(TARGET_GCC_92) |
| 109 | TOOLCHAIN_BIN := $(TOOLCHAIN_GCC_92)/bin |
| 110 | GCC_TOOLCHAIN_BIN := $(TOOLCHAIN_BIN) |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 111 | CC := $(TOOLCHAIN_BIN)/$(TARGET)-gcc |
| 112 | LD := $(TOOLCHAIN_BIN)/$(TARGET)-ld |
| 113 | OBJCOPY := $(TOOLCHAIN_BIN)/$(TARGET)-objcopy |
| 114 | OBJDUMP := $(TOOLCHAIN_BIN)/$(TARGET)-objdump |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 115 | endif |
| 116 | |
| 117 | ## |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 118 | ## Common targets |
| 119 | ## |
| 120 | |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 121 | .DEFAULT_GOAL := default |
| 122 | |
| 123 | .PHONY: default |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 124 | default: kvm-unit-tests linux |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 125 | |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 126 | .PHONY: clean |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 127 | clean: buildroot_clean kvm-unit-tests_clean linux_clean u-boot_clean |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 128 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 129 | .PHONY: distclean |
David Brazdil | f770f60 | 2020-07-27 09:53:28 +0000 | [diff] [blame] | 130 | distclean: |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 131 | - rm -rf $(OUT_DIR) $(DIST_DIR) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 132 | |
| 133 | .PHONY: all |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 134 | all: buildroot kvm-unit-tests linux u-boot |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 135 | |
| 136 | .PHONY: help |
| 137 | help: |
| 138 | @echo 'Generic Targets:' |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 139 | @echo ' default - builds all generic targets except for buildroot' |
| 140 | @echo ' all - builds all generic targets' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 141 | @echo ' buildroot - the buildroot rootfs image as well as the host qemu' |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 142 | @echo ' kvm-unit-tests - the kvm-unit-tests' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 143 | @echo ' linux - the linux kernel' |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 144 | @echo ' u-boot - the u-boot' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 145 | @echo '' |
| 146 | @echo 'Clean Targets:' |
| 147 | @echo ' clean - cleans all, but keeps the prebuilts' |
| 148 | @echo ' distclean - distclean for all targets' |
| 149 | @echo ' buildroot_clean - the buildroot rootfs image as well as the host qemu' |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 150 | @echo ' kvm-unit-tests_clean - the kvm-unit-tests' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 151 | @echo ' linux_clean - the linux kernel' |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 152 | @echo ' u-boot_clean - the u-boot' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 153 | @echo '' |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 154 | @echo 'Test Targets:' |
| 155 | @echo ' test - runs all tests in qemu-aarch64 simulated environment' |
| 156 | @echo ' test-kut - runs all kvm-unit-tests in qemu-aarch64 simulated environment' |
| 157 | @echo ' test-list - lists all test targets' |
| 158 | @echo '' |
Pierre-Clément Tosi | aa7c390 | 2021-09-22 14:46:06 +0200 | [diff] [blame] | 159 | @echo 'Test Parameters:' |
Pierre-Clément Tosi | a4c90ba | 2021-09-22 14:28:04 +0200 | [diff] [blame] | 160 | @echo ' CROSVM_TAR_GZ - path to a custom cvd-host_package.tar.gz' |
| 161 | @echo ' (default: uses a pre-built version)' |
Pierre-Clément Tosi | aa7c390 | 2021-09-22 14:46:06 +0200 | [diff] [blame] | 162 | @echo ' VM_IMAGE - path to an image to be used by the VMM to boot the VM' |
| 163 | @echo ' (default: uses the host image)' |
| 164 | @echo '' |
Pierre-Clément Tosi | 4768c6c | 2021-08-02 09:53:29 +0000 | [diff] [blame] | 165 | @echo 'Test Flags:' |
| 166 | @echo ' VERBOSE=[0|1] - prints the verbose output of the scripts running the test' |
| 167 | @echo ' (default: 0)' |
| 168 | @echo ' QUIET=[0|1] - redirects the output to a file instead of stdout' |
| 169 | @echo ' (default: 1)' |
| 170 | @echo ' GDB=[0|1] - makes the started test wait for a GDB connection' |
| 171 | @echo ' (default: 0)' |
| 172 | @echo '' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 173 | @echo 'Misc Targets:' |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 174 | @echo ' update-prebuilts - generates/update the prebuilt rootfs image (aarch64) and the qemu host (aarch64)' |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 175 | |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 176 | |
| 177 | ## |
| 178 | ## Buildroot |
| 179 | ## |
| 180 | |
Fuad Tabba | 714a692 | 2020-10-29 15:12:23 +0000 | [diff] [blame] | 181 | BR_DEFCONFIG ?= qemu_aarch64_virt_kvmunittests_defconfig |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 182 | BR_VERBOSE ?= $(VERBOSE) |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 183 | |
| 184 | BR_SRC := $(ROOT_DIR)/buildroot |
| 185 | BR_OUT := $(OUT_DIR)/buildroot |
| 186 | BR_MAKE := $(MAKE) -C $(BR_SRC) V=$(BR_VERBOSE) O=$(BR_OUT) |
| 187 | |
| 188 | .PHONY: buildroot |
| 189 | buildroot: |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 190 | + $(BR_MAKE) $(BR_DEFCONFIG) |
| 191 | + $(BR_MAKE) all |
David Brazdil | acc8ea4 | 2020-04-28 16:01:08 +0100 | [diff] [blame] | 192 | |
| 193 | .PHONY: buildroot_clean |
| 194 | buildroot_clean: |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 195 | + $(BR_MAKE) clean |
| 196 | |
| 197 | |
| 198 | ## |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 199 | ## kvm-unit-tests |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 200 | ## |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 201 | KUT_SRC := $(ROOT_DIR)/kvm-unit-tests |
| 202 | KUT_OUT := $(OUT_DIR)/kvm-unit-tests |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 203 | KUT_DIST := $(DIST_DIR)/kvm-unit-tests |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 204 | KUT_STAMP := $(KUT_OUT)/kvm-unit-tests.stamp |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 205 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 206 | |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 207 | .PHONY: kvm-unit-tests |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 208 | kvm-unit-tests $(KUT_STAMP): |
David Brazdil | 8f61ea5 | 2020-07-27 09:50:56 +0000 | [diff] [blame] | 209 | mkdir -p $(KUT_OUT) |
| 210 | cd $(KUT_OUT) && \ |
| 211 | $(KUT_SRC)/configure \ |
| 212 | --erratatxt=$(KUT_SRC)/errata.txt \ |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 213 | --prefix=$(KUT_OUT) --arch=$(ARCH) \ |
| 214 | --cc=$(CC) --ld=$(LD) \ |
| 215 | --objcopy=$(OBJCOPY) --objdump=$(OBJDUMP) |
Fuad Tabba | 72cc5fd | 2020-11-03 13:01:51 +0000 | [diff] [blame] | 216 | COMMON_CFLAGS="$(COMMON_CFLAGS)" \ |
David Brazdil | e6c2643 | 2020-07-27 16:17:44 +0000 | [diff] [blame] | 217 | $(MAKE) -C $(KUT_OUT) standalone |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 218 | $(call copy_to_dist, $(KUT_OUT)/tests, $(KUT_DIST)) |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 219 | touch $(KUT_STAMP) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 220 | |
David Brazdil | 54fb744 | 2020-07-27 09:54:56 +0000 | [diff] [blame] | 221 | .PHONY: kvm-unit-tests_clean |
| 222 | kvm-unit-tests_clean: |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 223 | - rm -f $(KUT_STAMP) |
David Brazdil | 8f61ea5 | 2020-07-27 09:50:56 +0000 | [diff] [blame] | 224 | - $(MAKE) -C $(KUT_OUT) clean |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 225 | |
| 226 | |
| 227 | ## |
| 228 | ## Linux kernel |
| 229 | ## |
| 230 | LINUX_DEFCONFIG ?= defconfig |
| 231 | LINUX_VERBOSE ?= $(VERBOSE) |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 232 | LINUX_SRC ?= $(ROOT_DIR)/linux |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 233 | LINUX_VMLINUX = $(LINUX_OUT)/vmlinux |
| 234 | LINUX_DIST_FILES = $(LINUX_CONFIG) $(LINUX_VMLINUX) $(KERNEL_IMAGE) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 235 | |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 236 | LINUX_MAKE := \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 237 | PATH=$(LINUX_TOOLCHAIN_BIN):$(PATH) \ |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 238 | ARCH=$(ARCH) \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 239 | CROSS_COMPILE="$(LINUX_TARGET)-" \ |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 240 | $(MAKE) \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 241 | $(LINUX_EXTRA) \ |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 242 | -C $(LINUX_SRC) \ |
| 243 | V=$(LINUX_VERBOSE) \ |
| 244 | O=$(LINUX_OUT) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 245 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 246 | LINUX_CONFIG := $(LINUX_OUT)/.config |
| 247 | |
| 248 | .PHONY: linux_defconfig |
| 249 | linux_defconfig $(LINUX_CONFIG): |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 250 | + $(LINUX_MAKE) $(LINUX_DEFCONFIG) |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 251 | |
David Brazdil | a7e3566 | 2020-12-03 09:40:38 +0000 | [diff] [blame] | 252 | .PHONY: linux_menuconfig |
| 253 | linux_menuconfig: $(LINUX_CONFIG) |
| 254 | + $(LINUX_MAKE) menuconfig |
| 255 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 256 | .PHONY: linux |
| 257 | linux: $(LINUX_CONFIG) |
Fuad Tabba | 990105b | 2020-05-12 15:39:52 +0100 | [diff] [blame] | 258 | + $(LINUX_MAKE) |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 259 | $(call copy_to_dist, $(LINUX_DIST_FILES), $(LINUX_DIST)) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 260 | |
Fuad Tabba | 6b9c08e | 2020-05-18 13:03:01 +0100 | [diff] [blame] | 261 | .PHONY: linux_image |
Pierre-Clément Tosi | 5133e85 | 2021-08-03 12:25:08 +0000 | [diff] [blame] | 262 | linux_image $(DEFAULT_KERNEL_IMAGE): $(LINUX_CONFIG) |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 263 | + $(LINUX_MAKE) Image.gz |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 264 | $(call copy_to_dist, $(LINUX_DIST_FILES), $(LINUX_DIST)) |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 265 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 266 | .PHONY: linux_clean |
| 267 | linux_clean: |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 268 | + $(LINUX_MAKE) mrproper |
| 269 | |
| 270 | |
| 271 | ## |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 272 | ## u-boot |
| 273 | ## |
| 274 | UBOOT_DEFCONFIG ?= pvmfw_arm64_defconfig |
| 275 | UBOOT_VERBOSE ?= $(VERBOSE) |
| 276 | UBOOT_SRC ?= $(ROOT_DIR)/u-boot |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 277 | UBOOT_OUT := $(OUT_DIR)/u-boot |
| 278 | UBOOT_MAKE := \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 279 | PATH=$(TOOLCHAIN_BIN):$(GCC_TOOLCHAIN_BIN):$(PATH) \ |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 280 | ARCH=$(ARCH) \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 281 | CROSS_COMPILE="$(TARGET)-" \ |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 282 | $(MAKE) \ |
Fuad Tabba | 6761847 | 2021-04-27 11:56:35 +0100 | [diff] [blame] | 283 | CC=$(CC) \ |
| 284 | LD=$(LD) \ |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 285 | -C $(UBOOT_SRC) \ |
| 286 | V=$(UBOOT_VERBOSE) \ |
| 287 | O=$(UBOOT_OUT) |
| 288 | |
| 289 | UBOOT_CONFIG := $(UBOOT_OUT)/.config |
Elena Petrova | 044fe52 | 2021-02-25 13:10:46 +0000 | [diff] [blame] | 290 | UBOOT_BIN := $(UBOOT_OUT)/u-boot.bin |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 291 | |
| 292 | .PHONY: u-boot_defconfig |
| 293 | u-boot_defconfig $(UBOOT_CONFIG): |
| 294 | + $(UBOOT_MAKE) $(UBOOT_DEFCONFIG) |
| 295 | |
| 296 | .PHONY: u-boot_menuconfig |
| 297 | u-boot_menuconfig: $(UBOOT_CONFIG) |
| 298 | + $(UBOOT_MAKE) menuconfig |
| 299 | |
| 300 | .PHONY: u-boot |
Elena Petrova | 044fe52 | 2021-02-25 13:10:46 +0000 | [diff] [blame] | 301 | u-boot $(UBOOT_BIN): $(UBOOT_CONFIG) |
Elena Petrova | 9cbf9b9 | 2021-02-01 12:53:31 +0000 | [diff] [blame] | 302 | + $(UBOOT_MAKE) |
| 303 | |
| 304 | .PHONY: u-boot_clean |
| 305 | u-boot_clean: |
| 306 | + $(UBOOT_MAKE) mrproper |
| 307 | |
| 308 | |
| 309 | ## |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 310 | ## Generating/Updating prebuilts |
| 311 | ## |
| 312 | |
Pierre-Clément Tosi | 58b789a | 2021-09-27 13:01:17 +0200 | [diff] [blame] | 313 | PREBUILTS_CROSVM_EXT4 := prebuilts/linux-aarch64/images/crosvm.ext4 |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 314 | PREBUILTS_ROOTFS_EXT4 := prebuilts/linux-aarch64/images/rootfs.ext4 |
| 315 | PREBUILTS_QEMU_ROM := prebuilts/linux-aarch64/images/efi-virtio.rom |
| 316 | PREBUILTS_QEMU_BIN := prebuilts/linux-x86/qemu |
| 317 | |
Pierre-Clément Tosi | 58b789a | 2021-09-27 13:01:17 +0200 | [diff] [blame] | 318 | CUSTOM_CROSVM_EXT4 := $(OUT_DIR)/images/crosvm.ext4 |
| 319 | |
Pierre-Clément Tosi | a4c90ba | 2021-09-22 14:28:04 +0200 | [diff] [blame] | 320 | ifeq ($(CROSVM_TAR_GZ),) |
Pierre-Clément Tosi | 58b789a | 2021-09-27 13:01:17 +0200 | [diff] [blame] | 321 | CROSVM_EXT4 := $(PREBUILTS_CROSVM_EXT4) |
Pierre-Clément Tosi | a4c90ba | 2021-09-22 14:28:04 +0200 | [diff] [blame] | 322 | else |
Pierre-Clément Tosi | 58b789a | 2021-09-27 13:01:17 +0200 | [diff] [blame] | 323 | CROSVM_EXT4 := $(CUSTOM_CROSVM_EXT4) |
Pierre-Clément Tosi | a4c90ba | 2021-09-22 14:28:04 +0200 | [diff] [blame] | 324 | endif |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 325 | |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 326 | .PHONY:update-prebuilts |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 327 | update-prebuilts: \ |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 328 | $(PREBUILTS_ROOTFS_EXT4) \ |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 329 | update-prebuilts-crosvm \ |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 330 | $(PREBUILTS_QEMU_ROM) \ |
| 331 | $(PREBUILTS_QEMU_BIN) |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 332 | |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 333 | $(PREBUILTS_ROOTFS_EXT4): buildroot |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 334 | mkdir -p $(shell dirname $@) |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 335 | cp $(BR_OUT)/images/rootfs.ext4 $@ |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 336 | |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 337 | $(PREBUILTS_QEMU_ROM): buildroot |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 338 | mkdir -p $(shell dirname $@) |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 339 | cp $(BR_OUT)/per-package/host-qemu/host/share/qemu/efi-virtio.rom $@ |
| 340 | |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 341 | CF_DOWNLOAD_AOSP_SH := $(ROOT_DIR)/build/cuttlefish/download-aosp.sh |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 342 | |
| 343 | # A PHONY target is necessary for allowing the user to update the archive |
| 344 | # because, as we are downloading it from a remote server, make dependencies are |
| 345 | # unable to express the local-->remote dependency: |
| 346 | .PHONY: update-prebuilts-crosvm |
| 347 | update-prebuilts-crosvm $(PREBUILTS_CROSVM_TAR_GZ): |
| 348 | @rm -f $(PREBUILTS_CROSVM_TAR_GZ) # else, wget will create "$@.1" |
| 349 | cd $(dir $(PREBUILTS_CROSVM_TAR_GZ)) && $(CF_DOWNLOAD_AOSP_SH) -XCa arm64 |
| 350 | @touch -c $(PREBUILTS_CROSVM_TAR_GZ) # wget doesn't set timestamp to now |
| 351 | |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 352 | CROSVM_IMG_SIZE_MB := 1024 |
| 353 | |
Pierre-Clément Tosi | 58b789a | 2021-09-27 13:01:17 +0200 | [diff] [blame] | 354 | $(CUSTOM_CROSVM_EXT4): TMP_DIR := $(shell mktemp -d) |
| 355 | $(CUSTOM_CROSVM_EXT4): $(CROSVM_TAR_GZ) |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 356 | mkdir -p $(@D) |
| 357 | cd $(TMP_DIR) && tar xzvf $(abspath $<) |
David Brazdil | 4f0603f | 2021-02-02 16:18:18 +0000 | [diff] [blame] | 358 | dd if=/dev/zero of=$@.tmp bs=1M count=$(CROSVM_IMG_SIZE_MB) |
| 359 | mkfs.ext4 -d $(TMP_DIR) $@.tmp |
| 360 | rm -rf $(TMP_DIR) |
| 361 | mv $@.tmp $@ |
| 362 | |
Fuad Tabba | ce13552 | 2020-08-26 10:15:47 +0100 | [diff] [blame] | 363 | # The qemu binary |
David Brazdil | e3446db | 2021-02-02 20:58:49 +0000 | [diff] [blame] | 364 | .PHONY:$(PREBUILTS_QEMU_BIN) |
| 365 | $(PREBUILTS_QEMU_BIN): |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 366 | - rm -rf $@ |
Fuad Tabba | 7f167f7 | 2020-09-17 15:26:45 +0100 | [diff] [blame] | 367 | ${SCRIPTS_DIR}/aarch64/build_qemu.sh $(OUT_DIR)/qemu ${TOOLCHAIN_BIN} |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 368 | mkdir -p $@/bin |
Fuad Tabba | ce13552 | 2020-08-26 10:15:47 +0100 | [diff] [blame] | 369 | cp $(OUT_DIR)/qemu/qemu-system-aarch64 $@/bin |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 370 | |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 371 | ## |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 372 | ## Run tests |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 373 | ## |
| 374 | |
Pierre-Clément Tosi | d181306 | 2021-07-30 15:50:41 +0000 | [diff] [blame] | 375 | KVM_MODES := vhe nvhe pkvm |
| 376 | hyphensuffix = $(lastword $(subst -, ,$(1))) |
| 377 | |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 378 | RUN_TEST_SH := $(SCRIPTS_DIR)/kvm-unit-tests/run_test.sh |
| 379 | RUN_TEST = $(RUN_TEST_SH) \ |
| 380 | -d $@ \ |
| 381 | -M $(call hyphensuffix,$@) \ |
| 382 | -k "$(KERNEL_IMAGE)" \ |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 383 | $(RUN_TEST_ARGS) "$(RUN_TEST_HOST_SH)" \ |
| 384 | $(if $(RUN_TEST_QEMU_ARGS),-- ,)$(RUN_TEST_QEMU_ARGS) |
| 385 | |
Pierre-Clément Tosi | 4768c6c | 2021-08-02 09:53:29 +0000 | [diff] [blame] | 386 | ifeq ($(VERBOSE),1) |
| 387 | RUN_TEST_ARGS += -v |
| 388 | endif |
| 389 | |
| 390 | ifneq ($(QUIET),0) |
| 391 | RUN_TEST_ARGS += -o "$(RUN_TEST_LOG_DIR)/$@.log" |
| 392 | endif |
| 393 | |
| 394 | ifeq ($(GDB),1) |
| 395 | # RUN_TEST_SH defaults to no-timeout when -G is passed but -t forces one: |
| 396 | RUN_TEST_ARGS += -G |
| 397 | else |
| 398 | # Without -G, RUN_TEST_SH defaults to a non-zero timeout duration. |
| 399 | # RUN_TEST_TIMEOUT should be use if a specific value is wanted (see 'man timeout'). |
| 400 | # In particular, RUN_TEST_TIMEOUT=0 prevents the test from timing out. |
| 401 | RUN_TEST_ARGS += $(if $(RUN_TEST_TIMEOUT),-t ,)$(RUN_TEST_TIMEOUT) |
| 402 | endif |
| 403 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 404 | # Root test targets. Dynamically generated per-test targets |
| 405 | # will add themselves as dependencies of these. |
| 406 | .PHONY: test test-list |
| 407 | test: |
| 408 | test-list: |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 409 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 410 | # |
| 411 | # kvm-unit-tests |
| 412 | # |
| 413 | |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 414 | KUT_RUN_TEST = $(RUN_TEST_SH) |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 415 | KUT_GEN_MAKEFILE := $(SCRIPTS_DIR)/kvm-unit-tests/gen_makefile.sh |
| 416 | KUT_MAKEFILE := $(OUT_DIR)/Makefile.kvm-unit-tests |
| 417 | KUT_TEST_DIR := $(KUT_OUT)/tests |
Fuad Tabba | cd90840 | 2021-02-09 17:18:15 +0000 | [diff] [blame] | 418 | KUT_LOG_DIR := $(DIST_DIR)/logs/kvm-unit-tests/ |
Fuad Tabba | 62b2119 | 2020-05-13 11:57:26 +0100 | [diff] [blame] | 419 | |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 420 | # Exclude tests that require user interaction or are known to fail. |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 421 | KUT_EXCLUDE := (.+migrat.+)|(gicv2-.+)|(pmu-event-introspection)|(micro-bench) |
Fuad Tabba | 42a3b29 | 2020-05-13 15:04:03 +0100 | [diff] [blame] | 422 | |
David Brazdil | ef8506d | 2020-07-27 19:56:16 +0000 | [diff] [blame] | 423 | # Generate a Makefile with targets per test and configuration. |
| 424 | # Pass in variable/target names from this Makefile that the |
| 425 | # generated Makefile will refer to. |
| 426 | $(KUT_MAKEFILE): $(SELF) $(KUT_GEN_MAKEFILE) $(KUT_STAMP) |
| 427 | @ mkdir -p $(shell dirname $@) |
| 428 | @ $(KUT_GEN_MAKEFILE) \ |
| 429 | $(KUT_TEST_DIR) "$(KUT_EXCLUDE)" \ |
| 430 | KERNEL_IMAGE KUT_LOG_DIR test test-list \ |
| 431 | > $@.tmp |
| 432 | @ mv $@.tmp $@ |
| 433 | include $(KUT_MAKEFILE) |
David Brazdil | 19d0b7a | 2021-02-02 18:15:44 +0000 | [diff] [blame] | 434 | |
| 435 | # |
David Brazdil | 490370a | 2021-03-10 22:55:02 +0000 | [diff] [blame] | 436 | # Basic boot tests in the various arm64 KVM modes |
| 437 | # |
| 438 | |
Pierre-Clément Tosi | d181306 | 2021-07-30 15:50:41 +0000 | [diff] [blame] | 439 | BOOT_TESTS := $(addprefix test-boot-,$(KVM_MODES)) |
David Brazdil | 490370a | 2021-03-10 22:55:02 +0000 | [diff] [blame] | 440 | |
David Brazdil | 490370a | 2021-03-10 22:55:02 +0000 | [diff] [blame] | 441 | .PHONY: test-boot |
| 442 | test-boot: $(BOOT_TESTS) |
| 443 | |
Pierre-Clément Tosi | 63d4087 | 2021-07-30 16:23:48 +0000 | [diff] [blame] | 444 | TEST_LISTS += test-list-boot |
| 445 | test-list-boot: LISTED_TESTS = $(BOOT_TESTS) |
David Brazdil | 490370a | 2021-03-10 22:55:02 +0000 | [diff] [blame] | 446 | |
Pierre-Clément Tosi | 4843686 | 2021-07-30 16:34:25 +0000 | [diff] [blame] | 447 | TESTS += $(BOOT_TESTS) |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 448 | $(BOOT_TESTS): RUN_TEST_LOG_DIR = $(DIST_DIR)/logs/boot |
| 449 | $(BOOT_TESTS): RUN_TEST_HOST_SH = $(SCRIPTS_DIR)/aarch64/test_boot.sh |
| 450 | $(BOOT_TESTS): RUN_TEST_QEMU_ARGS = -a "boot_test_mode=$(call hyphensuffix,$@)" |
David Brazdil | 490370a | 2021-03-10 22:55:02 +0000 | [diff] [blame] | 451 | |
| 452 | # |
David Brazdil | 19d0b7a | 2021-02-02 18:15:44 +0000 | [diff] [blame] | 453 | # CrosVM Hello World test |
| 454 | # |
| 455 | |
Pierre-Clément Tosi | d181306 | 2021-07-30 15:50:41 +0000 | [diff] [blame] | 456 | CROSVM_HELLOWORLD_TESTS := $(addprefix test-crosvm-helloworld-,$(KVM_MODES)) |
David Brazdil | 19d0b7a | 2021-02-02 18:15:44 +0000 | [diff] [blame] | 457 | |
Pierre-Clément Tosi | aa7c390 | 2021-09-22 14:46:06 +0200 | [diff] [blame] | 458 | VM_IMAGE ?= $(KERNEL_IMAGE) |
| 459 | |
David Brazdil | 19d0b7a | 2021-02-02 18:15:44 +0000 | [diff] [blame] | 460 | .PHONY: test-crosvm-helloworld |
| 461 | test-crosvm-helloworld: $(CROSVM_HELLOWORLD_TESTS) |
| 462 | |
Pierre-Clément Tosi | 63d4087 | 2021-07-30 16:23:48 +0000 | [diff] [blame] | 463 | TEST_LISTS += test-list-crosvm-helloworld |
| 464 | test-list-crosvm-helloworld: LISTED_TESTS = $(CROSVM_HELLOWORLD_TESTS) |
David Brazdil | 19d0b7a | 2021-02-02 18:15:44 +0000 | [diff] [blame] | 465 | |
Pierre-Clément Tosi | 4843686 | 2021-07-30 16:34:25 +0000 | [diff] [blame] | 466 | TESTS += $(CROSVM_HELLOWORLD_TESTS) |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 467 | $(CROSVM_HELLOWORLD_TESTS): $(CROSVM_EXT4) |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 468 | $(CROSVM_HELLOWORLD_TESTS): RUN_TEST_LOG_DIR = $(DIST_DIR)/logs/crosvm/helloworld |
| 469 | $(CROSVM_HELLOWORLD_TESTS): RUN_TEST_HOST_SH = $(SCRIPTS_DIR)/crosvm/helloworld/host.sh |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 470 | $(CROSVM_HELLOWORLD_TESTS): RUN_TEST_QEMU_ARGS = \ |
| 471 | -s 4 \ |
| 472 | -R $(SCRIPTS_DIR)/crosvm/helloworld/guest.sh \ |
Pierre-Clément Tosi | aa7c390 | 2021-09-22 14:46:06 +0200 | [diff] [blame] | 473 | -R $(VM_IMAGE) \ |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 474 | -R $(PREBUILTS_ROOTFS_EXT4) \ |
Pierre-Clément Tosi | 609555c | 2021-09-22 14:13:20 +0200 | [diff] [blame] | 475 | -R $(CROSVM_EXT4) |
Pierre-Clément Tosi | 4768c6c | 2021-08-02 09:53:29 +0000 | [diff] [blame] | 476 | $(CROSVM_HELLOWORLD_TESTS): RUN_TEST_TIMEOUT := 300s |
Pierre-Clément Tosi | 63d4087 | 2021-07-30 16:23:48 +0000 | [diff] [blame] | 477 | |
Pierre-Clément Tosi | 4843686 | 2021-07-30 16:34:25 +0000 | [diff] [blame] | 478 | .PHONY test: $(TESTS) |
| 479 | $(TESTS): $(KERNEL_IMAGE) |
Pierre-Clément Tosi | 253cd13 | 2021-08-02 08:49:39 +0000 | [diff] [blame] | 480 | @ $(RUN_TEST) |
Pierre-Clément Tosi | 63d4087 | 2021-07-30 16:23:48 +0000 | [diff] [blame] | 481 | .PHONY test-list: $(TEST_LISTS) |
| 482 | $(TEST_LISTS): |
| 483 | @ for x in $(LISTED_TESTS); do echo $$x; done |