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
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

View File

@ -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"

View File

@ -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}

View File

@ -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);