ReferencePlatforms/Test/Maemo

From MozillaWiki
Jump to navigation Jump to search

Configuration Details

These are simplified steps taken from User:Asasaki:N800Setup. The steps below should be followed as closely as possible, but if you need more information that page contains more historical context.

Firmware Update

Flash the firmware with 770Flasher.app using the OS2008 v 5.2008.43-7 image:

  • Turn off device and unplug it. Make sure it's entirely turned off (remove battery and reinsert if necessary).
  • Attach via USB to computer, still powered off at this point.
  • Open 770Flasher.app, open OS2008 v 5.2008.43-7 image.
  • When it's looking for the device, hold down the "Home" button on top on the left, and plug the power into the N810. Keep the "Home" button depressed until the 770Flasher.app says it is completely finished.
  • Detach the USB cable.

Wipe previous config

If the device is in an unknown state (i.e., not fresh out of the box), run these two steps. They will require a reboot. The default lock code is 12345.

Settings -> Control Panel -> (menu icon) -> Tools -> Restore original settings.
Settings -> Control Panel -> (menu icon) -> Tools -> Clear device

Initial user preferences

Device language: English (USA)
Date
Hostname -- you will be setting this directly later so the default is fine.

Don't pair with a phone; cancel phone setup.

Control panel settings

Go to Settings -> Control Panel.

Date and time

Select home city; choose Los Angeles for the Mountain View office.

Display

Display stays lit: when charging.

You will be revisiting this control panel after #moredimmingoptions is installed, and setting the Brightness period and the Switch off display to 1440minutes.

Memory

In the Virtual tab check "Extend virtual memory".


Connectivity

  • Mozilla Guest: Click on the wifi icon in the top right of the screen, connect to Mozilla Guest, and save the connection.
  • Disable Power Saving Mode:
    • Click the wifi icon and disconnect.
    • Open the Connectivity Control Panel.
    • Connections -> Edit (Mozilla Guest) -> Next -> Next -> Advanced -> Other tab: turn Power saving: OFF.
  • Reconnect to Mozilla Guest.

Sounds

Click on the "Sound Off" icon to mute the device.

Install software

sshd

Google maemo ssh. This should bring you here. Click the green install arrow; you will need to enable the Extras software repo and enter the [new] root password.

homeip

Settings -> Application manager -> Browse installable applications -> Accessories -> homeip -> Install

Close/minimize the Application manager. Click the "Home" menu icon in the top left of the desktop. Choose "Select applets" and unselect everything but HomeIP.

(You may wish to wait to do that last portion later, since the google applet is handy for the next two steps)

moredimmingoptions

Google for moredimmingoptions maemo and install.

Go back to the #Display control panel and set the dimming times to 1440min.

acknowledge update notification icon

Strangely enough, the little blinky orange notification icon causes noticeable drag on certain performance tests. You can disable it by clicking on it and choosing to "Install...". However, instead of installing the updates, close out of Application Manager once it loads.

Afterwards, to disable auto-update checking,

mv /etc/cron.daily/apt /root/apt

nginx

Google for nginx maemo and install.

ssh in as root and edit /etc/nginx/nginx.conf to change the default_type to text/plain.

Then restart nginx:

/etc/init.d/nginx restart


fix apt-get

echo "deb http://p.quinput.eu/debfarm chinook user" >> /etc/apt/sources.list
apt-get update
apt-get -f install

Note, if you get "Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?", then you probably need to close Application Manager.

apt-get install

apt-get --force-yes -y install rsync wget bzip2 gnutar x11vnc python2.5-dev hebrew

fix tar

rm /bin/tar
ln -s /bin/gtar /bin/tar

x11vnc setup

Set up the vnc password:

su user
x11vnc -storepasswd
# Enter your desired vnc password; save to /home/user/.vnc/passwd
exit

Create an /etc/init.d/x11vnc that looks like this:

#!/bin/sh
# built from /usr/bin/x11vnc.sh and /etc/init.d/ssh
#

test -x /usr/bin/x11vnc || exit 0

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
        echo -n "Starting VNC server: x11vnc"
        start-stop-daemon --start --quiet --pidfile /var/run/x11vnc.pid -b -c user --exec /usr/bin/x11vnc -- -cursor arrow -usepw > /var/log/x11vnc.log 2>&1
        echo "."
        ;;
  stop)
        echo -n "Stopping VNC server: x11vnc"
        start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/x11vnc.pid
        echo "."
        ;;

  restart)
        echo -n "Restarting VNC server: x11vnc"
        start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/x11vnc.pid
        start-stop-daemon --start --quiet --pidfile /var/run/x11vnc.pid -b -c user --exec /usr/bin/x11vnc -- -cursor arrow -usepw > /var/log/x11vnc.log 2>&1
        echo "."
        ;;

  *)
        echo "Usage: /etc/init.d/x11vnc {start|stop|restart}"
        exit 1
