9 Commits

Author SHA1 Message Date
Daniil Baturin
75f72ab901
Remove a stray debug output 2025-06-10 15:43:29 +01:00
Gabin-CC
02c2e30622 T7453: handle dynamic partition mapping in raw image build
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-06 20:59:22 +02:00
Gabin-CC
1cda2d42bb 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>
2025-06-06 20:58:04 +02:00
Daniil Baturin
1b12eeb9a1 build: T6904: allow development builds to have version strings 2024-11-20 15:52:55 +00:00
Vijayakumar A
e43017472c
T6386: added caller workflows and codeowners (#634) 2024-05-23 08:52:26 +02:00
zsdc
31b720b8f1 build-script: T3664: Add flavor and architecture to image name (rework)
The previous version did not work for all flavor types. This one should be
universal.
2024-05-14 21:00:20 +03:00
Daniil Baturin
58fbf3a226 build: T3664: modify the module-level template path
instead of setting an environment variable
2024-05-06 16:19:26 +00:00
Daniil Baturin
7dfd9232da build: T3664: fail the build on external command errors 2024-04-29 14:33:25 +00:00
Daniil Baturin
a896176ad8 build: T3664: add support for building non-ISO flavors 2024-04-10 16:36:10 +00:00