qemu-boot.sh: Add support for booting RPi

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-03-25 15:10:42 +00:00
commit 94c9cbd77f

View file

@ -63,10 +63,12 @@ list_hostnames()
boot_net()
{
local mac
[ "$hostname" ] && {
set -x
macaddr=`ldap_search -LLL "(cn=$short_hostname) dhcpHWAddress" |
mac=`ldap_search -LLL "(cn=$short_hostname) dhcpHWAddress" |
sed '/dhcpHWAddress:/ !d; s/dhcpHWAddress: ethernet *//'`
macaddr=",macaddr=$mac"
}
ps aux | grep -v grep | grep -q dhcpd || /etc/init.d/dhcpd start
@ -79,7 +81,7 @@ boot_net()
do_sudo -E /usr/bin/$qemu_exe \
-boot n \
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
-net nic,vlan=0$nic_model,macaddr=$macaddr \
-net nic,vlan=0$nic_model$macaddr \
"$qemu_opts"
# invalid param macaddr
@ -102,13 +104,14 @@ boot_image()
test -r "$boot_image" || fatal "inaccessible boot image \"$boot_image\""
#-net bridge,br=$bridge \
#-net nic,vlan=1$nic_model,macaddr=00:02:36:22:13:6c \
#-net tap,ifname=tap1,vlan=1,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
set -x
do_sudo -E /usr/bin/$qemu_exe \
-net nic,vlan=0$nic_model,macaddr=00:02:36:22:13:6b \
-net nic,vlan=1$nic_model,macaddr=00:02:36:22:13:6c \
-net nic,vlan=0$nic_model$macaddr \
-net tap,ifname=tap0,vlan=0,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
-net tap,ifname=tap1,vlan=1,script=$tmpdir/qemu-ifup,downscript=$tmpdir/qemu-ifdown \
"$qemu_opts" \
-drive format=raw,file=$boot_image
-drive file=$boot_image
}
boot()
@ -120,7 +123,7 @@ boot()
ln -s $exe qemu-ifdown
)
do_sudo /sbin/modprobe kvm-intel
#do_sudo /sbin/modprobe kvm-intel
xhost +
case $1 in
@ -144,7 +147,7 @@ exe=`readlink -f $0`
dirname=`dirname $exe`
bridge=priv0
#bridge=in1
macaddr=00:0B:DC:9B:D6:DA
macaddr=,macaddr=00:0B:DC:9B:D6:DA
base=dc=priv,dc=lcl
qemu_exe=qemu-kvm
qemu_opts=""
@ -156,7 +159,7 @@ tmpdir=""
trap goodbye INT QUIT EXIT KILL TERM PIPE
OPTIND=1
while getopts lhb:o:x:n:B: flag; do
while getopts lhb:o:x:n:B:M: flag; do
case $flag in
h)
usage 0;;
@ -177,6 +180,9 @@ while getopts lhb:o:x:n:B: flag; do
nic_model=",model=$OPTARG";;
B)
bridge=$OPTARG;;
M)
macaddr=",macaddr=$OPTARG";;
*)
usage 1;;
esac