Skip to content

Commit 36ea2a5

Browse files
authored
Merge pull request #35 from flashbots/ilya/move-bob-separate-image
Modularize bob image
2 parents e23cd1e + 228c775 commit 36ea2a5

39 files changed

+397
-385
lines changed

DEVELOPMENT.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ This comprehensive guide covers everything you need to know about developing wit
2222
```
2323
flashboxes/
2424
├── base/ # Core minimal Linux system
25-
│ ├── base.conf # Base mkosi configuration
25+
│ ├── mkosi.conf # Base mkosi configuration
2626
│ ├── mkosi.skeleton/ # Base filesystem overlay
2727
│ └── debloat*.sh # System cleanup scripts
28-
├── bob/ # BoB Searcher sandbox
28+
├── bob-common/ # TEE Searcher common image
29+
├── bob-l1/ # L1 TEE Searcher sandbox image
2930
├── buildernet/ # BuilderNet
3031
├── tdx-dummy/ # TDX test environment
3132
├── kernel/ # Kernel configuration
@@ -58,7 +59,7 @@ chmod +x mkosi.build mkosi.postinst
5859

5960
### Step 2: Create Module Configuration
6061

61-
**`mymodule/mymodule.conf`**:
62+
**`mymodule/mkosi.conf`**:
6263
```ini
6364
[Build]
6465
# Environment variables available in scripts
@@ -89,8 +90,8 @@ BuildPackages=build-essential
8990
**`mymodule.conf`** (in project root):
9091
```ini
9192
[Include]
92-
Include=base/base.conf
93-
Include=mymodule/mymodule.conf
93+
Include=base/mkosi.conf
94+
Include=mymodule/mkosi.conf
9495
```
9596

9697
### Step 4: Build Your Module
@@ -469,7 +470,7 @@ Reproducible builds are essential for security and trust. Here's how to verify y
469470
mkosi --force -I mymodule.conf
470471
cp build/mymodule-image.efi build/first-build.efi
471472

472-
mkosi --force -I mymodule.conf
473+
mkosi --force -I mymodule.conf
473474
cp build/mymodule-image.efi build/second-build.efi
474475

475476
# Compare hashes
@@ -536,7 +537,7 @@ set -e
536537
# Create system user
537538
useradd -r -s /bin/false myapp || true
538539

539-
# Set permissions
540+
# Set permissions
540541
chown myapp:myapp /etc/myapp/config.conf
541542
chmod 600 /etc/myapp/config.conf
542543

@@ -547,7 +548,7 @@ systemctl start myapp.service || true
547548
exit 0
548549
```
549550

550-
### Pre-removal Script
551+
### Pre-removal Script
551552

552553
**`DEBIAN/prerm`**:
553554
```bash
@@ -598,15 +599,15 @@ sudo dpkg -i mypackage-1.0.deb
598599
### Package Scripts Execution Order
599600

600601
1. **Installation**: `preinst` → files copied → `postinst`
601-
2. **Upgrade**: `preinst upgrade` → files copied → `postinst configure`
602+
2. **Upgrade**: `preinst upgrade` → files copied → `postinst configure`
602603
3. **Removal**: `prerm remove` → files removed → `postrm remove`
603604
4. **Purge**: `prerm remove` → files removed → `postrm purge`
604605

