Accepting request 485782 from home:dmolkentin:dracut:drop_binutils

Drop binutils dependency in favor of the lighter elfutils.

OBS-URL: https://build.opensuse.org/request/show/485782
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=295
This commit is contained in:
Daniel Molkentin 2017-04-05 10:20:43 +00:00 committed by Git OBS Bridge
parent c9a514e922
commit 6e554ccafb
3 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From f8d2fa4312ba7989e30b60e5f287c91a1f4b7450 Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <dmolkentin@suse.com>
Date: Mon, 3 Apr 2017 15:23:37 +0200
Subject: [PATCH] Make binutils optional when elfutils are available
Binutils increase the size of initramfs by 36 MB. 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 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index d25da8e3..f4794d1d 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1624,7 +1624,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
@@ -1636,14 +1640,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
--
2.12.0

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 3 13:30:20 UTC 2017 - daniel.molkentin@suse.com
- Drop binutils dependency in favor of elfutils
* add 0512-Make-binutils-optional-when-elfutils-are-available.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Mar 17 10:09:57 UTC 2017 - daniel.molkentin@suse.com Fri Mar 17 10:09:57 UTC 2017 - daniel.molkentin@suse.com

View File

@ -191,6 +191,7 @@ Patch504: 0504-ibft-fix-boot-flag-check.patch
Patch505: 0505-Allow-booting-from-degraded-MD-RAID-arrays.patch Patch505: 0505-Allow-booting-from-degraded-MD-RAID-arrays.patch
Patch507: 0507-Set-TaskMax-inifinite-for-the-emergency-shell.patch Patch507: 0507-Set-TaskMax-inifinite-for-the-emergency-shell.patch
Patch508: 0508-90multipath-start-before-local-fs-pre.target.patch Patch508: 0508-90multipath-start-before-local-fs-pre.target.patch
Patch512: 0512-Make-binutils-optional-when-elfutils-are-available.patch
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: bash BuildRequires: bash
@ -201,9 +202,9 @@ BuildRequires: pkgconfig(systemd) >= 219
Requires: %{_bindir}/get_kernel_version Requires: %{_bindir}/get_kernel_version
Requires: bash Requires: bash
# systemd-sysvinit provides: poweroff, reboot, halt # systemd-sysvinit provides: poweroff, reboot, halt
Requires: binutils
Requires: coreutils Requires: coreutils
Requires: cpio Requires: cpio
Requires: elfutils
Requires: file Requires: file
Requires: filesystem Requires: filesystem
Requires: findutils Requires: findutils
@ -406,6 +407,7 @@ chmod a+x modules.d/91zipl/install_zipl_cmdline.sh
%patch509 -p1 %patch509 -p1
%patch510 -p1 %patch510 -p1
%patch511 -p1 %patch511 -p1
%patch512 -p1
%build %build
%configure\ %configure\