diff --git a/README.md b/README.md index b5a14185..2cdb0787 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ The most important environment variables are: - `HOOK_LK_CONTAINERS_OCI_BASE`: OCI base coordinates for the LinuxKit containers. - `CACHE_DIR`: directory where the build system will cache downloaded files. Relative to the project root. - `USE_LATEST_BUILT_KERNEL`: set this to `yes` to use the latest built kernel from `quay.io/tinkerbell/hook-kernel`. + - `LINUXKIT_ISO`: set this to `yes` to build an ISO image instead of a kernel and initrd. - exclusively for the `qemu` command: - `TINK_SERVER=`: the IP address of the Tinkerbell GRPC server. No default. - `MAC=`: the MAC address of the machine that will be provisioned. No default. diff --git a/bash/linuxkit.sh b/bash/linuxkit.sh index 5f053256..b97f416d 100644 --- a/bash/linuxkit.sh +++ b/bash/linuxkit.sh @@ -83,6 +83,26 @@ function linuxkit_build() { declare lk_cache_dir="${CACHE_DIR}/linuxkit" mkdir -p "${lk_cache_dir}" + # if LINUXKIT_ISO is set, build an ISO with the kernel and initramfs + if [[ -n "${LINUXKIT_ISO}" ]]; then + declare lk_iso_output_dir="out" + mkdir -p "${lk_iso_output_dir}" + + declare -a lk_iso_args=( + "--docker" + "--arch" "${kernel_info['DOCKER_ARCH']}" + "--format" "iso-efi-initrd" + "--name" "hook" + "--cache" "${lk_cache_dir}" + "--dir" "${lk_iso_output_dir}" + "hook.${inventory_id}.yaml" # the linuxkit configuration file + ) + + log info "Building Hook ISO with kernel ${inventory_id} using linuxkit: ${lk_iso_args[*]}" + "${linuxkit_bin}" build "${lk_iso_args[@]}" + return 0 + fi + declare -a lk_args=( "--docker" "--arch" "${kernel_info['DOCKER_ARCH']}"