From 76a9e5e67c0f3a521d11311df4d2594acddb6dc4 Mon Sep 17 00:00:00 2001 From: cheloha Date: Mon, 28 Nov 2022 14:56:31 +0000 Subject: [PATCH] rc(8): reorder_libs: print names of relinked libraries When booting from slow media, the boot can appear to stall at the "reordering libs" line for quite some time. For my example, my G4 PowerMac booting from USB 1.1 takes a full minute to reorder the libraries. Let's print the name of each library before it is relinked. This gives the operator a better sense of what the machine is doing. In particular, it signals to the operator that the machine did not hang. With input from kn@, deraadt@. Positive feedback from sthen@. Link: https://marc.info/?l=openbsd-tech&m=165914104421476&w=2 ok kn@ --- etc/rc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/etc/rc b/etc/rc index ad7e246217f..6edf56e48ef 100644 --- a/etc/rc +++ b/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.564 2022/08/29 11:51:05 deraadt Exp $ +# $OpenBSD: rc,v 1.565 2022/11/28 14:56:31 cheloha Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the @@ -193,7 +193,7 @@ reorder_libs() { # Remount the (read-only) filesystems in _ro_list as read-write. for _mp in $_ro_list; do if ! mount -u -w $_mp; then - echo ' failed.' + echo '(failed).' return fi done @@ -215,6 +215,7 @@ reorder_libs() { cd $_tmpdir ar x $_liba if [[ $_lib == ld.so ]]; then + echo -n " $_lib" args="-g -x -e _dl_start \ --version-script=Symbols.map --shared -Bsymbolic \ --no-undefined" @@ -225,6 +226,7 @@ reorder_libs() { $_install /usr/libexec/ld.so /usr/libexec/ld.so.save $_install ld.so.test $_lib_dir/ld.so else + echo -n " ${_lib%%.*}" cc -shared -o $_lib $(ls *.so | sort -R) $(<.ldadd) [[ -s $_lib ]] && file $_lib | fgrep -q 'shared object' LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}' @@ -243,9 +245,9 @@ reorder_libs() { done if $_error; then - echo ' failed.' + echo '(failed).' else - echo ' done.' + echo '.' fi } -- 2.20.1