[elbe-devel] [PATCH v2 2/2] examples: busybox based rescue initramfs with shared libraries

Holger Dengler dengler at linutronix.de
Mon Sep 11 16:04:57 CEST 2017


This example creates a busybox based rescue initramfs with shared libs.
It can be used as base for rescue filesystems, which requires further
packages. Adding packages to <pkg-list> will increase the size of the
initramfs only by the size of the package itself and its pre-requisits.

Build size:
  - cpio: 11M
  - cpio.gz: 4.9M

Note:
If the basic glibc built-in iconv/gconv modules are sufficient, the
shared modules in /usr/lib/x86_64-linux-gnu/gconv can be removed. This
will save ~6M (cpio) and ~2.5M (cpio.gz) respectively.

Signed-off-by: Holger Dengler <dengler at linutronix.de>
---
 examples/x86_64-pc-rescue-busybox-dyn-cpio.xml | 84 ++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 examples/x86_64-pc-rescue-busybox-dyn-cpio.xml

diff --git a/examples/x86_64-pc-rescue-busybox-dyn-cpio.xml b/examples/x86_64-pc-rescue-busybox-dyn-cpio.xml
new file mode 100644
index 00000000..b189bef0
--- /dev/null
+++ b/examples/x86_64-pc-rescue-busybox-dyn-cpio.xml
@@ -0,0 +1,84 @@
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>x86_64-rescue-image</name>
+		<version>1.0</version>
+		<description>
+			busybox based rescue rfs for x86_64
+			with shared libs
+		</description>
+		<buildtype>amd64</buildtype>
+		<mirror>
+			<primary_host>ftp.de.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>stretch</suite>
+	</project>
+	<target>
+		<hostname>rescue</hostname>
+		<domain>linutronix.de</domain>
+		<passwd>foo</passwd>
+		<console>ttyS0,115200</console>
+		<package>
+			<cpio><name>rescue.cpio</name></cpio>
+		</package>
+		<fstab>
+			<bydev>
+				<source>none</source>
+				<mountpoint>/proc</mountpoint>
+				<fs>
+					<type>proc</type>
+				</fs>
+			</bydev>
+			<bydev>
+				<source>none</source>
+				<mountpoint>/sys</mountpoint>
+				<fs>
+					<type>sysfs</type>
+				</fs>
+			</bydev>
+			<bydev>
+				<source>none</source>
+				<mountpoint>/dev</mountpoint>
+				<fs>
+					<type>devtmpfs</type>
+				</fs>
+			</bydev>
+			<bydev>
+				<source>none</source>
+				<mountpoint>/sys/kernel/debug</mountpoint>
+				<fs>
+					<type>debugfs</type>
+				</fs>
+			</bydev>
+		</fstab>
+		<diet />
+		<norecommend />
+		<finetuning>
+			<!-- Create missing directories -->
+			<mkdir>/dev</mkdir>
+			<mkdir>/bin</mkdir>
+			<mkdir>/sbin</mkdir>
+			<mkdir>/usr/bin</mkdir>
+			<mkdir>/usr/sbin</mkdir>
+			<mkdir>/etc/init.d</mkdir>
+			<!-- Complete Busybox installation -->
+			<raw_cmd>/bin/busybox --install -s</raw_cmd>
+			<ln path="/sbin/init">/init</ln>
+			<!-- minimum dvice nodes (fallback) -->
+			<mknod opts="c 5 0">/dev/tty</mknod>
+			<mknod opts="c 5 1">/dev/console</mknod>
+			<mknod opts="c 1 3">/dev/null</mknod>
+			<!-- Add start script (may be moved to archive) -->
+			<command>echo "#!/bin/sh" | tee    /etc/init.d/rcS</command>
+			<command>echo "mount -a"  | tee -a /etc/init.d/rcS</command>
+			<command>chmod +x /etc/init.d/rcS</command>
+			<!-- Delete documentation and unused files -->
+			<rm>/usr/share</rm>
+		</finetuning>
+		<pkg-list>
+			<pkg>libc6</pkg>
+			<pkg>busybox</pkg>
+		</pkg-list>
+	</target>
+</ns0:RootFileSystem>
-- 
2.14.1




More information about the elbe-devel mailing list