diff --git a/recipes-diya/initramfs/files/debug b/recipes-diya/initramfs/files/debug deleted file mode 100644 index 00bfd7d..0000000 --- a/recipes-diya/initramfs/files/debug +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -# Copyright (C) 2011 O.S. Systems Software LTDA. -# Licensed on MIT - -# Adds support to dynamic debugging of initramfs using bootparam in -# following format: -# shell : starts a shell before and after each module -# shell=before: : starts a shell before is loaded and run -# shell=after: : starts a shell after is loaded and run -# -# shell-debug : run set -x as soon as possible -# shell-debug=before: : run set -x before is loaded and run -# shell-debug=after: : run set -x after is loaded and run - -DEBUG_SHELL="false" - -debug_hook_handler() { - status=$1 - module=$2 - - if [ -n "$bootparam_shell" ] && [ "$bootparam_shell" != "true" ]; then - shell_wanted_status=`expr $bootparam_shell : '\(.*\):.*'` - shell_wanted_module=`expr $bootparam_shell : '.*:\(.*\)'` - - if [ "$shell_wanted_status" = "before" ]; then - shell_wanted_status=pre - else - shell_wanted_status=post - fi - fi - - if [ "$bootparam_shell" = "true" ] || - ( [ "$status" = "$shell_wanted_status" ] && - [ "$module" = "$shell_wanted_module" ] ); then - if [ "$status" = "pre" ]; then - status_msg="before" - else - status_msg="after" - fi - - msg "Starting shell $status_msg $module..." - sh - fi - - if [ -n "$bootparam_shell_debug" ] && [ "$bootparam_shell_debug" != "true" ]; then - shell_debug_wanted_status=`expr $bootparam_shell_debug : '\(.*\):.*'` - shell_debug_wanted_module=`expr $bootparam_shell_debug : '.*:\(.*\)'` - - if [ "$shell_debug_wanted_status" = "before" ]; then - shell_debug_wanted_status=pre - else - shell_debug_wanted_status=post - fi - fi - - if [ "$bootparam_shell_debug" = "true" ] || - ( [ "$status" = "$shell_debug_wanted_status" ] && - [ "$module" = "$shell_debug_wanted_module" ] ); then - if [ "$DEBUG_SHELL" = "true" ]; then - return 0 - fi - - if [ "$status" = "pre" ]; then - status_msg="before" - else - status_msg="after" - fi - - msg "Starting shell debugging $status_msg $module..." - DEBUG_SHELL="true" - set -x - fi -} - -debug_enabled() { - return 0 -} - -debug_run() { - add_module_pre_hook "debug_hook_handler" - add_module_post_hook "debug_hook_handler" -} diff --git a/recipes-diya/initramfs/files/init b/recipes-diya/initramfs/files/init index 3425d17..8ae5d11 100755 --- a/recipes-diya/initramfs/files/init +++ b/recipes-diya/initramfs/files/init @@ -15,19 +15,6 @@ # 'foo' as 'bootparam_foo=true' # 'foo.bar[=value] as 'foo_bar=[value|true]' -# Register a function to be called before running a module -# The hook is called as: -# pre -add_module_pre_hook() { - MODULE_PRE_HOOKS="$MODULE_PRE_HOOKS $1" -} - -# Register a function to be called after running a module -# The hook is called as: -# post -add_module_post_hook() { - MODULE_POST_HOOKS="$MODULE_POST_HOOKS $1" -} # Load kernel module load_kernel_module() { @@ -68,9 +55,6 @@ fatal() { } # Variables shared amoung modules -MODULE_PRE_HOOKS="" # functions to call before running each module -MODULE_POST_HOOKS="" # functions to call after running each module -MODULES_DIR=/init.d # place to look for modules EFI_DIR=/sys/firmware/efi # place to store device firmware information # make mount stop complaining about missing /etc/fstab @@ -122,45 +106,5 @@ fi exec /sbin/init -# active the back light -echo 0 > /sys/class/backlight/backlight/bl_power - -# Load and run modules -for m in $MODULES_DIR/*; do - # Skip backup files - if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then - continue - fi - - module=`basename $m | cut -d'-' -f 2` - debug "Loading module $module" - - # pre hooks - for h in $MODULE_PRE_HOOKS; do - debug "Calling module hook (pre): $h" - eval "$h pre $module" - debug "Finished module hook (pre): $h" - done - - # process module - . $m - - if ! eval "${module}_enabled"; then - debug "Skipping module $module" - continue - fi - - debug "Running ${module}_run" - eval "${module}_run" - - # post hooks - for h in $MODULE_POST_HOOKS; do - debug "Calling module hook (post): $h" - eval "$h post $module" - debug "Finished module hook (post): $h" - done -done - - # Catch all fatal "ERROR: Initramfs failed to initialize the system." diff --git a/recipes-diya/initramfs/files/udev b/recipes-diya/initramfs/files/udev deleted file mode 100644 index 4898b89..0000000 --- a/recipes-diya/initramfs/files/udev +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# Copyright (C) 2011, 2012 O.S. Systems Software LTDA. -# Licensed on MIT - -udev_shutdown_hook_handler() { - status=$1 - module=$2 - if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then - udevadm settle - killall `basename $_UDEV_DAEMON` 2>/dev/null - fi -} - -udev_daemon() { - OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd" - - for o in $OPTIONS; do - if [ -x "$o" ]; then - echo $o - return 0 - fi - done - - return 1 -} - -_UDEV_DAEMON=`udev_daemon` - -udev_enabled() { - if [ -z "$_UDEV_DAEMON" ]; then - msg "WARNING: Cannot find the udev daemon; daemon will not be started in initramfs." - return 1 - fi - - return 0 -} - -udev_run() { - add_module_pre_hook "udev_shutdown_hook_handler" - - mkdir -p /run - mkdir -p /var/run - - # Workaround if console=null, systemd-udevd needs valid stdin, stdout and stderr to work - sh -c "exec 4< /dev/console" || { exec 0> /dev/null; exec 1> /dev/null; exec 2> /dev/null; } - - $_UDEV_DAEMON --daemon - udevadm trigger --action=add - udevadm settle -}