[blfs-support] Thoughts on 'init-functions' and bootscript files

alex lupu alupu01 at gmail.com
Sat May 5 13:43:57 PDT 2012


There are "extraneous" messages, like from Udev and
USB mouse/keyboard (if any), which interfere with B/LFS
bootscript console display output.
That makes the boot-up display confusing and hard to read at times.

To illustrate, an excerpt from the console boot display where
at best you get "orphan" star lines as shown
(in "real" case you get a lot of extra cruft interspersed with
the bootscript messages):

...
     Activating all swap files/partitions...Adding 514076k swap on /dev/sda4.
Priority:1 extents:1 across:514076k
  *                                                                [  OK  ]
  *  Mounting root file system in read-only mode...                [  OK  ]
     Checking file systems: /dev/sda3: clean, 360574/1564672 files,
3197887/6247276 blocks
  *                                                                [  OK  ]
...
Starting ALSA sound...
  *                                                                [  OK  ]
-------------------------------------------------------------------------------
To remedy this, I made some changes in
the 'init-functions' and some bootscript files.
Note:  I dared touch the 'init-functions' file because it needs some
       clean up consistency-wise, anyway
       (log_success_msg, log_failure_msg come to mind)

Basically, in 'init-functions'

1.  Consolidated the display in one single "echo", eliminating the
possibility that some other entity will sneak in its interference text:

log_success_msg3()      (excerpt)
{

     local MSG="$@"
     # Write message to console in one single shot
     echo -e "${CURS_ZERO}${SUCCESS_PREFIX}$MSG${SET_COL}${SUCCESS_SUFFIX}"
...
}

log_failure_msg3() ...

2.  Created the possibility of displaying a message in the return evaluation:

evaluate_retval2()
{
    local error_value="${?}"

    if [ ${error_value} = 0 ]; then
       log_success_msg3 ${1}
    else
       log_failure_msg3 ${1}

3.  In the bootscripts prone to interference,
 appropriate changes have been made
 (using an excerpt from 'swap' as an example):

-Before:
   start)
      log_info_msg "Activating all swap files/partitions..."
      swapon -a
      evaluate_retval

-After:
   start)
      swapon -a
      evaluate_retval2 "Activating all swap files/partitions..."

------------------------------------------------------------------

With these changes, the above boot-up display excerpt becomes:

Adding 514076k swap on /dev/sda4.  Priority:1 extents:1 across:514076k
  *  Activating all swap files/partitions...                        [  OK  ]
  *  Mounting root file system in read-only mode...                 [  OK  ]
     Checking file systems: /dev/sda3: clean, 360437/1564672 files,
3197573/6247276 blocks
  *  Checked the file systems.                                      [  OK  ]
...
  *  Starting ALSA sound...                                         [  OK  ]

------

For information (and comments) only,
-- Alex



More information about the blfs-support mailing list