diff options
author | Gabin-CC <gabin.laurent@rte-international.com> | 2025-06-05 03:37:56 +0200 |
---|---|---|
committer | Gabin-CC <gabin.laurent@rte-international.com> | 2025-06-06 20:58:04 +0200 |
commit | 1cda2d42bb5064868c6435c14a5d3e4b047500d8 (patch) | |
tree | d5ffe5e52080ff29df24c3973f2dc9787dd070ed /scripts/package-build/linux-kernel/patches/kernel/build-linux-perf-package.patch | |
parent | 8350580ac5e21d67716f8d40d65786306a7d7b0d (diff) | |
download | vyos-build-1cda2d42bb5064868c6435c14a5d3e4b047500d8.tar.gz vyos-build-1cda2d42bb5064868c6435c14a5d3e4b047500d8.zip |
T7453: Enhance raw/qcow2 image creation
Description
This pull request introduces improvements to the raw_image.py script responsible for building raw disk images in the VyOS build process.
Main Changes
Added use of kpartx to reliably map EFI and root partitions from the loop device.
Introduced disk_details as an attribute on the BuildContext object to pass partition metadata through the image build steps.
Improved the __exit__ method for BuildContext to unmount all mount points and clean up kpartx mappings and loop devices, even in failure cases.
Fixed a crash in mount_image() when con.disk_details was not set.
Added useful debug logs for loop device usage and partition mapping.
Motivation
The previous implementation assumed partitions like /dev/loopXp3 would appear automatically, which is unreliable across some environments (especially containers or newer systems).
This PR makes the process more reliable by explicitly mapping partitions with kpartx, a tool designed for this purpose.
It also ensures proper resource cleanup by unmounting and detaching everything cleanly, preventing leaked loop devices or stale mount points.
Test Instructions
Flavor : cloud-init.toml
packages = [
"cloud-init",
"qemu-guest-agent"
]
image_format = ["qcow2"]
disk_size = 10
[boot_settings]
console_type = "ttyS0"
Run:
sudo ./build-vyos-image --architecture amd64 \
--build-by "you@example.com" \
--reuse-iso vyos-1.5-rolling-*.iso \
cloud-init
Expected behavior:
The build completes without errors.
The .qcow2 image file is generated and bootable (e.g., in KVM or Proxmox).
Partitions are mounted correctly via /dev/mapper/loopXp*.
Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
Diffstat (limited to 'scripts/package-build/linux-kernel/patches/kernel/build-linux-perf-package.patch')
0 files changed, 0 insertions, 0 deletions