esac
 
exit 0

Then make it executable and run at boot:

chmod a+x /etc/init.d/x11vnc
update-rc.d x11vnc defaults 99
/etc/init.d/x11vnc start

Buildbot

Set hostname

Edit /etc/hostname.
Then set the hostname:

hostname `cat /etc/hostname`

Clean up disk

rm -rf /media/mmc2/Video /media/mmc2/map /home/user/MyDocs /media/mmc2/talos

Fix mount options

In /etc/fstab, change the mount point to /media/mmc2 and remove the noexec option:

rootfs  /               rootfs  defaults,errors=remount-ro,noatime      0 0
/dev/mmcblk0p1  /media/mmc2 vfat rw,noauto,nodev,nosuid,utf8,uid=29999 0 0
#/media/mmc2/.swap2 none swap sw 0 0

Edit /usr/sbin/mmc-mount to remove the noexec and *mask options:

#!/bin/sh
#mount -t vfat -o rw,noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133 "$1" "$2" > /dev/null
mount -t vfat -o rw,noauto,nodev,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed "$1" "$2" > /dev/null


Install twisted

Append this to /root/.bashrc :

export PYTHONPATH="/media/mmc2/twisted/twisted-2.4.0/lib/python2.5/site-packages:/media/mmc2/twisted/twisted-core-2.4.0/lib/python2.5/site-packages:/media/mmc2/twisted/zope-interface-3.3.0/lib/python2.5/site-packages"

And grab the precompiled version of twisted:

. /root/.bashrc
ln -s /media/mmc2/twisted /tools
cd /media/mmc2
wget http://people.mozilla.com/~asasaki/maemo/twisted-maemo-2.4.0.tgz
tar zxvf twisted-maemo-2.4.0.tgz
rm twisted-maemo-2.4.0.tgz

Install buildbot

On a separate machine with ssh and hg, grab buildbot and push:

hg clone http://hg.mozilla.org/build/buildbot
scp -r buildbot root@DEVICEIP:/media/mmc1/

Then ssh in and

cd /media/mmc1/buildbot
python setup.py install
cd ..
rm -rf buildbot

Set up buildbot slave

cd /media/mmc1
mkdir buildbot
cd buildbot
buildbot create-slave --umask=002 . 10.250.48.109:9011 `hostname` PASSWORD

Edit buildbot.tac to set keepalive=None

Edit /usr/lib/python2.5/site-packages/buildbot/scripts/logwatcher.py to change the -F tail option to -f

