Recently I've been doing some MIPS64 stuff on my EdgeRouter PoE.  It
has a USB disk, two 500MHz processors, and 512MB of RAM.

So, every time I reboot to test the next iteration of my kernel
patch, I get to here:

        reordering libraries: 

and I sit there for half a minute or more and wonder what the hell
it's doing.

And, in my intellectual brain, I know it's relinking the libraries
and that this is slow because it needs to link a bunch of object files
and my machine is slow and my disk is slow and I have almost no RAM.

But!  My animal brain wishes I could see some indication of progress.
Because the script has told me it is linking more than one library.
So, as with daemon startup, I am curious which library it is working
on at any given moment.

Can we print the library names as they are being relinked?

With the attached patch the boot now looks like this:

        reordering libraries: ld.so libc.so.96.1 libcrypto.so.49.1.

We print the library name before it is relinked, so you can know which
library it is linking.

If for some reason we fail on a particular library, it instead looks
like this:

        reordering libraries: ld.so(failed).

... which is me trying to imitate what we do for daemon startup.

Thoughts?

I know this makes rc(8) a bit noisier but it really does improve my
(for want of a better term) "user experience" as I wait for my machine
to boot.

Index: rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.563
diff -u -p -r1.563 rc
--- rc  28 Jul 2022 16:06:04 -0000      1.563
+++ rc  30 Jul 2022 00:15:26 -0000
@@ -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
@@ -210,6 +210,7 @@ reorder_libs() {
                _install='install -F -o root -g bin -m 0444'
                _lib=${_liba##*/}
                _lib=${_lib%.a}
+               echo -n " $_lib"
                _lib_dir=${_liba#$_relink}
                _lib_dir=${_lib_dir%/*}
                cd $_tmpdir
@@ -243,9 +244,9 @@ reorder_libs() {
        done
 
        if $_error; then
-               echo ' failed.'
+               echo '(failed).'
        else
-               echo ' done.'
+               echo '.'
        fi
 }
 

Reply via email to