[Libguestfs] [PATCH supermin 2/2] docs: Document how to link the init binary with an alternate libc.

Richard W.M. Jones rjones at redhat.com
Wed Feb 17 13:31:13 UTC 2016


Because of the previous commit, it is now possible to link the init
binary using alternate libc's.  This updates the documentation to
describe how to link it using dietlibc.

Using dietlibc reduces the overall size of the initrd substantially.
For libguestfs, 2.6M -> 1.8M.  Though this is still slightly larger
than the initrd using compressed modules (1.4M).
---
 README | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/README b/README
index 56a28f6..fc6689f 100644
--- a/README
+++ b/README
@@ -40,6 +40,8 @@ Requirements
     - This is just used to generate the manpage.
 
   static libc
+    - Can be replaced with dietlibc (and maybe other alternate libc).
+      See section ``Alternate libc'' below.
 
   bash
 
@@ -144,3 +146,25 @@ Feedback and bugs
 Send feedback to libguestfs at redhat.com.  You can file bugs in
 https://bugzilla.redhat.com/ (under "Fedora", "supermin")
 
+Alternate libc
+--------------
+
+Supermin uses a small, statically linked "init" binary.  Normally this
+is linked to static glibc, but static glibc produces enormous binaries
+(800KB+).  You can use an alternate libc if you prefer.  For example,
+using dietlibc, I can build a 22K init, about 1/40th of the size.
+
+$ ls -l src/init
+-rwxrwxr-x. 1 rjones rjones 21736 Feb 17 13:10 src/init
+
+- Dietlibc
+
+For dietlibc, build supermin as normal, and then do:
+
+  cd src
+  rm init init-init.o
+  make init CC="diet gcc"
+  make
+
+which rebuilds the init using dietlibc, and then rebuilds supermin
+with the dietlibc-using init binary.
-- 
2.5.0




More information about the Libguestfs mailing list