[Desire Android Development] sfjuocekr:
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="armv7a-unknown-linux-gnueabi"

USE="minimal unicode -X -gnome -kde -firefox -wifi syslog -udev -mdev threads nptl -ipv6 sqlite jpeg png dbus -gpm ssh"

VIDEO_CARDS="none"
ALSA_CARDS="none"
INPUT_DEVICES="none"
ACCEPT_LICENSE="*"
MAKEOPTS="-j1"
FEATURES="noman nodoc noinfo -userfetch"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog"
AUTOCLEAN="yes"
LINGUAS="en"
PORTAGE_NICENESS="19"

I use this make.conf for Gentoo on my Desire.

Firstly NEVER globally allow keywords, this is bad. Do this for the specific programs you need, you can use /etc/portage and mask/unmask packages you actually need unmasked.

Set MAKEOPTS to -j1 instead of 2, helps keeping the system usable while emerging together with PORTAGE_NICENESS at 19.

I have left X etc all out of the global USE flags to save space, again use /etc/portage to set specific USE flags for packages that need them. This will save alot of space, because there are lots of packages with X support you will never need usualy.

I'm not entirely sure about leaving wifi and mdev away, but wifi is handled by Android itself and mdev should be too.

Then in the startup-script there was a minor mistake bind mounting /dev/fd, this is the modified script:

#!/system/bin/sh
#
# Linux startup script for rooted Android systems
# © Deathisfatal @ xdaforums.com
#
# TODO:
# - Error handling
#

# Edit the following variables as required

HOSTNAME="UGH-GSM"
LINUX="/data/gentoo/"
BB="/system/xbin/busybox"
CHROOT="${BB} chroot ${LINUX}"
ROOT="/dev/block/mmcblk0p2"
#SWAP="/swap"

${BB} mount -o noatime -t ext3 ${ROOT} ${LINUX}
${BB} mount -o bind /dev ${LINUX}dev
${CHROOT} /bin/mkdir /dev/shm
${CHROOT} /bin/mount -t tmpfs -o size=32m none /dev/shm
${CHROOT} /bin/mkdir /dev/fd
${BB} mount -o bind /proc/self/fd /dev/fd
${CHROOT} /bin/mount -t devpts none /dev/pts
${BB} mount -t proc none ${LINUX}proc
#${CHROOT} /sbin/swapon ${SWAP}
${CHROOT} /bin/mount -t tmpfs -o size=32m none /tmp
${CHROOT} /bin/mkdir /tmp/run
${CHROOT} /bin/mkdir /tmp/run/portage
${CHROOT} /bin/touch /tmp/run/utmp
${CHROOT} /bin/chmod 777 -R /tmp
${CHROOT} /bin/mkdir /mnt/data
${CHROOT} /bin/mkdir /mnt/sdcard
${BB} mount -o bind /data ${LINUX}mnt/data
${BB} mount -o bind /sdcard ${LINUX}mnt/sdcard
${CHROOT} /bin/hostname ${HOSTNAME}

# Uncomment the following line to enable sshd on boot
#${CHROOT} /usr/sbin/sshd

And yea some error handling should be added to check if a directory exists yes or no, but not really important.

If I make more changes, I'll make notice here in the forums. If you have other general Gentoo questions, please ask I have been working with Gentoo since 2001 :) But it is a really trial and error distribution, you HAVE to be self capable to fix problems that will arise ... they WILL arise ;)

And again, leave

ACCEPT_KEYWORDS="~arm ~*" # Many useful packages are masked for arm with ~*

out of your makefile. Do it in /etc/portage when needed.

Don't use -O3 and -Os together, this actually GROWS ... same with using mcpu with march doesn't work just use march and mtune. -O2 is recommended.

http://www.gentoo.org/doc/en/gcc-optimization.xml