Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
stimages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
glasklar
infra
stimages
Commits
292033da
Verified
Commit
292033da
authored
1 year ago
by
Linus Nordberg
Browse files
Options
Downloads
Patches
Plain Diff
Add support for building stboot UKI's
parent
6a675121
Branches
Branches containing commit
Tags
v0.0.7
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/stboot/build-stboot
+8
-6
8 additions, 6 deletions
contrib/stboot/build-stboot
example.makefile
+13
-9
13 additions, 9 deletions
example.makefile
with
21 additions
and
15 deletions
contrib/stboot/build-stboot
+
8
−
6
View file @
292033da
...
...
@@ -4,18 +4,19 @@ set -eu
[
-z
"
$GOPATH
"
]
&&
{
echo
"
$0
: missing GOPATH"
;
exit
1
;
}
[
-d
"
$GOPATH
"
]
||
{
echo
"
$0
: missing
$GOPATH
"
;
exit
1
;
}
FORMAT
=
"
$1
"
;
shift
STIMAGE_NAME
=
"
$1
"
;
shift
OUT
=
"
$1
"
;
shift
ROOTCERT
=
"
$1
"
;
shift
GOBIN
=
$GOPATH
/bin
STBOOT_VERSION
=
v0.3.4
STBOOT_VERSION
=
v0.3.4
# FIXME: parameterize
OUTDIR
=
"
$(
dirname
"
$OUT
"
)
"
IDIR
=
"
$OUTDIR
/stboot"
# Intermediate output directory
mkdir
-p
"
$IDIR
"
install_dependencies
()
{
go
install
system-transparency.org/stmgr@latest
go
install
system-transparency.org/stmgr@latest
# FIXME: parameterize version
CGO_ENABLED
=
0 go
install
system-transparency.org/stboot@
"
${
STBOOT_VERSION
}
"
}
...
...
@@ -67,20 +68,21 @@ build_archive() {
mv
"
${
out
}
"
.tmp.gz
"
$out
"
}
create_i
so
()
{
create_i
mg
()
{
# stmgr refuses to overwrite target file
[[
-f
"
$OUT
DIR
"
/stboot.iso
]]
&&
mv
"
$OUTDIR
"
/stboot.iso
"
$OUTDIR
"
/stboot.iso
.BAK
[[
-f
"
$OUT
"
]]
&&
mv
"
$OUT
"
"
$OUT
"
.BAK
# NOTE: Simply using an arbitrary stimage kernel will most likely fail with "no modules found matching '/lib/modules/*.ko'"
"
$GOBIN
"
/stmgr uki create
\
-format
iso
\
-format
"
$FORMAT
"
\
-out
"
$OUT
"
\
-kernel
"contrib/stboot/linuxboot.vmlinuz"
\
-cmdline
console
=
ttyS0,115200
\
-initramfs
"
${
IDIR
}
"
/stboot.cpio.gz
}
install_dependencies
create_default_stboot_config
build_archive
"
${
IDIR
}
"
/stboot.cpio.gz
$uroot_files
create_i
so
create_i
mg
This diff is collapsed.
Click to expand it.
example.makefile
+
13
−
9
View file @
292033da
...
...
@@ -26,7 +26,8 @@ CMDLINE = $(BUILD)/$(BINDIST).kcmdline
INITRAMFS = $(BUILD)/$(BINDIST).cpio.gz
CA = keys/rootcert.pem keys/rootkey.pem
KEYS = keys/cert.pem keys/key.pem
STBOOT = $(BUILD)/stboot.iso
STBOOT_ISO = $(BUILD)/stboot.iso
STBOOT_UKI = $(BUILD)/stboot.uki
####################
all: stimage
...
...
@@ -34,10 +35,11 @@ stimage: $(STIMAGE)
kernel: $(KERNEL)
cmdline: $(CMDLINE)
initramfs: $(INITRAMFS)
stboot: $(STBOOT)
stboot-iso stboot: $(STBOOT_ISO)
stboot-uki: $(STBOOT_UKI)
boot: boot-qemu
clean:
-
sudo rm -rf $(BUILD)/rootfs
([ ! -d $(BUILD)/rootfs ] ||
sudo rm -rf $(BUILD)/rootfs
)
-rm -rf $(BUILD)
@echo "NOTE: Leaving keys and guest dir ($(GUEST_DATADIR)). Try make distclean."
distclean: clean
...
...
@@ -59,8 +61,10 @@ $(CMDLINE):
$(INITRAMFS): $(CONFIG)/pkgs/000base.pkglist
./build-initramfs $(CONFIG) $(FLAVOUR) $@ $^
$(STBOOT): keys/rootcert.pem
./contrib/stboot/build-stboot $(STIMAGE_NAME) $@ $^
$(STBOOT_ISO): keys/rootcert.pem
./contrib/stboot/build-stboot iso $(STIMAGE_NAME) $@ $^
$(STBOOT_UKI): keys/rootcert.pem
./contrib/stboot/build-stboot uki $(STIMAGE_NAME) $@ $^
####################
keys/rootcert.pem keys/rootkey.pem:
...
...
@@ -103,7 +107,7 @@ $(GUEST_OVMF_VARS): $(GUEST_DATADIR)/$(GUEST_NAME)
$(GUEST_STDATA): $(GUEST_DATADIR)/$(GUEST_NAME)
./mkstdata.sh $@ $(GUEST_NAME) -dhcp
boot-qemu: $(STBOOT) $(OVMF_CODE) $(GUEST_OVMF_VARS) $(GUEST_STDATA) wwworkaround
boot-qemu: $(STBOOT
_ISO
) $(OVMF_CODE) $(GUEST_OVMF_VARS) $(GUEST_STDATA) wwworkaround
qemu-system-x86_64 \
-drive if=pflash,format=raw,readonly=on,file="$(OVMF_CODE)" \
-drive if=pflash,format=raw,file="$(GUEST_OVMF_VARS)" \
...
...
@@ -113,7 +117,7 @@ boot-qemu: $(STBOOT) $(OVMF_CODE) $(GUEST_OVMF_VARS) $(GUEST_STDATA) wwworkaroun
-rtc base=localtime \
-m $(QEMU_RAM) \
$(DISPLAY_MODE) $(QEMU_STDATA_DRIVE) \
-drive file="$(STBOOT)",format=raw,if=none,media=cdrom,id=drive-cd1,readonly=on \
-drive file="$(STBOOT
_ISO
)",format=raw,if=none,media=cdrom,id=drive-cd1,readonly=on \
-device ahci,id=ahci0 -device ide-cd,bus=ahci0.0,drive=drive-cd1,id=cd1,bootindex=1
.PHONY: wwworkaround boot-qemu
...
...
@@ -128,7 +132,7 @@ VM_NETWORK ?= user
#VM_NETWORK ?= bridge=br0
# NOTE: no nvram=FILE in --boot so guest EFI variables end up in ~/.config/libvirt/qemu/nvram/$(VM_NAME)_VARS.fd
install-vm: $(STBOOT) $(OVMF_CODE) $(GUEST_STDATA) wwworkaround
install-vm: $(STBOOT
_ISO
) $(OVMF_CODE) $(GUEST_STDATA) wwworkaround
virt-install \
--debug \
--name $(GUEST_NAME) \
...
...
@@ -142,7 +146,7 @@ install-vm: $(STBOOT) $(OVMF_CODE) $(GUEST_STDATA) wwworkaround
--memory $(VM_RAM) \
--rng /dev/urandom \
--network $(VM_NETWORK) \
--disk "$(STBOOT)",format=raw,readonly=on \
--disk "$(STBOOT
_ISO
)",format=raw,readonly=on \
--disk "$(GUEST_STDATA)",format=raw
.PHONY: install-vm
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment