-
Notifications
You must be signed in to change notification settings - Fork 13
AndroidGlibcChroot
While Android is great for application development things can get a little rough for people doing platform development. People knowing Unix like system will feel that Android threw away many tools and tradition to start off from scratch in a different direction. By default for example Android will not come with a full set of ubiquitous command line tools like grep,find and vi not to forget. Some of these tools can be found in a busybox enabled installation but sometimes you might want to make full use of a “real” system. In such situation it is very useful to be able to start processes in a environment running a mature and complete libc implementation.
All you really need to do is to get yourself a compatible set of root file system files be it a debian root file system or in this case a downloaded OpenEmbedded root file system. http://www.angstrom-distribution.org/builder/
To be able to perform a chroot you need the chroot program (and this is not available by default in Android) and you normally can also not run it from the downloaded root file system as the chroot ot that system depends on a “real” libc implementation. The following lines of code assumes you untarred your file system in a directory called /oe and run the linker to execute the chroot.
export BASE=/oe
export PATH=${BASE}/bin:${BASE}/sbin:${BASE}/usr/bin/:${BASE}/usr/sbin:/sbin:/system/sbin:/system/bin:/system/xbin:${BASE}/lib/
export LD_LIBRARY_PATH=/system/lib:${BASE}/lib:${BASE}/usr/lib:/lib:/usr/lib
mount -o bind /dev ${BASE}/dev
mount -o bind /proc ${BASE}/proc
mount -o bind /sys ${BASE}/sys
${BASE}/lib/ld-2.9.so ${BASE}/usr/sbin/chroot ${BASE}
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export LD_LIBRARY_PATH=/lib:/usr/lib
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/graphics/fb0 The above script was used to run the ts_calibrate utility on an gumstix.