summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-01 15:08:09 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-01 15:08:45 +0100
commitcaab7fc509bf27706ff3248689f6afd04225cfda (patch)
treef832f656c91502303968fcee1aae382b9f713626
parent232ef8430e2cfbf6eee54f602dc74b9986e3997f (diff)
downloadpoky-caab7fc509bf27706ff3248689f6afd04225cfda.tar.gz
Drop chroot usage as its not well used, tested and is broken
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--handbook/development.xml42
-rw-r--r--meta/packages/oh/qemu-config.bb8
-rwxr-xr-xmeta/packages/oh/qemu-config/poky-chroot-init7
-rwxr-xr-xmeta/packages/oh/qemu-config/poky-chroot-launch26
-rwxr-xr-xscripts/poky-chroot-run86
-rwxr-xr-xscripts/poky-chroot-setup31
6 files changed, 2 insertions, 198 deletions
diff --git a/handbook/development.xml b/handbook/development.xml
index 4f36c7aa82..3bcf40506c 100644
--- a/handbook/development.xml
+++ b/handbook/development.xml
@@ -241,48 +241,6 @@
241 </para> 241 </para>
242 </section> 242 </section>
243 243
244 <section id="platdev-appdev-chroot">
245 <title>Developing externally in a chroot</title>
246 <para>
247 If you have a system that matches the architecture of the Poky machine you're using,
248 such as qemux86, you can run binaries directly from the image on the host system
249 using a chroot combined with tools like <ulink url='http://projects.o-hand.com/xephyr'>Xephyr</ulink>.
250 </para>
251 <para>
252 Poky has some scripts to make using its qemux86 images within a chroot easier. To use
253 these you need to install the poky-scripts package or otherwise obtain the
254 <filename>poky-chroot-setup</filename> and <filename>poky-chroot-run</filename> scripts.
255 You also need Xephyr and chrootuid binaries available. To initialize a system use the setup script:
256 </para>
257 <para>
258 <literallayout class='monospaced'>
259# poky-chroot-setup &lt;qemux86-rootfs.tgz&gt; &lt;target-directory&gt;
260</literallayout>
261 </para>
262 <para>
263 which will unpack the specified qemux86 rootfs tarball into the target-directory.
264 You can then start the system with:
265 </para>
266 <para>
267 <literallayout class='monospaced'>
268# poky-chroot-run &lt;target-directory&gt; &lt;command&gt;
269</literallayout>
270 </para>
271 <para>
272 where the target-directory is the place the rootfs was unpacked to and command is
273 an optional command to run. If no command is specified, the system will drop you
274 within a bash shell. A Xephyr window will be displayed containing the emulated
275 system and you may be asked for a password since some of the commands used for
276 bind mounting directories need to be run using sudo.
277 </para>
278 <para>
279 There are limits as to how far the the realism of the chroot environment extends.
280 It is useful for simple development work or quick tests but full system emulation
281 with QEMU offers a much more realistic environment for more complex development
282 tasks. Note that chroot support within Poky is still experimental.
283 </para>
284 </section>
285
286 <section id="platdev-appdev-insitu"> 244 <section id="platdev-appdev-insitu">
287 <title>Developing in Poky directly</title> 245 <title>Developing in Poky directly</title>
288 <para> 246 <para>
diff --git a/meta/packages/oh/qemu-config.bb b/meta/packages/oh/qemu-config.bb
index f1b7de74aa..fc59320282 100644
--- a/meta/packages/oh/qemu-config.bb
+++ b/meta/packages/oh/qemu-config.bb
@@ -1,14 +1,12 @@
1DESCRIPTION = "Adds scripts to use distcc on the host system under qemu" 1DESCRIPTION = "Adds scripts to use distcc on the host system under qemu"
2LICENSE = "GPL" 2LICENSE = "GPL"
3RDEPENDS = "distcc task-poky-nfs-server fakeroot oprofileui-server rsync bash" 3RDEPENDS = "distcc task-poky-nfs-server oprofileui-server rsync bash"
4PR = "r16" 4PR = "r17"
5 5
6SRC_URI = "file://distcc.sh \ 6SRC_URI = "file://distcc.sh \
7 file://anjuta-remote-run \ 7 file://anjuta-remote-run \
8 file://exports \ 8 file://exports \
9 file://shutdown.desktop \ 9 file://shutdown.desktop \
10 file://poky-chroot-init \
11 file://poky-chroot-launch \
12 file://qemu-autostart" 10 file://qemu-autostart"
13 11
14S = "${WORKDIR}" 12S = "${WORKDIR}"
@@ -24,8 +22,6 @@ do_install() {
24 22
25 install -d ${D}${bindir} 23 install -d ${D}${bindir}
26 install -m 0755 anjuta-remote-run ${D}${bindir}/ 24 install -m 0755 anjuta-remote-run ${D}${bindir}/
27 install -m 0775 poky-chroot-init ${D}${bindir}/
28 install -m 0775 poky-chroot-launch ${D}${bindir}/
29 25
30 install -d ${D}${datadir}/applications 26 install -d ${D}${datadir}/applications
31 install -m 0644 shutdown.desktop ${D}${datadir}/applications/ 27 install -m 0644 shutdown.desktop ${D}${datadir}/applications/
diff --git a/meta/packages/oh/qemu-config/poky-chroot-init b/meta/packages/oh/qemu-config/poky-chroot-init
deleted file mode 100755
index 0afa505100..0000000000
--- a/meta/packages/oh/qemu-config/poky-chroot-init
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/bash
2
3export USER=root
4export HOME=/home/root
5export PATH=/sbin:/bin:/usr/sbin:/usr/bin
6
7fakeroot ipkg configure
diff --git a/meta/packages/oh/qemu-config/poky-chroot-launch b/meta/packages/oh/qemu-config/poky-chroot-launch
deleted file mode 100755
index dbc432b66c..0000000000
--- a/meta/packages/oh/qemu-config/poky-chroot-launch
+++ /dev/null
@@ -1,26 +0,0 @@
1#!/bin/bash
2
3export USER=root
4export HOME=/home/root
5export PATH=/sbin:/bin:/usr/sbin:/usr/bin
6
7export DISPLAY=:1
8
9unset DBUS_SESSION_BUS_ADDRESS
10
11SERVICES=dbus-1
12
13for S in $SERVICES; do
14 fakeroot /etc/init.d/$S start
15done
16
17/etc/X11/Xsession &
18
19bash -l
20
21# The --user option in the dbus stop script breaks under chroot
22/sbin/start-stop-daemon --stop --pidfile /var/run/dbus/pid
23
24for S in $SERVICES; do
25 fakeroot /etc/init.d/$S stop
26done
diff --git a/scripts/poky-chroot-run b/scripts/poky-chroot-run
deleted file mode 100755
index f1f4dec6a4..0000000000
--- a/scripts/poky-chroot-run
+++ /dev/null
@@ -1,86 +0,0 @@
1#!/bin/bash
2#
3# Runs a command within a Poky chroot
4#
5
6XEPHYR=`which Xephyr`
7if [ ! -n "$XEPHYR" -o ! -x "$XEPHYR" ]; then
8 echo "You need to install Xephyr to use $0"
9 exit 1
10fi
11
12CHROOTUID=`which chrootuid`
13if [ ! -n "$CHROOTUID" -o ! -x "$CHROOTUID" ]; then
14 echo "You need to install Xephyr to use $0"
15 exit 1
16fi
17
18
19case $# in
20 0)
21 echo "Invalid arguments."
22 echo "$ $0 <target> [command]"
23 exit 1
24 ;;
25 1)
26 ROOTFS=$1
27 shift
28 # Set $1 to be the boot script
29 set -- /usr/bin/poky-chroot-launch
30 ;;
31 *)
32 ROOTFS=$1
33 shift
34 # Now $1 onwards are the command and arguments to run
35 ;;
36esac
37
38test -f "$ROOTFS/.pokychroot" || { echo "$ROOTFS is not setup for use as a Poky chroot." ; exit 1 ;}
39
40set -e
41
42# chrootuid doesn't handle relative paths, so ensure that the rootfs path is
43# absolute
44if test ${ROOTFS:0:1} != /; then
45 ROOTFS="$(pwd)/$ROOTFS"
46fi
47
48safe_mount() {
49 if ! mountpoint -q "$ROOTFS/$1"; then
50 sudo mount --bind $1 "$ROOTFS/$1"
51 fi
52}
53safe_umount() {
54 if mountpoint -q "$ROOTFS/$1"; then
55 sudo umount "$ROOTFS/$1"
56 fi
57}
58
59# Mount the directories we need
60for m in /dev /dev/pts /dev/shm /proc /sys /tmp; do
61 safe_mount $m
62done
63
64# Set up the environment
65export PATH=/bin:/usr/bin:/sbin:/usr/sbin
66export HOME=/home/$USER
67
68if [ ! -f "$ROOTFS/.pokychroot.init" ]; then
69 sudo $CHROOTUID -i "$ROOTFS" $USER /bin/sh -c "/usr/bin/poky-chroot-init"
70 touch "$ROOTFS/.pokychroot.init"
71fi
72
73$XEPHYR :1 -ac -screen 640x480x16 &
74
75# Go go go!
76sudo $CHROOTUID -i "$ROOTFS" $USER "$@" || /bin/true
77
78# Trap term signals so we don't kill ourselves
79trap true TERM
80# send term signal to the process group
81kill -- -$$
82
83# Unmount TODO: only umount if there are no other sessions active, somehow.
84for m in /tmp /sys /proc /dev/shm /dev/pts /dev; do
85 safe_umount $m
86done
diff --git a/scripts/poky-chroot-setup b/scripts/poky-chroot-setup
deleted file mode 100755
index 209efd6df4..0000000000
--- a/scripts/poky-chroot-setup
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash
2#
3# Script to extract a poky qemux86 rootfs and prepare it for
4# use as a chroot
5#
6
7set -e
8
9case $# in
10 2)
11 TGZ=$1
12 TARGET=$2
13 ;;
14 *)
15 echo "Invalid arguments, please run as:"
16 echo "$ $0 <qemux86-rootfs.tar.gz> <target-directory>"
17 exit 1
18esac
19
20echo "Extracting $TGZ into $TARGET"
21
22test -d "$TARGET" && { echo "$TARGET already exists, please remove and retry or specify a dirferent directory." ; exit 1 ; }
23mkdir --parents "$TARGET"
24
25tar -C "$TARGET" --exclude ./dev/\* -jxp -f "$TGZ"
26echo "HAVE_TOUCHSCREEN=0" >> "$TARGET/etc/formfactor/machconfig"
27echo "DISPLAY_WIDTH_PIXELS=640" >> "$TARGET/etc/formfactor/machconfig"
28echo "DISPLAY_HEIGHT_PIXELS=480" >> "$TARGET/etc/formfactor/machconfig"
29cp /etc/passwd "$TARGET/etc/passwd"
30cp /etc/resolv.conf "$TARGET/etc/resolv.conf"
31touch "$TARGET/.pokychroot"