@@ -94,29 +94,44 @@ For simplicity, this guide will not use the [`jailer`](../src/jailer/).
94
94
### Getting a rootfs and Guest Kernel Image
95
95
96
96
To successfully start a microVM, you will need an uncompressed Linux kernel
97
- binary, and an ext4 file system image (to use as rootfs). This guide uses a 5.10
98
- kernel image with a Ubuntu 24.04 rootfs from our CI:
97
+ binary, and an ext4 file system image (to use as rootfs). This guide uses the
98
+ latest kernel image and Ubuntu rootfs available in our CI for the latest
99
+ release.
99
100
100
101
``` bash
101
102
ARCH=" $( uname -m) "
102
-
103
- latest=$( wget " http://spec.ccfc.min.s3.amazonaws.com/?prefix=firecracker-ci/v1.11/$ARCH /vmlinux-5.10&list-type=2" -O - 2> /dev/null | grep -oP " (?<=<Key>)(firecracker-ci/v1.11/$ARCH /vmlinux-5\.10\.[0-9]{1,3})(?=</Key>)" )
103
+ release_url=" https://github.com/firecracker-microvm/firecracker/releases"
104
+ latest_version=$( basename $( curl -fsSLI -o /dev/null -w %{url_effective} ${release_url} /latest) )
105
+ CI_VERSION=${latest_version% .* }
106
+ latest_kernel_key=$( curl " http://spec.ccfc.min.s3.amazonaws.com/?prefix=firecracker-ci/$CI_VERSION /$ARCH /vmlinux-&list-type=2" \
107
+ | grep -oP " (?<=<Key>)(firecracker-ci/$CI_VERSION /$ARCH /vmlinux-[0-9]+\.[0-9]+\.[0-9]{1,3})(?=</Key>)" \
108
+ | sort -V | tail -1)
104
109
105
110
# Download a linux kernel binary
106
- wget " https://s3.amazonaws.com/spec.ccfc.min/${latest} "
111
+ wget " https://s3.amazonaws.com/spec.ccfc.min/${latest_kernel_key} "
112
+
113
+ latest_ubuntu_key=$( curl " http://spec.ccfc.min.s3.amazonaws.com/?prefix=firecracker-ci/$CI_VERSION /$ARCH /ubuntu-&list-type=2" \
114
+ | grep -oP " (?<=<Key>)(firecracker-ci/$CI_VERSION /$ARCH /ubuntu-[0-9]+\.[0-9]+\.squashfs)(?=</Key>)" \
115
+ | sort -V | tail -1)
116
+ ubuntu_version=$( basename $latest_ubuntu_key .sqashfs | grep -oE ' [0-9]+\.[0-9]+' )
107
117
108
118
# Download a rootfs
109
- wget -O ubuntu-24.04. squashfs.upstream " https://s3.amazonaws.com/spec.ccfc.min/firecracker-ci/v1.11/ ${ARCH} /ubuntu-24.04.squashfs "
119
+ wget -O ubuntu-$ubuntu_version . squashfs.upstream " https://s3.amazonaws.com/spec.ccfc.min/$latest_ubuntu_key "
110
120
111
121
# Create an ssh key for the rootfs
112
- unsquashfs ubuntu-24.04 .squashfs.upstream
122
+ unsquashfs ubuntu-$ubuntu_version .squashfs.upstream
113
123
ssh-keygen -f id_rsa -N " "
114
124
cp -v id_rsa.pub squashfs-root/root/.ssh/authorized_keys
115
- mv -v id_rsa ./ubuntu-24.04 .id_rsa
125
+ mv -v id_rsa ./ubuntu-$ubuntu_version .id_rsa
116
126
# create ext4 filesystem image
117
127
sudo chown -R root:root squashfs-root
118
- truncate -s 400M ubuntu-24.04.ext4
119
- sudo mkfs.ext4 -d squashfs-root -F ubuntu-24.04.ext4
128
+ truncate -s 400M ubuntu-$ubuntu_version .ext4
129
+ sudo mkfs.ext4 -d squashfs-root -F ubuntu-$ubuntu_version .ext4
130
+
131
+ # Verify everything was correctly set up and print versions
132
+ echo " Kernel: $( ls vmlinux-* | tail -1) "
133
+ echo " Rootfs: $( ls * .ext4 | tail -1) "
134
+ echo " SSH Key: $( ls * .id_rsa | tail -1) "
120
135
```
121
136
122
137
### Getting a Firecracker Binary
@@ -241,7 +256,7 @@ sudo curl -X PUT --unix-socket "${API_SOCKET}" \
241
256
}" \
242
257
" http://localhost/boot-source"
243
258
244
- ROOTFS=" ./ubuntu-24.04. ext4"
259
+ ROOTFS=" ./$( ls * . ext4 | tail -1 ) "
245
260
246
261
# Set rootfs
247
262
sudo curl -X PUT --unix-socket " ${API_SOCKET} " \
@@ -282,14 +297,16 @@ sudo curl -X PUT --unix-socket "${API_SOCKET}" \
282
297
# started before we attempt to SSH into it.
283
298
sleep 2s
284
299
300
+ KEY_NAME=./$( ls * .id_rsa | tail -1)
301
+
285
302
# Setup internet access in the guest
286
- ssh -i
./ubuntu-24.04.id_rsa [email protected] " ip route add default via 172.16.0.1 dev eth0"
303
+ ssh -i
$KEY_NAME [email protected] " ip route add default via 172.16.0.1 dev eth0"
287
304
288
305
# Setup DNS resolution in the guest
289
- ssh -i
./ubuntu-24.04.id_rsa [email protected] " echo 'nameserver 8.8.8.8' > /etc/resolv.conf"
306
+ ssh -i
$KEY_NAME [email protected] " echo 'nameserver 8.8.8.8' > /etc/resolv.conf"
290
307
291
308
# SSH into the microVM
292
- ssh -i
./ubuntu-24.04.id_rsa [email protected]
309
+ ssh -i
$KEY_NAME [email protected]
293
310
294
311
# Use `root` for both the login and password.
295
312
# Run `reboot` to exit.
0 commit comments