Skip to content

Commit

Permalink
Add metal-uefi target
Browse files Browse the repository at this point in the history
This builds but I haven't tested running it yet.
  • Loading branch information
cgwalters committed Feb 6, 2019
1 parent 4b47cfc commit b3adf49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/cmd-build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Usage: coreos-assembler build --help
- qemu
- metal-bios
- metal-uefi
EOF
}

Expand Down Expand Up @@ -271,6 +272,11 @@ for itype in "${IMAGE_TYPES[@]}"; do
images[$itype]="${img_metalbios}"
run_virtinstall "$(pwd)"/"${img_metalbios}" --variant=metal
;;
metal-uefi)
img_metaluefi=${imageprefix}-metal-uefi.raw
images[$itype]="${img_metaluefi}"
run_virtinstall "$(pwd)"/"${img_metaluefi}" --variant=metal-uefi
;;
*) fatal "Unrecognized image type: $itype"
;;
esac
Expand Down
12 changes: 9 additions & 3 deletions src/virt-install
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ parser.add_argument("--create-disk", help="Automatically create disk as qcow2, p
parser.add_argument("--image-config", help="coreos-assembler image.yaml",
action='store')
parser.add_argument("--variant", help="Use an internal (kickstart) config",
choices=('metal', 'cloud'), default=None)
choices=('metal', 'metal-uefi', 'cloud'), default=None)
parser.add_argument("--kickstart", help="Kickstart path",
action='store')
parser.add_argument("--kickstart-out", help="Save flattened kickstart",
Expand Down Expand Up @@ -89,7 +89,11 @@ else:
disk_size = None

if args.variant is not None:
with open(f'/usr/lib/coreos-assembler/image-{args.variant}.ks') as f:
if args.variant == 'metal-uefi':
variant_ks = 'metal'
else:
variant_ks = args.variant
with open(f'/usr/lib/coreos-assembler/image-{variant_ks}.ks') as f:
shutil.copyfileobj(f, ks_tmp)

if args.image_config:
Expand Down Expand Up @@ -161,7 +165,7 @@ if args.create_disk and args.kickstart:
fatal("--create-disk specified, but failed to find '{}' in kickstart".format(magic_virt_install_size_str))

if args.create_disk:
if args.variant == 'metal':
if args.variant in ('metal', 'metal-uefi'):
fmt = 'raw'
else:
fmt = 'qcow2'
Expand Down Expand Up @@ -225,6 +229,8 @@ try:
"--disk=path={},cache=unsafe".format(args.dest),
"--initrd-inject={}".format(ks_tmp.name),
"--extra-args", "ks=file://{} console=tty0 console=ttyS0,115200n8 inst.cmdline inst.notmux".format(os.path.basename(ks_tmp.name))])
if args.variant == 'metal-uefi':
vinstall_args.append('--boot=uefi')
run_sync_verbose(vinstall_args)
# And strip out all of the Anaconda stuff in /var; this uses libguestfs
# to ensure we fully control the code.
Expand Down

0 comments on commit b3adf49

Please sign in to comment.