summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2011-10-11 19:18:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-10-14 13:18:15 +0100
commite4953031de8f47953de6715bd0921da1a8e470a1 (patch)
tree57f5c8464891327206703667c321b44f5fbd8cf9
parentcd898bfd96b5ed9274e28a75372b00fd42062864 (diff)
downloadpoky-e4953031de8f47953de6715bd0921da1a8e470a1.tar.gz
initramfs-live-boot: make it more generic and easy to use
The script was making some assumptions that enforced many requirement in the machine kernel configuration and usage, besides it were too while booting. Changes included: * fix indentation; * rdepends on udev; * allow use of isofs as module; * remove rootdelay param parsing as it was unused; * don't verbosely kill udevd and mknod; * mount devtmpfs into rootfs, if available, before swithing root; (From OE-Core rev: 3fc8cec53038f41d31344040c56d62aac90ba7e0) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/initrdscripts/files/init-live.sh32
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb3
2 files changed, 22 insertions, 13 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index c054863a2a..eb5ab5b7a5 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -13,6 +13,11 @@ early_setup() {
13 mkdir /sys 13 mkdir /sys
14 mount -t proc proc /proc 14 mount -t proc proc /proc
15 mount -t sysfs sysfs /sys 15 mount -t sysfs sysfs /sys
16
17 # support modular kernel
18 modprobe isofs 2> /dev/null
19
20 mkdir /run
16 udevd --daemon 21 udevd --daemon
17 udevadm trigger --action=add 22 udevadm trigger --action=add
18} 23}
@@ -25,21 +30,25 @@ read_args() {
25 root=*) 30 root=*)
26 ROOT_DEVICE=$optarg ;; 31 ROOT_DEVICE=$optarg ;;
27 rootfstype=*) 32 rootfstype=*)
28 ROOT_FSTYPE=$optarg ;; 33 modprobe $optarg 2> /dev/null ;;
29 rootdelay=*) 34 LABEL=*)
30 rootdelay=$optarg ;; 35 label=$optarg ;;
31 LABEL=*) 36 video=*)
32 label=$optarg ;; 37 video_mode=$arg ;;
33 video=*) 38 vga=*)
34 video_mode=$arg ;; 39 vga_mode=$arg ;;
35 vga=*)
36 vga_mode=$arg ;;
37 esac 40 esac
38 done 41 done
39} 42}
40 43
41boot_live_root() { 44boot_live_root() {
42 killall udevd 45 killall udevd 2>/dev/null
46
47 # use devtmpfs if available
48 if grep -q devtmpfs /proc/filesystems; then
49 mount -t devtmpfs devtmpfs $ROOT_MOUNT/dev
50 fi
51
43 cd $ROOT_MOUNT 52 cd $ROOT_MOUNT
44 exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init 53 exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
45} 54}
@@ -78,7 +87,7 @@ done
78case $label in 87case $label in
79 boot) 88 boot)
80 mkdir $ROOT_MOUNT 89 mkdir $ROOT_MOUNT
81 mknod /dev/loop0 b 7 0 90 mknod /dev/loop0 b 7 0 2>/dev/null
82 91
83 if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then 92 if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
84 fatal "Couldnt mount rootfs image" 93 fatal "Couldnt mount rootfs image"
@@ -97,4 +106,3 @@ case $label in
97 fatal "Installation image failed" 106 fatal "Installation image failed"
98 ;; 107 ;;
99esac 108esac
100
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
index b404f8c600..e85a0e1189 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -1,9 +1,10 @@
1DESCRIPTION = "A live image init script" 1DESCRIPTION = "A live image init script"
2LICENSE = "MIT" 2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4RDEPENDS = "udev"
4SRC_URI = "file://init-live.sh" 5SRC_URI = "file://init-live.sh"
5 6
6PR = "r6" 7PR = "r7"
7 8
8do_install() { 9do_install() {
9 install -m 0755 ${WORKDIR}/init-live.sh ${D}/init 10 install -m 0755 ${WORKDIR}/init-live.sh ${D}/init