diff --git a/src/cmd-buildextend-live b/src/cmd-buildextend-live index 5ca935c20b..7ac8f9b394 100755 --- a/src/cmd-buildextend-live +++ b/src/cmd-buildextend-live @@ -51,6 +51,8 @@ parser.add_argument("--fast", action='store_true', default=False, help="Reduce compression for development (FCOS only)") parser.add_argument("--force", action='store_true', default=False, help="Overwrite previously generated installer") +parser.add_argument("--miniso", action='store_true', default=False, + help="Enable minimal ISO packing (temporary)") args = parser.parse_args() # Identify the builds and target the latest build if none provided @@ -120,6 +122,9 @@ for d in (tmpdir, tmpisoroot, tmpisocoreos, tmpisoimages, tmpisoimagespxe, # Size of file used to embed an Ignition config within a CPIO. ignition_img_size = 256 * 1024 +# Size of the file used to embed miniso data. +miniso_data_file_size = 16 * 1024 + # The kernel requires that uncompressed cpio archives appended to an initrd # start on a 4-byte boundary. If there's misalignment, it stops unpacking @@ -581,15 +586,28 @@ boot fh.write('\n') # Define inputs and outputs - genisoargs += ['-o', tmpisofile, tmpisoroot] + genisoargs_final = genisoargs + ['-o', tmpisofile, tmpisoroot] + + if args.miniso: + miniso_data = os.path.join(tmpisocoreos, "miniso.dat") + with open(miniso_data, 'wb') as f: + f.truncate(miniso_data_file_size) - run_verbose(genisoargs) + run_verbose(genisoargs_final) # Add MBR, and GPT with ESP, for x86_64 BIOS/UEFI boot when ISO is # copied to a USB stick if basearch == "x86_64": run_verbose(['/usr/bin/isohybrid', '--uefi', tmpisofile]) + if args.miniso: + genisoargs_minimal = genisoargs + ['-o', f'{tmpisofile}.minimal', tmpisoroot] + os.unlink(iso_rootfs) + os.unlink(miniso_data) + run_verbose(genisoargs_minimal) + if basearch == "x86_64": + run_verbose(['/usr/bin/isohybrid', '--uefi', f'{tmpisofile}.minimal']) + isoinfo = run_verbose(['isoinfo', '-lR', '-i', tmpisofile], stdout=subprocess.PIPE, text=True).stdout @@ -660,6 +678,11 @@ boot isofh.write(struct.pack(INITRDFMT, b'coreiso+', offset, ignition_img_size)) print(f'Embedded {ignition_img_size} bytes Ignition config space at {offset}') + if args.miniso: + # this consumes the minimal image + run_verbose(['coreos-installer', 'iso', 'extract', 'pack-minimal-iso', + tmpisofile, f'{tmpisofile}.minimal', "--consume"]) + buildmeta['images'].update({ 'live-iso': { 'path': iso_name,