1#!/bin/sh -eu
2#
3# Copyright 2021 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18"$QEMU_BIN" \
19  -kernel "$ANDROID_PRODUCT_OUT/kernel" \
20  -initrd "$ANDROID_PRODUCT_OUT/combined-ramdisk.img" \
21  -machine virt,mte=on \
22  -cpu max \
23  -drive "driver=raw,file=$ANDROID_PRODUCT_OUT/system-qemu.img,if=none,id=system" \
24  -device virtio-blk-device,drive=system \
25  -drive "driver=raw,file=$ANDROID_PRODUCT_OUT/userdata.img,if=none,id=userdata" \
26  -device virtio-blk-device,drive=userdata \
27  -append "console=ttyAMA0 earlyprintk=ttyAMA0 androidboot.hardware=qemu androidboot.boot_devices=a003e00.virtio_mmio loglevel=9" \
28  -m 4096 \
29  -no-reboot \
30  -nic user,model=virtio-net-pci-non-transitional,hostfwd=tcp:127.0.0.1:5555-172.20.51.1:5555,host=172.20.51.254,net=172.20.51.0/24,dhcpstart=172.20.51.1 \
31  -device virtio-gpu-pci \
32  -smp 8 \
33  -usb \
34  -device qemu-xhci \
35  -device usb-kbd \
36  -device usb-mouse \
37  -serial mon:stdio \
38  "$@"
39