QCOW2

draft

Introduction

In a nutshell, we will have to deploy those pieces

qemu
ocaml
hivex and its ocaml package
supermin
libguestfs with ocaml-hivex

Grab the latest releases

wget https://download.qemu.org/qemu-5.1.0.tar.xz
wget https://download.libguestfs.org/supermin/5.2-stable/supermin-5.2.0.tar.gz
wget https://download.libguestfs.org/hivex/hivex-1.3.19.tar.gz
wget https://download.libguestfs.org/1.42-stable/libguestfs-1.42.0.tar.gz

QEMU build

We could use SBo but this one requires X11, and we do not like that.

    #qemu libepoxy libdrm
    #ldd `which qemu`

Building from source!

tar xJf qemu-5.1.0.tar.xz
cd qemu-5.1.0/
./configure --disable-auth-pam \
--disable-sdl --disable-sdl-image \
--disable-gtk --disable-vte --disable-vnc \
--enable-xen --enable-xen-pci-passthrough \
--disable-opengl --disable-virglrenderer
time make
ls -lF /usr/local/bin/qemu* #won't interfere with -xen
make install
cd ../

OCaml install

Prepare OCaml

slackpkg search ocaml
slackpkg install ocaml

#slackpkg install opam
#opam init

Libguestfs build

Build and install Supermin

tar xzf supermin-5.2.0.tar.gz
cd supermin-5.2.0/
./configure
make
make install
cd ../

Build and install Hivex

tar xzf hivex-1.3.19.tar.gz
cd hivex-1.3.19/
./configure --disable-nls --enable-ocaml
make
make install
ls -lF /usr/lib64/ocaml/hivex/
ls -lF /usr/lib64/ocaml/stublibs/dllml*
cd ../

Build and install Libguestfs

ocamlfind printconf
vi /etc/findlib.conf

path="/usr/lib64/ocaml/site-lib:/usr/lib64/ocaml"

slackpkg install gperf cdrkit augeas jansson

tar xzf libguestfs-1.42.0.tar.gz
cd libguestfs-1.42.0/
./configure --disable-nls --without-libvirt --without-qemu --without-java \
    --enable-ocaml
make
make install
cd ../

Ready to go

create a QCOW2 disk as such

qemu-img-xen create -f qcow2 $guest.qcow2 10G

then use in a XEN guest config

disk = ['qcow2:/data/guests/buster/buster.qcow2,xvda1,w']

TODO MOUNT with Libguestfs…

Troubles

At libguestfs configure time

checking for OCaml findlib package hivex... not found
configure: error: the OCaml module 'hivex' is required

==> Install OCaml module atdgen as seen above.

Trash

'format=qcow2,vdev=xvda1,access=rw,target=/data/guests/buster/buster.qcow2'
disk = ['tap:qcow2:/data/guests/buster/buster.qcow2,xvda1,w']

Resources

old syntax https://wiki.xen.org/wiki/Blktap2

new syntax https://lists.xenproject.org/archives/html/xen-users/2019-07/msg00018.html

qemu

Re: [Qemu-devel] QEMU without X11 support https://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg03032.html

ocaml

https://github.com/libguestfs/hivex

https://ocaml.org/docs/install.html https://riptutorial.com/ocaml

findlib.conf - [Configuration of findlib/ocamlfind] https://manpages.debian.org/testing/ocaml-findlib/findlib.conf.5.en.html

https://github.com/ocaml/opam-repository/issues/10863

https://discuss.ocaml.org/t/connection-between-libraries-in-opam-dune-and-findlib/2536

guestfs

https://libguestfs.org/guestfs-building.1.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun