Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
f0c6d0c
fix fs.fakeudev, do not source uevent file
reith Jul 11, 2025
0a98017
black format
desultory Jul 12, 2025
fd4fc32
Added basic, incomplete tests for hibernate/resume
truffle0 Feb 9, 2025
61e55fe
Working QEMU tests for hibernate/resume, and changes to test module
truffle0 Feb 9, 2025
fee384b
Separated resume tests into a separate module
truffle0 May 2, 2025
39543a1
fixed up posix compliance & attempted to clean up variables
truffle0 May 5, 2025
b21a9cc
fixed up a few duplicates from rebase
truffle0 Jul 12, 2025
d2bc8b4
added basic resume unit test
truffle0 Jul 13, 2025
ee2efa7
improve logging when run commands fail
desultory Jul 13, 2025
25bbbb5
Merge pull request #330 from desultory/dev
desultory Jul 13, 2025
27d14af
Merge pull request #328 from reith/main
desultory Jul 13, 2025
8e7f843
improve logging for fakeudev, improve comments
desultory Jul 13, 2025
bf4f1b5
Merge pull request #331 from desultory/dev
desultory Jul 13, 2025
93b1431
bup ver
desultory Jul 13, 2025
2f8ad43
Merge pull request #332 from desultory/dev
desultory Jul 13, 2025
6ac8461
improve comments/naming for filesystem tests
desultory Jul 13, 2025
7eb86b6
improve comments for cryptsetup test module
desultory Jul 13, 2025
73ccaac
improve comments for the base test module
desultory Jul 13, 2025
c086aa7
skip zstd tests if the compression module is missing
desultory Jul 13, 2025
7e15719
move compression tests to another test module
desultory Jul 13, 2025
618df02
add tests for the mask system
desultory Jul 13, 2025
2713866
Merge pull request #333 from desultory/dev
desultory Jul 13, 2025
8149d59
add warning for when lsmod is used to detect many modules
desultory Jul 21, 2025
913b44d
Merge pull request #334 from desultory/dev
desultory Jul 21, 2025
1ae4ac7
add toggle to disable normalization of kmod names
desultory Jul 21, 2025
ba20c2b
Merge pull request #336 from desultory/dev
desultory Jul 21, 2025
d38bb2b
add basic platform module for detecting kmods based on the system type
desultory Jul 21, 2025
e3c5cf2
update block device module detection to handle vms
desultory Jul 21, 2025
026754e
Merge pull request #337 from desultory/dev
desultory Jul 21, 2025
2659518
make the platform module actually add kmods to kmod_init
desultory Jul 22, 2025
315bdb8
Merge pull request #338 from desultory/dev
desultory Jul 22, 2025
ff97ed0
add product kmods for vms to kmod_auto so they can be tolerated missing
desultory Jul 23, 2025
f974188
Merge pull request #339 from desultory/dev
desultory Jul 23, 2025
8675f87
add basic regulator detetction
desultory Jul 25, 2025
674aa50
catch exceptions when dmi info can't be read
desultory Jul 25, 2025
1c9b7cf
improve keyboard device driver detection
desultory Jul 25, 2025
29cf0ab
Merge pull request #340 from desultory/dev
desultory Jul 25, 2025
435e739
parse modules.builtin.modinfo and modules.alias
desultory Jul 25, 2025
419253a
add a toggle for detecting platform bus drivers
desultory Jul 26, 2025
cfb8d98
update mount kmod detection to look for mmc platform drivers
desultory Jul 26, 2025
8d456c1
return module name when processing module, in case an alias was resolved
desultory Jul 26, 2025
bf675ee
Merge pull request #341 from desultory/dev
desultory Jul 26, 2025
eddf494
make the banner print "built for kernel version"
desultory Jul 31, 2025
bea1145
Merge pull request #342 from desultory/dev
desultory Jul 31, 2025
6c8436c
check that the build time kernel version matches the runtime kver
desultory Jul 31, 2025
2ec3bd9
Merge pull request #343 from desultory/dev
desultory Jul 31, 2025
62cdc50
rename keymap example config file
desultory Aug 15, 2025
c0a9d7b
add keymap usage to docs
desultory Aug 15, 2025
00b8fd3
Merge pull request #344 from desultory/dev
desultory Aug 15, 2025
d9311ce
improve comments, add cryptsetup integrity detection
desultory Oct 15, 2025
a2513ed
fix slave detection for integrity backed luks mounts
desultory Oct 15, 2025
6c8ebab
handle integrity devices for slave info lookup
desultory Oct 15, 2025
e477cad
add the dm_integrity module if a CRYPT-SUBDEV is detected
desultory Oct 15, 2025
cb1df89
bup ver, dep ver
desultory Oct 15, 2025
3fe7633
improve logging/checks for no_kmod systems
desultory Oct 18, 2025
10dde08
Merge pull request #352 from desultory/nokmod
desultory Oct 18, 2025
dc30a0c
remove bashisms, black format
desultory Oct 19, 2025
f350a11
Merge pull request #353 from desultory/posix
desultory Oct 19, 2025
20360e1
add an internal flag for dm_integrity status
desultory Oct 19, 2025
4b908c7
move integrity detection to header validation, add tests
desultory Oct 19, 2025
187ecea
limit pbkdf memory usage for tests
desultory Oct 19, 2025
cc61f08
auto-enable authenc module and dm_integrity modules
desultory Oct 19, 2025
5aa4b2d
add required modules to tests
desultory Oct 19, 2025
a3f106b
add dm-integrity kmods based on header info
desultory Oct 19, 2025
253aef8
Merge pull request #350 from desultory/dev
desultory Oct 19, 2025
3454987
learn to type
desultory Oct 19, 2025
8fe3056
Merge pull request #354 from desultory/dev
desultory Oct 19, 2025
f9d4166
print mount failures when the passed cmdline fails
desultory Oct 31, 2025
b7b6e96
Merge pull request #355 from desultory/dev
desultory Oct 31, 2025
f984e58
don't add modprobe to the binaries list if no_kmod is set
desultory Nov 1, 2025
bab6ccc
Merge pull request #356 from desultory/nokmod
desultory Nov 1, 2025
7e701c1
partially "fix" no_kmod not being set on call of _process_kernel_version
redjard Nov 1, 2025
c4de290
Fix typo in example.toml
redjard Nov 2, 2025
3056149
Merge pull request #359 from redjard/patch-2
desultory Nov 2, 2025
38f690e
add _late_args for later kernel_version
desultory Nov 2, 2025
d0be452
Merge pull request #360 from desultory/dev
desultory Nov 2, 2025
9955118
Merge pull request #358 from redjard/patch-1
desultory Nov 2, 2025
3e1d635
remove unused force-out arg
desultory Nov 2, 2025
f209923
improve config documentation
desultory Nov 2, 2025
94b7d14
Merge pull request #361 from desultory/dev
desultory Nov 2, 2025
569fb21
Add make_nodes to example.toml
redjard Nov 2, 2025
fdcecb2
consolidate make_nodes and mknod_cpio
desultory Nov 2, 2025
68c53cc
Merge pull request #363 from desultory/dev
desultory Nov 2, 2025
3b73719
Merge pull request #362 from redjard/patch-3
desultory Nov 2, 2025
9432b5e
add warning about setting make_nodes = true when embedding in the bui…
redjard Nov 3, 2025
141b8b3
add subtle reference to gh docs into example.toml
redjard Nov 3, 2025
24fac7a
Merge pull request #364 from redjard/patch-4
desultory Nov 3, 2025
56d5c4f
Merge pull request #365 from redjard/patch-5
desultory Nov 3, 2025
72ed369
don't add default config to the procesing queue if populated
desultory Nov 5, 2025
b7e24e2
Merge pull request #368 from desultory/dev
desultory Nov 5, 2025
d803252
rename autodetect_root_<type> parameters to just autodetect_<type>
desultory Nov 5, 2025
a638651
run full autodection on all auto mounts, not just root
desultory Nov 5, 2025
859f821
add warning about device mapper based auto_mounts
desultory Nov 5, 2025
6e3c331
add auto_late_mounts, improve documentation
desultory Nov 5, 2025
a256dbc
update readme for better description of storage support
desultory Nov 5, 2025
d1ab3bb
Merge pull request #370 from desultory/dev
desultory Nov 5, 2025
f680a73
add flag btrfs_userspace
redjard Nov 5, 2025
5ff4d6e
Merge pull request #371 from redjard/no-userspace-btrfs2
desultory Nov 6, 2025
be48143
fix typos
desultory Nov 6, 2025
4142da2
Merge pull request #372 from desultory/dev
desultory Nov 6, 2025
3c5174c
fix btrfs module breaking for non-root mounts
desultory Nov 28, 2025
1ee1a5c
Merge pull request #374 from desultory/dev
desultory Nov 28, 2025
b3fea1b
Allow absolute build_dir paths
lazypingu Dec 1, 2025
6ba65d9
Merge pull request #376 from lazypingu/allow-absolute-build-dirs
desultory Dec 1, 2025
46c07fe
add tests for the build_dir parameter
desultory Dec 1, 2025
a551fbc
don't check the actual output dir for dry runs
desultory Dec 2, 2025
8bc3be1
add tests for file write paths within the build dir
desultory Dec 2, 2025
48d96f9
Merge branch 'resume' into dev
truffle0 Dec 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/bootloader_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ The `build_dir`can be embedded into the Linux kernel with:
CONFIG_INITRAMFS_SOURCE="/tmp/initramfs"
```

Take care to set `make_nodes = true` to create `/dev/console` in the build dir (instead of in the cpio when packing it).
The console device node file is required in builtin initrds.

A CPIO file can be embedded into the Linux kernel with:

```
Expand Down
31 changes: 24 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Modules write to a shared config dict that is accessible by other modules.
* `build_dir` (initramfs_build) If relative, it will be placed under `tmpdir`, defines the build directory.
* `random_build_dir` (false) Adds a uuid to the end of the build dir name when true.
* `build_logging` (false) Enables additional logging during the build process.
* `make_nodes` (false) Create real device nodes in the build dir.
* `make_nodes` (false) Create real device nodes in the build dir. Otherwise they are created in the CPIO archive.
* `find_libgcc` (true) Automatically locates libgcc using ldconfig -p and adds it to the initramfs.
* `musl_libc` (false) Disable ldconfig -p usage for libgcc detection, skip ld.so.cache regeneration.
* `out_dir` (initramfs_out) If relative, it will be placed under `tmpdir`, defines the output directory.
Expand Down Expand Up @@ -151,6 +151,12 @@ Defines /dev/ttyS1 as a `vt100` terminal with a `115200` baud rate.

`primary_console` (tty0) Used to set which console will be initialized with agetty on boot.

#### base.keymap

This module can be used to set keymaps in the initramfs.

The only available parameter is `keymap_file`, which should point to a valid keymap file.

#### base.debug

This module contains debug programs such as `cp`, `mv`, `rm`, `grep`, `dmesg`, `find`, and an editor,
Expand Down Expand Up @@ -178,6 +184,7 @@ The following parameters can be used to change the kernel module pulling and ini
* `kmod_ignore` - Kernel modules to ignore. Modules which depend on ignored modules will also be ignored.
* `kmod_ignore_softdeps` (false) Ignore softdeps when checking kernel module dependencies.
* `no_kmod` (false) Disable kernel modules entirely.
* `kmod_no_normalize` - A list of kernel module names to not normalize (replace dashes with underscores).

##### ugrd.kmod.input

Expand Down Expand Up @@ -227,19 +234,27 @@ Additional modules include:
#### ugrd.fs.mounts

* `autodetect_root` (true) Set the root mount parameter based on the current root label or uuid.
* `autodetect_root_dm` (true) Attempt to automatically configure virtual block devices such as LUKS/LVM/MDRAID.
* `autodetect_root_luks` (true) Attempt to automatically configure LUKS mounts for the root device.
* `autodetect_root_lvm` (true) Attempt to automatically configure LVM mounts for the root device.
* `autodetect_root_mdraid` (true) Attempt to automatically configure MDRAID mounts for the root device.
* `autodetect_dm` (true) Attempt to automatically configure virtual block devices such as LUKS/LVM/MDRAID.
* `autodetect_luks` (true) Attempt to automatically configure LUKS mounts for the root device.
* `autodetect_lvm` (true) Attempt to automatically configure LVM mounts for the root device.
* `autodetect_mdraid` (true) Attempt to automatically configure MDRAID mounts for the root device.
* `autodetect_init_mount'` (true) Automatically detect the mountpoint for the init binary, and add it to `late_mounts`.
* `run_dirs` A list of directories to create under `/run/` at runtime

> `autodetect_root` is required for `autodetect_root_<type>` to work.
> `autodetect_root` is required for `autodetect_<type>` to work.

`mounts`: A dictionary containing entries for mounts, with their associated config.

Mounts defined here are mounted before `init_main` is run. This cannot be used for mounts backed by LUKS, LVM, or MDRAID devices, because the backend will not be available when these mounts are attempted.

> `mounts` can be automatically populated by configuring paths as list items in `auto_mounts`.

`mounts.root` is predefined to have a destination of `/target_rootfs` and defines the root filesystem mount, used by `switch_root`.

`late_mounts`: A dictionary containing entries for mounts that should be mounted after `init_main` is run.

> `late_mounts` can be automatically populated by configuring paths as list items in `auto_late_mounts`.

Each mount has the following available parameters:

* `type` (auto) Mount filesystem type.
Expand Down Expand Up @@ -278,6 +293,8 @@ label = "extra"

Paths added to `auto_mounts` will be auto-configured to mount before `init_main` is run.

Paths added to `auto_late_mounts` will be auto-configured to mount after `init_main` is run.

#### ugrd.fs.fakeudev

This module is used to create fake udev entries for DM devices.
Expand All @@ -289,7 +306,6 @@ This module can be enabled by adding `ugrd.fs.fakeudev` to the `modules` list.

