Prerequisites
- a rooted xoom
- busybox installed
- a terminal emulator (Better Terminal Pro works perfectly)
- a large enough & preferably fast microsd card. I used an 8Gigs class 6.
- check if you have nothing important to backup on the card before starting
- optional : a bluetooth keyboard
First step : prepare an sdcard
Plug your card with a reader / adapter on a standard linux.
It should appear like a /dev/mmcblk0
Wipe out the partition table and create one big linux fs:
fdisk /dev/mmcblk0
remove all partitions: d d d
re-add one, primary with the default linux type with the default size (all disk)
n then p then enter enter
Create an ext4 file system:
mkfs.ext4 /dev/mmcblk0p1Mount the fs somewhere
mkdir -p /mnt/gentoo mount /dev/mmcblk0p1 /mnt/gentoo cd /mnt/gentooSecond step : copy over the stage3 and portage
Browse to http://www.gentoo.org/main/en/mirrors2.xml and find a good mirror for you or if you have already a gentoo machine do :
emerge mirrorselect mirrorselect -s 1 -oYou need to find a stage3 of armv7 arch with hardfp and undecompress it where you have mounted your sdcard :
cd /mnt/gentoo wget http://mirror.ovh.net/gentoo-distfiles/releases/arm/autobuilds/current-stage3-armv7a_hardfp/stage3-armv7a_hardfp-20110503.tar.bz2 tar xjvf stage3*.tar.bz2 rm stage3*.tar.bz2Then you need a portage snapshot and uncompress it in the right directory:
cd /mnt/gentoo/usr wget http://mirror.ovh.net/gentoo-distfiles/releases/snapshots/current/portage-latest.tar.bz2 tar xjvf portage-latest.tar.bz2 rm portage-latest.tar.bz2
Third step : adjust some settings
in /mnt/gentoo/etc/make.conf adjust your mirrors and, very important disable the userfetch feature:
[...] SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/" FEATURES="-userfetch" # on android non-priviledged users like portage has no right to open a socket due to CONFIG_ANDROID_PARANOID_NETWORK in the kernel configNote : you can also add MAKEOPTS="-j2" for parallel building
create /mnt/gentoo/root/.profile like this :
export TERM=xterm env-update cd
Unmount your card, put it in your Xoom and restart it.
Chroot in your gentoo
Here is a little script that you can put for example in /sdcard/gg.sh :
mkdir -p /sdcard/gentoo mountpoint -q /sdcard/gentoo || mount -t ext4 -o noatime /dev/block/mmcblk0p1 /sdcard/gentoo echo "nameserver `getprop dhcp.wlan0.dns1`" > /sdcard/gentoo/etc/resolv.conf mountpoint -q /sdcard/gentoo/dev || mount -o bind /dev /sdcard/gentoo/dev mountpoint -q /sdcard/gentoo/dev/pts || mount -o bind /dev/pts /sdcard/gentoo/dev/pts mountpoint -q /sdcard/gentoo/sys || mount -o bind /sys /sdcard/gentoo/sys mountpoint -q /sdcard/gentoo/proc || mount -t proc proc /sdcard/gentoo/proc export HOME=/root export TERMINFO=/etc/terminfo chroot /sdcard/gentoo /bin/bash -l
then do from adb shell or your favorite terminal on the device :
su source /sdcard/gg.sh
Enjoy your new gentoo environment !
Edit1:
- added a check to avoid remounts when you reexecute the script
- overrided the shell variable better terminal was putting
Edit2 2011-05-28: With the 3.1 update, the sdcard is mounted directly under /sdcard/external:
/dev/block/mmcblk0p1 /mnt/sdcard/external ext4 rw,relatime,barrier=1,data=ordered 0 0
So you can safely reuse it directly, here is the alternative script.
echo "nameserver `getprop dhcp.wlan0.dns1`" > /sdcard/external/etc/resolv.conf mountpoint -q /sdcard/external/dev || mount -o bind /dev /sdcard/external/dev mountpoint -q /sdcard/external/dev/pts || mount -o bind /dev/pts /sdcard/external/dev/pts mountpoint -q /sdcard/external/sys || mount -o bind /sys /sdcard/external/sys mountpoint -q /sdcard/external/proc || mount -t proc proc /sdcard/external/proc export HOME=/root export TERMINFO=/etc/terminfo chroot /sdcard/external /bin/bash -l
Caveat : in order to install overlay using subversions, it seems that the sandbox fails with dev-libs/apr.
ReplyDeleteSo before emerging subversion you can do :
FEATURES="-sandbox" emerge -1 dev-libs/apr
Thanks a lot an Greetings from Berlin!
ReplyDeleteWhen I try and emerge something, screen for example, it doesn't like the local file:
ReplyDelete('Filesize does not match recorded size', 352L, 840602)
and of course it fails when it tries to fetch. While it would be nice to fix the checksum errors, it would be even nicer to allow it to actually be able to open up sockets. Is there any way to enable this functionality?
You have set the FEATURES="-userfetch"?
ReplyDeleteDo you have tried it with a real sd?
Added an (slightly) alternative script for the 3.1 version.
ReplyDeleteThank you :) now compiling xfce+tightvnc and after that I try texlive ;) funny thing.
ReplyDeleteI do have -userfetch, haven't tried on a real SD card.
ReplyDeletetry to remove the leftover from /usr/portage/distfiles/ and retry ?
ReplyDeleteInteresting... I was considering crossdev and trying to build a lightweight version of gentoo for the Xoom... It seems that the xoom can handle the load, and this is promising that there might just be an option to do it! Thanks
ReplyDeleteI don't mean to troll your blog, but I was curious if you had any additional development on gentoo on the Xoom besides the chroot, and are you familiar with the Tegra kernel at git://nv-tegra.nvidia.com/linux-2.6.git?
ReplyDeleteFunny that you asked that, I was preparing a tutorial for adding hardware support to the xoom !
ReplyDeleteI just published it :
http://klaig.blogspot.com/2011/05/customizing-xoom-kernel-modules-to-add.html
Possibilities are just ... tantalizing !
@william for your previous comment about crossdev, have checked out my crossdev with distcc setup on this other post : http://klaig.blogspot.com/2011/05/speedup-compilation-with-distcc-cross.html ?
ReplyDeleteYou can compile from your Xoom and offload it while crosscompiling to your PC.
Well... I feel that I might be going about this the wrong way.... I might have to take a different approach. http://www.thebytes.net/projects/gentoo-arm-for-the-motorola-xoom/ My goals were: build arm-gentoo on my x86_64 and then test it in qemu(not sure how yet), then push. The biggest problem though was not being able to test the actual boot process and if the kernel loaded the right.
ReplyDeleteNow, chrooting gentoo ON the xoom sounds... just easy... i am going to give this a shot tonight.
Do you need to do anything special for the 8GB sdcard, because for some reason, mine is not being detected... but the 2GB is working fine.
ReplyDelete