diff options
author | Yang Shi <yang.shi@windriver.com> | 2012-04-10 18:33:43 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-11 12:15:32 +0100 |
commit | b23b2b42a0c1ff6243227cb7d38c8cb6ae388bcf (patch) | |
tree | 72b522f9b00dd127dbc4263ba866e95a0ab20d02 /meta/recipes-core/initrdscripts | |
parent | 88b399bb2c8adcf8563d144c0838cbcdd45c0694 (diff) | |
download | poky-b23b2b42a0c1ff6243227cb7d38c8cb6ae388bcf.tar.gz |
initrdscripts: fix init-live.sh and use unionfs
[YOCTO #1487]
When booting up with liveCD image, init scripts can't work well on read-only filesystem. Unionfs,
which is supported in Yocto kernel, allows a filesystem to appear as writeable, but without
actually allowing writes to change the filesystem.
Use unionfs to mount rootfs and make root file system can be writen when using liveCD to boot up.
Set UNION_FS variable depending on kernel config, so that it can work with kernel which doesn't
have unionfs feature.
[RP: Mark recipe as machine specific due to kernel dependency]
(From OE-Core rev: b7f4e8d153c2aebbcf6556e7e926f6b94801d6aa)
Signed-off-by: Yang Shi <yang.shi@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-live.sh | 23 | ||||
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb | 14 |
2 files changed, 30 insertions, 7 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index eb5ab5b7a5..737dae4cbc 100644 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh | |||
@@ -7,6 +7,7 @@ ROOT_IMAGE="rootfs.img" | |||
7 | MOUNT="/bin/mount" | 7 | MOUNT="/bin/mount" |
8 | UMOUNT="/bin/umount" | 8 | UMOUNT="/bin/umount" |
9 | ISOLINUX="" | 9 | ISOLINUX="" |
10 | UNIONFS="no" | ||
10 | 11 | ||
11 | early_setup() { | 12 | early_setup() { |
12 | mkdir /proc | 13 | mkdir /proc |
@@ -89,17 +90,31 @@ case $label in | |||
89 | mkdir $ROOT_MOUNT | 90 | mkdir $ROOT_MOUNT |
90 | mknod /dev/loop0 b 7 0 2>/dev/null | 91 | mknod /dev/loop0 b 7 0 2>/dev/null |
91 | 92 | ||
92 | if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then | 93 | |
93 | fatal "Couldnt mount rootfs image" | 94 | if [ "$UNIONFS" = "yes" ]; then |
95 | mkdir /rootfs-tmp | ||
96 | |||
97 | if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs-tmp ; then | ||
98 | fatal "Could not mount rootfs image" | ||
99 | else | ||
100 | mkdir /cow | ||
101 | mount -t tmpfs -o rw,noatime,mode=755 tmpfs /cow | ||
102 | mount -t unionfs -o dirs=/cow:/rootfs-tmp=ro unionfs $ROOT_MOUNT | ||
103 | boot_live_root | ||
104 | fi | ||
94 | else | 105 | else |
95 | boot_live_root | 106 | if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then |
107 | fatal "Could not mount rootfs image" | ||
108 | else | ||
109 | boot_live_root | ||
110 | fi | ||
96 | fi | 111 | fi |
97 | ;; | 112 | ;; |
98 | install) | 113 | install) |
99 | if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then | 114 | if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then |
100 | ./install.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode | 115 | ./install.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode |
101 | else | 116 | else |
102 | fatal "Couldnt find install script" | 117 | fatal "Could not find install script" |
103 | fi | 118 | fi |
104 | 119 | ||
105 | # If we're getting here, we failed... | 120 | # If we're getting here, we failed... |
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 e85a0e1189..8f7511eadd 100644 --- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb | |||
@@ -2,14 +2,22 @@ DESCRIPTION = "A live image init script" | |||
2 | LICENSE = "MIT" | 2 | LICENSE = "MIT" |
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
4 | RDEPENDS = "udev" | 4 | RDEPENDS = "udev" |
5 | DEPENDS = "virtual/kernel" | ||
5 | SRC_URI = "file://init-live.sh" | 6 | SRC_URI = "file://init-live.sh" |
6 | 7 | ||
7 | PR = "r7" | 8 | PR = "r9" |
8 | 9 | ||
10 | do_compile() { | ||
11 | if grep -q "CONFIG_UNION_FS=y" ${STAGING_KERNEL_DIR}/.config; then | ||
12 | sed -i 's/UNIONFS="no"/UNIONFS="yes"/g' ${WORKDIR}/init-live.sh | ||
13 | fi | ||
14 | } | ||
15 | |||
9 | do_install() { | 16 | do_install() { |
10 | install -m 0755 ${WORKDIR}/init-live.sh ${D}/init | 17 | install -m 0755 ${WORKDIR}/init-live.sh ${D}/init |
11 | } | 18 | } |
12 | 19 | ||
13 | inherit allarch | ||
14 | |||
15 | FILES_${PN} += " /init " | 20 | FILES_${PN} += " /init " |
21 | |||
22 | # Due to kernel depdendency | ||
23 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||