Skip to content

Commit 2d4dc41

Browse files
committed
fixup! busybox: Add patch to allow to boot from overlayfs
1 parent df75250 commit 2d4dc41

File tree

3 files changed

+44
-38
lines changed

3 files changed

+44
-38
lines changed

external/busybox/patches/0001-switch_root-Allow-to-use-on-overlayfs.patch

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 8993e7086444ca9b757b611f98834fa7a4e169c5 Mon Sep 17 00:00:00 2001
2+
From: Alexey Gladkov <legion@kernel.org>
3+
Date: Mon, 16 Jun 2025 09:42:16 +0200
4+
Subject: [PATCH] switch_root: Make filesystem check not fatal
5+
6+
The switch_root utility from util-linux does not fail if rootdev is not
7+
ramfs/tmpfs but only skips removing content from rootdev [1].
8+
9+
This change increases the compatibility of the switch_root utility
10+
between busybox and util_linux.
11+
12+
[1] https://web.git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/sys-utils/switch_root.c#n198
13+
14+
Signed-off-by: Alexey Gladkov <legion@kernel.org>
15+
---
16+
util-linux/switch_root.c | 8 ++++----
17+
1 file changed, 4 insertions(+), 4 deletions(-)
18+
19+
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
20+
index 14139736e..c3fef628b 100644
21+
--- a/util-linux/switch_root.c
22+
+++ b/util-linux/switch_root.c
23+
@@ -245,13 +245,13 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
24+
if ((unsigned)stfs.f_type != RAMFS_MAGIC
25+
&& (unsigned)stfs.f_type != TMPFS_MAGIC
26+
) {
27+
- bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs");
28+
- }
29+
-
30+
- if (!dry_run) {
31+
+ bb_simple_error_msg("root filesystem is not ramfs/tmpfs");
32+
+ } else if (!dry_run) {
33+
// Zap everything out of rootdev
34+
delete_contents("/", rootdev);
35+
+ }
36+
37+
+ if (!dry_run) {
38+
// Overmount / with newdir and chroot into it
39+
if (mount(".", "/", NULL, MS_MOVE, NULL)) {
40+
// For example, fails when newroot is not a mountpoint
41+
--
42+
2.49.0
43+

features/runtime-squashfs/bin/pack-squashfs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ mkdir -p -- \
4242
"$rootdir"/bin \
4343
"$rootdir"/dev \
4444
"$rootdir"/root \
45+
"$rootdir"/sysroot \
4546
"$rootdir"/squash \
4647
"$rootdir"/usr \
4748
#

0 commit comments

Comments
 (0)