summaryrefslogtreecommitdiff
path: root/scripts/image-build/raw_image.py
AgeCommit message (Collapse)Author
2025-06-10Remove a stray debug outputDaniil Baturin
2025-06-06T7453: handle dynamic partition mapping in raw image buildGabin-CC
Enhanced the raw image creation logic to dynamically detect and assign EFI and root partitions based on the number of partitions created by kpartx. - Supports both 2-partition and 3-partition layouts - Adds debug output for mapped partitions - Avoids hardcoded assumptions about partition order - Improves resilience in cloud-init and containerized build contexts Fixes build failure when /dev/loopXp3 is missing or not mapped properly. Signed-off-by: Gabin-CC <gabin.laurent@rte-international.com>
2025-06-06T7453: Enhance raw/qcow2 image creationGabin-CC
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>
2024-11-20build: T6904: allow development builds to have version stringsDaniil Baturin
2024-05-23T6386: added caller workflows and codeowners (#634)Vijayakumar A
2024-05-14build-script: T3664: Add flavor and architecture to image name (rework)zsdc
The previous version did not work for all flavor types. This one should be universal.
2024-05-06build: T3664: modify the module-level template pathDaniil Baturin
instead of setting an environment variable
2024-04-29build: T3664: fail the build on external command errorsDaniil Baturin
2024-04-10build: T3664: add support for building non-ISO flavorsDaniil Baturin