Skip to content

Latest commit

 

History

History
105 lines (82 loc) · 3.91 KB

README.md

File metadata and controls

105 lines (82 loc) · 3.91 KB

Workspace tools

This directory holds the sources for scripts installed into a separate LDD_ROOT workspace. It is not itself a runtime workspace. See the workspace layout for initial setup.

Source Installed path Purpose
activate $LDD_ROOT/activate Bash/Zsh hooks for automatic activation when entering the workspace.
clangd $LDD_ROOT/.clangd Point clangd at the QEMU build for the custom device sources.
bin/qemu $LDD_ROOT/bin/qemu Run the workspace's x86_64 QEMU build.
bin/boot.sh $LDD_ROOT/bin/boot.sh Boot the tutorial guest with the custom emulated devices.
bin/rebuild_initramfs.sh $LDD_ROOT/bin/rebuild_initramfs.sh Rebuild the workspace's initramfs archive.

Install

Run from the tutorial checkout, specifying your runtime workspace:

./tools/install.sh /home/doug/Kernel

The installer creates the workspace layout and installs the activation hook, clangd configuration, QEMU shim, guest launcher, and initramfs build script:

LDD_ROOT/
├── .clangd
├── activate
├── bin/
│   ├── qemu
│   ├── boot.sh
│   └── rebuild_initramfs.sh
├── src/
├── kernels/
├── initramfs/
└── shared/

Existing directory contents are preserved. Rerunning the installer updates the installed scripts. Source checkouts and build outputs are added later; the installer does not create src/qemu/build before QEMU is cloned. It can be invoked from any working directory using its absolute path.

Add the source line printed by the installer to ~/.bashrc or ~/.zshrc and open a new shell. Entering the workspace activates its tools; leaving restores the previous environment. Repeat the installation commands after updating these script sources. Installation does not build QEMU, the kernel, or the initramfs, or modify the shell configuration.

See QEMU setup for build instructions and activation behavior.

After entering the workspace with activation configured, run on the host:

rebuild_initramfs.sh
boot.sh

The initramfs source tree must already be populated, and the kernel and QEMU must be built. The launcher uses the workspace's kernel, initramfs, and shared directory.

Custom QEMU devices

qemu/ contains the custom QEMU devices and link.sh, which adds them to a QEMU source tree. It is run from the tutorial checkout and is not installed into the workspace.

Build all examples

Run from the tutorial checkout on a Linux host to build every example module and userspace test against one configured, prepared kernel tree:

./tools/check_builds.sh /path/to/linux    # default: $LDD_ROOT/src/linux-stable
./tools/check_builds.sh /path/to/linux 07_ioctl 22_lddbus

Examples are built in a temporary copy, so the checkout stays clean. The script runs the top-level examples/Makefile with make -k -O -j$(nproc), prints PASS/FAIL per directory, the build log for each failure, and exits non-zero if any build fails. Unfinished *_NOT_COMPLETE examples are skipped unless named explicitly. A directory whose dependency failed (for example 22_lddbus/sculld after 22_lddbus) is not built and not counted. The kernel tree path must not contain spaces.

Check the scripts

Run from the tutorial checkout:

python3 tools/tests/test_install.py
python3 tools/tests/test_boot.py
python3 tools/tests/test_qemu_shim.py
python3 tools/tests/test_activate.py
python3 tools/tests/test_check_builds.py
python3 tools/tests/test_qemu_link.py
bash -n tools/install.sh tools/activate tools/bin/qemu tools/bin/boot.sh tools/bin/rebuild_initramfs.sh tools/check_builds.sh tools/qemu/link.sh

The tests use temporary workspaces and mock executables. Bash is required; Zsh activation is also checked when Zsh is installed. The tests do not boot a guest or build QEMU.