Add option to turn on/off prelinking

--prelink, --noprelink

do_prelink=[yes|no]
master
Harald Hoyer 2013-09-17 12:23:20 -05:00
parent 3b9aaaab42
commit f4a942783a
3 changed files with 31 additions and 12 deletions

View File

@ -269,6 +269,12 @@ example:
**--nostrip**:: **--nostrip**::
do not strip binaries in the initramfs do not strip binaries in the initramfs


**--prelink**::
prelink binaries in the initramfs (default)

**--noprelink**::
do not prelink binaries in the initramfs

**--hardlink**:: **--hardlink**::
hardlink files in the initramfs (default) hardlink files in the initramfs (default)



View File

@ -67,6 +67,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
*do_strip=*"__{yes|no}__":: *do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes) Strip binaries in the initramfs (default=yes)


*do_prelink=*"__{yes|no}__"::
Prelink binaries in the initramfs (default=yes)

*hostonly=*"__{yes|no}__":: *hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration. instead of a generic host and generate host-specific configuration.

View File

@ -97,6 +97,8 @@ Creates initial ramdisk images for preloading modules
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
--strip Strip binaries in the initramfs --strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs --nostrip Do not strip binaries in the initramfs
--prelink Prelink binaries in the initramfs
--noprelink Do not prelink binaries in the initramfs
--hardlink Hardlink files in the initramfs --hardlink Hardlink files in the initramfs
--nohardlink Do not hardlink files in the initramfs --nohardlink Do not hardlink files in the initramfs
--prefix [DIR] Prefix initramfs files with [DIR] --prefix [DIR] Prefix initramfs files with [DIR]
@ -315,6 +317,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
--long kernel-cmdline: \ --long kernel-cmdline: \
--long strip \ --long strip \
--long nostrip \ --long nostrip \
--long prelink \
--long noprelink \
--long hardlink \ --long hardlink \
--long nohardlink \ --long nohardlink \
--long noprefix \ --long noprefix \
@ -394,6 +398,8 @@ while :; do
--no-early-microcode) early_microcode_l="no";; --no-early-microcode) early_microcode_l="no";;
--strip) do_strip_l="yes";; --strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";; --nostrip) do_strip_l="no";;
--prelink) do_prelink_l="yes";;
--noprelink) do_prelink_l="no";;
--hardlink) do_hardlink_l="yes";; --hardlink) do_hardlink_l="yes";;
--nohardlink) do_hardlink_l="no";; --nohardlink) do_hardlink_l="no";;
--noprefix) prefix_l="/";; --noprefix) prefix_l="/";;
@ -651,6 +657,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l [[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $do_strip ]] || do_strip=yes [[ $do_strip ]] || do_strip=yes
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
[[ $do_prelink ]] || do_prelink=yes
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l [[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
[[ $do_hardlink ]] || do_hardlink=yes [[ $do_hardlink ]] || do_hardlink=yes
[[ $prefix_l ]] && prefix=$prefix_l [[ $prefix_l ]] && prefix=$prefix_l
@ -1251,18 +1259,20 @@ if [[ $kernel_only != yes ]]; then
fi fi
fi fi


PRELINK_BIN="$(command -v prelink)" if [[ $do_prelink == yes ]]; then
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then PRELINK_BIN="$(command -v prelink)"
if [[ $DRACUT_FIPS_MODE ]]; then if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
dinfo "*** Installing prelink files ***" if [[ $DRACUT_FIPS_MODE ]]; then
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache dinfo "*** Installing prelink files ***"
else inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
dinfo "*** Pre-linking files ***" else
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf dinfo "*** Pre-linking files ***"
chroot "$initdir" "$PRELINK_BIN" -a inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
rm -f -- "$initdir/$PRELINK_BIN" chroot "$initdir" "$PRELINK_BIN" -a
rm -fr -- "$initdir"/etc/prelink.* rm -f -- "$initdir/$PRELINK_BIN"
dinfo "*** Pre-linking files done ***" rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"
fi
fi fi
fi fi