All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-initramfs][PATCH 1/2] initramfs-debug: add simple init script for debugging
@ 2015-04-02 15:23 Dmitry Eremin-Solenikov
  2015-04-02 15:23 ` [meta-initramfs][PATCH 2/2] initramfs-debug-image: tiny debugging initramfs image Dmitry Eremin-Solenikov
  2015-04-03 18:59 ` [meta-initramfs][PATCH 1/2] initramfs-debug: add simple init script for debugging Otavio Salvador
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Eremin-Solenikov @ 2015-04-02 15:23 UTC (permalink / raw)
  To: openembedded-devel

Add a tiny simple debug script that will mount all available virtual
file systems and then execute a shell.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
---
 .../recipes-bsp/initrdscripts/files/init-debug.sh  | 31 ++++++++++++++++++++++
 .../initrdscripts/initramfs-debug_1.0.bb           | 14 ++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 meta-initramfs/recipes-bsp/initrdscripts/files/init-debug.sh
 create mode 100644 meta-initramfs/recipes-bsp/initrdscripts/initramfs-debug_1.0.bb

diff --git a/meta-initramfs/recipes-bsp/initrdscripts/files/init-debug.sh b/meta-initramfs/recipes-bsp/initrdscripts/files/init-debug.sh
new file mode 100644
index 0000000..7edbd70
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/initrdscripts/files/init-debug.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+do_mount_fs() {
+	grep -q "$1" /proc/filesystems || return
+	test -d "$2" || mkdir -p "$2"
+	mount -t "$1" "$1" "$2"
+}
+
+do_mknod() {
+	test -e "$1" || mknod "$1" "$2" "$3" "$4"
+}
+
+mkdir -p /proc
+mount -t proc proc /proc
+
+do_mount_fs sysfs /sys
+do_mount_fs debugfs /sys/kernel/debug
+do_mount_fs devtmpfs /dev
+do_mount_fs devpts /dev/pts
+do_mount_fs tmpfs /dev/shm
+
+mkdir -p /run
+mkdir -p /var/run
+
+do_mknod /dev/console c 5 1
+do_mknod /dev/null c 1 3
+do_mknod /dev/zero c 1 5
+
+exec sh </dev/console >/dev/console 2>/dev/console 
diff --git a/meta-initramfs/recipes-bsp/initrdscripts/initramfs-debug_1.0.bb b/meta-initramfs/recipes-bsp/initrdscripts/initramfs-debug_1.0.bb
new file mode 100644
index 0000000..b7defff
--- /dev/null
+++ b/meta-initramfs/recipes-bsp/initrdscripts/initramfs-debug_1.0.bb
@@ -0,0 +1,14 @@
+SUMMARY = "Extremely basic live image init script"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+SRC_URI = "file://init-debug.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+        install -m 0755 ${WORKDIR}/init-debug.sh ${D}/init
+}
+
+inherit allarch
+
+FILES_${PN} += " /init "
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-03 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 15:23 [meta-initramfs][PATCH 1/2] initramfs-debug: add simple init script for debugging Dmitry Eremin-Solenikov
2015-04-02 15:23 ` [meta-initramfs][PATCH 2/2] initramfs-debug-image: tiny debugging initramfs image Dmitry Eremin-Solenikov
2015-04-03 19:01   ` Otavio Salvador
2015-04-03 18:59 ` [meta-initramfs][PATCH 1/2] initramfs-debug: add simple init script for debugging Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.