| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | target := aarch64-unknown-nonemode := releasekernel := target/$(target)/$(mode)/aarch64kernel_qemu_bin := target/$(target)/$(mode)/aarch64_qemu.binkernel_crosvm_bin := target/$(target)/$(mode)/aarch64_crosvm.binimg := target/$(target)/$(mode)/imgsysroot := $(shell rustc --print sysroot)objdump := $(shell find $(sysroot) -name llvm-objdump) --arch-name=aarch64objcopy := $(shell find $(sysroot) -name llvm-objcopy)BUILD_ARGS += --target $(target)ifeq ($(mode), release)	BUILD_ARGS += --releaseendif.PHONY: kernel clean qemu run envenv:	rustup component add llvm-tools-preview rustfmt	rustup target add $(target)kernel_qemu:	cargo clean	cargo build $(BUILD_ARGS) --config 'build.rustflags="--cfg platform=\"qemu\""'kernel_crosvm:	cargo clean	cargo build $(BUILD_ARGS) --config 'build.rustflags="--cfg platform=\"crosvm\""'$(kernel_qemu_bin): kernel_qemu	aarch64-linux-gnu-objcopy -O binary $(kernel) $(kernel_qemu_bin)$(kernel_crosvm_bin): kernel_crosvm	aarch64-linux-gnu-objcopy -O binary $(kernel) $(kernel_crosvm_bin)asm: kernel	$(objdump) -d $(kernel) | lesssym: kernel	$(objdump) -t $(kernel) | lessheader: kernel	$(objdump) -x $(kernel) | lessclean:	cargo cleanqemu: $(kernel_qemu_bin) $(img)	qemu-system-aarch64 \	  $(QEMU_ARGS) \		-machine virt \		-cpu max \		-serial chardev:char0 \		-kernel $(kernel_qemu_bin) \		-global virtio-mmio.force-legacy=false \		-nic none \		-drive file=$(img),if=none,format=raw,id=x0 \		-device virtio-blk-device,drive=x0 \		-device virtio-gpu-device \		-device virtio-serial,id=virtio-serial0 \		-chardev stdio,id=char0,mux=on \		-device virtconsole,chardev=char0qemu-pci: $(kernel_qemu_bin) $(img)	qemu-system-aarch64 \		-machine virt \		-cpu max \		-serial chardev:char0 \		-kernel $(kernel_qemu_bin) \		-nic none \		-drive file=$(img),if=none,format=raw,id=x0 \		-device virtio-blk-pci,drive=x0 \		-device virtio-gpu-pci \		-device virtio-serial,id=virtio-serial0 \		-chardev stdio,id=char0,mux=on \		-device virtconsole,chardev=char0crosvm: $(kernel_crosvm_bin) $(img)	adb shell 'mkdir -p /data/local/tmp/virt_raw'	adb push $(kernel_crosvm_bin) /data/local/tmp/virt_raw/aarch64_example	adb push $(img) /data/local/tmp/virt_raw/disk_img	adb shell "/data/local/tmp/crosvm --log-level=trace --extended-status run --disable-sandbox --serial=stdout,hardware=serial,num=1 --rwdisk=/data/local/tmp/virt_raw/disk_img --bios=/data/local/tmp/virt_raw/aarch64_example"$(img):	dd if=/dev/zero of=$@ bs=512 count=32run: qemu
 |