ラベル vm の投稿を表示しています。 すべての投稿を表示
ラベル vm の投稿を表示しています。 すべての投稿を表示

2011/04/18

WindowsのVMWare Player同士でシリアルポートを接続する

ホストOSとして使えるのがWindowsしかなく、VMWare Player上のLinuxカーネルをデバッグしたときの設定。

デバッグする側のVMをdebugger vm、デバッグされる側のVMをdebuggee vmとする。VMに仮想シリアルポートを名前付きパイプで追加して、debugger vmの仮想シリアルポートはサーバ、debugee vmの仮想シリアルポートはクライアントにする。
最近のVMware Playerは.vmxの設定をUIからできるので楽。

以下の設定はUIが無かったころのもの。
なお、ホストOSがLinuxのときはserial0.fileNameを/tmp/vm-ttyとかにすればOK。

- debugger vm の .vmx:


serial0.present = "TRUE"
serial0.startConnected = "TRUE"
serial0.yieldOnMsrRead = "TRUE"
serial0.pipe.endPoint = "server"
serial0.tryNoRxLoss = "FALSE"
serial0.fileType = "pipe"
serial0.fileName = "\\.\pipe\com1"
serial0.autodetect = "TRUE"



- debuggee vm の .vmx:


serial0.present = "TRUE"
serial0.startConnected = "TRUE"
serial0.yieldOnMsrRead = "TRUE"
serial0.pipe.endPoint = "client"
serial0.tryNoRxLoss = "FALSE"
serial0.fileType = "pipe"
serial0.fileName = "\\.\pipe\com1"
serial0.autodetect = "TRUE"

LinuxのVMWare PlayerでホストOSからゲストOSのLinuxをデバッグする

LinuxでVMware Player上のLinuxをデバッグするときの設定。
仮想シリアルポートをソケットとして追加する。

.vmx:

serial0.present = "TRUE"
serial0.fileType = "pipe"
serial0.fileName = "/tmp/vm-tty-pipe"
serial0.pipe.endPoint = "server"
serial0.yieldOnMsrRead = "TRUE"



あとはVirtualBoxのときと同じ。

/boot/grub/menu.lst(/boot/grub/grub.conf) の
kernel /vmlinuz-2.6..... というところに、以下を追加。

kgdbwait kgdboc=ttyS0,115200



Host OSで
$ socat -d -d /tmp/vm-tty-pipe pty

socatのログで /dev/pts/# の部分を確認。

2011/04/18 20:50:05 socat[23989] N PTY is /dev/pts/5



gdbの設定
.gdbinit:

file ./vmlinux
set remotebaud 115200
target remote /dev/pts/5 ... socatで確認した番号

2011/04/17

VMware Player 3D accelarationの設定

どの程度動くのか興味があってやってみた。
Host OSには当然及ばないが、かなり頑張ってる方だと思う。

なお最新のVMware Playerならば.vmxを直接編集せずにUIから設定できる。

.vmx:

#Enabled 3D Accelaration
mks.enable3d = TRUE
#VRAM 64MB
svga.vramSize = 67108864


あと、ゲームをするときなどはマウスが外に出ないよう、以下の設定をしておくと良い。

#Disable mouse integration
vmmouse.present = FALSE

VMware Playerのキーバインドを変更する

ある環境にVMware Playerをインストールしたとき、日本語キーボードで"_"を入力できなかったり、上矢印キーの動作が変なことがあった。以下の設定で直った。

/etc/vmware/config:

xkeymap.language = jp109
xkeymap.keycode.37 = 0x01d # Control_L
xkeymap.keycode.64 = 0x038 # Alt_L
xkeymap.keycode.97 = 0x073 # kana_RO
xkeymap.keycode.100 = 0x079 # Henkan
xkeymap.keycode.104 = 0x11c # KP_enter
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.106 = 0x135 # devide
xkeymap.keycode.107 = 0x137 # Print
xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.132 = 0x07d # backslash
xkeymap.keycode.133 = 0x15b # Super_L
xkeymap.keycode.135 = 0x15d # Menu
xkeymap.keycode.211 = 0x073

Ubuntu / VMWare Server 2.0の管理ユーザ設定

Ubuntuではrootでログインできない。したがって初期状態でVMware Infrastructure Web Accessにログインできない。

そこで、rootグループに属する別のユーザを追加する。
/etc/vmware/hostd/authorization.xml の
<ACEDataUser>root</ACEDataUser> のrootを、rootグループの別のユーザへ変更する。

VirtualBoxでLinuxカーネルをデバッグする

VirtualBoxの[Settings]->[Serial Ports]で"Port Mode"を"Host Pipe"にして、"Create Pipe"にチェック。
Pathに適当なパス(ここでは/tmp/vm-tty-pipe)を入力。

カーネルブート時のパラメータに次の文字列を追加。
kgdbwait kgdboc=ttyS0,115200

host os で
$ socat -d -d /tmp/vm-tty-pipe pty:

ちなみにsocatを使わないで直接 /tmp/vm-tty-pipe をgdbに渡す方法は不可。

gdbの設定
.gdbinit:

file ./vmlinux
set remotebaud 115200
target remote /dev/pts/0 ... 0 はsocatで出力された番号とする

VirutlaBoxで仮想ディスクをコピーする

cpコマンドなどでファイルをコピーした場合、VDIに記録されているUUIDを変更する。

$ VBoxManage internalcommands sethduuid original.vdi


以下のコマンドでも cp+sethduuid と同じ

$ VBoxManage clonevdi VDI1 VDI2


コピーしたときに、"udev: renamed network interface eth0 to eth2"と表示されて、
/dev/eth* が存在しない場合、/etc/udev/rules.d/70-persistent-net.rules
の中のMACアドレスを新しいものに変更する。

VMware Playerで仮想ディスクへの変更を削除する

.vmxを手動で変更。

ide0:0.mode = " independent-nonpersistent "
snapshot.action = " autoRevert "
snapshot.disabled = "TRUE"