[Android Q&A, Help & Troubleshooting] cashmundy:
My only machine at present is a netbook (Acer Aspire) which is running Fedora 17 (I normally use and recommend Debian).

Building CM7.2 presented quite a few challenges; having finally succeeded, I want to publish some notes to help others with similar constraints. There are doubtless better ways of doing some things set out here (comments welcome), but these worked.

First, Android can only successfully be built and then actually work if built with fairly aged software. Any recent distribution is likely to be troublesome, and FC17 is right out. The best solution appears to be to build in a VM. I built with Debian Wheezy (currently testing) because I had it lying around, but Debian Squeeze is probably the safest bet. One can do a very minimal install, no need for a gui or anything, just the usual tools and libraries.

I first started with VirtualBox on Fedora, using their "Shared Folders". I already had the repo checked out, and wanted to be able to keep the source outside of the VM instead of trapped inside it. VBox in Oracle's infinite wisdom decided not to support symlinks with "Shared Folders", making them useless. This problem appeared only at the end of the build, wasting lots of time.

At this point, I copied the source over to Windows and tried building it with VirtualBox there, which didn't work, so I decided to try Xen on Fedora.

Xen worked, but not very well. There were some crashes and hangs, and the machine could not be suspended.

Worst of all, memory used for guest VMs is permanently subtracted from the host VM, so one has to reboot after one or

two launches of a VM. One plus (on Fedora 17) is that firewall rules are automagically created to allow vibr0, the bridging

network between guest and host, to work so the guest can reach net. I Still needed to

manually add an iptables rule so the guest could access the host, and thus the nfs-exported source code.

iptables -A INPUT -i vibr0 -j ACCEPT

I probably could have gotten the build to work with Xen at this point, but decided that since I had nfs figured out and

VirtualBox (unfortunately) worked for me a lot better than Xen, I would give VBox another try, using nfs instead of "Shared Folders".

With VirtualBox, the default NAT network makes the host unreachable, so one needs to use two adapters

on the guest, one "Host-Only Adapter" to access NFS on host, one NAT adapter to be

able to reach the net (not strictly needed). I then needed to do a manual dhclient on NAT adapter to get the NAT access working:

dhclient eth1

On the host ,I needed to adjust iptables to open the firewall for the vbox NAT adapter

(192.168.56.0/24 at present) and enable masquerading. Note that no thought is given to security:

iptables -A INPUT -i vboxnet0 -j ACCEPT
-A FORWARD -i vboxnet0 -j ACCEPT
-A FORWARD -o vboxnet0 -j ACCEPT
-A POSTROUTING -s 192.168.56.0/24 ! -d 192.168.56.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.56.0/24 ! -d 192.168.56.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
-A POSTROUTING -s 192.168.56.0/24 ! -d 192.168.56.0/24 -j MASQUERADE

On the Debian guest, other than doing

dhclient eth[01] (whichever one is the NAT interface, see output of
inconfig -a)

nothing special was required beyond typical nfs mount.

On Fedora, nfs doesn't seem to start by itself; I had to do:

service rpcbind start

and then

service nfs start

to get it going.

Netbooks are not made to build software. Letting a build run without taking some measures eventually results in overheating and crashing.

I did all of the below manually, but using tools such as cpupower in package kernel-tools in Fedora 17 (used to be pacakge [

cpufrequtils is easier. There doesn't seem to be a command or sysctl setting to set ignore_nice_load.

Setting ignore_nice_load for the ondemand cpufreq governer should have done the job, but for some reason didn't work, even with both the build and the whole VM process niced:

[root@localhost ondemand]# pwd
/sys/devices/system/cpu/cpufreq/ondemand

[root@localhost ondemand]#
[root@localhost ondemand]# echo 1 >ignore_nice_load

I had to change the governor from ondemand to powersave, and had to do it for both cores. The easy way (with Fedora 17) is

cpupower frequency-set -g powersave

The manual way, in case the above is not available, is:

[root@localhost cpufreq]# pwd
/sys/devices/system/cpu/cpu0/cpufreq

cat scaling_available_governors
conservative userspace powersave ondemand performance
[root@localhost cpufreq]#

echo powersave >scaling_governor

root@localhost cpufreq]# pwd
/sys/devices/system/cpu/cpu1/cpufreq

and so forth.

This locked both cores at 800000 instead of 1000000 (those are the two speeds in the AMD C60). I also have the netbook elevated so heat can't collect underneath it. Having taken these measures, it can build CM (overnight or longer) without problems.

I hope these notes are useful to someone.