Skip to content

Commit e23cd1e

Browse files
authored
Merge pull request #39 from flashbots/readme-lima
Readme changes to reflect lima build process
2 parents 314ba7d + c1cb909 commit e23cd1e

File tree

1 file changed

+96
-39
lines changed

1 file changed

+96
-39
lines changed

README.md

Lines changed: 96 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
**Reproducible hardened Linux images for confidential computing and safe MEV**
44

5-
This repository provides a toolkit for building minimal, hardened Linux images designed for confidential computing environments and MEV (Maximum Extractable Value) applications. Built on mkosi and Nix, it provides reproducible, security-focused Linux distributions with strong network isolation, attestation capabilities, and blockchain infrastructure support.
5+
This repository provides a toolkit for building minimal, hardened Linux images
6+
designed for confidential computing environments and MEV (Maximum Extractable
7+
Value) applications. Built on mkosi and Nix, it provides reproducible,
8+
security-focused Linux distributions with strong network isolation, attestation
9+
capabilities, and blockchain infrastructure support.
610

7-
It contains our [bottom-of-block searcher sandbox](https://collective.flashbots.net/t/searching-in-tdx/3902) infrastructure and will soon contain our [BuilderNet](https://buildernet.org/blog/introducing-buildernet) infrastructure as well, along with any future TDX projects we implement.
11+
It contains our [bottom-of-block searcher sandbox](https://collective.flashbots.net/t/searching-in-tdx/3902)
12+
infrastructure and will soon contain our [BuilderNet](https://buildernet.org/blog/introducing-buildernet)
13+
infrastructure as well, along with any future TDX projects we implement.
814

9-
For more information about this repository, see [the Flashbots collective post](https://collective.flashbots.net/t/beyond-yocto-exploring-mkosi-for-tdx-images/4739).
15+
For more information about this repository, see
16+
[the Flashbots collective post](https://collective.flashbots.net/t/beyond-yocto-exploring-mkosi-for-tdx-images/4739).
1017

1118
## 🌟 Features
1219

@@ -19,57 +26,27 @@ For more information about this repository, see [the Flashbots collective post](
1926

2027
### Prerequisites
2128

22-
0. Make sure you're running systemd v250 or greater. Alternatively, you can utilize experimental [container support](DEVELOPMENT.md#building-with-podman-not-recommended).
23-
24-
1. **Install Nix** (single user mode is sufficient):
25-
```bash
26-
sh <(curl -L https://nixos.org/nix/install) --no-daemon
27-
```
28-
29-
2. **Enable Nix experimental features** in `~/.config/nix/nix.conf`:
30-
```
31-
experimental-features = nix-command flakes
32-
```
33-
34-
3. **Install Debian archive keyring** (temporary requirement):
35-
```bash
36-
# On Ubuntu/Debian
37-
sudo apt install debian-archive-keyring
38-
# On other systems, download via package manager or use Docker approach below
39-
```
29+
In order to build images, you'll need to install [Lima](https://lima-vm.io/) for your operating system. Building images without Lima is possible, but due to inconsistencies between distributions, it is not supported for generating official reproducible images.
4030

4131
### Building Images
4232

43-
**Using Make (Recommended)**:
4433
```bash
4534
# Build the BOB (searcher sandbox) image
4635
make build IMAGE=bob
4736

48-
# Build the Buildernet image
37+
# Build the Buildernet image
4938
make build IMAGE=buildernet
5039

40+
# Build the l2 builder image
41+
make build IMAGE=l2-builder
42+
5143
# Build with development tools
5244
make build-dev IMAGE=bob
5345

5446
# View all available targets
5547
make help
5648
```
5749

58-
**Manual Build**:
59-
```bash
60-
# Enter the development environment
61-
nix develop -c $SHELL
62-
63-
# Build a specific image
64-
mkosi --force -I bob.conf
65-
mkosi --force -I buildernet.conf
66-
67-
# Build with profiles
68-
mkosi --force -I bob.conf --profile=devtools
69-
mkosi --force -I bob.conf --profile=azure
70-
mkosi --force -I bob.conf --profile=azure,devtools
71-
```
72-
7350
### Measuring TDX Boot Process
7451

7552
**Export TDX measurements** for the built image:
@@ -116,7 +93,87 @@ This generates measurement files in the `build/` directory for attestation and v
11693
# ... rest of options same as above
11794
```
11895

119-
> Depending on your Linux distro, these commands may require changing the supplied OVMF paths or installing your distro's OVMF package.
96+
> [!NOTE]
97+
>
98+
> Depending on your Linux distro, these commands may require changing the
99+
> supplied OVMF paths or installing your distro's OVMF package.
100+
101+
> [!NOTE]
102+
>
103+
> Running `systemctl status` generates a report with an `unmerged-bin` taint. That's
104+
> expected.
105+
>
106+
> See [bug report #1085370](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085370)
107+
> for details.
108+
109+
## Building Without Lima (Unsupported)
110+
111+
### Prerequisites
112+
113+
1. **Install Nix** (single user mode is sufficient):
114+
115+
```bash
116+
sh <(curl -L https://nixos.org/nix/install) --no-daemon
117+
```
118+
119+
2. **Enable Nix experimental features** in `~/.config/nix/nix.conf`:
120+
121+
```conf
122+
experimental-features = nix-command flakes
123+
```
124+
125+
3. **Install Debian archive keyring** (temporary requirement):
126+
127+
```bash
128+
# On Ubuntu/Debian
129+
sudo apt install debian-archive-keyring
130+
# On other systems, download via package manager or use Docker approach below
131+
```
132+
133+
### Building
134+
135+
```bash
136+
# Enter the development environment
137+
nix develop -c $SHELL
138+
139+
# Build a specific image
140+
mkosi --force -I bob.conf
141+
mkosi --force -I buildernet.conf
142+
143+
# Build with profiles
144+
mkosi --force -I bob.conf --profile=devtools
145+
mkosi --force -I bob.conf --profile=azure
146+
mkosi --force -I bob.conf --profile=azure,devtools
147+
```
148+
149+
### Troubleshooting
150+
151+
- If you encounter `mkosi was forbidden to unshare namespaces`, try
152+
adding an apparmor profile like so:
153+
154+
```bash
155+
sudo cat <<EOF > /etc/apparmor.d/mkosi
156+
abi <abi/4.0>,
157+
include <tunables/global>
158+
159+
/nix/store/*-mkosi-*/bin/mkosi flags=(default_allow) {
160+
userns,
161+
}
162+
EOF
163+
164+
sudo systemctl reload apparmor
165+
```
166+
167+
- If you encounter `unshare: setgroups failed: Operation not permitted`,
168+
try to disable apparmor's restriction:
169+
170+
```bash
171+
sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0
172+
173+
sudo -c 'echo "kernel.apparmor_restrict_unprivileged_userns=0" >> /etc/sysctl.conf'
174+
```
175+
176+
- If you encounter `bootctl: unrecognized option '--root=/buildroot'`, you'll need to upgrade to a newer version of systemd (at least v250), which is only supported by recent versions of Ubuntu.
120177
121178
## 📖 Documentation
122179

0 commit comments

Comments
 (0)