Skip to content

Commit 3e6338e

Browse files
chalamalasettyYour Namegmileka
authored
Build 64k aarch64 ISO using imagecustomizer (microsoft#14206)
Co-authored-by: Your Name <[email protected]> Co-authored-by: George Mileka <[email protected]>
1 parent f6e53be commit 3e6338e

File tree

5 files changed

+459
-0
lines changed

5 files changed

+459
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
The ISO installer uses an attended_config.json file, generated by the toolkit from a configuration file,
2+
to facilitate OS installation. Imagecustomizer relies on the ISO installer and requires all necessary files
3+
including imager, liveinstaller, package list files, and attended_config.json to be present for ISO creation.
4+
Currently, manual intervention is necessary to update attended_config.json for Azure Linux 64k ISO (attended_config_aarch64_64k.json).
5+
Please note, each package json file should be included under both the ISO and OS sections in the imageconfigs/full-64k-arm64.yaml file.
6+
This will ensure generation of all required RPM packages for ISO installer.
7+
In the future, the Image Customizer tool will support fully automated end-to-end creation of the installer iso.
8+
For guidance on configuring attended_config_aarch64_64k.json, users should reference toolkit/imageconfigs/full-aarch64.json.
9+
Image Customizer tool requires that all necessary RPM packages for the target OS installation are available in the /RPMS directory.
10+
To obtain RPM packages from PMC, users may refer to the following sample post-installation script, which should be updated in
11+
`imageconfigs/postinstallscripts/imagecustomizer/isoinstaller_postinstalltask.sh`.
12+
13+
# Sample post installation script for retrieving RPM Packages from PMC for Arm64 64K ISO Installer
14+
# isoinstaller_postinstalltask.sh
15+
16+
# Create RPMS directory
17+
mkdir /RPMS
18+
19+
# Path to the main config JSON
20+
CONFIG_JSON="/config/attended_config.json"
21+
CONFIG_DIR="$(dirname "$CONFIG_JSON")"
22+
23+
echo "CONFIG_DIR: $CONFIG_DIR"
24+
echo "CONFIG_JSON: $CONFIG_JSON"
25+
26+
# Find all package list files referenced in the config
27+
pkglist_files=( $(jq -r '.SystemConfigs[].PackageLists[]' "$CONFIG_JSON") )
28+
29+
# Recursively parse and add each package and it dependencies to RPMS folder
30+
for pkglist in "${pkglist_files[@]}"; do
31+
# Make path relative to config file directory
32+
full_path="$CONFIG_DIR/$pkglist"
33+
if [[ -f "$full_path" ]]; then
34+
tdnf -y install --downloadonly --alldeps --nogpgcheck --downloaddir /RPMS $(jq -r '.packages[]' "$full_path")
35+
fi
36+
done
37+
38+
# Get kernel packages from KernelOptions (if present)
39+
tdnf -y install --downloadonly --alldeps --nogpgcheck --downloaddir /RPMS $(jq -r '.SystemConfigs[] | select(.KernelOptions) | .KernelOptions[]' "$CONFIG_JSON")
40+
41+
42+
# Create local ISO repo for RPMS directory
43+
createrepo /RPMS
44+
45+
# RPM packages are generated under rootfs RPMS folder.
46+
# Hence update baseurl path
47+
sed -i 's|baseurl=file:///mnt/cdrom/RPMS|baseurl=file:///RPMS|' /etc/yum.repos.d/mariner-iso.repo
48+
49+
# RPM packages should be installed from ISO local repo
50+
# Remove PMC official base repo from ISO
51+
rm -r /etc/yum.repos.d/azurelinux-official-base.rep
52+
53+
# end of isoinstaller_postinstalltask.sh
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"Disks": null,
3+
"SystemConfigs": [
4+
{
5+
"IsDefault": false,
6+
"IsKickStartBoot": false,
7+
"IsIsoInstall": true,
8+
"BootType": "",
9+
"EnableGrubMkconfig": true,
10+
"EnableSystemdFirstboot": false,
11+
"Hostname": "",
12+
"Name": "Azure Linux Full",
13+
"PackageLists": [
14+
"packages/hyperv-packages.json",
15+
"packages/developer-packages.json",
16+
"packages/virtualization-host-packages.json",
17+
"packages/core-packages-image-aarch64.json",
18+
"packages/core-tools-packages.json",
19+
"packages/selinux-full.json",
20+
"packages/virt-guest-packages.json",
21+
"packages/ssh-server.json"
22+
],
23+
"Packages": null,
24+
"KernelOptions": {
25+
"default": "kernel-64k"
26+
},
27+
"KernelCommandLine": {
28+
"CGroup": "",
29+
"ImaPolicy": null,
30+
"SELinux": "permissive",
31+
"SELinuxPolicy": "",
32+
"EnableFIPS": false,
33+
"ExtraCommandLine": "efi_mmap_nr_slack_slots=256"
34+
},
35+
"AdditionalFiles": {
36+
"additionalfiles/99-dhcp-en.network": [
37+
{
38+
"Path": "/etc/systemd/network/99-dhcp-en.network",
39+
"Permissions": null
40+
}
41+
]
42+
},
43+
"PartitionSettings": null,
44+
"PreInstallScripts": null,
45+
"PostInstallScripts": null,
46+
"FinalizeImageScripts": null,
47+
"Networks": null,
48+
"PackageRepos": null,
49+
"Groups": null,
50+
"Users": null,
51+
"Encryption": {
52+
"Enable": false,
53+
"Password": ""
54+
},
55+
"RemoveRpmDb": false,
56+
"PreserveTdnfCache": false,
57+
"EnableHidepid": false,
58+
"DisableRpmDocs": false,
59+
"OverrideRpmLocales": ""
60+
},
61+
{
62+
"IsDefault": false,
63+
"IsKickStartBoot": false,
64+
"IsIsoInstall": true,
65+
"BootType": "",
66+
"EnableGrubMkconfig": true,
67+
"EnableSystemdFirstboot": false,
68+
"Hostname": "",
69+
"Name": "Azure Linux Core",
70+
"PackageLists": [
71+
"packages/hyperv-packages.json",
72+
"packages/core-packages-image-aarch64.json",
73+
"packages/virt-guest-packages.json",
74+
"packages/ssh-server.json"
75+
],
76+
"Packages": null,
77+
"KernelOptions": {
78+
"default": "kernel-64k"
79+
},
80+
"KernelCommandLine": {
81+
"CGroup": "",
82+
"ImaPolicy": null,
83+
"SELinux": "",
84+
"SELinuxPolicy": "",
85+
"EnableFIPS": false,
86+
"ExtraCommandLine": "efi_mmap_nr_slack_slots=256"
87+
},
88+
"AdditionalFiles": {
89+
"additionalfiles/99-dhcp-en.network": [
90+
{
91+
"Path": "/etc/systemd/network/99-dhcp-en.network",
92+
"Permissions": null
93+
}
94+
]
95+
},
96+
"PartitionSettings": null,
97+
"PreInstallScripts": null,
98+
"PostInstallScripts": null,
99+
"FinalizeImageScripts": null,
100+
"Networks": null,
101+
"PackageRepos": null,
102+
"Groups": null,
103+
"Users": null,
104+
"Encryption": {
105+
"Enable": false,
106+
"Password": ""
107+
},
108+
"RemoveRpmDb": false,
109+
"PreserveTdnfCache": false,
110+
"EnableHidepid": false,
111+
"DisableRpmDocs": false,
112+
"OverrideRpmLocales": ""
113+
}
114+
],
115+
"DefaultSystemConfig": {
116+
"IsDefault": false,
117+
"IsKickStartBoot": false,
118+
"IsIsoInstall": true,
119+
"BootType": "",
120+
"EnableGrubMkconfig": true,
121+
"EnableSystemdFirstboot": false,
122+
"Hostname": "",
123+
"Name": "Azure Linux Full",
124+
"PackageLists": [
125+
"packages/hyperv-packages.json",
126+
"packages/developer-packages.json",
127+
"packages/virtualization-host-packages.json",
128+
"packages/core-packages-image-aarch64.json",
129+
"packages/core-tools-packages.json",
130+
"packages/selinux-full.json",
131+
"packages/virt-guest-packages.json",
132+
"packages/ssh-server.json"
133+
],
134+
"Packages": null,
135+
"KernelOptions": {
136+
"default": "kernel-64k"
137+
},
138+
"KernelCommandLine": {
139+
"CGroup": "",
140+
"ImaPolicy": null,
141+
"SELinux": "permissive",
142+
"SELinuxPolicy": "",
143+
"EnableFIPS": false,
144+
"ExtraCommandLine": "efi_mmap_nr_slack_slots=256"
145+
},
146+
"AdditionalFiles": {
147+
"additionalfiles/99-dhcp-en.network": [
148+
{
149+
"Path": "/etc/systemd/network/99-dhcp-en.network",
150+
"Permissions": null
151+
}
152+
]
153+
},
154+
"PartitionSettings": null,
155+
"PreInstallScripts": null,
156+
"PostInstallScripts": null,
157+
"FinalizeImageScripts": null,
158+
"Networks": null,
159+
"PackageRepos": null,
160+
"Groups": null,
161+
"Users": null,
162+
"Encryption": {
163+
"Enable": false,
164+
"Password": ""
165+
},
166+
"RemoveRpmDb": false,
167+
"PreserveTdnfCache": false,
168+
"EnableHidepid": false,
169+
"DisableRpmDocs": false,
170+
"OverrideRpmLocales": ""
171+
}
172+
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
storage:
2+
bootType: efi
3+
disks:
4+
- partitionTableType: gpt
5+
maxSize: 8G
6+
partitions:
7+
- id: esp
8+
type: esp
9+
size: 9M
10+
- id: boot
11+
size: 200M
12+
- id: root
13+
size: grow
14+
filesystems:
15+
- deviceId: esp
16+
type: fat32
17+
mountPoint:
18+
path: /boot/efi
19+
options: umask=0077
20+
- deviceId: boot
21+
type: ext4
22+
mountPoint:
23+
path: /boot
24+
- deviceId: root
25+
type: ext4
26+
mountPoint:
27+
path: /
28+
os:
29+
bootloader:
30+
resetType: hard-reset
31+
32+
kernelCommandLine:
33+
extraCommandLine:
34+
- efi_mmap_nr_slack_slots=256
35+
- console=tty0
36+
- console=ttyS0,115200n8
37+
38+
packages:
39+
install:
40+
- kernel-64k
41+
- kernel-64k-drivers-accessibility
42+
- kernel-64k-drivers-sound
43+
- createrepo_c
44+
- jq
45+
# iso required packages
46+
- squashfs-tools
47+
- tar
48+
- device-mapper
49+
- curl
50+
51+
installLists:
52+
- packagelists/isoinstaller-64k-packages.yaml
53+
54+
remove:
55+
- kernel
56+
57+
additionalFiles:
58+
- source: ../out/tools/imager
59+
destination: /installer/imager
60+
- source: ../out/tools/liveinstaller
61+
destination: /installer/liveinstaller
62+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/init
63+
destination: /init
64+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/installer/calamares-EULA.txt
65+
destination: /etc/calamares/azl-eula
66+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/installer/terminal-EULA.txt
67+
destination: /installer/EULA.txt
68+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/root/asoundrc
69+
destination: /root/.asoundrc
70+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/root/runliveinstaller
71+
destination: /root/runliveinstaller
72+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/root/silence.wav
73+
destination: /root/silence.wav
74+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/usr/lib/mariner/terminfo/mariner-installer
75+
destination: /usr/lib/mariner/terminfo/m/mariner-installer
76+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/usr/lib/systemd/system/[email protected]
77+
destination: /usr/lib/systemd/system/[email protected]
78+
- source: ../resources/imageconfigs/additionalfiles/iso_initrd/usr/lib/systemd/system/[email protected]
79+
destination: /usr/lib/systemd/system/[email protected]
80+
- source: ../resources/manifests/image/local.repo
81+
destination: /etc/yum.repos.d/mariner-iso.repo
82+
- source: additionalconfigs/99-dhcp-en.network
83+
destination: /config/additionalfiles/99-dhcp-en.network
84+
- source: packagelists/hyperv-packages.json
85+
destination: /config/packages/hyperv-packages.json
86+
- source: packagelists/developer-packages.json
87+
destination: /config/packages/developer-packages.json
88+
- source: packagelists/virtualization-host-packages.json
89+
destination: /config/packages/virtualization-host-packages.json
90+
- source: packagelists/core-packages-image-aarch64.json
91+
destination: /config/packages/core-packages-image-aarch64.json
92+
- source: packagelists/core-tools-packages.json
93+
destination: /config/packages/core-tools-packages.json
94+
- source: packagelists/selinux-full.json
95+
destination: /config/packages/selinux-full.json
96+
- source: packagelists/virt-guest-packages.json
97+
destination: /config/packages/virt-guest-packages.json
98+
- source: packagelists/ssh-server.json
99+
destination: /config/packages/ssh-server.json
100+
- source: files/imagecustomizer/isoinstaller/attended_config_aarch64_64k.json
101+
destination: /config/attended_config.json
102+
103+
additionalDirs:
104+
- source: ./installer-pkgs
105+
destination: /RPMS
106+
107+
users:
108+
- name: root
109+
passwordExpiresDays: 99999
110+
startupCommand: /root/runliveinstaller
111+
112+
scripts:
113+
postCustomization:
114+
- path: postinstallscripts/imagecustomizer/isoinstaller_postinstalltask.sh
115+
finalizeCustomization:
116+
- path: scripts/set_os_release_variant_entries.sh
117+
arguments:
118+
- --variant-id
119+
- full-64k
120+
- --variant
121+
- ISO installer for 64k Kernel
122+
123+
iso:
124+
additionalFiles:
125+
- source: additionalconfigs/99-dhcp-en.network
126+
destination: /config/additionalfiles/99-dhcp-en.network
127+
- source: packagelists/hyperv-packages.json
128+
destination: /config/packages/hyperv-packages.json
129+
- source: packagelists/developer-packages.json
130+
destination: /config/packages/developer-packages.json
131+
- source: packagelists/virtualization-host-packages.json
132+
destination: /config/packages/virtualization-host-packages.json
133+
- source: packagelists/core-packages-image-aarch64.json
134+
destination: /config/packages/core-packages-image-aarch64.json
135+
- source: packagelists/core-tools-packages.json
136+
destination: /config/packages/core-tools-packages.json
137+
- source: packagelists/selinux-full.json
138+
destination: /config/packages/selinux-full.json
139+
- source: packagelists/virt-guest-packages.json
140+
destination: /config/packages/virt-guest-packages.json
141+
- source: packagelists/ssh-server.json
142+
destination: /config/packages/ssh-server.json
143+
- source: files/imagecustomizer/isoinstaller/attended_config_aarch64_64k.json
144+
destination: /config/attended_config.json
145+
146+
output:
147+
image:
148+
format: iso

0 commit comments

Comments
 (0)