summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/initramfs-framework/finish
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/finish
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/finish')
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish46
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
new file mode 100755
index 0000000000..bedd803f10
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -0,0 +1,46 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5finish_enabled() {
6 return 0
7}
8
9finish_run() {
10 if [ -n "$ROOTFS_DIR" ]; then
11 if [ -n "$bootparam_rootdelay" ]; then
12 debug "Sleeping for $rootdelay second(s) to wait root to settle..."
13 sleep $bootparam_rootdelay
14 fi
15
16 if [ -n "$bootparam_root" ]; then
17 debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
18
19 if [ "${bootparam_root:0:5}" = "UUID=" ]; then
20 bootparam_root="/dev/disk/by-uuid/${bootparam_root/UUID=/}"
21 fi
22
23 if [ -e "$bootparam_root" ]; then
24 mount $bootparam_root $ROOTFS_DIR
25 else
26 debug "root '$bootparam_root' doesn't exist."
27 fi
28 fi
29
30 if [ ! -d $ROOTFS_DIR/dev ]; then
31 fatal "ERROR: There's no '/dev' on rootfs."
32 fi
33
34 info "Switching root to '$ROOTFS_DIR'..."
35
36 debug "Moving /dev, /proc and /sys onto rootfs..."
37 mount --move /dev $ROOTFS_DIR/dev
38 mount --move /proc $ROOTFS_DIR/proc
39 mount --move /sys $ROOTFS_DIR/sys
40
41 cd $ROOTFS_DIR
42 exec switch_root -c /dev/console $ROOTFS_DIR /sbin/init
43 else
44 debug "No rootfs has been set"
45 fi
46}