ReferencePlatforms/Test/Maemo: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 498: Line 498:
<ol>
<ol>
<li>change hostname <code>echo maemo-n810-01 > /etc/hostname</code></li>
<li>change hostname <code>echo maemo-n810-01 > /etc/hostname</code></li>
<li>remove standalone.txt file <code>rm /media/mmc1/standalone.txt</code></li>
<li>set time manually until something like: https://garage.maemo.org/frs/?group_id=506&release_id=1205 makes it into the ref image</li>
<li>set time manually until something like: https://garage.maemo.org/frs/?group_id=506&release_id=1205 makes it into the ref image</li>
<li>copy tp4, maemkit, pages directories to /media/mmc2.</li>
<li>copy tp4, maemkit, pages directories to /media/mmc2.</li>

Revision as of 00:42, 4 September 2009

Version 1/2

moz-ref-image-v1/2.jffs2

this was the initial test version. Do not use as it is busted

Version 3

moz-ref-image-v3.jffs2

All of these steps are done on the reference image. Anything involving /media/mmc2 needs to be redone as it is *NOT* in the image

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.
(reboot)
Settings -> Control Panel -> (menu icon) -> Tools -> Clear device
(reboot)

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

  • Open the Connectivity Control Panel.
  • Connections -> Next
    • Connection Name: Mozilla-Build
    • No scan
    • SSID: Mozilla-Build
    • Security Method: WPA pre-shared key
    • Pre-shared key: enter the password here
    • Advanced -> Other -> Power saving: Off

Sounds

Click on sound icon in the top right. The Mute icon on the left will mute the device.

Install software

sshd

Open the Application Manager. Top left menu -> Application catalog -> maemo Extras -> edit. Unclick "Disabled".

Then Browse Installable Applications -> All and install openssh.

This will ask you for the root ssh 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

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 wget bzip2 gnutar x11vnc python2.5-dev hebrew libpcre3 libattr1
wget http://repository.maemo.org/extras/pool/diablo/free/r/rsync/rsync_2.6.9-2_armel.deb
dpkg -i rsync_2.6.9-2_armel.deb
rm rsync_2.6.9-2_armel.deb

more info on extras-devel can be found at http://repository.maemo.org/

nginx

wget http://people.mozilla.org/~asasaki/maemo/nginx.deb
dpkg -i nginx.deb
rm nginx.deb

Edit /etc/nginx/nginx.conf to replace application/binary with text/plain.

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

Set up stupid

To stabilize the damn thing for bug 499334 / bug 3415.

Create a /usr/bin/stupid.sh:

#!/bin/sh

date
while [ 1 == 1 ] ; do
    sleep 1
done

Create a /etc/init.d/stupid:

osso-xterm stupid.sh &

Make them executable and start at boot:

chmod a+x /etc/init.d/stupid /usr/bin/stupid.sh
update-rc.d stupid defaults 99

This doesn't work and it just ends up hiding homeip so we don't know when it's lost network. Don't do this.

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/mmc1/twisted/twisted-2.4.0/lib/python2.5/site-packages:/media/mmc1/twisted/twisted-core-2.4.0/lib/python2.5/site-packages:/media/mmc1/twisted/zope-interface-3.3.0/lib/python2.5/site-packages"

And grab the precompiled version of twisted:

. /root/.bashrc
ln -s /media/mmc1/twisted /tools
cd /media/mmc1
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 "`hostname` 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 "`hostname` 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.

Version 4

Open control panel, edit Mozilla-Build to have no power saving and 10mW instead of 100mW TX power

Finish up

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

Post Imaging steps

  1. change hostname echo maemo-n810-01 > /etc/hostname
  2. remove standalone.txt file rm /media/mmc1/standalone.txt
  3. set time manually until something like: https://garage.maemo.org/frs/?group_id=506&release_id=1205 makes it into the ref image
  4. copy tp4, maemkit, pages directories to /media/mmc2.
  5. create a swap file, copy to device dd if=/dev/zero of=.swap bs=1024 count=131072; mkswap .swap
  6. mv /dev/random /dev/chaos; ln -s /dev/urandom /dev/random
  7. Enable extras and install openntpd then disable extras again. Uncomment the DAEMON_OPTS line in /etc/default/openntpd.