#!/bin/ksh

qemu_dir=/opt/ooce/bin

qemu_cmd=$qemu_dir/qemu-system-aarch64
disk_img=braich-151055.raw

vnic=braich0

mac=`dladm show-vnic -p -o MACADDRESS $vnic | \
    /usr/bin/awk -F: \
    '{printf("%02s:%02s:%02s:%02s:%02s:%02s",$1,$2,$3,$4,$5,$6)}' | \
    tr '[:lower:]' '[:upper:]'`

pfexec ${qemu_cmd} \
	-nographic \
	-machine virt \
	-accel tcg,thread=multi \
	-m 3G \
	-smp 2 \
	-cpu cortex-a53 \
	-bios u-boot.bin \
	-netdev vnic,ifname=$vnic,id=net0 \
	-device virtio-net-device,netdev=net0,mac=$mac \
	-device virtio-blk-device,drive=hd0 \
	-drive file=$disk_img,format=raw,id=hd0,if=none \
	-semihosting-config enable=on,target=native

