gnomeos: sysvinit actually runs inside the chroot

This commit is contained in:
Colin Walters 2011-11-15 15:19:31 -05:00
parent 97e82447c6
commit 701ba596e4
4 changed files with 20 additions and 5 deletions

View File

@ -23,10 +23,12 @@ BUILD_TAR=$1
test -n "$BUILD_TAR" || usage test -n "$BUILD_TAR" || usage
shift shift
origcwd=`pwd`
tempdir=`mktemp -d tmp-commit-yocto-build.XXXXXXXXXX` tempdir=`mktemp -d tmp-commit-yocto-build.XXXXXXXXXX`
cd $tempdir cd $tempdir
mkdir fs mkdir fs
cd fs cd fs
fakeroot -s ../fakeroot.db tar xf $BUILD_TAR 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 fakeroot -i ../fakeroot.db ostree --repo=${OSTREE_REPO} commit -s "Build (need ostree git version here)" -b gnomeos-base
cd ${origcwd}
rm -rf $tempdir rm -rf $tempdir

View File

@ -74,15 +74,19 @@ if (! test -f ${OBJ}); then
cd ${WORKDIR} cd ${WORKDIR}
umount fs umount fs
rmdir fs
mv ${OBJ}.tmp ${OBJ} mv ${OBJ}.tmp ${OBJ}
fi fi
ARGS="$@" ARGS="$@"
if ! [ echo $ARGS | grep -q 'init=']; then if ! echo $ARGS | grep -q 'init='; then
ARGS="init=/ostree-init $ARGS" ARGS="init=/ostree-init $ARGS"
fi fi
if ! [ echo $ARGS | grep -q 'root=']; then if ! echo $ARGS | grep -q 'root='; then
ARGS="root=/dev/hda $ARGS" ARGS="root=/dev/hda $ARGS"
fi 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" exec qemu-kvm -kernel ./tmp/deploy/images/bzImage-qemux86.bin -hda gnomeos-fs.img -append "$ARGS"

View File

@ -10,7 +10,7 @@ inherit rootfs_${IMAGE_PKGTYPE}
PACKAGE_INSTALL = "task-core-boot task-base-extended \ PACKAGE_INSTALL = "task-core-boot task-base-extended \
ostree ostree-init" ostree ostree-init"
RDEPENDS += "${PACKAGE_INSTALL}" RDEPENDS += "${PACKAGE_INSTALL}"
DEPENDS += "virtual/fakeroot-native" DEPENDS += "makedevs-native virtual/fakeroot-native"
EXCLUDE_FROM_WORLD = "1" EXCLUDE_FROM_WORLD = "1"
@ -20,6 +20,9 @@ do_rootfs[lockfiles] += "${IMAGE_ROOTFS}.lock"
do_build[nostamp] = "1" do_build[nostamp] = "1"
do_rootfs[umask] = 022 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 # 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. # task, so that we have a single fakeroot context for the whole process.
fakeroot do_rootfs () { fakeroot do_rootfs () {
@ -31,6 +34,8 @@ fakeroot do_rootfs () {
rootfs_${IMAGE_PKGTYPE}_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 echo "GNOME OS Unix login" > ${IMAGE_ROOTFS}/etc/issue
TOPROOT_BIND_MOUNTS="home root tmp" TOPROOT_BIND_MOUNTS="home root tmp"
@ -48,6 +53,8 @@ fakeroot do_rootfs () {
for d in $READONLY_BIND_MOUNTS; do for d in $READONLY_BIND_MOUNTS; do
mv ${IMAGE_ROOTFS}/$d . mv ${IMAGE_ROOTFS}/$d .
done done
# Also copy over any static /dev contents for now
mv ${IMAGE_ROOTFS}/dev .
rm -rf ${IMAGE_ROOTFS} rm -rf ${IMAGE_ROOTFS}
mv ${WORKDIR}/gnomeos-contents ${IMAGE_ROOTFS} mv ${WORKDIR}/gnomeos-contents ${IMAGE_ROOTFS}

View File

@ -112,6 +112,8 @@ int main(int argc, char *argv[])
exit (1); exit (1);
} }
fprintf (stderr, "ostree-init kernel cmdline: %s\n", buf);
fflush (stderr);
p = buf; p = buf;
while (p != NULL) while (p != NULL)
{ {
@ -142,7 +144,7 @@ int main(int argc, char *argv[])
snprintf (destpath, sizeof(destpath), "/ostree/%s/var", ostree_root); snprintf (destpath, sizeof(destpath), "/ostree/%s/var", ostree_root);
if (mount ("/ostree/var", destpath, NULL, MS_BIND, NULL) < 0) 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); exit (1);
} }
@ -181,7 +183,7 @@ int main(int argc, char *argv[])
init_argv[i] = argv[i]; init_argv[i] = argv[i];
init_argv[i] = NULL; 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); fflush (stderr);
execv (INIT_PATH, init_argv); execv (INIT_PATH, init_argv);
perrorv ("Failed to exec init '%s'", INIT_PATH); perrorv ("Failed to exec init '%s'", INIT_PATH);