]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make binutils optional when elfutils are available 213/head
authorDaniel Molkentin <dmolkentin@suse.com>
Mon, 3 Apr 2017 13:23:37 +0000 (15:23 +0200)
committerDaniel Molkentin <dmolkentin@suse.com>
Mon, 10 Apr 2017 09:28:04 +0000 (11:28 +0200)
This is intended for minimum host OSes where 36 MB used by binutils
are deemed too expensive. We only need "strip", which exists as eu-strip
in elfutils, which in turn is < 1 MB in size.

Note that the tests (TEST-04-FULL-SYSTEMD/test.sh) still depend on
strip from binutils. It could use sstrip in the future.

dracut.sh

index ccfa31dce7dc87fa8fa743c6bed49dccca709b50..c5474026b9395d40c735f08e68cef82e39dea117 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1605,7 +1605,11 @@ fi
 
 # strip binaries
 if [[ $do_strip = yes ]] ; then
-    for p in strip xargs find; do
+    # Prefer strip from elfutils for package size
+    declare strip_cmd=$(command -v eu-strip)
+    test -z "$strip_cmd" && strip_cmd="strip"
+
+    for p in $strip_cmd xargs find; do
         if ! type -P $p >/dev/null; then
             dinfo "Could not find '$p'. Not stripping the initramfs."
             do_strip=no
@@ -1617,14 +1621,14 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
     dinfo "*** Stripping files ***"
     find "$initdir" -type f \
         -executable -not -path '*/lib/modules/*.ko' -print0 \
-        | xargs -r -0 strip -g 2>/dev/null
+        | xargs -r -0 $strip_cmd -g 2>/dev/null
 
     # strip kernel modules, but do not touch signed modules
     find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
         | while read -r -d $'\0' f || [ -n "$f" ]; do
         SIG=$(tail -c 28 "$f" | tr -d '\000')
         [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
-    done | xargs -r -0 strip -g
+    done | xargs -r -0 $strip_cmd -g
 
     dinfo "*** Stripping files done ***"
 fi