605606
For comprehensive .deb creation, see: [Debian New Maintainers' Guide](https://www.debian.org/doc/manuals/maint-guide/)
606607

607608
## Building with Podman (Not Recommended)
608609
For systems without systemd v250+ or where Nix installation isn't feasible, you can use the experimental Podman containerization support. This approach is not recommended due to slower build times and a complex setup process.
609-
1. Configure the Podman daemon to use a storage driver other than OverlayFS
610+
1. Configure the Podman daemon to use a storage driver other than OverlayFS
610611
- The btrfs driver is fastest, but requires that you have a btrfs filesystem
611612
- The storage driver can be configuring by editing `/etc/containers/storage.conf`
612613
2. Build the development container:
@@ -615,7 +616,7 @@ For systems without systemd v250+ or where Nix installation isn't feasible, you
615616
```
616617
3. Create required directories
617618
```
618-
mkdir mkosi.packages mkosi.cache mkosi.builddir build
619+
mkdir mkosi.packages mkosi.cache mkosi.builddir build
619620
```
620621
4. Run the container with proper mounts and privilages
621622
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,4 @@ try to disable apparmor's restriction:
178178
## 📖 Documentation
179179
180180
- [Development Guide](DEVELOPMENT.md) - Comprehensive guide for creating new modules and extending existing ones
181-
- [BOB Module Guide](bob/readme.md) - Detailed documentation for the MEV searcher environment
181+
- [BOB Module Guide](bob-common/readme.md) - Detailed documentation for the MEV searcher environment
File renamed without changes.

bob/mkosi.build renamed to bob-common/mkosi.build

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
22
set -euxo pipefail
33

4-
source scripts/build_rust_package.sh
54
source scripts/make_git_package.sh
65

76
# Compile searchersh
87
mkdir -p "$DESTDIR/usr/bin"
9-
mkosi-chroot gcc -o "$DESTDIR/usr/bin/searchersh" "$SRCDIR/bob/searchersh.c"
8+
mkosi-chroot gcc -o "$DESTDIR/usr/bin/searchersh" "$SRCDIR/bob-common/searchersh.c"
109
chmod 755 "$DESTDIR/usr/bin/searchersh"
1110

1211
# Compile cryptsetup
@@ -18,32 +17,6 @@ make_git_package \
1817
".libs/cryptsetup:/usr/sbin/cryptsetup" \
1918
".libs/libcryptsetup.so.12.11.0:/usr/lib/libcryptsetup.so.12"
2019

21-
# Compile lighthouse
22-
LIGHTHOUSE_BUILD_CMD="
23-
# Switch from jemalloc to the system allocator to fix reproducibility issues
24-
sed -i 's/malloc_utils = { workspace = true, features = \[\"jemalloc\"\] }/malloc_utils = { workspace = true }/' lighthouse/Cargo.toml
25-
sed -i 's/#\[cfg(target_os = \"windows\")\]/#[cfg(not(feature = \"jemalloc\"))]/' lighthouse/src/main.rs
26-
sed -i 's/#\[cfg(not(target_os = \"windows\"))\]/#[cfg(feature = \"jemalloc\")]/' lighthouse/src/main.rs
27-
28-
# Reproducibility flags
29-
export RUSTFLAGS='-C target-cpu=generic -C link-arg=-Wl,--build-id=none -C symbol-mangling-version=v0 -L /usr/lib/x86_64-linux-gnu -l z -l zstd -l snappy'
30-
export CARGO_PROFILE_RELEASE_LTO='thin'
31-
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS='1'
32-
export CARGO_PROFILE_RELEASE_PANIC='unwind'
33-
export CARGO_PROFILE_RELEASE_STRIP='none'
34-
export CARGO_PROFILE_RELEASE_OPT_LEVEL='3'
35-
export CARGO_TERM_COLOR='never'
36-
37-
cargo fetch
38-
DESTDIR=$BUILDROOT cargo build --release --frozen --bin lighthouse --no-default-features --features portable
39-
"
40-
make_git_package \
41-
"lighthouse" \
42-
"v7.1.0" \
43-
"https://github.com/sigp/lighthouse.git" \
44-
"$LIGHTHOUSE_BUILD_CMD" \
45-
"target/release/lighthouse:/usr/bin/lighthouse"
46-
4720
# Build fluent-bit
4821
BUILD_CMD="
4922
export SOURCE_DATE_EPOCH=0

bob/bob.conf renamed to bob-common/mkosi.conf

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[Build]
2-
Environment=LIGHTHOUSE_BINARY KERNEL_CONFIG_SNIPPETS=bob/kernel.config
32
WithNetwork=true
43

54
[Content]
6-
ExtraTrees=bob/mkosi.extra
7-
PostInstallationScripts=bob/mkosi.postinst
8-
BuildScripts=bob/mkosi.build
5+
ExtraTrees=bob-common/mkosi.extra
6+
PostInstallationScripts=bob-common/mkosi.postinst
7+
BuildScripts=bob-common/mkosi.build
98

109
Packages=podman
1110
runc
@@ -32,12 +31,6 @@ Packages=podman
3231
BuildPackages=build-essential
3332
git
3433
gcc
35-
zlib1g-dev
36-
libzstd-dev
37-
libleveldb-dev
38-
libsnappy-dev
39-
libpq-dev
40-
libssl-dev
4134
golang
4235
autoconf
4336
automake
File renamed without changes.

0 commit comments

Comments
 (0)