1111 - [ Commands] ( #commands )
1212 - [ Build Command] ( #build-command )
1313 - [ Validate Command] ( #validate-command )
14+ - [ Inspect Command] ( #inspect-command )
15+ - [ Compare Command] ( #compare-command )
1416 - [ Cache Command] ( #cache-command )
1517 - [ cache clean] ( #cache-clean )
1618 - [ Config Command] ( #config-command )
2224 - [ Building an Image] ( #building-an-image )
2325 - [ Managing Configuration] ( #managing-configuration )
2426 - [ Managing Cache] ( #managing-cache )
27+ - [ Inspecting and Comparing Images] ( #inspecting-and-comparing-images )
2528 - [ Validating Templates] ( #validating-templates )
2629 - [ Configuration Files] ( #configuration-files )
2730 - [ Global Configuration File] ( #global-configuration-file )
@@ -111,7 +114,7 @@ The OS Image Composer command-line utility uses a layered configuration approach
111114with command-line options taking priority over the configuration file settings:
112115
113116| Option | Description |
114- | -------- | ------------- |
117+ | ------ | ----------- |
115118| ` --config FILE ` | Global configuration file. This file contains system-wide settings that apply to all image builds. If not specified, the tool searches for configuration files in standard locations. |
116119| ` --log-level LEVEL ` | Log level: debug, info, warn, error (overrides config). Use debug for troubleshooting build issues. |
117120| ` --log-file PATH ` | Tee logs to a specific file path (overrides ` logging.file ` in the configuration). |
@@ -136,7 +139,7 @@ os-image-composer build [flags] TEMPLATE_FILE
136139** Flags:**
137140
138141| Flag | Description |
139- | ------ | ------------- |
142+ | ---- | ----------- |
140143| ` --workers, -w INT ` | Number of concurrent download workers (overrides config). |
141144| ` --cache-dir, -d DIR ` | Package cache directory (overrides config). Proper caching significantly improves build times. |
142145| ` --work-dir DIR ` | Working directory for builds (overrides config). This directory is where images are constructed before being finalized. |
@@ -206,6 +209,140 @@ See also:
206209- [ Validate Stage] ( ./os-image-composer-build-process.md#1-validate-stage )
207210 for details on the validation process
208211
212+ ### Inspect Command
213+
214+ Inspects a raw image and outputs comprehensive details about the image including partition
215+ table layout, partition identity and attributes, filesystem information, bootloader details, and layout diagnostics.
216+
217+ ``` bash
218+ os-image-composer inspect [flags] IMAGE_FILE
219+ ```
220+
221+ ** Arguments:**
222+
223+ - ` IMAGE_FILE ` - Path to the RAW image file to inspect (required)
224+
225+ ** Flags:**
226+
227+ | Flag | Description |
228+ | ---- | ----------- |
229+ | ` --format STRING ` | Output format: ` text ` , ` json ` , or ` yaml ` (default: ` text ` ) |
230+ | ` --pretty ` | Pretty-print JSON output (only for ` --format=json ` ; default: ` false ` ) |
231+
232+ ** Description:**
233+
234+ The inspect command extracts and analyzes the following from a disk image:
235+
236+ ** Partition Table:**
237+
238+ - Type (GPT/MBR) and sector sizes
239+ - For GPT: disk GUID and protective MBR status
240+ - Layout diagnostics: largest unallocated free span and misaligned partitions (detected against physical sector size and 1 MiB alignment)
241+
242+ ** Partitions:**
243+
244+ - Index, name, type/GUID, start/end LBA, and size
245+ - For GPT: partition GUID and decoded attribute bits (required, legacy BIOS bootable, read-only)
246+ - Filesystem type, label, and UUID
247+ - EFI/UKI evidence (if present on ESP/VFAT partitions)
248+
249+ ** Bootloader & Secure Boot:**
250+
251+ - EFI binaries: kind, architecture, signature status, SBAT
252+ - UKI payloads: kernel/initrd/OS-release hashes and metadata
253+
254+ ** Output Formats:**
255+
256+ - ` text ` : Human-readable summary with tables and structured sections
257+ - ` json ` : Complete structured data suitable for automation and comparison
258+ - ` yaml ` : YAML representation of the image summary
259+
260+ ** Example:**
261+
262+ ``` bash
263+ # Inspect a raw image and output text (default)
264+ os-image-composer inspect my-image.raw
265+
266+ # Inspect and output pretty JSON
267+ os-image-composer inspect --format=json --pretty my-image.raw
268+
269+ # Inspect and output YAML
270+ os-image-composer inspect --format=yaml my-image.raw
271+ ```
272+
273+ ### Compare Command
274+
275+ Compares two disk images and outputs detailed differences in partition layout, filesystems, bootloaders, and EFI/UKI payloads.
276+
277+ ``` bash
278+ os-image-composer compare [flags] IMAGE_FILE1 IMAGE_FILE2
279+ ```
280+
281+ ** Arguments:**
282+
283+ - ` IMAGE_FILE1 ` - Path to the first RAW image file (required)
284+ - ` IMAGE_FILE2 ` - Path to the second RAW image file (required)
285+
286+ ** Flags:**
287+
288+ | Flag | Description |
289+ | ---- | ----------- |
290+ | ` --format STRING ` | Output format: ` text ` or ` json ` (default: ` text ` ) |
291+ | ` --mode STRING ` | Compare mode: ` diff ` (partition/FS changes), ` summary ` (high-level counts), or ` full ` (complete image metadata). Default: ` diff ` for text, ` full ` for JSON |
292+ | ` --pretty ` | Pretty-print JSON output (only for ` --format=json ` ; default: ` false ` ) |
293+
294+ ** Description:**
295+
296+ The compare command performs a deep structural comparison of two images and reports:
297+
298+ ** Partition Table Changes:**
299+
300+ - Disk GUID changes (GPT)
301+ - Partition table type or sector size changes
302+ - Free space layout changes (largest unallocated extent)
303+ - Misaligned partition detection changes
304+
305+ ** Partition Changes:**
306+
307+ - Added/removed partitions (detected by GUID for GPT, by LBA range for MBR)
308+ - Modified partitions: changes to name, GUID, LBA range, size, or GPT attribute bits
309+ - Filesystem changes: type, label, UUID modifications
310+ - Per-partition EFI binary changes (path, kind, architecture, signature status)
311+
312+ ** Global EFI/UKI Changes:**
313+
314+ - Added/removed EFI binaries across all partitions
315+ - Modified EFI binaries: SHA256, signature status, bootloader kind
316+ - UKI payload changes: kernel, initrd, OS-release, and section SHA256s
317+
318+ ** Compare Modes:**
319+
320+ - ` diff ` : Detailed changes (partitions, filesystems, EFI binaries)
321+ - ` summary ` : High-level counts (added, removed, modified counts)
322+ - ` full ` : Complete image metadata plus all diffs
323+
324+ ** Output:**
325+
326+ - Text format provides human-readable sections with tables and field-by-field diffs
327+ - JSON format includes complete structured data for scripting and tooling
328+ - Exit code is 0 if images are equal, 1 if differences found
329+
330+ ** Example:**
331+
332+ ``` bash
333+ # Compare two images and show detailed text diff
334+ os-image-composer compare image-v1.raw image-v2.raw
335+
336+ # Show only a summary of changes
337+ os-image-composer compare --mode=summary image-v1.raw image-v2.raw
338+
339+ # Compare and output pretty JSON with full metadata
340+ os-image-composer compare --format=json --mode=full --pretty image-v1.raw image-v2.raw
341+
342+ # Compact JSON diff suitable for CI/CD automation
343+ os-image-composer compare --format=json --mode=diff image-v1.raw image-v2.raw
344+ ```
345+
209346### Cache Command
210347
211348Manage cached artifacts created during the build process.
@@ -225,7 +362,7 @@ os-image-composer cache clean [flags]
225362** Flags:**
226363
227364| Flag | Description |
228- | ------ | ------------- |
365+ | ---- | ----------- |
229366| ` --packages ` | Remove cached packages (default when no scope flags are provided). |
230367| ` --workspace ` | Remove cached chroot environments and chroot tarballs under the workspace directory. |
231368| ` --all ` | Enable both package and workspace cleanup in a single invocation. |
@@ -330,7 +467,7 @@ os-image-composer install-completion [flags]
330467** Flags:**
331468
332469| Flag | Description |
333- | ------ | ------------- |
470+ | ---- | ----------- |
334471| ` --shell STRING ` | Shell type (bash, zsh, fish, powershell). If not specified, auto-detects current shell. |
335472| ` --force ` | Force overwrite existing completion files. |
336473
@@ -419,6 +556,22 @@ os-image-composer cache clean --workspace --provider-id azure-linux-azl3-x86_64
419556os-image-composer cache clean --all --dry-run
420557```
421558
559+ ### Inspecting and Comparing Images
560+
561+ ``` bash
562+ # Inspect an image in text format
563+ os-image-composer inspect my-image.raw
564+
565+ # Inspect and output JSON (suitable for tooling/CI)
566+ os-image-composer inspect --format=json --pretty my-image.raw
567+
568+ # Compare two images with detailed diff
569+ os-image-composer compare image-v1.raw image-v2.raw
570+
571+ # Compare with JSON output for parsing
572+ os-image-composer compare --format=json --mode=diff image-v1.raw image-v2.raw
573+ ```
574+
422575### Validating Templates
423576
424577``` bash
@@ -474,7 +627,7 @@ logging:
474627**Configuration Fields:**
475628
476629| Field | Type | Description |
477- |-------| ------| ------------- |
630+ | ----- | ---- | ----------- |
478631| ` workers` | integer | Number of concurrent download workers (1-100). Default: 8 |
479632| `cache_dir` | string | Directory for package cache. Default : " ./cache" |
480633| `work_dir` | string | Working directory for builds. Default : " ./workspace" |
@@ -535,7 +688,7 @@ The tool provides consistent exit codes that can be used in scripting and
535688automation :
536689
537690| Code | Description |
538- |------| ------------- |
691+ | ---- | ----------- |
539692| 0 | Success : The command completed successfully. |
540693| 1 | General error : An unspecified error occurred during execution. |
541694
0 commit comments