Pierre posted a proposed patch to the initramfs instructions in ticket 
3298.  I'd like to discuss the changes here (not exactly in order).

-  if [ "$2" == "lib" ]; then
-    file=$(PATH=/lib:/usr/lib type -p $1)
+  if [ "$2" = "lib" ]; then
+    file=$(find /lib /usr/lib -maxdepth 1 -name $1 | head -n 1)
    else
-    file=$(type -p $1)
+    file=$(find /bin /usr/bin /sbin /usr/sbin -maxdepth 1 -name $1 | 
head -n 1)
    fi

This segment is in a script that explicitly has #!/bin/bash as the 
shell, so "==" is quite as valid as "=".  Also the `type` command is a 
bash builtin.  The changes do the same thing as the current code but 
with a different style.  I don't think changes are needed.

-binfiles="sh cat cp dd killall ls lsmod mkdir mknod mount "
+binfiles="bash cat cp dd killall ls mkdir mknod mount"

+ln -s bash $WDIR/bin/sh

sh is needed in the case where the user has /bin/sh linked to something 
other than bash.  We could do a test and either add the other file or 
create a symlink to bash.

-sbinfiles="udevadm udevd modprobe blkid switch_root mdadm"
+sbinfiles="udevadm modprobe blkid switch_root"

+# Add mdadm if present
+if [ -x /sbin/mdadm ] ; then sbinfiles="$sbinfiles mdadm"; fi
+
+# Add udevd if present in /sbin (newer versions of udev have it in
+# /lib/udev)
+if [ -x /sbin/udevd ] ; then sbinfiles="$sbinfiles udevd"; fi

OK, but what about the case when udevd is in /lib/udev/?  Perhaps we 
should copy it to sbin in the initramfs instead of leaving it in 
/lib/udev.  We also need to make sure that we get all the libraries that 
udevd needs (e.g. libblkid.so.1).

-# Create a temporrary working directory
+# Create a temporary working directory

OK, typo.

-  ln -s lvm $WDIR/sbin/lvchange
-  ln -s lvm $WDIR/sbin/lvchange

We could do that or change these to other lv commands: lvrename, 
lvextend, etc.  These are only here if the boot fails and drops back to 
the shell within the initramfs.


# Install libraries
  sort $unsorted | uniq | while read lib ; do
+  lib=$(basename $lib)
    if [ "$lib" == "linux-vdso.so.1" ] ||
       [ "$lib" == "linux-gate.so.1" ]; then
      continue
    fi

-  copy $library lib
+  copy $lib lib
  done

I'd prefer to fix this with:

  sort $unsorted | uniq | while read library ; do
    if [ "$library" == "linux-vdso.so.1" ] ||
       [ "$library" == "linux-gate.so.1" ]; then
      continue
    fi

   copy $library lib
  done

The $lib and text string "lib" are a little confusing.

+  cp /lib/modules/$KERNEL_VERSION/modules.{builtin,order} \
+        $WDIR/lib/modules/$KERNEL_VERSION

OK.

(In init.in)
-udevd --daemon --resolve-names=never
+if [ -x /sbin/udevd ]; then
+UDEV_PATH=/sbin
+else
+UDEV_PATH=/lib/udev
+fi
+
+${UDEV_PATH}/udevd --daemon --resolve-names=never

-killall -w /sbin/udevd
+killall -w $UDEV_PATH/udevd

OK.  Why udev changed and put a daemon executable in a library directory 
is beyond me.

Thanks for the review.

   -- Bruce

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to