diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2013-01-29 12:24:43 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-06 09:37:28 +0000 |
commit | 7c106a3bb8a427321db579b682adfb4a2bd1eddc (patch) | |
tree | d1a9c256c2dd780459143eff88d41ed33ffee169 /meta/recipes-core | |
parent | db5847dd411f12b8b96b9bee624e9be30b504653 (diff) | |
download | poky-7c106a3bb8a427321db579b682adfb4a2bd1eddc.tar.gz |
initscripts: add read-only-rootfs-hook.sh script
Add read-only-rootfs-hook.sh script to support a read-only rootfs.
This script makes a union mount of /var/lib and /var/volatile/lib,
making /var/lib directory writable.
[YOCTO #3406]
(From OE-Core rev: a9591158962eee1f8ae04168d6256032ecd7bc6b)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 19 | ||||
-rw-r--r-- | meta/recipes-core/initscripts/initscripts_1.0.bb | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh new file mode 100644 index 0000000000..3a295eea0b --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | |||
@@ -0,0 +1,19 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | . /etc/default/rcS | ||
4 | |||
5 | [ "$ROOTFS_READ_ONLY" = "no" ] && exit 0 | ||
6 | |||
7 | # Make sure unionfs is in /proc/filesystems | ||
8 | if ! grep -q unionfs /proc/filesystems; then | ||
9 | echo "ERROR: unionfs not supported by kernel!" | ||
10 | exit 1 | ||
11 | fi | ||
12 | |||
13 | mkdir -p /var/volatile/lib | ||
14 | mount -t unionfs -o dirs=/var/volatile/lib:/var/lib=ro none /var/lib | ||
15 | |||
16 | if [ $? != 0 ]; then | ||
17 | echo "ERROR: Union mount failed!" | ||
18 | exit 1 | ||
19 | fi | ||
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb index 69b9bfbe32..68f80346ef 100644 --- a/meta/recipes-core/initscripts/initscripts_1.0.bb +++ b/meta/recipes-core/initscripts/initscripts_1.0.bb | |||
@@ -28,6 +28,7 @@ SRC_URI = "file://functions \ | |||
28 | file://sysfs.sh \ | 28 | file://sysfs.sh \ |
29 | file://device_table.txt \ | 29 | file://device_table.txt \ |
30 | file://populate-volatile.sh \ | 30 | file://populate-volatile.sh \ |
31 | file://read-only-rootfs-hook.sh \ | ||
31 | file://volatiles \ | 32 | file://volatiles \ |
32 | file://save-rtc.sh \ | 33 | file://save-rtc.sh \ |
33 | file://GPLv2.patch" | 34 | file://GPLv2.patch" |
@@ -85,6 +86,7 @@ do_install () { | |||
85 | install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default | 86 | install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default |
86 | install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d | 87 | install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d |
87 | install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d | 88 | install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d |
89 | install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d | ||
88 | install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d | 90 | install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d |
89 | install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core | 91 | install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core |
90 | 92 | ||
@@ -116,6 +118,7 @@ do_install () { | |||
116 | update-rc.d -r ${D} bootmisc.sh start 55 S . | 118 | update-rc.d -r ${D} bootmisc.sh start 55 S . |
117 | update-rc.d -r ${D} sysfs.sh start 02 S . | 119 | update-rc.d -r ${D} sysfs.sh start 02 S . |
118 | update-rc.d -r ${D} populate-volatile.sh start 37 S . | 120 | update-rc.d -r ${D} populate-volatile.sh start 37 S . |
121 | update-rc.d -r ${D} read-only-rootfs-hook.sh start 41 S . | ||
119 | update-rc.d -r ${D} devpts.sh start 38 S . | 122 | update-rc.d -r ${D} devpts.sh start 38 S . |
120 | if [ "${TARGET_ARCH}" = "arm" ]; then | 123 | if [ "${TARGET_ARCH}" = "arm" ]; then |
121 | update-rc.d -r ${D} alignment.sh start 06 S . | 124 | update-rc.d -r ${D} alignment.sh start 06 S . |