Skip to content

Commit 1ee3def

Browse files
tomassrnkaryan-sana
authored andcommitted
feat(fc-kernels): add the 6.1.158-android guest kernel flavour
Co-authored-by: Ryan Sana <ssanaeekohroudi@e2b.dev> GitOrigin-RevId: de8d84ca927ec488c4435a66af357a3653a15133
1 parent e7b859b commit 1ee3def

6 files changed

Lines changed: 7274 additions & 3 deletions

File tree

‎firecracker/fc-kernels/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Then add the version to `kernel_versions.txt` and build.
4949

5050
`make build` builds every version in the file, so keep the list to the versions you still want built. Dropping a pin is safe: published artifacts are never overwritten or deleted, and a template records the kernel version it was built with.
5151

52+
## Flavours
53+
54+
A flavour is the same upstream tree and patches built under a different config, named `<version>-<flavour>`: `6.1.158-android` is `6.1.158` with binder, DMA-BUF heaps, Android's networking options and a small patch that answers Android's ashmem ioctls on memfd files instead of an ashmem driver, so a sandbox can run Android in a container. `build.sh` takes the upstream tag and the `patches/` directory from the stem (`6.1.158`) and everything else — the config, the output directory, and so the published name a template selects — from the full name. Seed a flavour's config from its stem's and settle it the same way as a new version (`sudo env CONFIG_ONLY=1 ./build.sh 6.1.158-android`, per architecture). A flavour is a sibling of its stem, not a patch release: the weekly bump neither seeds from it nor bumps it. A flavour may also carry patches of its own under `patches/<version>-<flavour>/`; they apply after the stem's, and a change there rebuilds only that flavour.
55+
5256
## New kernel in E2B's infra
5357
_Note: these steps should give you a new kernel on your self-hosted E2B using https://github.com/e2b-dev/infra_
5458

‎firecracker/fc-kernels/build.sh‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ set -euo pipefail
88
# ./build.sh <kernel_version> [arch] # build a single version
99
#
1010
# arch is one of: x86_64 (default), arm64 (kernel-style names).
11+
# A version may carry a flavour, 6.1.158-android: the upstream tag and the patches
12+
# come from its stem (6.1.158), the config and the output from the full name.
1113
# Output: builds/vmlinux-<version>/<output_arch>/vmlinux.bin where
1214
# <output_arch> is the Go/OCI name (amd64/arm64) used by the orchestrator.
1315
#
@@ -66,6 +68,11 @@ get_tag() {
6668
return 1
6769
}
6870

71+
# The upstream version a pin is built from: 6.1.158 for 6.1.158-android.
72+
version_stem() {
73+
echo "${1%%-*}"
74+
}
75+
6976
# The salt Kconfig carries into the vmlinux as an ELF note, naming what the
7077
# binary was built from. It is a plain string symbol, so olddefconfig keeps
7178
# whatever the config it reads says: a config seeded from another version names
@@ -115,17 +122,22 @@ build_version() {
115122

116123
cp "$SCRIPT_DIR/configs/${target_arch}/${version}.config" .config
117124

118-
local tag=""
125+
local stem tag=""
126+
stem="$(version_stem "$version")"
119127
# get_tag greps, so no match is a non-zero exit, not just empty output.
120-
tag="$(get_tag "$version")" || true
128+
tag="$(get_tag "$stem")" || true
121129
if [ -z "$tag" ]; then
122130
echo "No amzn tag for kernel version $version" >&2
123131
return 1
124132
fi
125133
echo "Checking out $tag for kernel version: $version"
126134
git checkout -f "$tag"
135+
# A patch that adds files leaves them untracked; the next build's apply would refuse them.
136+
git clean -fdq
127137

128-
apply_patches "$version"
138+
apply_patches "$stem"
139+
# A flavour may carry patches of its own, applied after its stem's.
140+
[ "$version" = "$stem" ] || apply_patches "$version"
129141

130142
local make_opts="" cross=""
131143
if [[ "$target_arch" == "arm64" ]]; then

0 commit comments

Comments
 (0)