Edit info/* to include email + hostname.

Start buildbot at boot

Create an /etc/init.d/buildbot that looks like this:

#!/bin/sh
# built from /usr/bin/x11vnc.sh and /etc/init.d/ssh
#

test -x /usr/bin/buildbot || exit 0

case "$1" in
  start)
        echo -n "Starting buildbot in 120 seconds"
#        swapon -a 2>/dev/null
        /media/mmc1/buildbot/start.sh 120 | tee /media/mmc1/buildbot/start.out &
        ;;

  stop)
        echo -n "Stopping buildbot"
        cd /media/mmc1/buildbot
        buildbot stop .
        echo "."
        ;;

  restart)
        echo -n "Restarting buildbot"
        cd /media/mmc1/buildbot
        buildbot stop .
        buildbot start `pwd`
        echo "."
        ;;

  *)
        echo "Usage: /etc/init.d/buildbot {start|stop|restart}"
        exit 1
esac

exit 0

Also create a /media/mmc1/buildbot/start.sh that looks like

#!/bin/sh -x

date

STANDALONE_FILE="/media/mmc1/standalone.txt"

# Respect the no-go file
if [ -f $STANDALONE_FILE ] ; then
        echo "Not starting buildbot: `cat $STANDALONE_FILE`"
        exit
fi

# Don't continue if buildbot is already running
if [ -f "/media/mmc1/buildbot/twistd.pid" ] ; then
        pid=`cat /media/mmc1/buildbot/twistd.pid`
        ps -ef | grep $pid | grep -q buildbot
        if [ $? -eq 0 ] ; then
                exit 0
        fi
fi

if [ $# -gt 0 ] ; then
    sleep $1
fi

MAX_PING_ATTEMPTS=50
PING_HOST="10.250.48.109"

count=1
while [ $count -le $MAX_PING_ATTEMPTS ] ; do
        ping -c1 $PING_HOST >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
                break
        fi
        count=`expr $count + 1`
        sleep 2
done

if [ $count -gt $MAX_PING_ATTEMPTS ] ; then
        echo "Can't ping $PING_HOST; rebooting now!"
        reboot
fi

export DISPLAY=:0.0
. /root/.bashrc # set PYTHONPATH

# Tweak env settings to be able to run fennec
unset CONSOLE
export DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/session_bus_socket
export GTK2_RC_FILES=/home/user/.osso/current-gtk-theme:/home/user/.osso/current-gtk-key-theme
export HOME=/root
export TMPDIR=/var/tmp
export USER=root

env

rm -f /var/log/nginx/access.log
rm -f /var/log/nginx/error.log

cd /media/mmc1/buildbot
rm -f twistd.log*
touch twistd.log
buildbot start `pwd`

Make 'em executable and run at boot:

chmod a+x /etc/init.d/buildbot /media/mmc1/buildbot/start.sh
update-rc.d buildbot defaults 99

Set up a daily reboot

I've seen too many devices hang or lose buildbot connectivity, then go idle for days and shut themselves off. To try to combat this, I'm trying to make sure none of them stay up for more than 1-2 days they need to.

Create an /etc/cron.daily/daily_reboot.sh :

#!/bin/sh

REBOOT=0
UPTIME=`uptime | sed -e 's/^.*up *\([^,]*\).*$/\1/'`
BUILDBOT_PROCS=`ps | grep buildbot | grep -v grep | wc -l`
HOSTNAME=`hostname`
STANDALONE_FILE="/media/mmc1/standalone.txt"

# Respect the no-go file
if [ -f $STANDALONE_FILE ] ; then
        echo "Not starting buildbot: `cat $STANDALONE_FILE`"
        exit
fi

echo $UPTIME | grep 'day' >/dev/null 2>&1
if [ $? -eq 0 ] ; then
        echo "$0: $HOSTNAME has been up over a day."
        REBOOT=1
fi

if [ $BUILDBOT_PROCS -lt 1 ] ; then
        echo $UPTIME | grep ':' >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
                echo "$0: $HOSTNAME up for over an hour with no buildbot!"
                REBOOT=1
        else
                MIN_UPTIME=`echo $UPTIME | sed -e 's/ *min$//'`
                if [ $MIN_UPTIME -gt 30 ] ; then
                        echo "$0: $HOSTNAME up for over 30 min with no buildbot!"
                        REBOOT=1
                fi
        fi
fi

if [ $REBOOT -gt 0 ] ; then
        echo "$0: $HOSTNAME rebooting!"
        reboot
        sleep 600
fi


Then

chmod a+x /etc/cron.daily/daily_reboot.sh
echo "reimaging `date`" > /media/mmc1/standalone.txt

Looks like cron won't run on the device, but I have an hourly cron on the master that ssh's in via publickey and runs this.

Talos

Install PyYAML

cd /media/mmc1
#wget http://pyyaml.org/download/pyyaml/PyYAML-3.05.tar.gz
wget http://people.mozilla.com/~asasaki/maemo/PyYAML-3.05.tar.gz
tar zxvf PyYAML-3.05.tar.gz
cd PyYAML-3.05
python setup.py install
cd ..
rm -rf PyYAML*

Install talos

Grab talos from CVS mozilla/testing/performance/talos [hg] and put it in /media/mmc1/talos

You'll need the PerfConfigurator.py patch and mobile.config from [bug 471599] until those are checked in.

You'll also need to build the pageloader and place the chrome/ and components/ directories into talos/

(the above 2 paragraphs are already done in aki's talos-maemo user repo)

The pages need to go in /media/mmc2/pages and /media/mmc2/tp4. Then you need to softlink:

rm -f /var/www/page_load_test

ln -s /media/mmc1/talos/page_load_test /var/www/page_load_test
ln -s /media/mmc2/pages /media/mmc1/talos/page_load_test/pages
ln -s /media/mmc2/pages /media/mmc1/talos/page_load_test/tp3
ln -s /media/mmc2/tp4 /media/mmc1/talos/page_load_test/tp4

Unit tests

Install maemkit

On an hg-enabled computer,

hg clone http://hg.mozilla.org/qa/maemkit

and copy that over to /media/mmc2/maemkit

Note: there are currently outstanding patches for maemkit , so it might be best to copy from an existing N810.

Finish up

rm /media/mmc1/standalone.txt
/etc/cron.daily/daily_reboot.sh