Skip to content

Commit 2218902

Browse files
committed
overlay afterburn: reduce binary size for release profile
In the release profile of Cargo.toml, add `codegen-units = 1`, `strip = true`, and remove `debug = true`, to reduce binary size of afterburn included in production images.
1 parent dcea3eb commit 2218902

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/afterburn-9999.ebuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ PATCHES=(
313313
"${FILESDIR}"/0001-Revert-remove-cl-legacy-feature.patch
314314
"${FILESDIR}"/0002-util-cmdline-Handle-the-cmdline-flags-as-list-of-sup.patch
315315
"${FILESDIR}"/0003-vmware-arm64-unsupported.patch
316+
"${FILESDIR}"/0004-cargo-reduce-binary-size-for-release-profile.patch
316317
)
317318

318319
src_unpack() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From c47aa98230e7b540c88a4551a54fd9348f60b6a9 Mon Sep 17 00:00:00 2001
2+
Message-Id: <c47aa98230e7b540c88a4551a54fd9348f60b6a9.1701862700.git.dpark@linux.microsoft.com>
3+
From: Dongsu Park <dpark@linux.microsoft.com>
4+
Date: Wed, 6 Dec 2023 12:36:24 +0100
5+
Subject: [PATCH] Cargo: reduce binary size for release profile
6+
7+
In the release profile of Cargo.toml, add `codegen-units = 1`,
8+
`strip = true`, and remove `debug = true`, to reduce binary size of
9+
afterburn included in production images.
10+
---
11+
Cargo.toml | 6 ++++--
12+
1 file changed, 4 insertions(+), 2 deletions(-)
13+
14+
diff --git a/Cargo.toml b/Cargo.toml
15+
index da74d909..1cf3213c 100644
16+
--- a/Cargo.toml
17+
+++ b/Cargo.toml
18+
@@ -30,8 +30,10 @@ name = "afterburn"
19+
path = "src/main.rs"
20+
21+
[profile.release]
22+
-# We assume we're being delivered via e.g. RPM which supports split debuginfo
23+
-debug = true
24+
+# Flatcar: Reduce binary size for prod images by using one codegen unit,
25+
+# stripping binary, and removing debug = true.
26+
+codegen-units = 1
27+
+strip = true
28+
29+
[features]
30+
cl-legacy = []
31+
--
32+
2.34.1
33+

0 commit comments

Comments
 (0)