In one of my previous posts I have described how to run Gentoo on Android ARM device. Depending on its power your emerges may take either a long time or a longer time. And your device will warm up significantly. But you have already heard of and used FEATURES=”distcc”, right? Here’s how to set-up a cross compilation with a help from an x86 box in a nutshell.
For sake of clarity I will refer to the systems as follows:
- box – your laptop, PC, server, etc. – where distccd will be running to serve the compilation power
- phone – the Android ARM device with FEATURES=”distcc” enabled
First of all – in order to minimize impact on your box system I strongly advise to use a separate chroot incarnation of Gentoo. Therefore – get your latest stage3 archive and unpack it properly into an empty, new directory of your choice:
(box) # mkdir /mnt/arm-crossdev-chroot (box) # cd /mnt/arm-crossdev-chroot (box) # wget -q -O /dev/stdout $STAGE3_URL | tar xvfjp -
Set-up your bind mounts for the chroot (/dev, /proc, /usr/portage, optionally /usr/portage/distfiles):
(box) # mount --bind /dev ./dev (box) # mount --bind /proc ./proc (box) # mkdir ./usr/portage (box) # mount --bind /usr/portage ./usr/portage (box) # # if you need to: (box) # mount --bind /usr/portage/distfiles ./usr/portage/distfiles
Chroot inside (and stay there) and set-up some sane environment:
(box) # chroot . /bin/bash (box) # env-update && source /etc/profile (box) # PS="(crossdev-chroot) $PS1" (box) # export PS1="(crossdev-chroot) $PS1" (box) # echo 'PS1="(crossdev-chroot) $PS1"' >> ./etc/profile (box) # env-update && source /etc/profile (box) # echo GENTOO_MIRRORS=$YOUR_MIRRORS >> /etc/make.conf
Match your gcc versions on the phone and on the box – just to be safe with well known general distcc guideline.
What you need to do now is to emerge distcc and crossdev:
(box) # emerge -va distcc crossdev
And set up crossdev for ARM like this:
(box) # mkdir /usr/local/portage (box) # echo 'PORTDIR_OVERLAY="/usr/local/portage"' >> /etc/make.conf (box) # crossdev -S -P -v -t armv7a-hardfloat-linux-gnueabi
You need to match the CHOST value above to what you have on your phone. Having done all that you should be almost ready. You may now try running distcc in the foreground on the box:
(box) # distccd --verbose --no-detach --log-stderr --allow x.x.x.x/yy --port 11453
If you see it starting up and the compiler seems OK you need to set up the phone – emerge distcc on it locally first and set-up FEATURES in make.conf. Note that this needs to be performed inside your Gentoo chroot of course.:
(phone) # emerge -va distcc (phone) # echo y.y.y.y:11453 >> /etc/distcc/hosts (phone) # echo 'FEATURES="distcc"' >> /etc/make.conf
And a final touch recommended by the excellent Gentoo’s guide to distcc cross-compiling (on the phone) – in a nutshell:
(phone) # cd /usr/lib/distcc/bin
Create a wrapper script with the following content:
#!/bin/bash exec /usr/lib/distcc/bin/armv7a-hardfloat-linux-gnueabi-g${0:$[-2]} "$@"
And name it armv7a-hardfloat-linux-gnueabi-wrapper.
Then chmod it and set-up symlinks:
(phone) # rm c++ g++ gcc cc (phone) # chmod a+x armv7a-hardfloat-linux-gnueabi-wrapper (phone) # ln -s armv7a-hardfloat-linux-gnueabi-wrapper cc (phone) # ln -s armv7a-hardfloat-linux-gnueabi-wrapper gcc (phone) # ln -s armv7a-hardfloat-linux-gnueabi-wrapper g++ (phone) # ln -s armv7a-hardfloat-linux-gnueabi-wrapper c++
Now you should be all set. Make sure your portage user is set to an uid which is not deprived of network connectivity – see my previous post for details. Now emerge something and watch the output on box generated by foreground distccd:
(phone) # emerge -va vim
Good luck!
Related articles
- Gentoo on Samsung Galaxy S2 (rootprompt.apatsch.net)
- Samsung Galaxy S2 – rootprompt’s first things first (rootprompt.apatsch.net)
hello !
i want to run windows xp in android tab. it has all the requirements but i dont know how to do it.
i have problems understanding your post about windows xp in android.
i wnt to do it using vnc server in my android and i have the windows xp .img file too.
so please tell me the proper guide and i dont know about gentoo and all so help me please!
either reply me with the proper method to run xp in android or email me the same sushobhit333@yahoo.com
(i will be highly obliged to you)
Very useful ,thank you !