This module handles CPIO creation.

* `mknod_cpio` (true) Only create device nodes within the CPIO.
* `cpio_compression` (xz) Sets the compression method for the CPIO file, passed to PyCPIO.
* `cpio_rotate` (true) Rotates old CPIO files, keeping `old_count` number of old files.

Expand All @@ -308,6 +324,7 @@ Importing this module will run `btrfs device scan` and pull btrfs modules.
* `autodetect_root_subvol` (true) Autodetect the root subvolume, unless `root_subvol` or `subvol_selector` is set. Depends on `hostonly`.
* `root_subvol` - Set the desired root subvolume.
* `_base_mount_path` (/root_base) Sets where the subvolume selector mounts the base filesytem to scan for subvolumes.
* `btrfs_userspace` (true) Add btrfs binary to be able to mount multi-device btrfs partitions.

#### ugrd.fs.resume

Expand Down
2 changes: 2 additions & 0 deletions docs/dev_manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Python functions can be added imported into `init` and `build` runlevels to exec

Within modules, all config values are imported, then processed according to the order of the `custom_parameters` list.

> If config values have validation which may fail if other config is not loaded, those values can be added to the `_late_args' list to be processed last.

`_module_name` can be set within a module for logging purposes, it is verified to be accurate when imported but optional.

## Imports
Expand Down
11 changes: 10 additions & 1 deletion examples/example.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##############################################################################
## ##
## there are docs at https://github.com/desultory/ugrd/tree/main/docs ##
## ##
##############################################################################

# This config will decrypt the LUKS volume with uuid "fdf442da-0574-4531-98c7-55227a041f1d", mapping it to "/dev/mapper/root"
# Note: In most cases, the uuid of the LUKS volume will be detected from the root mount. It's set as an example here.
# It will attempt to mount the btrfs volume with label "rootfs" to /target_rootfs
Expand All @@ -21,10 +27,13 @@ modules = [
#kmod_ignore_sound = false
#kmod_ignore_network = false

# The initramfs will be built in /tmp/initramfs if "build_dir" is not specified not specified
# The initramfs will be built in /tmp/initramfs if "build_dir" is not specified
#out_dir = "/usr/src/initramfs"
#out_dir = "/boot"

# create device nodes in build dir, requires root
#make_nodes = true

# By default, xz compression is used. This can be disabled or set to zstd if the zstandard python module is installed
#cpio_compression = "zstd" # Use zstd compression
#cpio_compression = false # No compression
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/luks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modules = [
]

# Device mapper autodetection is enabled by default
# autodetect_root_luks = true
# autodetect_luks = true

# Information about the LUKS volume can be manually specified
#[cryptsetup.root]
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ugrd"
version = "2.0.1"
version = "2.1.0"
authors = [
{ name="Desultory", email="[email protected]" },
]
Expand All @@ -19,7 +19,7 @@ classifiers = [

dependencies = [
"zenlib >= 3.0.2",
"pycpio >= 1.5.2"
"pycpio >= 1.5.5"
]

[project.optional-dependencies]
Expand Down
22 changes: 13 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Generated images are as static and secure as possible, only including components

The final build environment is left in the specified `build_dir`, where it can be examined or repacked.

Unless validation is disabled, µgRD attemts to validate most configuration against the host system, raising exceptions or logging warnings warnings if the configuration is invalid.
Unless validation is disabled, µgRD attempts to validate most configuration against the host system, raising exceptions or logging warnings warnings if the configuration is invalid.

## Project goal and features

Expand All @@ -26,15 +26,19 @@ The original goal of this project was to create an initramfs suitable for decryp
### Auto-detection

* Root mount, using `/proc/mounts`. `root=` and `rootflags=` can be used but are not required
* MDRAID auto-configuration for the root mount
* LUKS auto-configuration and validation for the root mount
* MDRAID auto-configuration
* LVM auto-configuration
* LUKS auto-configuration and validation
- LUKS under LVM support
- LUKS under MDRAID support
* LVM based root volumes are auto-mounted
* BTRFS root subvolumes are automatically detected to `root_subvol`
- `subvol_selector` can be used to select a subvolume at boot time
* `/usr` auto-mounting if the init system requires it
* Auto-detection of kernel modules required by the storage device used by the root filesystem
- Detached header support
- YubiKey (OpenPGP smartcard) support
- Recovery using a passphrase using `try_nokey`
- DM-Integrity support
* BTRFS root subvolumes are automatically detected or can be manually set with `root_subvol`
- `subvol_selector` can be used to interactively select a subvolume at boot time
* `/usr`, `/var`, and `/etc` auto-mounting if the init system requires it
* Auto-detection of kernel modules required by storage devices and filesystems
* Init system/target auto-detection

### Validation
Expand All @@ -61,7 +65,7 @@ The original goal of this project was to create an initramfs suitable for decryp
- Device nodes are created within the CPIO only, so true root privileges are not required
- Hardlinks are automatically created for files with matching SHA256 hashes
- Automatic xz compression
* "merged usr" symlinks are creatd by default and can be disabled by setting `merge_usr = false`
* "merged usr" symlinks are created by default and can be disabled by setting `merge_usr = false`
* ZSH and BASH autocompletion for the `ugrd` command
* Basic hibernation/resume support with `ugrd.fs.resume`
* Similar usage/arguments as Dracut
Expand Down
4 changes: 2 additions & 2 deletions src/ugrd/base/banner.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
__author__ = "desultory"
__version__ = "0.1.0"
__version__ = "0.2.0"


def print_banner(self) -> list[str]:
"""Prints the banner. Prints the kernel version if set"""
banner = [self.banner]
if kver := self.get("kernel_version"):
banner.append(f"einfo 'Kernel version: {kver}'")
banner.append(f"einfo 'Built for kernel version: {kver}'")
return banner
6 changes: 2 additions & 4 deletions src/ugrd/base/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = "desultory"
__version__ = "4.7.0"
__version__ = "4.7.1"

from os import environ, makedev, mknod, uname
from pathlib import Path
Expand Down Expand Up @@ -303,9 +303,7 @@ def deploy_nodes(self) -> None:
self.logger.info("Created device node '%s' at path: %s" % (node, node_path))
except PermissionError as e:
self.logger.error("Unable to create device node %s at path: %s" % (node, node_path))
self.logger.info(
"`mknod_cpio` in `ugrd.base` can be used to generate device nodes within the initramfs archive if they cannot be created on the host system."
)
self.logger.info("When `make_nodes` is disabled, device nodes are synthetically created in the resulting CPIO archive.")
raise e


Expand Down
12 changes: 6 additions & 6 deletions src/ugrd/base/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ hostonly = "bool" # If true, the initramfs will be built specifically for the h
validate = "bool" # If true, the configuration of the initramfs will be validated against the host
timeout = "int" # The timeout for _run commands, defaults to 15 seconds
_custom_init_file = "str" # Add the _custom_init_file propety, used to set where the custom init file is located
tmpdir = "Path" # The base directory for builds
build_dir = "Path" # The directory where the initramfs is built
tmpdir = "Path" # The base directory for builds, defaults to /tmp. the build and output directories are created inside this directory
build_dir = "Path" # The directory where the initramfs is built, inside the tmpdir unless an absolute path is given
random_build_dir = "bool" # If true, a random build directory will be used
build_logging = "bool" # If true, additional build information will be logged to the console
_build_log_level = "int" # The level of logging to use for the build log, set to 10 by default and incremeted by if build_log is true (min 20)
Expand All @@ -78,17 +78,17 @@ zstd_dependencies = "NoDupFlatList" # ZStandard compressed dependencies propert
gz_dependencies = "NoDupFlatList" # GZipped dependencies property, used to define the gzipped dependencies (will be extracted)
library_paths = "NoDupFlatList" # library_paths property, used to define the library paths to add to LD_LIBRARY_PATH
find_libgcc = "bool" # If true, the initramfs will search for libgcc_s.so.1 and add it to the initramfs
musl_libc = "bool" # If true, disables find_libgcc and regen_ld_so_cache
musl_libc = "bool" # If true, disables find_libgcc and regen_ld_so_cache (not needed for musl libc based systems)
libraries = "NoDupFlatList" # Additional libraries, by name, added to the initramfs
binaries = "NoDupFlatList" # Binaries which should be included in the intiramfs, dependencies resolved with lddtree
binary_search_paths = "NoDupFlatList" # Binary paths, used to define the paths to search for binaries
copies = "dict" # Copies dict, defines the files to be copied to the initramfs
nodes = "dict" # Nodes dict, defines the device nodes to be created
paths = "NoDupFlatList" # Paths to be created in the initramfs
masks = "dict" # Imports to be masked in the initramfs
make_nodes = "bool" # If true, actual device nodes will be created in the build dir
out_dir = "Path" # The directory where the initramfs is packed/output. If no packer is used, this is the final output directory.
make_nodes = "bool" # If true, actual device nodes will be created in the build dir instead of only being created in the cpio archive
out_dir = "Path" # The directory where the initramfs is packed/output
out_file = "str" # The name of the output file, if absolute, overrides out dir with the path, and sets out_file to the filename
old_count = "int" # The number of times to cycle old files before deleting
clean = "bool" # Add the clean property, used to define if the mounts should be cleaned up after boot
clean = "bool" # Add the clean property, used to define if the build directory should be cleaned before building
shell = "str" # Set the shell to use for the init process
9 changes: 6 additions & 3 deletions src/ugrd/base/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _get_qemu_cmd_args(self, test_image):
"-cpu": self["test_cpu"],
"-kernel": self["test_kernel"],
"-initrd": test_initrd,
"-append": self["test_cmdline"],
"-append": " ".join(self["test_cmdline"]),
"-drive": "file=%s,format=raw" % test_rootfs,
}

Expand Down Expand Up @@ -86,7 +86,7 @@ def make_test_image(self):
"validate": False,
"NO_BASE": True,
"config": None,
"modules": "ugrd.fs.test_image",
"modules": ",".join(self["test_modules"]), # By default is only "ugrd.fs.test_image"
"out_file": self["test_rootfs_name"],
"build_dir": self["test_rootfs_build_dir"],
"custom_parameters": get_copy_config_types(self),
Expand Down Expand Up @@ -163,7 +163,10 @@ def test_image(self):
if self["test_flag"] in line:
self.logger.info("Test flag found in output: %s", c_(line, "green"))
break
elif line.endswith("exitcode=0x00000000"):
elif (
line.endswith("exitcode=0x00000000")
or "---[ end Kernel panic - not syncing: sysrq triggered crash ]---" in line
):
failed = True
break
elif "press space" in line.lower():
Expand Down
11 changes: 6 additions & 5 deletions src/ugrd/base/test.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
test_rootfs_name = 'ugrd-test-rootfs'
test_rootfs_build_dir = 'initramfs_test_rootfs'
test_image_size = 16
test_image_size = 256

test_copy_config = ["_mounts", "mounts", "out_dir", "tmpdir", "clean", "test_image_size", "test_no_rootfs", "test_flag", "cryptsetup"]
kmod_init = ["ata_piix", "sd_mod"]

test_memory = '256M'
test_cpu = 'host'
test_arch = 'x86_64'
test_timeout = 15
test_cmdline = 'console=ttyS0,115200 panic=1'
#qemu_bool_args = ['nographic', 'no-reboot', 'enable-kvm']
test_timeout = 30
test_cmdline = ['console=ttyS0,115200', 'panic=0']
test_modules = [ "ugrd.fs.test_image" ]
qemu_bool_args = ['nographic', 'enable-kvm' ]

[imports.build_pre]
Expand All @@ -24,11 +24,12 @@ test_kernel = "Path" # Define the kernel to use for the test
test_memory = "str" # Define the amount of memory to use for the test image (passed to qemu)
test_cpu = "str" # Define the CPU to use for the test image (passed to qemu)
test_arch = "str" # Define the qemu arch (added to the qemu-system- command)
test_cmdline = "str" # Define the kernel command line for the test image
test_cmdline = "NoDupFlatList" # Define the kernel command line for the test image
test_timeout = "int" # Define the timeout for the test
test_image_size = "int" # Define the size of the test image, in MB
test_flag = "str" # Define the success flag for the test
test_no_rootfs = "bool" # Toggle to run tests without mounting the root image
test_rootfs_name = "str" # Define the name of the rootfs image
test_rootfs_build_dir = "Path" # Define the build directory for the rootfs image
test_modules = "NoDupFlatList" # List of modules to include in test image
qemu_bool_args = "NoDupFlatList" # Define the qemu boolean arguments
Loading