Skip to content

Commit

Permalink
Add instructions for embedded images: (#9076)
Browse files Browse the repository at this point in the history
* Add instructions for embedded images:

For EKS Anywhere >= v0.21.0 embedded images are required
when building HookOS.

Signed-off-by: Jacob Weinstock <[email protected]>

* Update docs/content/en/docs/getting-started/baremetal/customize/bare-custom-hookos.md

Co-authored-by: Rahul Ganesh <[email protected]>

* Update docs/content/en/docs/getting-started/baremetal/customize/bare-custom-hookos.md

Co-authored-by: Rahul Ganesh <[email protected]>

---------

Signed-off-by: Jacob Weinstock <[email protected]>
Co-authored-by: Rahul Ganesh <[email protected]>
  • Loading branch information
jacobweinstock and rahulbabu95 authored Dec 23, 2024
1 parent 40e4a76 commit 2966308
Showing 1 changed file with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Be sure to install all the following dependencies.
cd hook/
```

1. Run the Linux kernel [menuconfig](https://en.wikipedia.org/wiki/Menuconfig) TUI and configuring the kernel as needed. Be sure to save the config before exiting. The result of this step will be a modified kernel configuration file (`./kernel/configs/generic-6.6.y-x86_64`).
1. Run the Linux kernel [menuconfig](https://en.wikipedia.org/wiki/Menuconfig) TUI and configure the kernel as needed. Save the config before you exit.
The result of this step will be a modified kernel configuration file (`./kernel/configs/generic-6.6.y-x86_64`).

```bash
./build.sh kernel-config hook-latest-lts-amd64
Expand All @@ -53,10 +54,32 @@ Be sure to install all the following dependencies.
./build.sh kernel hook-latest-lts-amd64
```

1. Build the HookOS kernel and initramfs artifacts. The result of this step will be the kernel and initramfs. These files are located at `./out/hook/vmlinuz-latest-lts-x86_64` and `./out/hook/initramfs-latest-lts-x86_64` respectively.
1. Add the embedded Action images. This creates the file, `images.txt`, in the `images/hook-embedded` directory and runs the script, `images/hook-embedded/pull-images.sh`, to pull and embed the images in the HookOS initramfs.
The result of this step will be a populated images file: `images/hook-embedded/images.txt` and a Docker directory cache of images: `images/hook-embedded/images/`.

```bash
./build.sh linuxkit hook-latest-lts-amd64
BUNDLE_URL=$(eksctl anywhere version | grep "https://anywhere-assets.eks.amazonaws.com/releases/bundles" | tr -d ' ' | cut -d":" -f2,3)
IMAGES=$(curl -s $BUNDLE_URL | grep "public.ecr.aws/eks-anywhere/tinkerbell/hub/\|public.ecr.aws/eks-anywhere/tinkerbell/tink/tink-worker" | sort | uniq | tr -d ' ' | cut -d":" -f2,3)
images_file="images/hook-embedded/images.txt"
rm "$images_file"
while read -r image; do
action_name=$(basename "$image" | cut -d":" -f1)
echo "$image 127.0.0.1/embedded/$action_name" >> "$images_file"
done <<< "$IMAGES"
(cd images/hook-embedded; ./pull-images.sh)
```

1. Build the HookOS kernel and initramfs artifacts. The `sudo` command is needed as the image embedding step uses Docker-in-Docker (DinD) which changes file ownerships to the root user.
The result of this step will be the kernel and initramfs. These files are located at `./out/hook/vmlinuz-latest-lts-x86_64` and `./out/hook/initramfs-latest-lts-x86_64` respectively.

```bash
sudo ./build.sh linuxkit hook-latest-lts-amd64
```

**Note:** If you did not customize the kernel configuration, you can use the latest upstream built kernel by setting the `USE_LATEST_BUILT_KERNEL` to `yes`. Run this command instead of the previous one.

```bash
sudo ./build.sh linuxkit hook-latest-lts-amd64 USE_LATEST_BUILT_KERNEL=yes
```

1. Rename the kernel and initramfs files to `vmlinuz-x86_64` and `initramfs-x86_64` respectively.
Expand Down

0 comments on commit 2966308

Please sign in to comment.