0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

QEMU Guest Agent for Windows をビルドする

Posted at

これはなに?

Windows 用 QEMU ゲストエージェントをビルドすることに関する個人的なメモです。
ぜんぜんまとまっていませんので、スルーしてください。

おおまかな手順は https://github.com/rbld/rebuild/wiki/QEMU-Guest-Agent-for-Windows-Build-Environment にあるとおりです。

Dockerを扱いやすくしてくれる Rebuild を使って、手元の環境を汚さずに作業します。

Rebuild環境構築

コンテナ作成

rbld create -b fedora:rawhide qemu-ga
rbld modify qemu-ga

必要なパッケージ

ビルドに必要なパッケージです。Wikiにある手順より少し多いです。

コンテナ内での作業です。

sudo dnf install -y git \
glib2-devel libfdt-devel pixman-devel zlib-devel \
python gcc gcc-c++ ninja-build findutils make \
mingw*-glib2 mingw*-pixman mingw*-gmp mingw*-SDL2 mingw*-pkg-config \
mingw*-glib2-static mingw*-zlib-static \
mingw*-winpthreads-static mingw*-pcre-static \
mingw*-pixman-static \
flex bison bzip2

ビルド手順

コンテナ内での作業です。

VSS SDKをダウンロードします。

curl -o VSS_SDK_7.2_setup.exe https://download.microsoft.com/download/9/4/c/94c588cf-8176-4bdb-9d55-2597c76043c6/setup.exe

ソースを取得します。

wget https://download.qemu.org/qemu-6.0.0.tar.xz
tar Jxf qemu-6.0.0.tar.xz
cd qemu-6.0.0

VSS SDKを展開します。

./scripts/extract-vsssdk-headers ../VSS_SDK_7.2_setup.exe

ビルドします。x64版の場合です。

mkdir build
cd build
../configure --disable-docs --target-list=x86_64-softmmu --cross-prefix=x86_64-w64-mingw32- --static --enable-guest-agent-msi --with-vss-sdk
make qemu-ga

build/qgaの下にmsiファイルが出来上がります。

バージョン番号

バージョン番号はルートにある VERSION ファイルにあります。

virtio-guest-tools を使って qemu gaを入れると、バージョン番号が100.0.0.0とかなっているので、上書きインストールするmsiを作りたいときはより大きいバージョン番号にします。

インストールに失敗する(1)

このようなメッセージが出て、インストーラがコケます。

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2613.

MSITOOLSの不具合のようです。 https://gitlab.gnome.org/GNOME/msitools/-/issues/37

インストールに失敗する(2)

このようなメッセージが出て、インストーラがこけます。

Service `QEMU Guest Agent' (QEMU_GA) failed to start. Verify that you have sufficient privileges to start system services.

image.png

virtio guest toolsに入っている qemu ga は大丈夫なのに。。。

そもそもなんで、自前でビルドしているのか

Windows 10では動くのに、Windows Server (2012/2016/2019)では動かないのをどうにかしたかったのです。

イベントビューアにこのようなメッセージが記録されます。

Faulting application name: qemu-ga.exe, version: 100.0.0.0, time stamp: 0x5c473543
Faulting module name: msvcrt.dll, version: 7.0.17763.475, time stamp: 0xf362c2f9
Exception code: 0xc0000005
Fault offset: 0x000000000005d700
Faulting process id: 0x77c
Faulting application start time: 0x01d7787041c4b0c0
Faulting application path: C:\Program Files\Qemu-ga\qemu-ga.exe
Faulting module path: C:\Windows\System32\msvcrt.dll
Report Id: bf4178f2-396d-4fa9-a537-ebfeec0caf10
Faulting package full name: 
Faulting package-relative application ID: 

いろいろ試してみると、--daemonize オプションをつけて起動すると落ちる様子です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?