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

99.6. squashfs-tools-4.7.5

Tools to create and extract squashfs filesystems

Version 4.7.5, release 1
Shelf filesystem — Filesystem utilities, FUSE, and network or encrypted filesystems
Phase 41_system (System), 506 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://github.com/plougher/squashfs-tools
Build time 0.1 SBU
Installed size 658.8 KiB in 9 files
Recipe ports/core/filesystem/squashfs-tools/kpkgbuild

About

squashfs-tools makes and unpacks squashfs images, the compressed read-only filesystem the KDOS live medium boots from: mksquashfs builds one, unsquashfs lists and extracts one, and sqfstar and sqfscat build one from a tar archive and print files from one. script/phases/70_image/110_iso.sh writes the ISO’s system.sfs with mksquashfs, zstd at level 19 and 1 MiB blocks unless KDOS_ISO_COMP names another codec or level or KDOS_ISO_BLOCK another block size, then appends the recipe tree as /ports and checks the result with unsquashfs -l. kdos rebuild needs mksquashfs to make a new medium from a source tree on a running system. How the live root is mounted is in The live medium and persistence.

The tools have no configure step. The build is selected with variables on the make command line, which override the Makefile’s own assignments.

Sources

Dependencies

Depends on: zlib, xz, lzo, zstd, lz4, sed.

Required by: no port names it.

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 squashfs-tools'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/filesystem/squashfs-tools.

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/filesystem/squashfs-tools
echo '547b7b7f4d2e44bf91b6fc554664850c69563701deab9fd9cd7e21f694c88ea6  squashfs-tools-4.7.5.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/squashfs-tools
SRC=$SRC_ROOT/squashfs-tools-4.7.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf squashfs-tools-4.7.5.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:

cd squashfs-tools

SED=/usr/bin/sed make \
	XZ_SUPPORT=1 \
	LZMA_XZ_SUPPORT=1 \
	ZLIB_SUPPORT=1 \
	LZ4_SUPPORT=1 \
	ZSTD_SUPPORT=1 \
	USE_PREBUILT_MANPAGES=y \
	INSTALL_DIR=$PKG/usr/bin \
	INSTALL_MANPAGES_DIR=$PKG/usr/share/man/man1 \
	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/squashfs-tools, 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 squashfs-tools-4.7.5-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/squashfs-tools, and runs the triggers its paths call for.

Contents

Installed programs: mksquashfs, sqfscat, sqfstar, unsquashfs.

Installed directories: /usr/share/licenses/squashfs-tools.

Short descriptions

mksquashfs tool to create and append to squashfs filesystems
sqfscat tool to cat files from a squashfs filesystem to stdout
sqfstar tool to create a squashfs filesystem from a tar archive
unsquashfs tool to uncompress, extract and list squashfs filesystems

Notes

LZO (LZO_SUPPORT) is also on by Makefile default, and lzo is in depends for it.

The prebuilt manual pages list the compressors of upstream’s default build, which has no LZMA1, so they leave out the lzma this build adds. mksquashfs -help on the installed program is the accurate list.