Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script to facilitate iso builds #241

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<ip>`: the IP address of the Tinkerbell GRPC server. No default.
- `MAC=<mac>`: the MAC address of the machine that will be provisioned. No default.
Expand Down
20 changes: 20 additions & 0 deletions bash/linuxkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
Expand Down
Loading