Skip to contentSkip to conversation

initramfs-framework: provides a modular initramfs

PATCH Applied Otavio Salvador 3 participants 4 messages Dec 7, 2011 – Dec 20, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 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

---
 .../initrdscripts/initramfs-framework/debug        |   82 ++++++++++++
 .../initrdscripts/initramfs-framework/e2fs         |   28 ++++
 .../initrdscripts/initramfs-framework/finish       |   46 +++++++
 .../initrdscripts/initramfs-framework/init         |  136 ++++++++++++++++++++
 .../initrdscripts/initramfs-framework/mdev         |   30 +++++
 .../initrdscripts/initramfs-framework/udev         |   22 +++
 .../initrdscripts/initramfs-framework_1.0.bb       |   57 ++++++++
 7 files changed, 401 insertions(+), 0 deletions(-)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/debug
 create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/e2fs
 create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/finish
 create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/init
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/mdev
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/udev
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
meta/recipes-core/initrdscripts/initramfs-framework/debug new file +82 -0
new file mode 100644
index 0000000..00bfd7d
@@ -0,0 +1,82 @@
+#!/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:<module> : starts a shell before <module> is loaded and run
+#   shell=after:<module>  : starts a shell after <module> is loaded and run
+#
+#   shell-debug                 : run set -x as soon as possible
+#   shell-debug=before:<module> : run set -x before <module> is loaded and run
+#   shell-debug=after:<module>  : run set -x after <module> 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"
+}
meta/recipes-core/initrdscripts/initramfs-framework/e2fs new file +28 -0
new file mode 100755
index 0000000..29f801a
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+e2fs_enabled() {
+	return 0
+}
+
+e2fs_run() {
+	filesystems="ext4 ext3 ext2"
+
+	# load modules
+	for fs in $filesystems; do
+		load_kernel_module $fs
+	done
+
+	for fs in $filesystems; do
+		eval "fs_options=\$bootparam_${fs}"
+		if [ -n "$fs_options" ]; then
+		    dev=`expr "$fs_options" : '\([^:]*\).*'`
+		    path=`expr "$fs_options" : '[^:]*:\([^:]*\).*'`
+
+		    info "Mounting $dev as $fs on $path as $fs..."
+			mkdir -p $path
+		    mount -t $fs $dev $path
+		fi
+	done
+}
meta/recipes-core/initrdscripts/initramfs-framework/finish new file +46 -0

46 lines not on this page · raw message

meta/recipes-core/initrdscripts/initramfs-framework/init new file +136 -0

136 lines not on this page · raw message

meta/recipes-core/initrdscripts/initramfs-framework/mdev new file +30 -0
new file mode 100644
index 0000000..a5df1d7
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+mdev_enabled() {
+	if [ ! -e /sbin/mdev ]; then
+		debug "/sbin/mdev doesn't exist"
+		return 1
+	fi
+
+	return 0
+}
+
+mdev_run() {
+	# setup the environment
+	mount -t tmpfs tmpfs /dev
+
+	mkdir -m 1777 /dev/shm
+
+	mkdir -m 0755 /dev/pts
+	mount -t devpts devpts /dev/pts
+
+	echo /sbin/mdev > /proc/sys/kernel/hotplug
+	mdev -s
+
+	# load modules for devices
+	find /sys -name modalias | while read m; do
+		load_kernel_module $(cat $m)
+	done
+}
meta/recipes-core/initrdscripts/initramfs-framework/udev new file +22 -0
new file mode 100644
index 0000000..9ea8aa3
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+udev_enabled() {
+	if [ ! -e /sbin/udevd ]; then
+		debug "/sbin/udev doesn't exist"
+		return 1
+	fi
+
+	return 0
+}
+
+udev_run() {
+	mkdir -p /run
+
+	udevd --daemon > /dev/null
+	udevadm trigger --action=add
+	udevadm settle
+
+	killall udevd 2>/dev/null
+}
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.7.2.5
Applied
#2 lore raw
Quoted 23 lines · Otavio Salvador

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

---
  .../initrdscripts/initramfs-framework/debug        |   82 ++++++++++++
  .../initrdscripts/initramfs-framework/e2fs         |   28 ++++
  .../initrdscripts/initramfs-framework/finish       |   46 +++++++
  .../initrdscripts/initramfs-framework/init         |  136 ++++++++++++++++++++
  .../initrdscripts/initramfs-framework/mdev         |   30 +++++
  .../initrdscripts/initramfs-framework/udev         |   22 +++
  .../initrdscripts/initramfs-framework_1.0.bb       |   57 ++++++++
  7 files changed, 401 insertions(+), 0 deletions(-)
Quoted 8 lines

create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/debug create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/e2fs create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/finish create mode 100755 meta/recipes-core/initrdscripts/initramfs-framework/init create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/mdev create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/udev create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb

Merged to OE-Core

Thanks
Sau!

#3 lore raw

Hi Otavio and Saul,

I tried to build initramfs-framework in Yocto master, and it reports the following multiple provider issue:

ERROR: Multiple .bb files are due to be built which each provide udev (/home/dongxiao/poky/meta/recipes-core/udev/udev_164.bb /home/dongxiao/poky/meta/recipes-core/udev/udev_145.bb).

I saw initramfs-framework RDEPENDS on package udev-utils, which doesn't exist in latest udev-164, thus it will try to include udev-145. This caused the multiple provider issue.

Could you help to have a look at that?

Thanks,
Dongxiao

Quoted 60 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Saul Wold
Sent: Friday, December 09, 2011 2:16 AM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] initramfs-framework: provides a modular initramfs

Quoted 8 lines · Otavio Salvador

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

Quoted 8 lines

* initramfs-module-mdev: enables mdev usage

* initramfs-module-e2fs: adds support for ext4, ext3 and ext2 filesystems

---
  .../initrdscripts/initramfs-framework/debug        |   82

++++++++++++

Quoted 3 lines
  .../initrdscripts/initramfs-framework/e2fs         |   28 ++++
  .../initrdscripts/initramfs-framework/finish       |   46 +++++++
  .../initrdscripts/initramfs-framework/init         |  136

++++++++++++++++++++

Quoted 5 lines
  .../initrdscripts/initramfs-framework/mdev         |   30 +++++
  .../initrdscripts/initramfs-framework/udev         |   22 +++
  .../initrdscripts/initramfs-framework_1.0.bb       |   57 ++++++++
  7 files changed, 401 insertions(+), 0 deletions(-)

create mode 100644

meta/recipes-core/initrdscripts/initramfs-framework/debug

Quoted 1 line

create mode 100755

meta/recipes-core/initrdscripts/initramfs-framework/e2fs

Quoted 1 line

create mode 100755

meta/recipes-core/initrdscripts/initramfs-framework/finish

Quoted 1 line

create mode 100755

meta/recipes-core/initrdscripts/initramfs-framework/init

Quoted 1 line

create mode 100644

meta/recipes-core/initrdscripts/initramfs-framework/mdev

Quoted 1 line

create mode 100644

meta/recipes-core/initrdscripts/initramfs-framework/udev

Quoted 3 lines

create mode 100644
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb

Merged to OE-Core

Thanks
Sau!

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#4 lore raw
Quoted 9 lines · Dongxiao

Hi Otavio and Saul,

I tried to build initramfs-framework in Yocto master, and it reports the following multiple provider issue:

ERROR: Multiple .bb files are due to be built which each provide udev (/home/dongxiao/poky/meta/recipes-core/udev/udev_164.bb/home/dongxiao/poky/meta/recipes-core/udev/ udev_145.bb).

The proper fix IMO is to update udev to what we are using at meta-oe.

Quoted 6 lines

I saw initramfs-framework RDEPENDS on package udev-utils, which doesn't exist in latest udev-164, thus it will try to include udev-145. This caused the multiple provider issue.

Could you help to have a look at that?

Sure.

Sau, you told me you were looking at udev IIRC. Did you checked it?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br