* [PATCH V4 00/10] Make read-only rootfs work with live images
@ 2013-08-07 8:08 Qi.Chen
2013-08-07 8:08 ` [PATCH V4 01/10] init-live.sh: make $ROOT_MOUNT/media writable when necessary Qi.Chen
` (9 more replies)
0 siblings, 10 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core
From: Chen Qi <Qi.Chen@windriver.com>
Changes from V3:
1. Take hidden directories and files into consideration when copying before bind mounting.
2. Use 'cp -a' in populate-volatile.sh to avoid potential problems
Change from V2:
1. modify the irda init script so that it doesn't necessarily need to write to /etc/sysconfig/irda
2. drop the lighttpd patch
3. modify the logic for openssh in case of a read-only rootfs
Change from V1:
1. Disable the generating of ssh keys at rootfs time
2. Add a mechanism to read-only-rootfs-hook.sh to check whether a directory is on a read-only partition.
3. Fix a new bug#4937 (https://bugzilla.yoctoproject.org/show_bug.cgi?id=4937)
The following changes since commit f63e7f4323368c0d6fe7a1d44393a7e15652d4f2:
subversion: Add patch to use neon 0.30 (2013-08-07 07:43:47 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/read-only-rootfs-in-live-images
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/read-only-rootfs-in-live-images
Chen Qi (10):
init-live.sh: make $ROOT_MOUNT/media writable when necessary
use a uniform way to determine whether rootfs is read-only
udev: remove implicit dependency on initscripts
populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIR
populate-volatile.sh: don't spawn background process at rootfs time
runqemu-internal: fix to start X correctly in live images
initscripts: use a uniform way to handle directories in read-only
rootfs
populate-volatile.sh: use 'cp -a' to avoid potential problem
irda-utils: fix for read-only rootfs
openssh: fix for read-only rootfs
meta/classes/image.bbclass | 16 +++++--
.../irda-utils/irda-utils-0.9.18/init | 13 +-----
.../openssh/openssh-6.2p2/init | 22 ++++++---
meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 9 +++-
meta/recipes-core/initrdscripts/files/init-live.sh | 2 +
.../initscripts/initscripts-1.0/functions | 14 ++++++
.../initscripts-1.0/populate-volatile.sh | 15 ++++--
.../initscripts-1.0/read-only-rootfs-hook.sh | 48 ++++++++++++++++++--
meta/recipes-core/initscripts/initscripts_1.0.bb | 5 ++
meta/recipes-core/sysvinit/sysvinit/rcS-default | 4 --
meta/recipes-core/udev/udev/init | 21 +++++++--
meta/recipes-core/udev/udev/udev-cache | 5 ++
.../0001-add-is_rootfs_readonly-to-functions.patch | 37 +++++++++++++++
meta/recipes-extended/lsb/lsbinitscripts_9.48.bb | 1 +
scripts/runqemu-internal | 2 +-
15 files changed, 172 insertions(+), 42 deletions(-)
create mode 100644 meta/recipes-extended/lsb/lsbinitscripts/0001-add-is_rootfs_readonly-to-functions.patch
--
1.7.9.5
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH V4 01/10] init-live.sh: make $ROOT_MOUNT/media writable when necessary
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only Qi.Chen
` (8 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
If the live image is mounted as read-only, we cannot make necessary
directories under $ROOT_MOUNT/media, so trying to move the mount points
lead to errors.
So in case that no unification filesystem mechanism is available in kernel
and the rootfs is mounted as read-only, we mount tmpfs on $ROOT_MOUNT/media
so that it's possible to make necessary directories under it.
[YOCTO #4881]
[YOCTO #4103]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
meta/recipes-core/initrdscripts/files/init-live.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 890c562..861d874 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -184,6 +184,8 @@ mount_and_boot() {
"")
if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
fatal "Could not mount rootfs image"
+ else
+ mount -t tmpfs -o rw,noatime,mode=755 tmpfs $ROOT_MOUNT/media
fi
;;
esac
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
2013-08-07 8:08 ` [PATCH V4 01/10] init-live.sh: make $ROOT_MOUNT/media writable when necessary Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 20:29 ` Otavio Salvador
2013-08-07 8:08 ` [PATCH V4 03/10] udev: remove implicit dependency on initscripts Qi.Chen
` (7 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
Previously, we had two ways to check whether the rootfs was read-only.
In some part of the system, we determined whether the rootfs is read-only
by checking the fstab or /proc/mounts; in other part of the system, we
used the value of ROOTFS_READ_ONLY in /etc/default/rcS as a criteria.
Having two ways to check the rootfs is confusing and makes systems inconsistent.
We should drop the use of ROOTFS_READ_ONLY and figure out a uniform and
consistent way to determine whether rootfs is read-only.
This patch fixes this problem by using the following strategy.
On target, we use /proc/mounts to check whether / is read-only; on host, we
use $ROOT_DIR/etc/fstab to check whether the rootfs is going to be mounted
as read-only or not.
[YOCTO #4880]
[YOCTO #4103]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
meta/classes/image.bbclass | 4 ---
.../initscripts/initscripts-1.0/functions | 14 ++++++++
.../initscripts-1.0/populate-volatile.sh | 4 +++
.../initscripts-1.0/read-only-rootfs-hook.sh | 4 ++-
meta/recipes-core/sysvinit/sysvinit/rcS-default | 4 ---
meta/recipes-core/udev/udev/init | 5 +++
meta/recipes-core/udev/udev/udev-cache | 5 +++
.../0001-add-is_rootfs_readonly-to-functions.patch | 37 ++++++++++++++++++++
meta/recipes-extended/lsb/lsbinitscripts_9.48.bb | 1 +
9 files changed, 69 insertions(+), 9 deletions(-)
create mode 100644 meta/recipes-extended/lsb/lsbinitscripts/0001-add-is_rootfs_readonly-to-functions.patch
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index cf02f88..15fe51a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -259,10 +259,6 @@ read_only_rootfs_hook () {
if ${@base_contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
# Tweak the mount option and fs_passno for rootfs in fstab
sed -i -e '/^[#[:space:]]*rootfs/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
- # Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
- if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
- sed -i 's/ROOTFS_READ_ONLY=no/ROOTFS_READ_ONLY=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
- fi
# Run populate-volatile.sh at rootfs time to set up basic files
# and directories to support read-only rootfs.
if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions
index 8e15762..ca477b7 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/functions
+++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
@@ -58,3 +58,17 @@ status() {
fi
return 3
}
+
+# Determine whether rootfs is read-only or not according to /proc/mounts or /etc/fstab.
+is_rootfs_readonly () {
+ local DIRNAME=`dirname $0`
+ local ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
+ local criteria_file
+ [ -n "$ROOT_DIR" ] && criteria_file="$ROOT_DIR/etc/fstab" || criteria_file="/proc/mounts"
+ local flag
+ for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < $criteria_file`; do
+ [ "$flag" = "ro" ] && { echo "yes"; return 0; }
+ done
+ echo "no"
+ return 0
+}
\ No newline at end of file
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index 91c70efb..a760081 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -13,8 +13,12 @@ DIRNAME=`dirname $0`
ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
[ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS
+FUNCTIONS_FILE="${ROOT_DIR}`readlink -f ${ROOT_DIR}/etc/init.d/functions`"
+. $FUNCTIONS_FILE
# When running populate-volatile.sh at rootfs time, disable cache.
[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no
+# Determine whether the rootfs is read-only
+ROOTFS_READ_ONLY=`is_rootfs_readonly`
# If rootfs is read-only, disable cache.
[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no
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
index 9cf0921..d523924 100644
--- 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
@@ -1,6 +1,8 @@
#!/bin/sh
-. /etc/default/rcS
+. /etc/init.d/functions
+
+ROOTFS_READ_ONLY=`is_rootfs_readonly`
[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS-default b/meta/recipes-core/sysvinit/sysvinit/rcS-default
index 709cdf6..3c9dea9 100644
--- a/meta/recipes-core/sysvinit/sysvinit/rcS-default
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS-default
@@ -23,7 +23,3 @@ FSCKFIX=yes
#TICKADJ=10000
# Enable caching in populate-volatile.sh
VOLATILE_ENABLE_CACHE=yes
-# Indicate whether the rootfs is intended to be read-only or not.
-# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
-# Normally you should not change this value.
-ROOTFS_READ_ONLY=no
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index d90d446..4e5094a 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -79,6 +79,11 @@ case "$1" in
echo "$NEWDATA" > /dev/shm/udev.cache
fi
else
+ # Determine whether the rootfs is read-only or not
+ ROOTFS_READ_ONLY="no"
+ for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
+ [ "$flag" = "ro" ] && ROOTFS_READ_ONLY="yes"
+ done
if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
# If rootfs is not read-only, it's possible that a new udev cache would be generated;
# otherwise, we do not bother to read files.
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index db5a513..862e0e6 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -18,6 +18,11 @@ export TZ=/etc/localtime
[ -f /etc/default/rcS ] && . /etc/default/rcS
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
+ROOTFS_READ_ONLY="no"
+for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
+ [ "$flag" = "ro" ] && ROOTFS_READ_ONLY="yes"
+done
+
if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
[ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
exit 0
diff --git a/meta/recipes-extended/lsb/lsbinitscripts/0001-add-is_rootfs_readonly-to-functions.patch b/meta/recipes-extended/lsb/lsbinitscripts/0001-add-is_rootfs_readonly-to-functions.patch
new file mode 100644
index 0000000..f076b0d
--- /dev/null
+++ b/meta/recipes-extended/lsb/lsbinitscripts/0001-add-is_rootfs_readonly-to-functions.patch
@@ -0,0 +1,37 @@
+From b8e8e7f93aca54561cc1d7945ef3ec7aca5f6f43 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 23 Jul 2013 10:48:32 +0800
+Subject: [PATCH V4 V3] add is_rootfs_readonly to functions
+
+---
+ rc.d/init.d/functions | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
+index a5b2b9e..0663c7f 100644
+--- a/rc.d/init.d/functions
++++ b/rc.d/init.d/functions
+@@ -577,6 +577,20 @@ apply_sysctl() {
+ fi
+ }
+
++# Determine whether rootfs is read-only or not according to /proc/mounts or /etc/fstab.
++is_rootfs_readonly () {
++ local DIRNAME=`dirname $0`
++ local ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
++ local criteria_file
++ [ -n "$ROOT_DIR" ] && criteria_file="$ROOT_DIR/etc/fstab" || criteria_file="/proc/mounts"
++ local flag
++ for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < $criteria_file`; do
++ [ "$flag" = "ro" ] && { echo "yes"; return 0; }
++ done
++ echo "no"
++ return 0
++}
++
+ # A sed expression to filter out the files that is_ignored_file recognizes
+ __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
+
+--
+1.7.9.5
+
diff --git a/meta/recipes-extended/lsb/lsbinitscripts_9.48.bb b/meta/recipes-extended/lsb/lsbinitscripts_9.48.bb
index 3011f98..927c9db 100644
--- a/meta/recipes-extended/lsb/lsbinitscripts_9.48.bb
+++ b/meta/recipes-extended/lsb/lsbinitscripts_9.48.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ebf4e8b49780ab187d51bd26aaa022c6"
S="${WORKDIR}/initscripts-${PV}"
SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/initscripts/initscripts-9.48.tar.bz2/7dfab81a5a8d3f0dea5ba55e391c26f3/initscripts-9.48.tar.bz2 \
file://functions.patch \
+ file://0001-add-is_rootfs_readonly-to-functions.patch \
"
SRC_URI[md5sum] = "7dfab81a5a8d3f0dea5ba55e391c26f3"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 03/10] udev: remove implicit dependency on initscripts
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
2013-08-07 8:08 ` [PATCH V4 01/10] init-live.sh: make $ROOT_MOUNT/media writable when necessary Qi.Chen
2013-08-07 8:08 ` [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 04/10] populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIR Qi.Chen
` (6 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
At some point, the udev was modified to source the functions from
initscripts or lsbinitscripts. This dependency is actually not needed.
If we use udev in a system where initscripts from oe-core is not available,
there will be errors.
This patch fixes this problem by removing the implicit dependency.
[YOCTO #4882]
[YOCTO #4103]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
meta/recipes-core/udev/udev/init | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 4e5094a..52c7925 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -9,8 +9,6 @@
# Short-Description: Start udevd, populate /dev and load drivers.
### END INIT INFO
-. /etc/init.d/functions
-
export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
@@ -31,6 +29,11 @@ readfiles () {
done
}
+kill_udevd () {
+ pid=`pidof -x udevd`
+ [ -n "$pid" ] && kill $pid
+}
+
case "$1" in
start)
export ACTION=add
@@ -94,7 +97,7 @@ case "$1" in
fi
# make_extra_nodes
- killproc udevd > "/dev/null" 2>&1
+ kill_udevd > "/dev/null" 2>&1
# trigger the sorted events
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
@@ -119,7 +122,12 @@ case "$1" in
$0 start
;;
status)
- status udevd
+ pid=`pidof -x udevd`
+ if [ -n "$pid" ]; then
+ echo "udevd (pid $pid) is running ..."
+ else
+ echo "udevd is stopped"
+ fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 04/10] populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIR
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (2 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 03/10] udev: remove implicit dependency on initscripts Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 05/10] populate-volatile.sh: don't spawn background process at rootfs time Qi.Chen
` (5 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
It's possible that a 'No such directory' error occurs when doing
check_requirement in populate-volatile.sh at rootfs time. This is
because the $ROOT_DIR/var/tmp might be a dead link.
Use $ROOT_DIR/var/volatile/tmp as the TMPDIR instead to avoid this
error.
[YOCTO #4883]
[YOCTO #4103]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
.../initscripts-1.0/populate-volatile.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index a760081..d8ae14e 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -23,7 +23,7 @@ ROOTFS_READ_ONLY=`is_rootfs_readonly`
[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no
CFGDIR="${ROOT_DIR}/etc/default/volatiles"
-TMPROOT="${ROOT_DIR}/var/tmp"
+TMPROOT="${ROOT_DIR}/var/volatile/tmp"
COREDEF="00_core"
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 05/10] populate-volatile.sh: don't spawn background process at rootfs time
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (3 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 04/10] populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIR Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 06/10] runqemu-internal: fix to start X correctly in live images Qi.Chen
` (4 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
If we're building a read-only rootfs, we'll get the following error now
and then.
tar: .: file changed as we read it
The root cause is that we spawn background process at rootfs time.
When the tar command is running, it's possible that files under rootfs
are changed by background processes, thus this error.
[YOCTO #4937]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
.../initscripts-1.0/populate-volatile.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index d8ae14e..827fd7d 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -46,7 +46,7 @@ create_file() {
# but these failures should not be logged to make sure the do_rootfs
# process doesn't fail. This does no harm, as this script will
# run on target to set up the correct files and directories.
- eval $EXEC > /dev/null 2>&1 &
+ eval $EXEC > /dev/null 2>&1
fi
}
}
@@ -91,7 +91,7 @@ link_file() {
else
# For the same reason with create_file(), failures should
# not be logged.
- eval $EXEC > /dev/null 2>&1 &
+ eval $EXEC > /dev/null 2>&1
fi
}
@@ -160,7 +160,7 @@ apply_cfgfile() {
[ "${TTYPE}" = "l" ] && {
TSOURCE="$TLTARGET"
[ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
- link_file "${TSOURCE}" "${TNAME}" &
+ link_file "${TSOURCE}" "${TNAME}"
continue
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 06/10] runqemu-internal: fix to start X correctly in live images
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (4 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 05/10] populate-volatile.sh: don't spawn background process at rootfs time Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 07/10] initscripts: use a uniform way to handle directories in read-only rootfs Qi.Chen
` (3 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
The QEMUOPTIONS for ISOFS was not complete, leading to failures when
trying to start X in live images.
This patch fixes this problem.
[YOCTO #4103]
[YOCTO #4884]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
scripts/runqemu-internal | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 9619bec..8a6e551 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -526,7 +526,7 @@ if [ "x$RAMFS" = "xtrue" ]; then
fi
if [ "x$ISOFS" = "xtrue" ]; then
- QEMUOPTIONS="-cdrom $ROOTFS"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS"
fi
if [ "x$QEMUOPTIONS" = "x" ]; then
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 07/10] initscripts: use a uniform way to handle directories in read-only rootfs
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (5 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 06/10] runqemu-internal: fix to start X correctly in live images Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 8:08 ` [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem Qi.Chen
` (2 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
Packages in our system may need to write to some directories to function
correctly. In read-only rootfs, these directories should be made writable.
This patch uses a convenient and uniform way to handle such situations.
The read-only-rootfs-hook.sh script searches the /etc/default/readonly
diretory for config files and then apply them one by one.
The config files simply have the following format.
<original diretory> <corresponding directory in volatile story>
For example, /etc/default/readonly/initscripts have the following content.
/var/lib /var/volatile/lib
This patch only has effect for systems with read-only rootfs.
[YOCTO #4103]
[YOCTO #4888]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
.../initscripts-1.0/read-only-rootfs-hook.sh | 44 ++++++++++++++++++--
meta/recipes-core/initscripts/initscripts_1.0.bb | 5 +++
2 files changed, 45 insertions(+), 4 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
index d523924..eb89e18 100644
--- 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
@@ -1,15 +1,51 @@
#!/bin/sh
. /etc/init.d/functions
+READONLY_CFGDIR="/etc/default/readonly"
ROOTFS_READ_ONLY=`is_rootfs_readonly`
[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
+is_on_read_only_partition () {
+ DIRECTORY=$1
+ dir=`readlink -f $DIRECTORY`
+ while true; do
+ if [ ! -d "$dir" ]; then
+ echo "ERROR: $dir is not a directory"
+ exit 1
+ else
+ for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
+ [ "$flag" = "FOUND" ] && partition="read-write"
+ [ "$flag" = "ro" ] && { partition="read-only"; break; }
+ done
+ fi
+ if [ "$dir" = "/" -o -n "$partition" ]; then
+ break
+ else
+ dir=`dirname $dir`
+ fi
+ done
+ [ "$partition" = "read-only" ] && echo "yes" || echo "no"
+}
+
+apply_conf () {
+ cfgfile=$1
+ cat $cfgfile | while read line; do
+ eval `echo "$line" | sed -n "s/\(.*\)\ \(.*\)/DIR_READONLY=\1; DIR_VOLATILE=\2;/p"`
+ if [ `is_on_read_only_partition $DIR_READONLY` = "yes" ]; then
+ mkdir -p $DIR_VOLATILE
+ cp -a $DIR_READONLY/* $DIR_VOLATILE 2>/dev/null
+ cp -a $DIR_READONLY/.[!.]* $DIR_VOLATILE 2>/dev/null
+ mount --bind $DIR_VOLATILE $DIR_READONLY
+ fi
+ done
+}
+
if [ "$1" = "start" ] ; then
- grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
- mkdir -p /var/volatile/lib
- cp -a /var/lib/* /var/volatile/lib
- mount --bind /var/volatile/lib /var/lib
+ grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
+ for file in `ls -1 "$READONLY_CFGDIR"`; do
+ apply_conf "$READONLY_CFGDIR/$file"
+ done
fi
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 52e1c9c..46c4c99 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -105,6 +105,11 @@ do_install () {
install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
install -m 0755 ${WORKDIR}/device_table.txt ${D}${sysconfdir}/device_table
#
+# Create config files for read-only rootfs
+#
+ install -d ${D}${sysconfdir}/default/readonly
+ echo "/var/lib /var/volatile/lib" > ${D}${sysconfdir}/default/readonly/initscripts
+#
# Create runlevel links
#
update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (6 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 07/10] initscripts: use a uniform way to handle directories in read-only rootfs Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-08 2:50 ` ChenQi
2013-08-07 8:08 ` [PATCH V4 09/10] irda-utils: fix for read-only rootfs Qi.Chen
2013-08-07 8:08 ` [PATCH V4 10/10] openssh: " Qi.Chen
9 siblings, 1 reply; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
Previously, dead links in target directory will not be copied.
This is incorrect as dead links are not uncommon in our rootfs.
So we use '-a' option instead.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
.../initscripts-1.0/populate-volatile.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index 827fd7d..b1c0245 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -76,7 +76,8 @@ link_file() {
if [ -L \"$2\" ]; then
[ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
elif [ -d \"$2\" ]; then
- for f in $2/* $2/.[^.]*; do [ -e \$f ] && cp -rf \$f $1; done;
+ cp -a $2/* $1
+ cp -a $2/.[!.]* $1
rm -rf \"$2\";
ln -sf \"$1\" \"$2\";
else
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 09/10] irda-utils: fix for read-only rootfs
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (7 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
2013-08-07 14:18 ` Chris Larson
2013-08-07 8:08 ` [PATCH V4 10/10] openssh: " Qi.Chen
9 siblings, 1 reply; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
The init script for irda writes configuration items to /etc/sysconfig/irda
if that file is not available in system. But it's actually not necessary,
the behavior doesn't change whether the init script writes to the file or not.
Considering it issues error messages in case of a read-only rootfs, I delete
the writing process.
[YOCTO #4103]
[YOCTO #4886]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
.../irda-utils/irda-utils-0.9.18/init | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
index 63750f1..14efb94 100755
--- a/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
+++ b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
@@ -13,7 +13,6 @@ module_id() {
}
if [ ! -f /etc/sysconfig/irda ]; then
-
case `module_id` in
"HP iPAQ H2200" | "HP iPAQ HX4700" | "HTC Universal")
IRDA=yes
@@ -28,18 +27,10 @@ if [ ! -f /etc/sysconfig/irda ]; then
DISCOVERY=
;;
esac
-
- mkdir -p /etc/sysconfig
- echo "IRDA=$IRDA" > /etc/sysconfig/irda
- if [ $IRDA = "yes" ]; then
- echo "DEVICE=$DEVICE" >> /etc/sysconfig/irda
- echo "DONGLE=$DONGLE" >> /etc/sysconfig/irda
- echo "DISCOVERY=$DISCOVERY" >> /etc/sysconfig/irda
- fi
+else
+ . /etc/sysconfig/irda
fi
-. /etc/sysconfig/irda
-
# Check that irda is up.
[ ${IRDA} = "no" ] && exit 0
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH V4 10/10] openssh: fix for read-only rootfs
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
` (8 preceding siblings ...)
2013-08-07 8:08 ` [PATCH V4 09/10] irda-utils: fix for read-only rootfs Qi.Chen
@ 2013-08-07 8:08 ` Qi.Chen
9 siblings, 0 replies; 18+ messages in thread
From: Qi.Chen @ 2013-08-07 8:08 UTC (permalink / raw)
To: openembedded-core; +Cc: clarson, chen_q07
From: Chen Qi <Qi.Chen@windriver.com>
If the rootfs is read-only and the ssh keys are not available at system
start-up, the init script will generate ssh keys into /etc/ssh, thus
causing a 'read-only file system' error.
In order for Yocto based image to work correctly for read-only rootfs,
we use the following logic for openssh.
If the rootfs is read-only and there are pre-generated keys under /etc/ssh,
we use the pre-generated keys. Note the pre-generated keys are mainly for
debugging or development purpose.
If the rootfs is read-only and there are no pre-generated keys under
/etc/ssh, we use /var/run/ssh as the location for ssh keys. That is, at
system boot-up, the generated ssh keys will put into /var/run/ssh.
[YOCTO #4887]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
meta/classes/image.bbclass | 12 +++++++++++
.../openssh/openssh-6.2p2/init | 22 +++++++++++++-------
meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 9 +++++++-
3 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 15fe51a..769cf81 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -264,6 +264,18 @@ read_only_rootfs_hook () {
if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
fi
+ # If we're using openssh and the /etc/ssh directory has no pre-generated keys,
+ # we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
+ # and the keys under /var/run/ssh.
+ if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
+ if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
+ echo "SYSCONFDIR=/etc/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
+ echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
+ else
+ echo "SYSCONFDIR=/var/run/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
+ echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
+ fi
+ fi
fi
}
diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/init b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
index 6beec84..12fb79b 100644
--- a/meta/recipes-connectivity/openssh/openssh-6.2p2/init
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/init
@@ -6,14 +6,22 @@ set -e
test -x /usr/sbin/sshd || exit 0
( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
+# /etc/default/ssh may set SYSCONFDIR and SSHD_OPTS
if test -f /etc/default/ssh; then
. /etc/default/ssh
fi
+[ -z "$SYSCONFDIR" ] && SYSCONFDIR=/etc/ssh
+mkdir -p $SYSCONFDIR
+
+HOST_KEY_RSA=$SYSCONFDIR/ssh_host_rsa_key
+HOST_KEY_DSA=$SYSCONFDIR/ssh_host_dsa_key
+HOST_KEY_ECDSA=$SYSCONFDIR/ssh_host_ecdsa_key
+
check_for_no_start() {
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
- if [ -e /etc/ssh/sshd_not_to_be_run ]; then
- echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
+ if [ -e $SYSCONFDIR/sshd_not_to_be_run ]; then
+ echo "OpenBSD Secure Shell server not in use ($SYSCONFDIR/sshd_not_to_be_run)"
exit 0
fi
}
@@ -32,17 +40,17 @@ check_config() {
check_keys() {
# create keys if necessary
- if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
+ if [ ! -f $HOST_KEY_RSA ]; then
echo " generating ssh RSA key..."
- ssh-keygen -q -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
+ ssh-keygen -q -f $HOST_KEY_RSA -N '' -t rsa
fi
- if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then
+ if [ ! -f $HOST_KEY_ECDSA ]; then
echo " generating ssh ECDSA key..."
- ssh-keygen -q -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
+ ssh-keygen -q -f $HOST_KEY_ECDSA -N '' -t ecdsa
fi
if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
echo " generating ssh DSA key..."
- ssh-keygen -q -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
+ ssh-keygen -q -f $HOST_KEY_DSA -N '' -t dsa
fi
}
diff --git a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
index ab2eefb..c76f9ac 100644
--- a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
+++ b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
@@ -86,6 +86,13 @@ do_install_append () {
install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
+ # Create config files for read-only rootfs
+ install -d ${D}${sysconfdir}/ssh
+ install -m 644 ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly
+ sed -i '/HostKey/d' ${D}${sysconfdir}/ssh/sshd_config_readonly
+ echo "HostKey /var/run/ssh/ssh_host_rsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
+ echo "HostKey /var/run/ssh/ssh_host_dsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
+ echo "HostKey /var/run/ssh/ssh_host_ecdsa_key" >> ${D}${sysconfdir}/ssh/sshd_config_readonly
}
ALLOW_EMPTY_${PN} = "1"
@@ -94,7 +101,7 @@ PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc $
FILES_${PN}-scp = "${bindir}/scp.${BPN}"
FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
-FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config"
+FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly"
FILES_${PN}-sftp = "${bindir}/sftp"
FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH V4 09/10] irda-utils: fix for read-only rootfs
2013-08-07 8:08 ` [PATCH V4 09/10] irda-utils: fix for read-only rootfs Qi.Chen
@ 2013-08-07 14:18 ` Chris Larson
2013-08-08 2:10 ` ChenQi
0 siblings, 1 reply; 18+ messages in thread
From: Chris Larson @ 2013-08-07 14:18 UTC (permalink / raw)
To: ChenQi; +Cc: chen_q07, Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]
On Wed, Aug 7, 2013 at 1:08 AM, <Qi.Chen@windriver.com> wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The init script for irda writes configuration items to /etc/sysconfig/irda
> if that file is not available in system. But it's actually not necessary,
> the behavior doesn't change whether the init script writes to the file or
> not.
>
> Considering it issues error messages in case of a read-only rootfs, I
> delete
> the writing process.
>
> [YOCTO #4103]
> [YOCTO #4886]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>
This is a start, but is incomplete, from what I can tell. As mentioned in
the other thread, the startup script shouldn't be using /etc/sysconfig/ at
all, in any form. We use /etc/default/ for our startup script config files,
not /etc/sysconfig/. Also, the purpose of this block was clearly to
implement a default configuration, yet the recipe isn't altered to ship a
default configuration to provide equivalent functionality.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 1635 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only
2013-08-07 8:08 ` [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only Qi.Chen
@ 2013-08-07 20:29 ` Otavio Salvador
2013-08-08 2:17 ` ChenQi
0 siblings, 1 reply; 18+ messages in thread
From: Otavio Salvador @ 2013-08-07 20:29 UTC (permalink / raw)
To: ChenQi
Cc: Christopher Larson, chen_q07,
Patches and discussions about the oe-core layer
On Wed, Aug 7, 2013 at 5:08 AM, <Qi.Chen@windriver.com> wrote:
...
> --- a/meta/recipes-core/initscripts/initscripts-1.0/functions
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
> @@ -58,3 +58,17 @@ status() {
> fi
> return 3
> }
> +
> +# Determine whether rootfs is read-only or not according to /proc/mounts or /etc/fstab.
> +is_rootfs_readonly () {
> + local DIRNAME=`dirname $0`
> + local ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
> + local criteria_file
> + [ -n "$ROOT_DIR" ] && criteria_file="$ROOT_DIR/etc/fstab" || criteria_file="/proc/mounts"
> + local flag
> + for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < $criteria_file`; do
> + [ "$flag" = "ro" ] && { echo "yes"; return 0; }
> + done
> + echo "no"
> + return 0
> +}
> \ No newline at end of file
Please fix this.
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 09/10] irda-utils: fix for read-only rootfs
2013-08-07 14:18 ` Chris Larson
@ 2013-08-08 2:10 ` ChenQi
2013-08-08 2:23 ` Khem Raj
0 siblings, 1 reply; 18+ messages in thread
From: ChenQi @ 2013-08-08 2:10 UTC (permalink / raw)
To: Chris Larson; +Cc: chen_q07, Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]
On 08/07/2013 10:18 PM, Chris Larson wrote:
>
> On Wed, Aug 7, 2013 at 1:08 AM, <Qi.Chen@windriver.com
> <mailto:Qi.Chen@windriver.com>> wrote:
>
> From: Chen Qi <Qi.Chen@windriver.com <mailto:Qi.Chen@windriver.com>>
>
> The init script for irda writes configuration items to
> /etc/sysconfig/irda
> if that file is not available in system. But it's actually not
> necessary,
> the behavior doesn't change whether the init script writes to the
> file or not.
>
> Considering it issues error messages in case of a read-only
> rootfs, I delete
> the writing process.
>
> [YOCTO #4103]
> [YOCTO #4886]
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com
> <mailto:Qi.Chen@windriver.com>>
>
>
> This is a start, but is incomplete, from what I can tell. As mentioned
> in the other thread, the startup script shouldn't be using
> /etc/sysconfig/ at all, in any form. We use /etc/default/ for our
> startup script config files, not /etc/sysconfig/.
Yeah, I agree with you.
But when I checked the irda source code, I saw that it actually could
ship its own init script (irda-utils-xxx/etc/irda.rc). And I think our
init script is derived from this one. In its own init script,
/etc/sysconfig is used.
(Of course, I still think /etc/default is a better location for its
configuration file.)
> Also, the purpose of this block was clearly to implement a default
> configuration, yet the recipe isn't altered to ship a default
> configuration to provide equivalent functionality.
In its source code, there's a default configuration file, and we don't
use that. I think there might be a reason.
So I'm not sure about this one.
If you have a patch to fix the irda issue properly, send it out and I'll
rebase my remote branch and drop this one.
Best Regards,
Chen Qi
> --
> Christopher Larson
> clarson at kergoth dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Maintainer - Tslib
> Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 4033 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only
2013-08-07 20:29 ` Otavio Salvador
@ 2013-08-08 2:17 ` ChenQi
0 siblings, 0 replies; 18+ messages in thread
From: ChenQi @ 2013-08-08 2:17 UTC (permalink / raw)
To: Otavio Salvador
Cc: Christopher Larson, chen_q07,
Patches and discussions about the oe-core layer
On 08/08/2013 04:29 AM, Otavio Salvador wrote:
> On Wed, Aug 7, 2013 at 5:08 AM, <Qi.Chen@windriver.com> wrote:
> ...
>> --- a/meta/recipes-core/initscripts/initscripts-1.0/functions
>> +++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
>> @@ -58,3 +58,17 @@ status() {
>> fi
>> return 3
>> }
>> +
>> +# Determine whether rootfs is read-only or not according to /proc/mounts or /etc/fstab.
>> +is_rootfs_readonly () {
>> + local DIRNAME=`dirname $0`
>> + local ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
>> + local criteria_file
>> + [ -n "$ROOT_DIR" ] && criteria_file="$ROOT_DIR/etc/fstab" || criteria_file="/proc/mounts"
>> + local flag
>> + for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' < $criteria_file`; do
>> + [ "$flag" = "ro" ] && { echo "yes"; return 0; }
>> + done
>> + echo "no"
>> + return 0
>> +}
>> \ No newline at end of file
> Please fix this.
>
Thanks for pointing it out.
Remote branch has been updated :)
Best Regards,
Chen Qi
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 09/10] irda-utils: fix for read-only rootfs
2013-08-08 2:10 ` ChenQi
@ 2013-08-08 2:23 ` Khem Raj
2013-08-08 2:29 ` ChenQi
0 siblings, 1 reply; 18+ messages in thread
From: Khem Raj @ 2013-08-08 2:23 UTC (permalink / raw)
To: ChenQi
Cc: Chris Larson, chen_q07@163.com,
Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]
On Wednesday, August 7, 2013, ChenQi <Qi.Chen@windriver.com> wrote:
> On 08/07/2013 10:18 PM, Chris Larson wrote:
>
> On Wed, Aug 7, 2013 at 1:08 AM, <Qi.Chen@windriver.com> wrote:
>>
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> The init script for irda writes configuration items to
/etc/sysconfig/irda
>> if that file is not available in system. But it's actually not necessary,
>> the behavior doesn't change whether the init script writes to the file
or not.
>>
>> Considering it issues error messages in case of a read-only rootfs, I
delete
>> the writing process.
>>
>> [YOCTO #4103]
>> [YOCTO #4886]
>>
>> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>
> This is a start, but is incomplete, from what I can tell. As mentioned in
the other thread, the startup script shouldn't be using /etc/sysconfig/ at
all, in any form. We use /etc/default/ for our startup script config files,
not /etc/sysconfig/.
>
> Yeah, I agree with you.
> But when I checked the irda source code, I saw that it actually could
ship its own init script (irda-utils-xxx/etc/irda.rc). And I think our init
script is derived from this one. In its own init script, /etc/sysconfig is
used.
> (Of course, I still think /etc/default is a better location for its
configuration file.)
>
>
> Also, the purpose of this block was clearly to implement a default
configuration, yet the recipe isn't altered to ship a default configuration
to provide equivalent functionality.
>
> In its source code, there's a default configuration file, and we don't
use that. I think there might be a reason.
> So I'm not sure about this one.
>
> If you have a patch to fix the irda issue properly, send it out and I'll
rebase my remote branch and drop this one.
Whether Chris has a patch or not this patch in its form should be dropped
since there is a better way to do it
>
> Best Regards,
> Chen Qi
>
>
> --
> Christopher Larson
> clarson at kergoth dot com
> Founder - BitBake, OpenEmbedded, OpenZaurus
> Maintainer - Tslib
> Senior Software Engineer, Mentor Graphics
>
[-- Attachment #2: Type: text/html, Size: 2593 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 09/10] irda-utils: fix for read-only rootfs
2013-08-08 2:23 ` Khem Raj
@ 2013-08-08 2:29 ` ChenQi
0 siblings, 0 replies; 18+ messages in thread
From: ChenQi @ 2013-08-08 2:29 UTC (permalink / raw)
To: Khem Raj
Cc: Chris Larson, chen_q07@163.com,
Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 2551 bytes --]
On 08/08/2013 10:23 AM, Khem Raj wrote:
>
>
> On Wednesday, August 7, 2013, ChenQi <Qi.Chen@windriver.com
> <mailto:Qi.Chen@windriver.com>> wrote:
> > On 08/07/2013 10:18 PM, Chris Larson wrote:
> >
> > On Wed, Aug 7, 2013 at 1:08 AM, <Qi.Chen@windriver.com
> <mailto:Qi.Chen@windriver.com>> wrote:
> >>
> >> From: Chen Qi <Qi.Chen@windriver.com <mailto:Qi.Chen@windriver.com>>
> >>
> >> The init script for irda writes configuration items to
> /etc/sysconfig/irda
> >> if that file is not available in system. But it's actually not
> necessary,
> >> the behavior doesn't change whether the init script writes to the
> file or not.
> >>
> >> Considering it issues error messages in case of a read-only rootfs,
> I delete
> >> the writing process.
> >>
> >> [YOCTO #4103]
> >> [YOCTO #4886]
> >>
> >> Signed-off-by: Chen Qi <Qi.Chen@windriver.com
> <mailto:Qi.Chen@windriver.com>>
> >
> > This is a start, but is incomplete, from what I can tell. As
> mentioned in the other thread, the startup script shouldn't be using
> /etc/sysconfig/ at all, in any form. We use /etc/default/ for our
> startup script config files, not /etc/sysconfig/.
> >
> > Yeah, I agree with you.
> > But when I checked the irda source code, I saw that it actually
> could ship its own init script (irda-utils-xxx/etc/irda.rc). And I
> think our init script is derived from this one. In its own init
> script, /etc/sysconfig is used.
> > (Of course, I still think /etc/default is a better location for its
> configuration file.)
> >
> >
> > Also, the purpose of this block was clearly to implement a default
> configuration, yet the recipe isn't altered to ship a default
> configuration to provide equivalent functionality.
> >
> > In its source code, there's a default configuration file, and we
> don't use that. I think there might be a reason.
> > So I'm not sure about this one.
> >
> > If you have a patch to fix the irda issue properly, send it out and
> I'll rebase my remote branch and drop this one.
>
> Whether Chris has a patch or not this patch in its form should be
> dropped since there is a better way to do it
>
Shipping a default configuration file or using /etc/default as the
configuration directory? Or something else?
//Chen Qi
> >
> > Best Regards,
> > Chen Qi
> >
> >
> > --
> > Christopher Larson
> > clarson at kergoth dot com
> > Founder - BitBake, OpenEmbedded, OpenZaurus
> > Maintainer - Tslib
> > Senior Software Engineer, Mentor Graphics
> >
[-- Attachment #2: Type: text/html, Size: 3972 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem
2013-08-07 8:08 ` [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem Qi.Chen
@ 2013-08-08 2:50 ` ChenQi
0 siblings, 0 replies; 18+ messages in thread
From: ChenQi @ 2013-08-08 2:50 UTC (permalink / raw)
To: openembedded-core
On 08/07/2013 04:08 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Previously, dead links in target directory will not be copied.
> This is incorrect as dead links are not uncommon in our rootfs.
> So we use '-a' option instead.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
> .../initscripts-1.0/populate-volatile.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> index 827fd7d..b1c0245 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
> @@ -76,7 +76,8 @@ link_file() {
> if [ -L \"$2\" ]; then
> [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
> elif [ -d \"$2\" ]; then
> - for f in $2/* $2/.[^.]*; do [ -e \$f ] && cp -rf \$f $1; done;
> + cp -a $2/* $1
> + cp -a $2/.[!.]* $1
My apologies.
The above two lines are missing colons.
They should be:
cp -a $2/* $1;
cp -a $2/.[!.]* $1;
Remote branch has been updated to fix this error.
Sorry for the inconvenience.
Best Regards,
Chen Qi
> rm -rf \"$2\";
> ln -sf \"$1\" \"$2\";
> else
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2013-08-08 2:50 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 8:08 [PATCH V4 00/10] Make read-only rootfs work with live images Qi.Chen
2013-08-07 8:08 ` [PATCH V4 01/10] init-live.sh: make $ROOT_MOUNT/media writable when necessary Qi.Chen
2013-08-07 8:08 ` [PATCH V4 02/10] use a uniform way to determine whether rootfs is read-only Qi.Chen
2013-08-07 20:29 ` Otavio Salvador
2013-08-08 2:17 ` ChenQi
2013-08-07 8:08 ` [PATCH V4 03/10] udev: remove implicit dependency on initscripts Qi.Chen
2013-08-07 8:08 ` [PATCH V4 04/10] populate-volatile.sh: use $ROOT_DIR/var/volatile/tmp as TMPDIR Qi.Chen
2013-08-07 8:08 ` [PATCH V4 05/10] populate-volatile.sh: don't spawn background process at rootfs time Qi.Chen
2013-08-07 8:08 ` [PATCH V4 06/10] runqemu-internal: fix to start X correctly in live images Qi.Chen
2013-08-07 8:08 ` [PATCH V4 07/10] initscripts: use a uniform way to handle directories in read-only rootfs Qi.Chen
2013-08-07 8:08 ` [PATCH V4 08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem Qi.Chen
2013-08-08 2:50 ` ChenQi
2013-08-07 8:08 ` [PATCH V4 09/10] irda-utils: fix for read-only rootfs Qi.Chen
2013-08-07 14:18 ` Chris Larson
2013-08-08 2:10 ` ChenQi
2013-08-08 2:23 ` Khem Raj
2013-08-08 2:29 ` ChenQi
2013-08-07 8:08 ` [PATCH V4 10/10] openssh: " Qi.Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox