| // Copyright (C) 2020 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| cc_defaults { |
| name: "kvmtool-defaults", |
| |
| cflags: [ |
| "-D_FILE_OFFSET_BITS=64", |
| "-D_GNU_SOURCE", |
| "-DKVMTOOLS_VERSION=\"android\"", |
| |
| "-Wall", |
| "-Wformat=2", |
| "-Winit-self", |
| "-Wmissing-declarations", |
| "-Wmissing-prototypes", |
| "-Wnested-externs", |
| "-Wno-system-headers", |
| "-Wold-style-definition", |
| "-Wredundant-decls", |
| "-Wsign-compare", |
| "-Wstrict-prototypes", |
| "-Wundef", |
| "-Wvolatile-register-var", |
| "-Wwrite-strings", |
| "-Wno-format-nonliteral", |
| |
| // Needed because Android makes these an error by default. |
| "-Wno-unused-parameter", |
| "-Wno-pointer-arith", |
| ], |
| local_include_dirs: [ "include" ], |
| |
| arch: { |
| arm64: { |
| cflags: [ |
| "-DCONFIG_ARM64", |
| "-DBUILD_ARCH=\"arm64\"", |
| "-DCONFIG_HAS_LIBFDT", |
| ], |
| local_include_dirs: [ |
| "arm/include", |
| "arm/aarch64/include" |
| ], |
| }, |
| x86_64: { |
| cflags: [ |
| "-DCONFIG_X86", |
| "-DCONFIG_X86_64", |
| "-DBUILD_ARCH=\"x86_64\"", |
| ], |
| local_include_dirs: [ "x86/include" ], |
| }, |
| }, |
| } |
| |
| cc_library_static { |
| name: "libkvmtool_static", |
| defaults: ["kvmtool-defaults"], |
| |
| srcs: [ |
| "builtin-balloon.c", |
| "builtin-debug.c", |
| "builtin-help.c", |
| "builtin-list.c", |
| "builtin-stat.c", |
| "builtin-pause.c", |
| "builtin-resume.c", |
| "builtin-run.c", |
| "builtin-setup.c", |
| "builtin-stop.c", |
| "builtin-version.c", |
| "devices.c", |
| "disk/core.c", |
| "framebuffer.c", |
| "guest_compat.c", |
| "hw/rtc.c", |
| "hw/serial.c", |
| "ioport.c", |
| "irq.c", |
| "kvm-cpu.c", |
| "kvm.c", |
| "mmio.c", |
| "pci.c", |
| "term.c", |
| "vfio/core.c", |
| "vfio/pci.c", |
| "virtio/blk.c", |
| "virtio/scsi.c", |
| "virtio/console.c", |
| "virtio/core.c", |
| "virtio/net.c", |
| "virtio/rng.c", |
| "virtio/balloon.c", |
| "virtio/pci.c", |
| "disk/blk.c", |
| "disk/qcow.c", |
| "disk/raw.c", |
| "ioeventfd.c", |
| "net/uip/core.c", |
| "net/uip/arp.c", |
| "net/uip/icmp.c", |
| "net/uip/ipv4.c", |
| "net/uip/tcp.c", |
| "net/uip/udp.c", |
| "net/uip/buf.c", |
| "net/uip/csum.c", |
| "net/uip/dhcp.c", |
| "kvm-cmd.c", |
| "util/init.c", |
| "util/iovec.c", |
| "util/rbtree.c", |
| "util/threadpool.c", |
| "util/parse-options.c", |
| "util/rbtree-interval.c", |
| "util/strbuf.c", |
| "util/read-write.c", |
| "util/util.c", |
| "virtio/9p.c", |
| "virtio/9p-pdu.c", |
| "kvm-ipc.c", |
| "builtin-sandbox.c", |
| "virtio/mmio.c", |
| ], |
| arch: { |
| arm64: { |
| cflags: [ |
| "-DCONFIG_ARM64", |
| "-DBUILD_ARCH=\"arm64\"", |
| "-DCONFIG_HAS_LIBFDT", |
| ], |
| local_include_dirs: [ |
| "arm/include", |
| "arm/aarch64/include" |
| ], |
| srcs: [ |
| "arm/fdt.c", |
| "arm/gic.c", |
| "arm/gicv2m.c", |
| "arm/ioport.c", |
| "arm/kvm.c", |
| "arm/kvm-cpu.c", |
| "arm/pci.c", |
| "arm/timer.c", |
| "arm/pmu.c", |
| "arm/aarch64/arm-cpu.c", |
| "arm/aarch64/kvm-cpu.c", |
| "arm/aarch64/kvm.c", |
| "hw/cfi_flash.c", |
| ], |
| static_libs: [ "libfdt", ], |
| }, |
| x86_64: { |
| srcs: [ |
| "hw/i8042.c", |
| "x86/boot.c", |
| "x86/cpuid.c", |
| "x86/interrupt.c", |
| "x86/ioport.c", |
| "x86/irq.c", |
| "x86/kvm.c", |
| "x86/kvm-cpu.c", |
| "x86/mptable.c", |
| |
| "x86/bios.c", // depends on "bios-rom.h" |
| "x86/bios/bios-rom.S", // depends on "bios.bin" |
| // TODO: build "bios.bin", generate "bios-rom.h" |
| ], |
| }, |
| }, |
| } |
| |
| cc_binary { |
| name: "kvmtool", |
| defaults: ["kvmtool-defaults"], |
| srcs: [ "main.c" ], |
| static_libs: [ "libfdt", "libkvmtool_static" ], |
| } |