Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make host/rootfs/Makefile:run somehow usable on Ubuntu #31

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 5 additions & 1 deletion Documentation/scripts/undocumented-uuids.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/sh -eu
# SPDX-FileCopyrightText: 2022 Alyssa Ross <[email protected]>
# SPDX-FileCopyrightText: 2022 Unikie
# SPDX-License-Identifier: EUPL-1.2+

cd "$(dirname "$0")/../.."

PATTERN='\b[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}\b'
UUID_REFERENCE_PATH=Documentation/uuid-reference.adoc

tmp=$(mktemp)
grep -Eio "$PATTERN" "$UUID_REFERENCE_PATH" | sort -u >$tmp
git ls-files -coz --exclude-standard |
grep -Fxvz "$UUID_REFERENCE_PATH" |
xargs -0 git grep -Ehio --no-index --no-line-number "$PATTERN" -- |
sort -u |
comm -23 - <(grep -Eio "$PATTERN" "$UUID_REFERENCE_PATH" | sort -u)
comm -23 - $tmp
rm -f $tmp
5 changes: 1 addition & 4 deletions host/rootfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,11 @@ build/live.img: $(SCRIPTS)/format-uuid.sh $(SCRIPTS)/make-gpt.sh build/rootfs.ve
run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
$(QEMU_KVM) -cpu host -m 2G \
-machine q35,kernel=$(KERNEL),kernel-irqchip=split,initrd=$(INITRAMFS) \
-display gtk,gl=on \
-qmp unix:vmm.sock,server,nowait \
-monitor vc \
-parallel none \
-drive file=build/live.img,if=virtio,format=raw,readonly=on \
-drive file=$(EXT_FS),if=virtio,format=raw,readonly=on \
-append "console=ttyS0 roothash=$$(< build/rootfs.verity.roothash) ext=/dev/vdb intel_iommu=on" \
-device intel-iommu,intremap=on \
-device virtio-vga-gl \
-device vhost-vsock-pci,guest-cid=3
-device intel-iommu,intremap=on
.PHONY: run
15 changes: 14 additions & 1 deletion scripts/format-uuid.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/sh -eu
#
# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <[email protected]>
# SPDX-FileCopyrightText: 2022 Unikie
# SPDX-License-Identifier: EUPL-1.2+

printf "%s\n" "${1:0:8}-${1:8:4}-${1:12:4}-${1:16:4}-${1:20}"
substr () {
str=$1
beg=$2
end=$3
echo $(echo $str | cut -c $beg-$end)
}

u1=$(substr $1 1 8)
u2=$(substr $1 9 12)
u3=$(substr $1 13 16)
u4=$(substr $1 17 20)
u5=$(substr $1 21 32)
printf "%s\n" "$u1-$u2-$u3-$u4-$u5"
7 changes: 3 additions & 4 deletions scripts/make-gpt.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh -eu
#
# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <[email protected]>
# SPDX-FileCopyrightText: 2022 Unikie
# SPDX-License-Identifier: EUPL-1.2+
#
# usage: make-gpt.sh GPT_PATH PATH:PARTTYPE[:PARTUUID]...
Expand Down Expand Up @@ -38,7 +39,7 @@ scriptsDir="$(dirname "$0")"
out="$1"
shift

nl=$'\n'
nl='\n'
table="label: gpt"

# Keep 1MiB free at the start, and 1MiB free at the end.
Expand All @@ -51,9 +52,7 @@ done

rm -f "$out"
truncate -s "$gptBytes" "$out"
sfdisk "$out" <<EOF
$table
EOF
printf "$table" | sfdisk "$out"

n=0
for partition; do
Expand Down