(OK) Creating manually one VMs from an existing VDI file in CLI (VBoxManage) in Fedora 23


VBoxManage list runningvms
VBoxManage guestproperty get android-x86_64-6.0-rc1-1 "/VirtualBox/GuestInfo/Net/0/V4/IP"
VBoxManage showvminfo android-x86_64-6.0-rc1-1 --details
VBoxManage guestproperty enumerate android-x86_64-6.0-rc1-1
VBoxManage guestproperty enumerate Winxp


(OK) Creating manually one VMs from an existing VDI file in CLI (VBoxManage) in Fedora 23


---------------------------------------------------------------------------------
//successful (natpf1, NAT Port Forwarding) OK OK OK
---------------------------------------------------------------------------------

getprop service.adb.ip
getprop service.adb.tcp.port

setprop service.adb.ip 192.168.56.3
setprop service.adb.tcp.port 5555
stop adbd
start adbd


tunctl -t tap_a_1
ip link set up dev tap_a_1
brctl addif br_a_1 tap_a_1

brctl addbr br_a_1
ip link set up dev br_a_1
ifconfig br_a_1 up

brctl addbr br_a_0
ip link set up dev br_a_0
ifconfig br_a_0 up

// bridged, --nic2 none --nic3 none --nic4 none, android-x86_64-6.0-rc1-0

VBoxManage createvm --name android-x86_64-6.0-rc1-0 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-0 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 bridged --bridgeadapter1 br_a_1 --nic2 none --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-0 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-0 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-0.vdi; VBoxManage startvm android-x86_64-6.0-rc1-0;


tunctl -t tap_a_1
ip link set up dev tap_a_1
brctl addbr br_a_1
brctl addif br_a_1 tap_a_1
ip link set up dev br_a_1
ifconfig br_a_1 up

// bridged, --nic2 none --nic3 none --nic4 none, android-x86_64-6.0-rc1-1

VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 bridged --bridgeadapter1 br_a_1 --nic2 none --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;


// natpf1, --nic2 none --nic3 none --nic4 none

VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic2 none --nic3 none --nic4 none; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --natpf1 adb,tcp,*,5555,*,5555; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;

// natpf1, --nic2 bridged --bridgeadapter2 br_a_1

VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic2 bridged --bridgeadapter2 br_a_1 --nic3 none --nic4 none; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --natpf1 adb,tcp,*,5555,*,5555; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;

adb -s emulator-5554 shell
adb -s emulator-5554 shell ls /

// vboxnet0,  --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0

VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0 --nic2 bridged --bridgeadapter2 br_a_1 --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;


tunctl -t tap_a_1
ip link set up dev tap_a_1
brctl addbr br_a_1
brctl addif br_a_1 tap_a_1
ip link set up dev br_a_1
ifconfig br_a_1 up

// vboxnet0,  --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0 --nic2 none --nic3 none --nic4 none;

VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0 --nic2 none --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;


---------------------------------------
The following commands are not used
---------------------------------------
adb connect 127.0.0.1:5555;
adb devices
adb -s 127.0.0.1:5555 root
adb -s 127.0.0.1:5555 shell
adb disconnect 127.0.0.1:5555

adb connect 192.168.56.3 && adb -s 192.168.56.3 root
adb devices
adb -s 192.168.56.3 root
adb -s 192.168.56.4 shell
adb disconnect 192.168.56.3

stop adbd
start adbd
---------------------------------------







++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
virtualbox nat port forwarding adb "device offline"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://stackoverflow.com/questions/14993855/android-adb-device-offline-cant-issue-commands?rq=1

[root@localhost tools]# pwd
/opt/android-on-linux/android-sdk-linux/tools
[root@localhost tools]#
[root@localhost tools]# ./android update adb
adb has been updated. You must restart adb with the following commands
    adb kill-server
    adb start-server
    adb version
[root@localhost tools]#
    ./android update adb
    ./android update sdk --no-ui

Run these commands
    adb kill-server
    android update sdk --no-ui
    adb start-server
To verify that it worked, run 'adb version' before and after the commands and make sure it is the latest. The reason for the adb kill-server command is that it it most likely running, and it can't be updated while it is running, so you have to kill it first.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

VBoxManage showvminfo "android-x86_64-6.0-rc1-1" | grep NIC

ifconfig br_a_1 down
brctl delif br_a_1 tap_a_1
brctl delbr br_a_1
ifconfig tap_a_1 down
tunctl -d tap_a_1

---------------------------------------------------------------------------------




---------------------------------------------------------------------------------
tunctl -t tap_a_1
ip link set up dev tap_a_1
brctl addbr br_a_1
brctl addif br_a_1 tap_a_1
ip link set up dev br_a_1
ifconfig br_a_1 up

//successful (hostonly, vboxnet0)
VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0 --nic2 none --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;

//failed
VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register; VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 hostonly --nictype1 Am79C973 --hostonlyadapter1 vboxnet0 --nic2 bridged --bridgeadapter2 br_a_1 --nic3 none --nic4 none; VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4; VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86_64-6.0-rc1-1.vdi; VBoxManage startvm android-x86_64-6.0-rc1-1;
---------------------------------------------------------------------------------




route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.1
route add -net 192.168.62.0 netmask 255.255.255.0 gw 192.168.1.1
route del -net 0.0.0.0 netmask 0.0.0.0

VBoxManage unregistervm android-x86_64-6.0-rc1-1
rm /root/VirtualBox\ VMs/android-x86_64-6.0-rc1-1 -rf


ifconfig br_a_1 down
brctl delif br_a_1 tap_a_1
brctl delbr br_a_1

ifconfig tap_a_1 down
tunctl -d tap_a_1


sleep 30; adb connect 192.168.56.101; sleep 1; adb -s 192.168.56.101:5555 root; sleep 1; adb connect 192.168.56.101; sleep 1; adb -s 192.168.56.101:5555 root; sleep 1; adb connect 192.168.56.101; adb -s 192.168.56.101:5555 shell mkdir -p /opt/android-on-linux/quagga/out/etc; adb -s 192.168.56.101:5555 shell cp /system/xbin/quagga/etc/zebra.conf /opt/android-on-linux/quagga/out/etc/; adb -s 192.168.56.101:5555 shell cp /system/xbin/quagga/etc/ospf6d.conf /opt/android-on-linux/quagga/out/etc/; adb -s 192.168.56.101:5555 shell /system/xbin/quagga/zebra -d; adb -s 192.168.56.101:5555 shell /system/xbin/quagga/ospf6d -d; adb -s 192.168.56.101:5555 shell ifconfig eth1 down; adb -s 192.168.56.101:5555 shell ifconfig eth1 192.168.26.1 netmask 255.255.255.0 up; adb -s 192.168.56.101:5555 shell ifconfig eth0 down




posted @ 2016-06-28 14:38  张同光  阅读(185)  评论(0编辑  收藏  举报