initramfs-uniboot: Add support for early-init plugins.
authorPaul Sokolovsky <pmiscml@gmail.com>
Sat, 8 Mar 2008 18:37:36 +0000 (18:37 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Sat, 8 Mar 2008 18:37:36 +0000 (18:37 +0000)
* Extend plugin protocol: plugins matching pattern '0*' are early-init,
executed ASAP after boot, before kernel command and block devices are scanned.
And thus, they can affect parsing of kernel command line (by overriding $CMDLINE)
or detection of block devices (e.g. by loading additional modules).

packages/initrdscripts/files/init.sh
packages/initrdscripts/initramfs-uniboot_1.0.bb

index 8b9fe12..e250e39 100644 (file)
@@ -25,7 +25,7 @@ dev_setup()
 }
 
 read_args() {
-    CMDLINE=`cat /proc/cmdline`
+    [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
     for arg in $CMDLINE; do
         optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
         case $arg in
@@ -40,7 +40,7 @@ read_args() {
 }
 
 load_modules() {
-    for module in $MODULE_DIR/*; do
+    for module in $MODULE_DIR/$1; do
         echo "initramfs: Loading $module module"
         source $module
     done
@@ -60,6 +60,7 @@ fatal() {
 
 echo "Starting initramfs boot..."
 early_setup
+load_modules '0*'
 read_args
 
 if [ -n "$rootdelay" ]; then
@@ -69,7 +70,8 @@ fi
 
 dev_setup
 
-load_modules
+load_modules '[1-9]*'
+
 [ -n "$BOOT_ROOT" ] && boot_root
 
 fatal "No valid root device was specified.  Please add root=/dev/something to the kernel command-line and try again."
index e0f7265..10c9459 100644 (file)
@@ -1,5 +1,5 @@
 SRC_URI = "file://init.sh"
-PR = "r4"
+PR = "r5"
 DESCRIPTON = "A modular initramfs init script system."
 RRECOMMENDS = "kernel-module-mtdblock"