Skip to content

Commit 3e34141

Browse files
authored
MIC: Add support for full OS initramfs when creating ISO/PXE artifacts (#260)
<!-- Description: Please provide a summary of the changes and the motivation behind them. --> --- ### **Checklist** - [x] Tests added/updated - [x] Documentation updated (if needed) - [x] Code conforms to style guidelines
1 parent ddc0cbe commit 3e34141

54 files changed

Lines changed: 2258 additions & 923 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/imagecustomizer/api/cli.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ The file path to write the final customized image to.
6060

6161
Added in v0.3.
6262

63+
## --output-path=FILE-PATH
64+
65+
An alias to `--output-image-file`.
66+
67+
Added in v0.15.
68+
6369
## --output-image-format=FORMAT
6470

6571
Required, unless
@@ -70,7 +76,7 @@ value is used.
7076

7177
The image format of the final customized image.
7278

73-
Options: vhd, vhd-fixed, vhdx, qcow2, raw, iso, and [cosi](./cosi.md).
79+
Options: vhd, vhd-fixed, vhdx, qcow2, raw, iso, pxe-dir, pxe-tar, and [cosi](./cosi.md).
7480

7581
The vhd-fixed option outputs a fixed size VHD image. This is the required format for
7682
VMs in Azure.
@@ -145,15 +151,6 @@ installation.
145151

146152
Added in v0.3.
147153

148-
## --output-pxe-artifacts-dir
149-
150-
Create a folder containing the artifacts to be used for PXE booting.
151-
152-
For an overview of Image Customizer support for PXE, see the
153-
[PXE support page](../concepts/pxe.md).
154-
155-
Added in v0.8.
156-
157154
## --log-level=LEVEL
158155

159156
Default: `info`
@@ -181,6 +178,7 @@ This flag enables snapshot-based package filtering during installation or update
181178
ensuring only packages available at that point in time are considered.
182179

183180
Supports:
181+
184182
- A date in `YYYY-MM-DD` format (interpreted as UTC midnight)
185183
- A full RFC 3339 timestamp (e.g., `2024-05-20T23:59:59Z`)
186184

docs/imagecustomizer/api/cli/inject-files.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,19 @@ is modified at `--image-file`.
6060

6161
Added in v0.14.
6262

63+
## --output-path=FILE-PATH
64+
65+
An alias to `--output-image-file`
66+
67+
Added in v0.15.
68+
6369
## --output-image-format=FORMAT
6470

6571
Optional.
6672

6773
The image format of the final image written to `--output-image-file`.
6874

69-
Options: `vhd`, `vhd-fixed`, `vhdx`, `qcow2`, `raw`, `iso`, and `cosi`.
75+
Options: `vhd`, `vhd-fixed`, `vhdx`, `qcow2`, `raw`, `pxe-dir`, `pxe-tar`, `iso`, and `cosi`.
7076

7177
If this option is not provided, the format of the input image is preserved.
7278

docs/imagecustomizer/api/configuration.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ The top level type for the YAML file is the [config](./configuration/config.md)
8383
22. If a ([verity](./configuration/storage.md#verity-verity)) device is specified, then
8484
create the hash tree and update the grub config.
8585

86-
23. If the output format is set to `iso`, copy additional iso media files.
87-
([iso](./configuration/iso.md))
88-
89-
24. If [--output-pxe-artifacts-dir](./cli.md#--output-pxe-artifacts-dir) is specified,
90-
then export the ISO image contents to the specified folder.
86+
23. If the output format is set to `iso` or `pxe`, copy additional iso media files.
87+
([iso](./configuration/iso.md) or [pxe](./configuration/pxe.md))
9188

9289
## /etc/resolv.conf
9390

@@ -166,9 +163,19 @@ os:
166163
- [permissions](./configuration/additionalfile.md#permissions-string)
167164
- [kernelCommandLine](./configuration/iso.md#kernelcommandline-kernelcommandline) ([kernelCommandLine type](./configuration/kernelcommandline.md))
168165
- [extraCommandLine](./configuration/kernelcommandline.md#extracommandline-string)
166+
- [initramfsType](./configuration/iso.md#initramfstype-string)
169167
- [pxe](./configuration/config.md#pxe-pxe) ([pxe type](./configuration/pxe.md))
170-
- [isoImageBaseUrl](./configuration/pxe.md#isoimagebaseurl-string)
171-
- [isoImageFileUrl](./configuration/pxe.md#isoimagefileurl-string)
168+
- [additionalFiles](./configuration/pxe.md#additionalfiles-additionalfile)
169+
- [additionalFile type](./configuration/additionalfile.md)
170+
- [source](./configuration/additionalfile.md#source-string)
171+
- [content](./configuration/additionalfile.md#content-string)
172+
- [destination](./configuration/additionalfile.md#destination-string)
173+
- [permissions](./configuration/additionalfile.md#permissions-string)
174+
- [kernelCommandLine](./configuration/pxe.md#kernelcommandline-kernelcommandline) ([kernelCommandLine type](./configuration/kernelcommandline.md))
175+
- [extraCommandLine](./configuration/kernelcommandline.md#extracommandline-string)
176+
- [initramfsType](./configuration/pxe.md#initramfstype-string)
177+
- [bootstrapBaseUrl](./configuration/pxe.md#bootstrapbaseurl-string)
178+
- [bootstrapFileUrl](./configuration/pxe.md#bootstrapfileurl-string)
172179
- [os](./configuration/config.md#os-os) ([os type](./configuration/os.md))
173180
- [bootloader](./configuration/os.md#bootloader-bootloader) ([bootloader type](./configuration/bootloader.md))
174181
- [resetType](./configuration/bootloader.md#resettype-string)

docs/imagecustomizer/api/configuration/iso.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ parent: Configuration
44

55
# iso type
66

7-
Specifies the configuration for the generated ISO media.
7+
Specifies the configuration for the generated ISO image when the `--output-format`
8+
is set to `iso`.
89

910
Example:
1011

@@ -17,6 +18,8 @@ iso:
1718
kernelCommandLine:
1819
extraCommandLine:
1920
- rd.info
21+
22+
initramfsType: bootstrap
2023
```
2124
2225
See also: [ISO Support](../../concepts/iso.md)
@@ -32,3 +35,28 @@ Added in v0.3.
3235
Adds files to the ISO.
3336
3437
Added in v0.7.
38+
39+
## initramfsType [string]
40+
41+
Specifies the initramfs type to generate and include in the ISO image.
42+
43+
Supported options:
44+
45+
- `bootstrap`: Creates a minimal Dracut-based initramfs image that later
46+
transitions to the full OS. The full OS is packaged in a separate image
47+
and is included on the media. This option allows the generated ISO to boot
48+
on hardware that has memory restrictions on the initramfs image size.
49+
- `full-os`: Creates a full OS initramfs image.
50+
51+
The default value for `initramfsType` is `bootstrap`.
52+
53+
Note that SELinux cannot be enabled if `initramfsType` is set to `full-os`.
54+
55+
Example:
56+
57+
```yaml
58+
iso:
59+
initramfsType: full-os
60+
```
61+
62+
Added in v0.15.

docs/imagecustomizer/api/configuration/pxe.md

Lines changed: 96 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,122 @@ parent: Configuration
44

55
# pxe type
66

7-
Specifies the PXE-specific configuration for the generated OS artifacts.
7+
Specifies the configuration for the generated PXE artifacts when the `--output-format`
8+
is set to `pxe-dir` or `pxe-tar`.
89

9-
Added in v0.8.
10+
If the `--output-format` is set to `pxe-dir`, `--output-path` will point to a
11+
directory where the customized PXE artifacts will be placed.
1012

11-
## isoImageBaseUrl [string]
13+
If the `--output-format` is set to `pxe-tar`, `--output-path` will point to a
14+
`.tar.gz` file where the customized PXE artifacts will be archived in.
1215

13-
Specifies the base URL for the ISO image to download at boot time. The Azure
14-
Linux Image Customizer will append the output image name to the specified base
15-
URL to form the full URL for downloading the image. The output image name is
16-
specified on the command-line using the `--output-image file` argument (see the
17-
[command-line interface](../cli.md) document for more details).
16+
Example:
1817

19-
This can be useful if the ISO image name changes with each build and the
20-
script deploying the artifacts to the PXE server does not update grub.cfg with
21-
the ISO image name.
18+
```yaml
19+
pxe:
20+
additionalFiles:
21+
- source: files/a.txt
22+
destination: /a.txt
2223

23-
For example,
24+
kernelCommandLine:
25+
extraCommandLine:
26+
- rd.info
27+
28+
initramfsType: bootstrap
29+
30+
bootstrapBaseUrl: http://my-pxe-server
31+
```
32+
33+
See also the [PXE Support](../../concepts/pxe.md) page.
34+
35+
## kernelCommandLine [[kernelCommandLine](./kernelcommandline.md)]
36+
37+
Specifies extra kernel command line options.
38+
39+
Added in v0.15.
40+
41+
## additionalFiles [[additionalFile](./additionalfile.md)[]]
42+
43+
Adds files to the PXE artifacts.
44+
45+
Added in v0.15.
46+
47+
## initramfsType [string]
2448
25-
- If the user has the following content in the configuration file:
49+
Specifies the initramfs type to generate and include in the PXE artifacts.
2650
27-
```yaml
28-
pxe:
29-
isoImageBaseUrl: http://hostname-or-ip/iso-publish-path
30-
```
51+
Supported options:
3152
32-
- and specifies the following on the command line:
53+
- `bootstrap`: Creates a minimal Dracut-based initramfs image that later
54+
transitions to the full OS. The full OS is packaged in a separate image
55+
and is included on in the PXE artifacts folder for the initramfs to find it.
56+
This option allows the generated PXE artifacts to boot on hardware that has
57+
memory restrictions on the initramfs image size.
58+
- `full-os`: Creates a full OS initramfs image.
3359

34-
```bash
35-
sudo imagecustomizer \
36-
--image-file "./input/azure-linux.vhdx" \
37-
--config-file "./input/customization-config.yaml" \
38-
--rpm-source "./input/rpms" \
39-
--build-dir "./build" \
40-
--output-image-format "iso" \
41-
--output-image-file "./build/output/output.iso" \
42-
--output-pxe-artifacts-dir "./build/output/pxe-artifacts"
43-
```
60+
The default value for `initramfsType` is `full-os`.
4461

45-
- then, during PXE booting, the ISO image will be downloaded from:
62+
Note that SELinux cannot be enabled if `initramfsType` is set to `full-os`.
4663

47-
```bash
48-
http://hostname-or-ip/iso-publish-path/output.iso
49-
```
64+
Example:
5065

51-
This field is mutually exclusive with `isoImageFileUrl`.
66+
```yaml
67+
pxe:
68+
initramfsType: bootstrap
69+
```
5270

53-
For an overview of Image Customizer support for PXE, see the
54-
[PXE support page](../../concepts/pxe.md).
71+
For an overview of the Image Customizer tool support for PXE, see the
72+
[PXE support](../../concepts/pxe.md) page.
5573

56-
Added in v0.8.
74+
Added in v0.15.
5775

58-
## isoImageFileUrl [string]
76+
## bootstrapBaseUrl [string]
5977

60-
Specifies the URL of the ISO image to download at boot time.
61-
The ISO image must be a LiveOS ISO image generated by the Azure Linux Image
62-
Customizer. The booting process will pivot to the root file system embedded
63-
in the ISO image after downloading it.
78+
Specifies the base URL for the bootstrap ISO image to download at boot time.
79+
The bootstrap ISO image is generated by the Image Customizer tool along with the
80+
rest of the PXE artifacts. The Image Customizer tool will append the
81+
default image name (`image.iso`) to the specified base URL to form the full URL
82+
for downloading the image.
83+
84+
For example, if the user has the following content in the configuration file:
85+
86+
```yaml
87+
pxe:
88+
bootstrapBaseUrl: http://hostname-or-ip/iso-publish-path
89+
```
90+
91+
Then the download URL becomes `http://hostname-or-ip/iso-publish-path/image.iso`.
92+
93+
This field is mutually exclusive with `bootstrapFileUrl`.
94+
95+
For an overview of the Image Customizer tool support for PXE, see the
96+
[PXE support](../../concepts/pxe.md) page.
97+
98+
Added in v0.15.
99+
100+
## bootstrapFileUrl [string]
101+
102+
Specifies the URL of the bootstrap ISO image to download at boot time.
103+
The bootstrap ISO image is generated by the Image Customizer tool along with the
104+
rest of the PXE artifacts. The generated ISO will always be placed at the root
105+
of the PXE artifacts folder (archive) and will be have the same name as the file
106+
name specified by `bootstrapFileUrl`.
107+
108+
For example,
64109

65-
PXE Configuration Example:
110+
```yaml
111+
pxe:
112+
bootstrapFileUrl: http://hostname-or-ip/iso-publish-path/my-bootstrap.iso
113+
```
66114

67-
- ```yaml
68-
pxe:
69-
isoImageFileUrl: http://hostname-or-ip/iso-publish-path/my-liveos.iso
70-
```
115+
A file named `my-bootstrap.iso` will be placed at the root of the PXE artifacts
116+
folder.
71117

72118
The supported download protocols are: nfs, http, https, ftp, torent, tftp.
73119

74-
This field is mutually exclusive with `isoImageBaseUrl`.
120+
This field is mutually exclusive with `bootstrapBaseUrl`.
75121

76-
For an overview of Image Customizer support for PXE, see the
77-
[PXE support page](../../concepts/pxe.md).
122+
For an overview of the Image Customizer tool support for PXE, see the
123+
[PXE support](../../concepts/pxe.md) page.
78124

79-
Added in v0.8.
125+
Added in v0.15.

docs/imagecustomizer/concepts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ provides basic functionality, more comprehensive documentation is provided for t
1212
following scenarios:
1313

1414
* Image History: Record the customization history of images. See [Image History](./imagehistory.md) for more info
15+
* Live OS: What is a Live OS? More details in [Live OS](./liveos.md)
1516
* ISO: Live-ISO creation. More details in [ISO Support](./iso.md)
1617
* PXE: Creating a PXE bootable image. More details in [PXE Support](./pxe.md)
1718
* Verity protected images: [Guidelines for creating a verity-protected root filesystem](./verity.md)

0 commit comments

Comments
 (0)