aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/runx/runx/0001-make-initrd-allow-externally-provided-busybox.patch
blob: 3c7e97c237a77c1e129fc9a7f5c098de146f6db7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 4a128a3d1bc3b069ac12d3d61f79bc001340a8b7 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Fri, 26 Mar 2021 10:55:49 -0400
Subject: [PATCH] make-initrd: allow externally provided busybox

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 initrd/make-initrd | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/initrd/make-initrd b/initrd/make-initrd
index 21170e8..939f71d 100755
--- a/initrd/make-initrd
+++ b/initrd/make-initrd
@@ -35,6 +35,8 @@ then
     cp $busybox_src_config .config
     make -j "$(getconf _NPROCESSORS_ONLN)"
     export busybox="$busybox_image"
+else
+    echo "busybox: using externally provided binary"
 fi
 
 
@@ -48,10 +50,24 @@ mkdir -p $tmpdir/lib
 mkdir -p $tmpdir/var
 mkdir -p $tmpdir/mnt
 cp "$busybox" $tmpdir/bin/busybox
-for i in `cat "$base"/applet-list`
-do
-    ln -s /bin/busybox $tmpdir/bin/$i
-done
+
+if [ -n "$CROSS_COMPILE" ]; then
+    echo "cross compiling, busybox --install emulation"
+    if [ -n "$QEMU_USER" ]; then
+        $QEMU_USER $tmpdir/bin/busybox --install $tmpdir/bin
+    else
+        echo "QEMU_USER is not defined, default binary symlinks will be available"
+	for i in `cat "$base"/applet-list`
+	do
+	    ln -s /bin/busybox $tmpdir/bin/$i
+	done
+    fi
+else
+    for i in `cat "$base"/applet-list`
+    do
+        ln -s /bin/busybox $tmpdir/bin/$i
+    done
+fi
 
 mkdir -p $tmpdir/etc/init.d
 cp $init $tmpdir/etc/init.d/rcS
-- 
2.19.1