mirror of
https://git.yoctoproject.org/poky
synced 2026-04-05 08:02:25 +02:00
Drop chroot usage as its not well used, tested and is broken
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
@@ -241,48 +241,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="platdev-appdev-chroot">
|
||||
<title>Developing externally in a chroot</title>
|
||||
<para>
|
||||
If you have a system that matches the architecture of the Poky machine you're using,
|
||||
such as qemux86, you can run binaries directly from the image on the host system
|
||||
using a chroot combined with tools like <ulink url='http://projects.o-hand.com/xephyr'>Xephyr</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
Poky has some scripts to make using its qemux86 images within a chroot easier. To use
|
||||
these you need to install the poky-scripts package or otherwise obtain the
|
||||
<filename>poky-chroot-setup</filename> and <filename>poky-chroot-run</filename> scripts.
|
||||
You also need Xephyr and chrootuid binaries available. To initialize a system use the setup script:
|
||||
</para>
|
||||
<para>
|
||||
<literallayout class='monospaced'>
|
||||
# poky-chroot-setup <qemux86-rootfs.tgz> <target-directory>
|
||||
</literallayout>
|
||||
</para>
|
||||
<para>
|
||||
which will unpack the specified qemux86 rootfs tarball into the target-directory.
|
||||
You can then start the system with:
|
||||
</para>
|
||||
<para>
|
||||
<literallayout class='monospaced'>
|
||||
# poky-chroot-run <target-directory> <command>
|
||||
</literallayout>
|
||||
</para>
|
||||
<para>
|
||||
where the target-directory is the place the rootfs was unpacked to and command is
|
||||
an optional command to run. If no command is specified, the system will drop you
|
||||
within a bash shell. A Xephyr window will be displayed containing the emulated
|
||||
system and you may be asked for a password since some of the commands used for
|
||||
bind mounting directories need to be run using sudo.
|
||||
</para>
|
||||
<para>
|
||||
There are limits as to how far the the realism of the chroot environment extends.
|
||||
It is useful for simple development work or quick tests but full system emulation
|
||||
with QEMU offers a much more realistic environment for more complex development
|
||||
tasks. Note that chroot support within Poky is still experimental.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="platdev-appdev-insitu">
|
||||
<title>Developing in Poky directly</title>
|
||||
<para>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
DESCRIPTION = "Adds scripts to use distcc on the host system under qemu"
|
||||
LICENSE = "GPL"
|
||||
RDEPENDS = "distcc task-poky-nfs-server fakeroot oprofileui-server rsync bash"
|
||||
PR = "r16"
|
||||
RDEPENDS = "distcc task-poky-nfs-server oprofileui-server rsync bash"
|
||||
PR = "r17"
|
||||
|
||||
SRC_URI = "file://distcc.sh \
|
||||
file://anjuta-remote-run \
|
||||
file://exports \
|
||||
file://shutdown.desktop \
|
||||
file://poky-chroot-init \
|
||||
file://poky-chroot-launch \
|
||||
file://qemu-autostart"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
@@ -24,8 +22,6 @@ do_install() {
|
||||
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 anjuta-remote-run ${D}${bindir}/
|
||||
install -m 0775 poky-chroot-init ${D}${bindir}/
|
||||
install -m 0775 poky-chroot-launch ${D}${bindir}/
|
||||
|
||||
install -d ${D}${datadir}/applications
|
||||
install -m 0644 shutdown.desktop ${D}${datadir}/applications/
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
export USER=root
|
||||
export HOME=/home/root
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
fakeroot ipkg configure
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
export USER=root
|
||||
export HOME=/home/root
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
export DISPLAY=:1
|
||||
|
||||
unset DBUS_SESSION_BUS_ADDRESS
|
||||
|
||||
SERVICES=dbus-1
|
||||
|
||||
for S in $SERVICES; do
|
||||
fakeroot /etc/init.d/$S start
|
||||
done
|
||||
|
||||
/etc/X11/Xsession &
|
||||
|
||||
bash -l
|
||||
|
||||
# The --user option in the dbus stop script breaks under chroot
|
||||
/sbin/start-stop-daemon --stop --pidfile /var/run/dbus/pid
|
||||
|
||||
for S in $SERVICES; do
|
||||
fakeroot /etc/init.d/$S stop
|
||||
done
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Runs a command within a Poky chroot
|
||||
#
|
||||
|
||||
XEPHYR=`which Xephyr`
|
||||
if [ ! -n "$XEPHYR" -o ! -x "$XEPHYR" ]; then
|
||||
echo "You need to install Xephyr to use $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CHROOTUID=`which chrootuid`
|
||||
if [ ! -n "$CHROOTUID" -o ! -x "$CHROOTUID" ]; then
|
||||
echo "You need to install Xephyr to use $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
case $# in
|
||||
0)
|
||||
echo "Invalid arguments."
|
||||
echo "$ $0 <target> [command]"
|
||||
exit 1
|
||||
;;
|
||||
1)
|
||||
ROOTFS=$1
|
||||
shift
|
||||
# Set $1 to be the boot script
|
||||
set -- /usr/bin/poky-chroot-launch
|
||||
;;
|
||||
*)
|
||||
ROOTFS=$1
|
||||
shift
|
||||
# Now $1 onwards are the command and arguments to run
|
||||
;;
|
||||
esac
|
||||
|
||||
test -f "$ROOTFS/.pokychroot" || { echo "$ROOTFS is not setup for use as a Poky chroot." ; exit 1 ;}
|
||||
|
||||
set -e
|
||||
|
||||
# chrootuid doesn't handle relative paths, so ensure that the rootfs path is
|
||||
# absolute
|
||||
if test ${ROOTFS:0:1} != /; then
|
||||
ROOTFS="$(pwd)/$ROOTFS"
|
||||
fi
|
||||
|
||||
safe_mount() {
|
||||
if ! mountpoint -q "$ROOTFS/$1"; then
|
||||
sudo mount --bind $1 "$ROOTFS/$1"
|
||||
fi
|
||||
}
|
||||
safe_umount() {
|
||||
if mountpoint -q "$ROOTFS/$1"; then
|
||||
sudo umount "$ROOTFS/$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Mount the directories we need
|
||||
for m in /dev /dev/pts /dev/shm /proc /sys /tmp; do
|
||||
safe_mount $m
|
||||
done
|
||||
|
||||
# Set up the environment
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
export HOME=/home/$USER
|
||||
|
||||
if [ ! -f "$ROOTFS/.pokychroot.init" ]; then
|
||||
sudo $CHROOTUID -i "$ROOTFS" $USER /bin/sh -c "/usr/bin/poky-chroot-init"
|
||||
touch "$ROOTFS/.pokychroot.init"
|
||||
fi
|
||||
|
||||
$XEPHYR :1 -ac -screen 640x480x16 &
|
||||
|
||||
# Go go go!
|
||||
sudo $CHROOTUID -i "$ROOTFS" $USER "$@" || /bin/true
|
||||
|
||||
# Trap term signals so we don't kill ourselves
|
||||
trap true TERM
|
||||
# send term signal to the process group
|
||||
kill -- -$$
|
||||
|
||||
# Unmount TODO: only umount if there are no other sessions active, somehow.
|
||||
for m in /tmp /sys /proc /dev/shm /dev/pts /dev; do
|
||||
safe_umount $m
|
||||
done
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to extract a poky qemux86 rootfs and prepare it for
|
||||
# use as a chroot
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
case $# in
|
||||
2)
|
||||
TGZ=$1
|
||||
TARGET=$2
|
||||
;;
|
||||
*)
|
||||
echo "Invalid arguments, please run as:"
|
||||
echo "$ $0 <qemux86-rootfs.tar.gz> <target-directory>"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
echo "Extracting $TGZ into $TARGET"
|
||||
|
||||
test -d "$TARGET" && { echo "$TARGET already exists, please remove and retry or specify a dirferent directory." ; exit 1 ; }
|
||||
mkdir --parents "$TARGET"
|
||||
|
||||
tar -C "$TARGET" --exclude ./dev/\* -jxp -f "$TGZ"
|
||||
echo "HAVE_TOUCHSCREEN=0" >> "$TARGET/etc/formfactor/machconfig"
|
||||
echo "DISPLAY_WIDTH_PIXELS=640" >> "$TARGET/etc/formfactor/machconfig"
|
||||
echo "DISPLAY_HEIGHT_PIXELS=480" >> "$TARGET/etc/formfactor/machconfig"
|
||||
cp /etc/passwd "$TARGET/etc/passwd"
|
||||
cp /etc/resolv.conf "$TARGET/etc/resolv.conf"
|
||||
touch "$TARGET/.pokychroot"
|
||||
Reference in New Issue
Block a user