Skip to content

Commit d8e52c8

Browse files
pb8ozulinx86
authored andcommitted
ci: regenerate new artifacts
Add a new script to regenerate the CI artifacts. This includes: - Latest stable Linux kernels - Latest rootfs (Ubuntu 22.04) Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
1 parent 1c42af1 commit d8e52c8

17 files changed

+3244
-406
lines changed

docs/rootfs-and-kernel-setup.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ on an aarch64 machine.
7474

7575
## Creating a rootfs Image
7676

77-
A rootfs image is just a file system image, that hosts at least an init
78-
system. For instance, our getting started guide uses an EXT4 FS image with
79-
OpenRC as an init system. Note that, whichever file system you choose to use,
80-
support for it will have to be compiled into the kernel, so it can be mounted
81-
at boot time.
77+
A rootfs image is just a file system image, that hosts at least an init system.
78+
For instance, our getting started guide uses an ext4 filesystem image. Note
79+
that, whichever file system you choose to use, support for it will have to be
80+
compiled into the kernel, so it can be mounted at boot time.
8281

83-
In order to obtain an EXT4 image that you can use with Firecracker, you have
84-
the following options:
82+
In order to obtain an ext4 image that you can use with Firecracker, you have the
83+
following options:
8584

8685
### Manual build
8786

@@ -168,20 +167,14 @@ Alpine Linux:
168167
### Use the provided recipe
169168

170169
The disk images used in our CI to test Firecracker's features are obtained by
171-
using the recipe inside devtool:
172-
173-
```bash
174-
./tools/devtool build_rootfs -s 300MB
175-
```
176-
177-
or
170+
using the recipe (in a Ubuntu 22.04 host):
178171

179172
```bash
180-
./tools/devtool build_rootfs -p
173+
./resources/rebuild.sh
181174
```
182175

183-
in order to obtain a partuuid enabled rootfs.
184-
The images resulting using this method are minimized Ubuntu 18.04.
176+
The images resulting using this method are minimized Ubuntu 22.04. Feel free to
177+
adjust the script(s) to suit your use case.
185178

186179
You should now have a kernel image (`vmlinux`) and a rootfs image
187180
(`rootfs.ext4`), that you can boot with Firecracker.

resources/chroot.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# fail if we encounter an error, uninitialized variable or a pipe breaks
6+
set -eu -o pipefail
7+
8+
# be verbose
9+
set -x
10+
PS4='+\t '
11+
12+
cp -ruv $rootfs/* /
13+
14+
packages="udev systemd-sysv openssh-server iproute2 curl socat python3-minimal iperf3 iputils-ping fio kmod"
15+
16+
# msr-tools is only supported on x86-64.
17+
arch=$(uname -m)
18+
if [ "${arch}" == "x86_64" ]; then
19+
packages="$packages msr-tools cpuid"
20+
fi
21+
22+
export DEBIAN_FRONTEND=noninteractive
23+
apt update
24+
apt install -y --no-install-recommends $packages
25+
apt autoremove
26+
27+
# Set a hostname.
28+
echo "ubuntu-fc-uvm" > /etc/hostname
29+
30+
passwd -d root
31+
32+
# The serial getty service hooks up the login prompt to the kernel console
33+
# at ttyS0 (where Firecracker connects its serial console). We'll set it up
34+
# for autologin to avoid the login prompt.
35+
for console in ttyS0; do
36+
mkdir "/etc/systemd/system/serial-getty@$console.service.d/"
37+
cat <<'EOF' > "/etc/systemd/system/serial-getty@$console.service.d/override.conf"
38+
[Service]
39+
# systemd requires this empty ExecStart line to override
40+
ExecStart=
41+
ExecStart=-/sbin/agetty --autologin root -o '-p -- \\u' --keep-baud 115200,38400,9600 %I dumb
42+
EOF
43+
done
44+
45+
# Setup fcnet service. This is a custom Firecracker setup for assigning IPs
46+
# to the network interfaces in the guests spawned by the CI.
47+
ln -s /etc/systemd/system/fcnet.service /etc/systemd/system/sysinit.target.wants/fcnet.service
48+
49+
# Disable resolved and ntpd
50+
#
51+
rm -f /etc/systemd/system/multi-user.target.wants/systemd-resolved.service
52+
rm -f /etc/systemd/system/dbus-org.freedesktop.resolve1.service
53+
rm -f /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service
54+
55+
# make /tmp a tmpfs
56+
ln -s /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
57+
systemctl enable tmp.mount
58+
59+
# don't need this
60+
systemctl disable e2scrub_reap.service
61+
rm -vf /etc/systemd/system/timers.target.wants/*
62+
# systemctl list-units --failed
63+
# /lib/systemd/system/systemd-random-seed.service
64+
65+
systemctl enable var-lib-systemd.mount
66+
67+
#### trim image https://wiki.ubuntu.com/ReducingDiskFootprint
68+
# this does not save much, but oh well
69+
rm -rf /usr/share/{doc,man,info,locale}
70+
71+
cat >> /etc/sysctl.conf <<EOF
72+
# This avoids a SPECTRE vuln
73+
kernel.unprivileged_bpf_disabled=1
74+
EOF

resources/guest_configs/microvm-kernel-ci-arm64-4.14.config renamed to resources/guest_configs/microvm-kernel-ci-aarch64-4.14.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ CONFIG_VIRTIO_CONSOLE=y
13751375
# CONFIG_IPMI_HANDLER is not set
13761376
CONFIG_HW_RANDOM=y
13771377
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
1378-
# CONFIG_HW_RANDOM_VIRTIO is not set
1378+
CONFIG_HW_RANDOM_VIRTIO=y
13791379

13801380
#
13811381
# PCMCIA character devices

0 commit comments

Comments
 (0)