summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/initramfs-framework/debug
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2011-12-07 21:23:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-12-08 15:24:28 +0000
commited2ac23c5b47c1aa2d5371f2b4c29f471501928a (patch)
tree5bebed84cb2a46f84134e301365a3a3713258b85 /meta/recipes-core/initrdscripts/initramfs-framework/debug
parent1e459c83e5092b6e1e7d73dce22b29c9e3138607 (diff)
downloadpoky-ed2ac23c5b47c1aa2d5371f2b4c29f471501928a.tar.gz
initramfs-framework: provides a modular initramfs
Provides the API and modules for a modular initramfs. The currently included modules are: * initramfs-module-debug adds support to dynamic debugging of initramfs using bootparams * initramfs-module-udev: enables udev usage * initramfs-module-mdev: enables mdev usage * initramfs-module-e2fs: adds support for ext4, ext3 and ext2 filesystems (From OE-Core rev: 7b69ad2167a1f0e57db82817b98a0cbcb70a0dd3) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/initramfs-framework/debug')
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/debug82
1 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/debug b/meta/recipes-core/initrdscripts/initramfs-framework/debug
new file mode 100644
index 0000000000..00bfd7d3f5
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/debug
@@ -0,0 +1,82 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5# Adds support to dynamic debugging of initramfs using bootparam in
6# following format:
7# shell : starts a shell before and after each module
8# shell=before:<module> : starts a shell before <module> is loaded and run
9# shell=after:<module> : starts a shell after <module> is loaded and run
10#
11# shell-debug : run set -x as soon as possible
12# shell-debug=before:<module> : run set -x before <module> is loaded and run
13# shell-debug=after:<module> : run set -x after <module> is loaded and run
14
15DEBUG_SHELL="false"
16
17debug_hook_handler() {
18 status=$1
19 module=$2
20
21 if [ -n "$bootparam_shell" ] && [ "$bootparam_shell" != "true" ]; then
22 shell_wanted_status=`expr $bootparam_shell : '\(.*\):.*'`
23 shell_wanted_module=`expr $bootparam_shell : '.*:\(.*\)'`
24
25 if [ "$shell_wanted_status" = "before" ]; then
26 shell_wanted_status=pre
27 else
28 shell_wanted_status=post
29 fi
30 fi
31
32 if [ "$bootparam_shell" = "true" ] ||
33 ( [ "$status" = "$shell_wanted_status" ] &&
34 [ "$module" = "$shell_wanted_module" ] ); then
35 if [ "$status" = "pre" ]; then
36 status_msg="before"
37 else
38 status_msg="after"
39 fi
40
41 msg "Starting shell $status_msg $module..."
42 sh
43 fi
44
45 if [ -n "$bootparam_shell_debug" ] && [ "$bootparam_shell_debug" != "true" ]; then
46 shell_debug_wanted_status=`expr $bootparam_shell_debug : '\(.*\):.*'`
47 shell_debug_wanted_module=`expr $bootparam_shell_debug : '.*:\(.*\)'`
48
49 if [ "$shell_debug_wanted_status" = "before" ]; then
50 shell_debug_wanted_status=pre
51 else
52 shell_debug_wanted_status=post
53 fi
54 fi
55
56 if [ "$bootparam_shell_debug" = "true" ] ||
57 ( [ "$status" = "$shell_debug_wanted_status" ] &&
58 [ "$module" = "$shell_debug_wanted_module" ] ); then
59 if [ "$DEBUG_SHELL" = "true" ]; then
60 return 0
61 fi
62
63 if [ "$status" = "pre" ]; then
64 status_msg="before"
65 else
66 status_msg="after"
67 fi
68
69 msg "Starting shell debugging $status_msg $module..."
70 DEBUG_SHELL="true"
71 set -x
72 fi
73}
74
75debug_enabled() {
76 return 0
77}
78
79debug_run() {
80 add_module_pre_hook "debug_hook_handler"
81 add_module_post_hook "debug_hook_handler"
82}