Skip to content

Commit 0e37839

Browse files
author
Ubuntu
committed
wip
1 parent 865b9f8 commit 0e37839

File tree

7 files changed

+54
-4
lines changed

7 files changed

+54
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# mkosi artifacts
22

33
build/
4+
build.*/
45
env.json
56
mkosi.builddir/
67
mkosi.cache/

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,38 @@ build-dev: check-perms setup ## Build module with development tools
5050

5151
##@ Utilities
5252

53+
check-repro: ## Build same module twice and compare resulting images
54+
@rm -rf build.1
55+
@rm -rf build.2
56+
57+
@rm -rf build/* mkosi.builddir/* mkosi.cache/* mkosi.packages/*
58+
@sleep 5
59+
60+
@echo "Building image #1..."
61+
$(WRAPPER) mkosi --force -I $(IMAGE).conf
62+
@cp -r build build.1
63+
64+
@rm -rf build/* mkosi.builddir/* mkosi.cache/* mkosi.packages/*
65+
@sleep 5
66+
67+
@echo "Building image #2..."
68+
$(WRAPPER) mkosi --force -I $(IMAGE).conf
69+
@cp -r build build.2
70+
71+
@echo "Comparing..."
72+
73+
@echo ""
74+
@sha256sum build.1/tdx-debian.vmlinuz
75+
@sha256sum build.2/tdx-debian.vmlinuz
76+
77+
@echo ""
78+
@sha256sum build.1/tdx-debian.initrd
79+
@sha256sum build.2/tdx-debian.initrd
80+
81+
@echo ""
82+
@sha256sum build.1/tdx-debian.efi
83+
@sha256sum build.2/tdx-debian.efi
84+
5385
measure: ## Export TDX measurements for the built EFI file
5486
@if [ ! -f build/tdx-debian.efi ]; then \
5587
echo "Error: build/tdx-debian.efi not found. Run 'make build' first."; \

kernel/mkosi.build

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ if [[ -n "${KERNEL_CONFIG_SNIPPETS:-}" ]]; then
1515
IFS=',' read -ra snippets <<< "$KERNEL_CONFIG_SNIPPETS"
1616
for snippet in "${snippets[@]}"; do
1717
snippet_file="$SRCDIR/$snippet"
18-
[[ -f "$snippet_file" ]] && cat "$snippet_file" >> "$config_file"
18+
if [[ -f "$snippet_file" ]]; then
19+
cat "$snippet_file" >> "$config_file" || true
20+
fi
1921
done
2022
fi
23+
for snippets_var in "${!KERNEL_CONFIG_SNIPPETS_@}"; do
24+
IFS=',' read -ra snippets <<< "${!snippets_var}"
25+
for snippet in "${snippets[@]}"; do
26+
snippet_file="$SRCDIR/$snippet"
27+
if [[ -f "$snippet_file" ]]; then
28+
cat "$snippet_file" >> "$config_file" || true
29+
fi
30+
done
31+
done
2132

2233
# Calculate cache key and paths
2334
config_hash=$(sha256sum "$config_file" | cut -d' ' -f1 | cut -c1-12)
@@ -43,6 +54,9 @@ else
4354
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" make olddefconfig
4455
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" make -j "$(nproc 2>/dev/null || echo 2)" bzImage ARCH=x86_64 CONFIG_EFI_STUB=y
4556

57+
echo "# kernel config:"
58+
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" cat .config
59+
4660
# Cache result
4761
mkdir -p "$cache_dir"
4862
cp arch/x86_64/boot/bzImage "$cache_dir/"

l2/kernel.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
CONFIG_NET_VENDOR_GOOGLE=y
2-
CONFIG_GVE=y
31
CONFIG_XFS_FS=y

l2/mkosi.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Include=base/mkosi.conf
55
Profiles=gcp
66

77
[Build]
8-
Environment=KERNEL_CONFIG_SNIPPETS=kernel/snippets/ubuntu.config,l2/kernel.config
8+
Environment=KERNEL_CONFIG_SNIPPETS_L2=kernel/snippets/ubuntu.config,l2/kernel.config
99
WithNetwork=true
1010

1111
[Content]

mkosi.profiles/gcp/kernel.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_NET_VENDOR_GOOGLE=y
2+
CONFIG_GVE=y

mkosi.profiles/gcp/mkosi.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[Build]
2+
Environment=KERNEL_CONFIG_SNIPPETS_GCP=mkosi.profiles/gcp/kernel.config
3+
14
[Content]
25
ExtraTrees=mkosi.extra
36

0 commit comments

Comments
 (0)