image: Add /sysroot as a toplevel bind mount to the real root
This allows tools to see and operate on the "real" root conveniently; for example, ostree clearly needs to operate on /ostree/repo.
This commit is contained in:
parent
cb04d99b76
commit
d145b0426c
|
|
@ -144,8 +144,10 @@ if ! test -d ${OBJ}; then
|
|||
rm ostree/gnomeos-origin/debian-setup.sh
|
||||
(cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Run debian-setup.sh' --repo=../repo --from-stdin)
|
||||
|
||||
cp -p ${SRCDIR}/chroot_break ostree/gnomeos-origin/sbin/chroot_break
|
||||
(cd ostree/gnomeos-origin; $OSTREE commit -s 'Add chroot_break' --repo=../repo --add=sbin/chroot_break)
|
||||
# This is the name for the real rootfs, not the chroot
|
||||
(cd ostree/gnomeos-origin;
|
||||
mkdir sysroot;
|
||||
$OSTREE commit -s 'Add sysroot' --repo=../repo --add=sysroot)
|
||||
|
||||
(cd ostree;
|
||||
rev=$($OSTREE rev-parse --repo=repo master)
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ fi
|
|||
kv=`uname -r`
|
||||
kernel=/boot/vmlinuz-${kv}
|
||||
|
||||
exec qemu-kvm -kernel ${kernel} -initrd gnomeos-initrd.img -hda gnomeos-fs.img -append "root=/dev/sda ostree=current"
|
||||
exec qemu-kvm -kernel ${kernel} -initrd gnomeos-initrd.img -hda gnomeos-fs.img -append "root=/dev/sda ostree=current $1"
|
||||
|
|
|
|||
|
|
@ -219,6 +219,12 @@ static int switchroot(const char *newroot, const char *subroot)
|
|||
}
|
||||
}
|
||||
|
||||
snprintf(destpath, sizeof(destpath), "%s/sysroot", subroot_path);
|
||||
if (mount(newroot, destpath, NULL, MS_BIND, NULL) < 0) {
|
||||
perrorv("Failed bind mount sysroot");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (chdir(newroot)) {
|
||||
perrorv("failed to change directory to %s", newroot);
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue