Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SHELL := /usr/bin/env bash
WRAPPER := scripts/env_wrapper.sh

FILE ?= build/latest.efi
SERIAL_CONSOLE ?= false

##@ Help

Expand Down Expand Up @@ -43,8 +44,9 @@ build: setup ## Build the specified module
$(WRAPPER) mkosi --force --image-id $(IMAGE) --include=images/$(IMAGE).conf

# Build module with devtools profile
build-dev: SERIAL_CONSOLE_PROFILE := $(if $(filter true,$(SERIAL_CONSOLE)),serial-console,)
build-dev: setup ## Build module with development tools
$(WRAPPER) mkosi --force --image-id $(IMAGE)-dev --profile=devtools --include=images/$(IMAGE).conf
$(WRAPPER) mkosi --force --image-id $(IMAGE)-dev --profile=devtools,$(SERIAL_CONSOLE_PROFILE) --include=images/$(IMAGE).conf

##@ Utilities

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ make build IMAGE=l2-builder
# Build with development tools
make build-dev IMAGE=flashbox-l1

# Build dev image with serial console + password auth enabled
make build-dev IMAGE=flashbox-l1 SERIAL_CONSOLE=true

# View all available targets
make help
```

#### Serial console

Pass `SERIAL_CONSOLE=true` to enable the serial console service and password authentication. This also sets a fixed root password (`dqSPjo4p`) for SSH login, so only use this for local development/debugging.

### Measuring TDX Boot Process

**Export TDX measurements** for the built image:
Expand Down
2 changes: 0 additions & 2 deletions images/l2-op-rbuilder-bproxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ Include=shared/mkosi.conf
Include=modules/l2/_common/mkosi.conf
Include=modules/l2/_gcp/mkosi.conf
Include=modules/l2/_devtools_users/mkosi.conf
Include=modules/l2/_devtools_no_console/mkosi.conf
Include=modules/l2/_devtools_no_root_login/mkosi.conf
Include=modules/l2/op-rbuilder-bproxy/mkosi.conf
2 changes: 0 additions & 2 deletions images/l2-op-rbuilder.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ Include=shared/mkosi.conf
Include=modules/l2/_common/mkosi.conf
Include=modules/l2/_gcp/mkosi.conf
Include=modules/l2/_devtools_users/mkosi.conf
Include=modules/l2/_devtools_no_console/mkosi.conf
Include=modules/l2/_devtools_no_root_login/mkosi.conf
Include=modules/l2/op-rbuilder/mkosi.conf
2 changes: 0 additions & 2 deletions images/l2-simulator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ Include=shared/mkosi.conf
Include=modules/l2/_common/mkosi.conf
Include=modules/l2/_gcp/mkosi.conf
Include=modules/l2/_devtools_users/mkosi.conf
Include=modules/l2/_devtools_no_console/mkosi.conf
Include=modules/l2/_devtools_no_root_login/mkosi.conf
Include=modules/l2/simulator/mkosi.conf
3 changes: 1 addition & 2 deletions mkosi.profiles/devtools/mkosi.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[Content]
ExtraTrees=mkosi.extra
custom
ExtraTrees=custom
PostInstallationScripts=custom.postinst.d/*.sh

Packages=adjtimex
Expand Down
11 changes: 0 additions & 11 deletions mkosi.profiles/devtools/mkosi.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

set -euxo pipefail

# Enable console service
mkosi-chroot systemctl unmask serial-console.service
mkosi-chroot systemctl add-wants minimal.target serial-console.service

# Deterministically set root password
PASSWORD="dqSPjo4p"
HASH=$(mkosi-chroot openssl passwd -6 -salt salt "$PASSWORD")
mkosi-chroot passwd -u root
mkosi-chroot usermod -p "$HASH" root

# Remove git files in custom/ folder
mkosi-chroot rm /.gitignore /.gitkeep || true

Expand All @@ -20,7 +10,6 @@ if [ -f "$BUILDROOT/etc/default/dropbear" ]; then
sed -i '/^DROPBEAR_EXTRA_ARGS=/s/-[swg] \?//g' "$BUILDROOT/etc/default/dropbear"
else
echo "PermitRootLogin yes" >> "$BUILDROOT/etc/ssh/sshd_config"
echo "PasswordAuthentication yes" >> "$BUILDROOT/etc/ssh/sshd_config"
mkosi-chroot systemctl unmask ssh.service ssh.socket systemd-user-sessions.service
mkosi-chroot systemctl add-wants minimal.target ssh.service systemd-user-sessions.service
fi
2 changes: 2 additions & 0 deletions mkosi.profiles/serial-console/mkosi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Content]
ExtraTrees=serial-console.service:/usr/lib/systemd/system/serial-console.service
16 changes: 16 additions & 0 deletions mkosi.profiles/serial-console/mkosi.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euxo pipefail

# Enable console service
mkosi-chroot systemctl unmask serial-console.service
mkosi-chroot systemctl add-wants minimal.target serial-console.service

# Deterministically set root password
PASSWORD="dqSPjo4p"
HASH=$(mkosi-chroot openssl passwd -6 -salt salt "$PASSWORD")
mkosi-chroot passwd -u root
mkosi-chroot usermod -p "$HASH" root

# Allow login by password
echo "PasswordAuthentication yes" >> "$BUILDROOT/etc/ssh/sshd_config"
5 changes: 0 additions & 5 deletions modules/l2/_devtools_no_console/mkosi.conf

This file was deleted.

22 changes: 0 additions & 22 deletions modules/l2/_devtools_no_console/mkosi.postinst.chroot

This file was deleted.

6 changes: 0 additions & 6 deletions modules/l2/_devtools_no_root_login/mkosi.conf

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions modules/l2/_devtools_no_root_login/mkosi.postinst.chroot

This file was deleted.