[ostree] gnomeos: sysvinit actually runs inside the chroot



commit 701ba596e4765f256053d27e4bdb26a9111af23f
Author: Colin Walters <walters verbum org>
Date:   Tue Nov 15 15:19:31 2011 -0500

    gnomeos: sysvinit actually runs inside the chroot

 gnomeos/yocto/commit-yocto-build.sh                |    2 ++
 gnomeos/yocto/gnomeos-run.sh                       |    8 ++++++--
 .../recipies-core/images/gnomeos-image-contents.bb |    9 ++++++++-
 .../yocto/recipies-core/ostree-init/ostree-init.c  |    6 ++++--
 4 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/gnomeos/yocto/commit-yocto-build.sh b/gnomeos/yocto/commit-yocto-build.sh
index d9ee3a5..78d2343 100755
--- a/gnomeos/yocto/commit-yocto-build.sh
+++ b/gnomeos/yocto/commit-yocto-build.sh
@@ -23,10 +23,12 @@ BUILD_TAR=$1
 test -n "$BUILD_TAR" || usage
 shift
 
+origcwd=`pwd`
 tempdir=`mktemp -d tmp-commit-yocto-build.XXXXXXXXXX`
 cd $tempdir
 mkdir fs
 cd fs
 fakeroot -s ../fakeroot.db tar xf $BUILD_TAR
 fakeroot -i ../fakeroot.db ostree --repo=${OSTREE_REPO} commit -s "Build (need ostree git version here)" -b gnomeos-base
+cd ${origcwd}
 rm -rf $tempdir
diff --git a/gnomeos/yocto/gnomeos-run.sh b/gnomeos/yocto/gnomeos-run.sh
index b9b750e..5fbc01c 100755
--- a/gnomeos/yocto/gnomeos-run.sh
+++ b/gnomeos/yocto/gnomeos-run.sh
@@ -74,15 +74,19 @@ if (! test -f ${OBJ}); then
     cd ${WORKDIR}
     
     umount fs
+    rmdir fs
     mv ${OBJ}.tmp ${OBJ}
 fi
 
 ARGS="$@"
-if ! [ echo $ARGS | grep -q 'init=']; then
+if ! echo $ARGS | grep -q 'init='; then
     ARGS="init=/ostree-init $ARGS"
 fi
-if ! [ echo $ARGS | grep -q 'root=']; then
+if ! echo $ARGS | grep -q 'root='; then
     ARGS="root=/dev/hda $ARGS"
 fi
+if ! echo $ARGS | grep -q 'ostree='; then
+    ARGS="ostree=current $ARGS"
+fi
 
 exec qemu-kvm -kernel ./tmp/deploy/images/bzImage-qemux86.bin -hda gnomeos-fs.img -append "$ARGS"
diff --git a/gnomeos/yocto/recipies-core/images/gnomeos-image-contents.bb b/gnomeos/yocto/recipies-core/images/gnomeos-image-contents.bb
index fefda5a..7e2e273 100644
--- a/gnomeos/yocto/recipies-core/images/gnomeos-image-contents.bb
+++ b/gnomeos/yocto/recipies-core/images/gnomeos-image-contents.bb
@@ -10,7 +10,7 @@ inherit rootfs_${IMAGE_PKGTYPE}
 PACKAGE_INSTALL = "task-core-boot task-base-extended \
 		   ostree ostree-init"
 RDEPENDS += "${PACKAGE_INSTALL}"
-DEPENDS += "virtual/fakeroot-native"
+DEPENDS += "makedevs-native virtual/fakeroot-native"
 
 EXCLUDE_FROM_WORLD = "1"
 
@@ -20,6 +20,9 @@ do_rootfs[lockfiles] += "${IMAGE_ROOTFS}.lock"
 do_build[nostamp] = "1"
 do_rootfs[umask] = 022
 
+def gnomeos_get_devtable_list(d):
+    return bb.which(d.getVar('BBPATH', 1), 'files/device_table-minimal.txt')
+
 # Must call real_do_rootfs() from inside here, rather than as a separate
 # task, so that we have a single fakeroot context for the whole process.
 fakeroot do_rootfs () {
@@ -31,6 +34,8 @@ fakeroot do_rootfs () {
 
 	rootfs_${IMAGE_PKGTYPE}_do_rootfs
 
+	makedevs -r ${IMAGE_ROOTFS} -D ${ gnomeos_get_devtable_list(d)}
+
 	echo "GNOME OS Unix login" > ${IMAGE_ROOTFS}/etc/issue
 
 	TOPROOT_BIND_MOUNTS="home root tmp"
@@ -48,6 +53,8 @@ fakeroot do_rootfs () {
 	for d in $READONLY_BIND_MOUNTS; do
             mv ${IMAGE_ROOTFS}/$d .
 	done
+	# Also copy over any static /dev contents for now
+	mv ${IMAGE_ROOTFS}/dev .
 	rm -rf ${IMAGE_ROOTFS}
 	mv ${WORKDIR}/gnomeos-contents ${IMAGE_ROOTFS}
 
diff --git a/gnomeos/yocto/recipies-core/ostree-init/ostree-init.c b/gnomeos/yocto/recipies-core/ostree-init/ostree-init.c
index d0368dc..2c214e8 100644
--- a/gnomeos/yocto/recipies-core/ostree-init/ostree-init.c
+++ b/gnomeos/yocto/recipies-core/ostree-init/ostree-init.c
@@ -112,6 +112,8 @@ int main(int argc, char *argv[])
       exit (1);
     }
 
+  fprintf (stderr, "ostree-init kernel cmdline: %s\n", buf);
+  fflush (stderr);
   p = buf;
   while (p != NULL)
     {
@@ -142,7 +144,7 @@ int main(int argc, char *argv[])
       snprintf (destpath, sizeof(destpath), "/ostree/%s/var", ostree_root);
       if (mount ("/ostree/var", destpath, NULL, MS_BIND, NULL) < 0)
 	{
-	  perrorv ("Failed to bind mount /ostree/var to '%s'", destpath);
+	  perrorv ("Failed to bind mount / to '%s'", destpath);
 	  exit (1);
 	}
 
@@ -181,7 +183,7 @@ int main(int argc, char *argv[])
     init_argv[i] = argv[i];
   init_argv[i] = NULL;
   
-  fprintf (stderr, "ostree-init: Running real init\n");
+  fprintf (stderr, "ostree-init: Running real init (argc=%d)\n", argc);
   fflush (stderr);
   execv (INIT_PATH, init_argv);
   perrorv ("Failed to exec init '%s'", INIT_PATH);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]