Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

102.3. libvhdi-20260901

Virtual Hard Disk (VHD, VHDX) image library, vhdiinfo and vhdimount

Version 20260901, release 1
Shelf security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit
Phase 41_system (System), 927 of 1047 in build order
Licence LGPL-3.0-or-later
Homepage https://github.com/libyal/libvhdi
Build time 0.5 SBU
Installed size 1.4 MiB in 18 files
Recipe ports/core/security/libvhdi/kpkgbuild

About

libvhdi reads Microsoft’s Virtual Hard Disk images, both VHD and VHDX, in their fixed, dynamic (sparse) and differencing forms. The package holds the library, vhdiinfo, which prints an image’s metadata, and vhdimount, which presents the disk inside an image as a raw file through FUSE. sleuthkit links it to open .vhd and .vhdx images directly. It is a libyal library, built the same way as libewf, libvmdk and libvslvm.

Sources

Dependencies

Depends on: pkgconf, libbfio, fuse.

Required by (1): sleuthkit.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libvhdi'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/libvhdi.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/security/libvhdi
echo 'b5c6f10b94bdea5b902fc74a984f0ae4c29b9bb24f81b6318c5b38d60bba24f2  libvhdi-20260901.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/libvhdi
SRC=$SRC_ROOT/libvhdi-20260901
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libvhdi-20260901.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

./configure \
	--prefix=/usr \
	--libdir=/usr/lib \
	--disable-static \
	--disable-nls \
	--disable-rpath \
	--disable-python \
	--enable-multi-threading-support \
	--with-pthread \
	--with-libbfio \
	--with-libfuse \
	--with-libcerror=no \
	--with-libcthreads=no \
	--with-libcdata=no \
	--with-libclocale=no \
	--with-libcnotify=no \
	--with-libcsplit=no \
	--with-libuna=no \
	--with-libcfile=no \
	--with-libcpath=no \
	--with-libfcache=no \
	--with-libfguid=no \
	--with-libfdata=no

for have in HAVE_MULTI_THREAD_SUPPORT HAVE_LIBBFIO HAVE_LIBFUSE3; do
	if ! grep -q "^#define $have 1" common/config.h; then
		echo "libvhdi: configure did not find $have" >&2
		exit 1
	fi
done

make
make DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libvhdi, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf libvhdi-20260901-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libvhdi, and runs the triggers its paths call for.

Contents

Installed programs: vhdiinfo, vhdimount.

Installed libraries: libvhdi.so.

Installed directories: /usr/include/libvhdi, /usr/share/licenses/libvhdi.

Short descriptions

vhdiinfo determines information about a Virtual Hard Disk (VHD) image file
vhdimount mounts a Virtual Hard Disk (VHD) image file
libvhdi.pc Library to access the Virtual Hard Disk (VHD) image format

Notes

The loop after configure reads common/config.h and stops the build unless multi-threading, libbfio and libfuse 3 were all found. configure treats each as optional and would otherwise build without it and say nothing.