From: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
To: <openembedded-devel@lists.openembedded.org>
Subject: [meta-initramfs][PATCH 1/2] initramfs-debug: add simple init script for debugging
Date: Thu, 2 Apr 2015 18:23:01 +0300 [thread overview]
Message-ID: <1427988182-26274-1-git-send-email-dmitry_eremin@mentor.com> (raw)
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
next reply other threads:[~2015-04-02 15:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 15:23 Dmitry Eremin-Solenikov [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427988182-26274-1-git-send-email-dmitry_eremin@mentor.com \
--to=dmitry_eremin@mentor.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.