Skip to content

Commit 2cd3e0c

Browse files
committed
osbuild: add patch to set TMPDIR for mkfs.erofs
This will help reduce the memory requirements of mkfs.erofs. osbuild/osbuild#2020
1 parent 38f966f commit 2cd3e0c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ patch_osbuild() {
172172
cat /usr/lib/coreos-assembler/0001-stages-coreos.live-artifacts-add-erofs-support.patch \
173173
/usr/lib/coreos-assembler/0002-stages-coreos.live-artifacts-update-comments-names-t.patch \
174174
/usr/lib/coreos-assembler/0001-stages-add-more-options-to-qemu-vmdk-disk-type.patch \
175+
/usr/lib/coreos-assembler/0001-stages-coreos.live-artifacts-use-var-tmp-for-mkfs.er.patch \
175176
| patch -d /usr/lib/osbuild -p1
176177

177178
# And then move the files back; supermin appliance creation will need it back
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 31faba33b71feb160f436aaf4c9ac9932cb68830 Mon Sep 17 00:00:00 2001
2+
From: Dusty Mabe <[email protected]>
3+
Date: Fri, 14 Feb 2025 12:23:48 -0500
4+
Subject: [PATCH] stages/coreos.live-artifacts: use /var/tmp for mkfs.erofs
5+
6+
This helps reduce the memory requirements of mkfs.erofs since
7+
it won't be writing to tmpfs (memory backed) storage, which is
8+
what is mounted on /tmp/.
9+
---
10+
stages/org.osbuild.coreos.live-artifacts.mono | 6 +++++-
11+
1 file changed, 5 insertions(+), 1 deletion(-)
12+
13+
diff --git a/stages/org.osbuild.coreos.live-artifacts.mono b/stages/org.osbuild.coreos.live-artifacts.mono
14+
index 302b24d3..a5837deb 100755
15+
--- a/stages/org.osbuild.coreos.live-artifacts.mono
16+
+++ b/stages/org.osbuild.coreos.live-artifacts.mono
17+
@@ -606,10 +606,14 @@ def mkrootfs_metal(paths, workdir, img_metal, fstype, fsoptions, loop_client):
18+
# Note the filename must be exactly "root.[squash|ero]fs"
19+
# because the 35coreos-live dracut module requires it.
20+
if fstype == "erofs":
21+
+ # Set TMPDIR='/var/tmp' to write temporary files into non-tmpfs
22+
+ # (memory backed) storage. This helps reduce memory requirements.
23+
+ # https://github.com/erofs/erofs-utils/issues/13
24+
subprocess.check_call(['mkfs.erofs',
25+
*fsoptions.split(' '),
26+
paths["initrd-rootfs/root.erofs"],
27+
- tmp_rootfs_dir])
28+
+ tmp_rootfs_dir],
29+
+ env=dict(os.environ, TMPDIR='/var/tmp'))
30+
else:
31+
subprocess.check_call(['mksquashfs', tmp_rootfs_dir,
32+
paths["initrd-rootfs/root.squashfs"],
33+
--
34+
2.48.1
35+

0 commit comments

Comments
 (0)