ReferencePlatforms/Test/Maemo: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Version 1/2 =
'''NOTE: THIS DOCUMENT IS ONLY VALID FOR OUR N810 DEVICES'''
moz-ref-image-v1/2.jffs2
For information on the N900 please see [[ReferencePlatforms/Test/N900-PR1.2]]
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.
=prep for image=
Obtain
* SHA1(flasher-2.0)= 484bb141dad18ea68f7618c4f07f549311caf9b5
** flasher v0.8.1 (Jun 22 2006)
* SHA1(RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin)= 5464ae20a17afdbd59633f3d36a2e63281fcd106


== Firmware Update ==
==Flash default firmware==
sudo ./flasher-2.0 --set-root-device flash
sudo ./flasher-2.0 -F RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin -f
boot device


Flash the firmware with [http://people.mozilla.com/~asasaki/maemo/770Flasher-2.0.dmg 770Flasher.app] using the [http://people.mozilla.org/~asasaki/maemo/n810-RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin OS2008 v 5.2008.43-7] image:
==Initial Setup==
*device language: English -> Next
*set date and time -> Next
*device name: maemo-n810-ref -> Next -> Finish
*Cancel 'Phone Selection' wizard


* Turn off device and unplug it.  Make sure it's entirely turned off (remove battery and reinsert if necessary).
==Control Panel==
* Attach via USB to computer, still powered off at this point.
*tap third icon from top on left gutter
* Open 770Flasher.app, open OS2008 v 5.2008.43-7 image.
*Settings->Control Panel
* 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.
*Connectivity
* Detach the USB cable.
*Join network as appropriate with the advanced options of:
**Other tab: XMit power 10 mW, power saving Off


== Wipe previous config ==
==Home Page==
click the home word in the top left of the screen -> select applets -> untick all ticked


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.
==Applications==
*Open 'Application Manager'
**Programs -> settings -> application manager
*tap title bar -> tools -> application catalog...
*tap 'maemo extras' -> edit -> untick disabled
*close application manager


Settings -> Control Panel -> (menu icon) -> Tools -> Restore original settings.<br />
==Terminal==
(reboot)<br />
Open the X Terminal from the Utilities menu list and run:
Settings -> Control Panel -> (menu icon) -> Tools -> Clear device<br />
(reboot)
 
== Initial user preferences ==
 
Device language: English (USA)<br />
Date<br />
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 <tt>moredimmingoptions maemo</tt> 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 <tt>/etc/nginx/nginx.conf</tt> to replace <tt>application/binary</tt> with <tt>text/plain</tt>.
 
=== fix tar ===


sudo gainroot
visudo
Add the following line between 'Defaults env_reset' and the first 'user ALL = ...' line
user ALL=(ALL) NOPASSWD: ALL
#dropbear and dropbear-client packages are broken
apt-get install bzip2 wget gnutar dropbear-server openssh-client libpcre3 unzip zip libssl0.9.7 e2fsprogs openntpd
  rm /bin/tar
  rm /bin/tar
  ln -s /bin/gtar /bin/tar
  mv /bin/gtar /bin/tar
 
  ln -s /bin/tar /bin/gtar
=== 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 <tt>/etc/init.d/x11vnc</tt> that looks like this:


  #!/bin/sh
==Packages from source==
  # built from /usr/bin/x11vnc.sh and /etc/init.d/ssh
On a machine with the Chinook SDK do:
  #
  mkdir -p /builds/scratchbox/users/cltbld/home/cltbld/new-n810/install-root
  su -c 'mount -o bind /builds/scratchbox/users/cltbld/home/cltbld/new-n810/install-root/usr/local/ /builds/scratchbox/users/cltbld/targets/CHINOOK-ARMEL-2007/usr/local/'
su -c
/scratchbox/moz_scratchbox
cd new-n810
mkdir install-root
export ROOT=`pwd`/install-root
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2
  wget http://mercurial.selenic.com/release/mercurial-1.4.2.tar.gz
wget http://tmrc.mit.edu/mirror/twisted/Twisted/9.0/Twisted-9.0.0.tar.bz2
wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz
wget http://downloads.sourceforge.net/buildbot/buildbot-0.7.12.tar.gz
wget http://nginx.org/download/nginx-0.7.65.tar.gz
wget http://projects.o-hand.com/sources/xrestop/xrestop-0.4.tar.gz
wget http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.23/cvs-1.11.23.tar.bz2
wget http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz
wget http://samba.anu.edu.au/ftp/rsync/src/rsync-2.6.9.tar.gz
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.6p1.tar.gz
find -name "*.tar.bz2" -exec tar jxf {} \;
find -name "*.tar.gz" -exec tar zxf {} \;
   
   
  test -x /usr/bin/x11vnc || exit 0
  #rsync
   
  cd rsync-2.6.9
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
  ./configure --prefix=/usr/local --disable-debug --disable-locale
  make -j4
case "$1" in
  make install DESTDIR=$ROOT
  start)
  cd ..
        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:
#python
## We need something like http://bugs.python.org/file9603/python.patch from
## http://bugs.python.org/issue2233
cd Python-2.5.4
./configure --prefix=/usr/local
make -j4 #if this fails, try again
make install DESTDIR=$ROOT
export PYTHON=/usr/local/bin/python2.5
mount -o bind $ROOT/usr/local /usr/local
cd ..


  chmod a+x /etc/init.d/x11vnc
  #mercurial
  update-rc.d x11vnc defaults 99
cd mercurial-1.4.2
  /etc/init.d/x11vnc start
  $PYTHON setup.py install
  cd ..


=== Set up stupid ===
#zope interface
<s>
cd zope.interface-3.3.0
To stabilize the damn thing for {{bug|499334}} / [https://bugs.maemo.org/show_bug.cgi?id=3415 bug 3415].
$PYTHON setup.py install
cd ..


Create a <tt>/usr/bin/stupid.sh</tt>:
#twisted
cd Twisted-9.0.0
$PYTHON setup.py install
cd ..


  #!/bin/sh
  #buildbot
   
  cd buildbot-0.7.12
  date
  $PYTHON setup.py install
  while [ 1 == 1 ] ; do
  cd ..
    sleep 1
done


Create a <tt>/etc/init.d/stupid</tt>:
#PyYAML-3.09
cd PyYAML-3.09
$PYTHON setup.py install
cd ..


  osso-xterm stupid.sh &
  #cvs
cd cvs-1.11.23
./configure --prefix=/usr/local
make -j4
make install DESTDIR=$ROOT
cd ..


Make them executable and start at boot:
#xrestop
cd xrestop-0.4
fakeroot apt-get install libxres-dev #build host needs this
fakeroot apt-get install libncurses5-dev
./configure --prefix=/usr/local
make install DESTDIR=$ROOT
cd ..


  chmod a+x /etc/init.d/stupid /usr/bin/stupid.sh
  #nginx
  update-rc.d stupid defaults 99
cd nginx-0.7.65
</s>
fakeroot apt-get install libpcre3-dev
./configure --without-http-cache --prefix=/usr/nginx
  make -j4
make install DESTDIR=$ROOT
cd ..


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.
  #ntpd
 
  cd ntp-4.2.6p1
== Buildbot ==
  ./configure
 
  cd ntpdate
=== Set hostname ===
  make -j4
 
  make install DESTDIR=$ROOT
Edit <tt>/etc/hostname</tt>.<br />
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 <tt>/etc/fstab</tt>, change the mount point to <tt>/media/mmc2</tt> 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 <tt>/usr/sbin/mmc-mount</tt> 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 <tt>/root/.bashrc</tt> :
 
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 ..
  cd ..
rm -rf buildbot


=== Set up buildbot slave ===
<strike>Strip the binaries
cd $ROOT
du -hsc #should be ~101M
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
</strike>


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


<s>Edit buildbot.tac to set keepalive=None</s>
==Make SD Card Image==
'''WARNING!!! YOU CAN SERIOUSLY BREAK YOUR COMPUTER AND ERASE ALL YOUR DATA'''


Edit <tt>/usr/lib/python2.5/site-packages/buildbot/scripts/logwatcher.py</tt> to change the <tt>-F</tt> tail option to <tt>-f</tt>
'''YOU HAVE BEEN WARNED'''


Edit info/* to include email + hostname.
'''MAKE SURE YOU HAVE THE CORRECT DEVICE NODE FILE i.e. /dev/sdb'''
For this you will need to have an SD card that has an ext3 filesystem. On imaging computer with SD card inserted
dd if=/dev/zero of=/dev/sd? bs=512 count=1
sudo parted --script /dev/sd? mktable msdos
sudo parted --script /dev/sd? mkpart primary 0 1900
sudo parted --script /dev/sd? mkpart primary 1901 3900
mkfs.ext3 /dev/sd? -L root-fs
mkfs.ext3 /dev/sd? -L scratch


=== Start buildbot at boot ===
You will also need to copy the rsync binary onto your N810.  This is done on imaging computer
scp $ROOT/usr/local/bin/rsync root@<dev>


Create an <tt>/etc/init.d/buildbot</tt> that looks like this:
Now remount your device's root filesystem.  Boot the N810 with the prepared SD card in the slot.
sudo gainroot
mount -t jffs2 /dev/mtdblock4 /opt
mount /dev/mmcblk1p1 /floppy
rsync -av /opt/. /floppy/.
umount /floppy


#!/bin/sh
Now put the sd card back in the computer. I would suggest making a backup of your image at this point.  
# built from /usr/bin/x11vnc.sh and /etc/init.d/ssh
  mkdir ~/base-n810
#
  sudo rsync2 -av /media/root-fs/. ~/base-n810/.
  umount /media/root-fs
  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 <tt>/media/mmc1/buildbot/start.sh</tt> that looks like
Make your device boot from SD
sudo ./flasher-2.0 --set-root-device mmc


#!/bin/sh -x
boot device and verify that your device is booted from mmc
  mount | grep "/dev/mmcblk0p1 on /"
date
should print a line
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 <s>1-2 days</s> they need to.
==Install compiled applications==
on the imaging computer with the N810 running from the SD card
sudo rsync2 -av $ROOT/. root@<devip>:/.


Create an <tt>/etc/cron.daily/daily_reboot.sh</tt> :
==Configure Programs==
edit /etc/init.d/dropbear and set
DROPBEAR_EXTRA_ARGS="-K 10 -b /etc/hostname -F -m"
edit /etc/profile and set
export PATH="/usr/local/bin:/usr/bin:/usr/bin"


#!/bin/sh
configure nginx
chown user:users /usr/nginx
cat > /usr/nginx/conf/nginx.conf <<EOF
worker_processes  1;
user user users;
   
   
  REBOOT=0
  events {
  UPTIME=`uptime | sed -e 's/^.*up *\([^,]*\).*$/\1/'`
    worker_connections 1024;
  BUILDBOT_PROCS=`ps | grep buildbot | grep -v grep | wc -l`
  }
HOSTNAME=`hostname`
STANDALONE_FILE="/media/mmc1/standalone.txt"
   
   
  # Respect the no-go file
  http {
if [ -f $STANDALONE_FILE ] ; then
    include      mime.types;
        echo "`hostname` Not starting buildbot: `cat $STANDALONE_FILE`"
    default_type text/plain;
        exit
  fi
   
   
echo $UPTIME | grep 'day' >/dev/null 2>&1
    sendfile        on;
  if [ $? -eq 0 ] ; then
    keepalive_timeout 65;
        echo "$0: $HOSTNAME has been up over a day."
        REBOOT=1
fi
   
   
if [ $BUILDBOT_PROCS -lt 1 ] ; then
    server {
        echo $UPTIME | grep ':' >/dev/null 2>&1
         listen      80;
         if [ $? -eq 0 ] ; then
         server_name  localhost;
                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
         location / {
         echo "$0: $HOSTNAME rebooting!"
            root /builds/talos;
        reboot
            index index.html index.htm;
        sleep 600
        }
fi
    }
 
  }
 
  EOF
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 <s>CVS <tt>mozilla/testing/performance/talos</tt></s> [[http://hg.mozilla.org/users/asasaki_mozilla.com/talos-maemo/ hg]] and put it in <tt>/media/mmc1/talos</tt>
 
<s>You'll need the <tt>PerfConfigurator.py</tt> patch and <tt>mobile.config</tt> from [[https://bugzilla.mozilla.org/show_bug.cgi?id=471599 bug 471599]] until those are checked in.
 
You'll also need to build the pageloader and place the <tt>chrome/</tt> and <tt>components/</tt> directories into <tt>talos/</tt></s>
 
(the above 2 paragraphs are already done in aki's <tt>talos-maemo</tt> user repo)
 
The pages need to go in <tt>/media/mmc2/pages</tt> and <tt>/media/mmc2/tp4</tt>. 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 <tt>/media/mmc2/maemkit</tt>
Add ssh keys
cat > /root/.ssh/authorized_keys <<EOF
ssh-dss AAAAB3NzaC1kc3MAAACBAKF2RLI6znaFGSTLUWLOJoq3GYOPdfGgqiH3T4Vgg35W0WdbKGNfICt1ZTNYf1udQUmOIiGSwIkfXo6bySRdodyI9xKACOS/JEdxOa1utEJw8TgeBdjhZOIpim0NExuaHcbPp/bAaYah+a3pWariLItVzkl6+waJbGnwEpjfnN/TAAAAFQDUAS2QJUQjKWqnEVgKGBeQ/+uZPwAAAIBxZfrvFLqYnW125Ye42ataUMphcnjXcdBSfHMz8Hg7eH7Lzf/T9HdjkJvyI1aM2FcJDe/mpr0Bm+osDyk7+xehegZxIhBv4TtlBJsZsqGhLK+KRqGQC1z0lr/MCXj2zfRyFaq0nRxc0aAguqJUmtN7ULhCorRgyRm0VwHlGHDAWwAAAIBYmZyMRs8+nzQ6lLqS/+SuhjRJBoT7GVzZsK4oduhSeh+RViQT1f3DxWoZM5vMU7cgFY+niEd4HfryCJvMUQJQtspVwHFSotuyzUwZh39bFkuCbD7wKflVh7b/QEPYOkSnYz24HURdEqCxnnfVOvPLacTrDNv0pks4rguY1jzC7w== jhford@jhford-wifi.mv.mozilla.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA54bmAA9MVIkHwgRABpqFIQt26Cur2X1Sw8eDeGEYCLmNoOQI8ZAFZS73QHD7AcjJB+4rjzjc1IVUp+PXcBfsrv+6UTbgmRQAx1AcMd9SrKTZH72cO7aTvAjKAIhWTcCHwRSpHW8rpzHOqEpSsFnupoERQg1teG7rKrXK5h2isro8aFjkDnwZVxtpIXArEIlcZIOap4ZAbKNHOlUgNqgmMBMr2LtOvvG/GdHlVFne9gVfZWXQ7xi/N4LWZHt1u5gENzBh62pXwr5reTBM552qz4LKwuQknwdrbWXjgsei08F9JQulsMnJ0K+2W7IWB26MUydXHhqBNfs2Ylit7RQY8w== cltbld@staging-mobile-master.office.mozilla.org
EOF


<s>Note: there are currently outstanding patches for maemkit , so it might be best to copy from an existing N810.</s>
==Install mozilla scripts==
On n810 run:
hg clone http://hg.mozilla.org/build/tools
rsync -a tools/buildfarm/mobile/n810-imaging/rootfs/. /.
rm -rf tools
update-rc.d mozilla defaults


=Version 4=
Install the uptime-check.py script
Open control panel, edit Mozilla-Build to have no power saving and 10mW instead of 100mW TX power
cp uptime-check.py /bin/uptime-check.py


== Finish up ==
==TP4==
install TP4
rsync -av tp4-source/. root@<devip>:/tools/tp4/.
and on device, fix permissions
chown -R root:root /tools


  rm /media/mmc1/standalone.txt
=take image=
  /etc/cron.daily/daily_reboot.sh
Insert SD card into card reader and run
  cd n810-imaging/
  sudo ./moz-get-image.sh /dev/sd? moz-n810-v999 #replace ? and 999 as appropriate


=Post Imaging steps=
=image card
<ol>
this is only for doing a test image. this is not the general purpose flashing doc
<li>change hostname <code>echo maemo-n810-01 > /etc/hostname</code></li>
sudo ./moz-image.sh moz-n810-v999 /dev/sd? maemo-n810-???
<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>create a swap file, copy to device
<code>dd if=/dev/zero of=.swap bs=1024 count=131072; mkswap .swap</code>
</li>
<li>mv /dev/random /dev/chaos; ln -s /dev/urandom /dev/random
</li>
<li>edit /usr/lib/python2.5/site_packages/buildbot/buildslave.py
At line 566 (end of <tt>def buildStarted(self, sb):</tt> ), append
<blockquote><pre>
        # HACK ALERT: only allow one build per slave                           
        self.slave_status.setGraceful(True)
</pre></blockquote>
and rm buildslaves.pyc
</li>
<li>
Enable extras and install openntpd then disable extras again.
Uncomment the DAEMON_OPTS line in <tt>/etc/default/openntpd</tt>.
</li>
</ol>

Latest revision as of 17:21, 27 July 2010

NOTE: THIS DOCUMENT IS ONLY VALID FOR OUR N810 DEVICES For information on the N900 please see ReferencePlatforms/Test/N900-PR1.2


prep for image

Obtain

  • SHA1(flasher-2.0)= 484bb141dad18ea68f7618c4f07f549311caf9b5
    • flasher v0.8.1 (Jun 22 2006)
  • SHA1(RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin)= 5464ae20a17afdbd59633f3d36a2e63281fcd106

Flash default firmware

sudo ./flasher-2.0 --set-root-device flash
sudo ./flasher-2.0 -F RX-44_DIABLO_5.2008.43-7_PR_COMBINED_MR0_ARM.bin -f

boot device

Initial Setup

  • device language: English -> Next
  • set date and time -> Next
  • device name: maemo-n810-ref -> Next -> Finish
  • Cancel 'Phone Selection' wizard

Control Panel

  • tap third icon from top on left gutter
  • Settings->Control Panel
  • Connectivity
  • Join network as appropriate with the advanced options of:
    • Other tab: XMit power 10 mW, power saving Off

Home Page

click the home word in the top left of the screen -> select applets -> untick all ticked

Applications

  • Open 'Application Manager'
    • Programs -> settings -> application manager
  • tap title bar -> tools -> application catalog...
  • tap 'maemo extras' -> edit -> untick disabled
  • close application manager

Terminal

Open the X Terminal from the Utilities menu list and run:

sudo gainroot
visudo

Add the following line between 'Defaults env_reset' and the first 'user ALL = ...' line

user ALL=(ALL) NOPASSWD: ALL
#dropbear and dropbear-client packages are broken
apt-get install bzip2 wget gnutar dropbear-server openssh-client libpcre3 unzip zip libssl0.9.7 e2fsprogs openntpd
rm /bin/tar
mv /bin/gtar /bin/tar
ln -s /bin/tar /bin/gtar

Packages from source

On a machine with the Chinook SDK do:

mkdir -p /builds/scratchbox/users/cltbld/home/cltbld/new-n810/install-root
su -c 'mount -o bind /builds/scratchbox/users/cltbld/home/cltbld/new-n810/install-root/usr/local/ /builds/scratchbox/users/cltbld/targets/CHINOOK-ARMEL-2007/usr/local/'
su -c
/scratchbox/moz_scratchbox
cd new-n810
mkdir install-root
export ROOT=`pwd`/install-root
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2
wget http://mercurial.selenic.com/release/mercurial-1.4.2.tar.gz
wget http://tmrc.mit.edu/mirror/twisted/Twisted/9.0/Twisted-9.0.0.tar.bz2 
wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz
wget http://downloads.sourceforge.net/buildbot/buildbot-0.7.12.tar.gz
wget http://nginx.org/download/nginx-0.7.65.tar.gz
wget http://projects.o-hand.com/sources/xrestop/xrestop-0.4.tar.gz
wget http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.23/cvs-1.11.23.tar.bz2
wget http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz
wget http://samba.anu.edu.au/ftp/rsync/src/rsync-2.6.9.tar.gz
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.6p1.tar.gz
find -name "*.tar.bz2" -exec tar jxf {} \;
find -name "*.tar.gz" -exec tar zxf {} \;

#rsync
cd rsync-2.6.9
./configure --prefix=/usr/local --disable-debug --disable-locale
make -j4 
make install DESTDIR=$ROOT
cd ..
#python
## We need something like http://bugs.python.org/file9603/python.patch from
## http://bugs.python.org/issue2233
cd Python-2.5.4
./configure --prefix=/usr/local
make -j4 #if this fails, try again
make install DESTDIR=$ROOT
export PYTHON=/usr/local/bin/python2.5
mount -o bind $ROOT/usr/local /usr/local
cd ..
#mercurial
cd mercurial-1.4.2
$PYTHON setup.py install
cd ..
#zope interface
cd zope.interface-3.3.0
$PYTHON setup.py install
cd ..
#twisted
cd Twisted-9.0.0
$PYTHON setup.py install
cd ..
#buildbot
cd buildbot-0.7.12
$PYTHON setup.py install
cd ..
#PyYAML-3.09
cd PyYAML-3.09
$PYTHON setup.py install
cd ..
#cvs
cd cvs-1.11.23
./configure --prefix=/usr/local
make -j4
make install DESTDIR=$ROOT
cd ..
#xrestop
cd xrestop-0.4
fakeroot apt-get install libxres-dev #build host needs this
fakeroot apt-get install libncurses5-dev
./configure --prefix=/usr/local
make install DESTDIR=$ROOT
cd ..
#nginx
cd nginx-0.7.65
fakeroot apt-get install libpcre3-dev
./configure --without-http-cache --prefix=/usr/nginx
make -j4
make install DESTDIR=$ROOT
cd ..
#ntpd
cd ntp-4.2.6p1
./configure
cd ntpdate
make -j4
make install DESTDIR=$ROOT
cd ..

Strip the binaries

cd $ROOT
du -hsc #should be ~101M
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null


Make SD Card Image

WARNING!!! YOU CAN SERIOUSLY BREAK YOUR COMPUTER AND ERASE ALL YOUR DATA

YOU HAVE BEEN WARNED

MAKE SURE YOU HAVE THE CORRECT DEVICE NODE FILE i.e. /dev/sdb For this you will need to have an SD card that has an ext3 filesystem. On imaging computer with SD card inserted

dd if=/dev/zero of=/dev/sd? bs=512 count=1
sudo parted --script /dev/sd? mktable msdos
sudo parted --script /dev/sd? mkpart primary 0 1900
sudo parted --script /dev/sd? mkpart primary 1901 3900
mkfs.ext3 /dev/sd? -L root-fs
mkfs.ext3 /dev/sd? -L scratch

You will also need to copy the rsync binary onto your N810. This is done on imaging computer

scp $ROOT/usr/local/bin/rsync root@<dev>

Now remount your device's root filesystem. Boot the N810 with the prepared SD card in the slot.

sudo gainroot
mount -t jffs2 /dev/mtdblock4 /opt
mount /dev/mmcblk1p1 /floppy
rsync -av /opt/. /floppy/.
umount /floppy

Now put the sd card back in the computer. I would suggest making a backup of your image at this point.

mkdir ~/base-n810
sudo rsync2 -av /media/root-fs/. ~/base-n810/.
umount /media/root-fs

Make your device boot from SD

sudo ./flasher-2.0 --set-root-device mmc

boot device and verify that your device is booted from mmc

mount | grep "/dev/mmcblk0p1 on /"

should print a line

Install compiled applications

on the imaging computer with the N810 running from the SD card

sudo rsync2 -av $ROOT/. root@<devip>:/.

Configure Programs

edit /etc/init.d/dropbear and set

DROPBEAR_EXTRA_ARGS="-K 10 -b /etc/hostname -F -m"

edit /etc/profile and set

export PATH="/usr/local/bin:/usr/bin:/usr/bin"

configure nginx chown user:users /usr/nginx cat > /usr/nginx/conf/nginx.conf <<EOF

worker_processes  1;
user user users;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  text/plain;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root /builds/talos;
            index index.html index.htm;
        }
    }
}
EOF

Add ssh keys

cat > /root/.ssh/authorized_keys <<EOF
ssh-dss AAAAB3NzaC1kc3MAAACBAKF2RLI6znaFGSTLUWLOJoq3GYOPdfGgqiH3T4Vgg35W0WdbKGNfICt1ZTNYf1udQUmOIiGSwIkfXo6bySRdodyI9xKACOS/JEdxOa1utEJw8TgeBdjhZOIpim0NExuaHcbPp/bAaYah+a3pWariLItVzkl6+waJbGnwEpjfnN/TAAAAFQDUAS2QJUQjKWqnEVgKGBeQ/+uZPwAAAIBxZfrvFLqYnW125Ye42ataUMphcnjXcdBSfHMz8Hg7eH7Lzf/T9HdjkJvyI1aM2FcJDe/mpr0Bm+osDyk7+xehegZxIhBv4TtlBJsZsqGhLK+KRqGQC1z0lr/MCXj2zfRyFaq0nRxc0aAguqJUmtN7ULhCorRgyRm0VwHlGHDAWwAAAIBYmZyMRs8+nzQ6lLqS/+SuhjRJBoT7GVzZsK4oduhSeh+RViQT1f3DxWoZM5vMU7cgFY+niEd4HfryCJvMUQJQtspVwHFSotuyzUwZh39bFkuCbD7wKflVh7b/QEPYOkSnYz24HURdEqCxnnfVOvPLacTrDNv0pks4rguY1jzC7w== jhford@jhford-wifi.mv.mozilla.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA54bmAA9MVIkHwgRABpqFIQt26Cur2X1Sw8eDeGEYCLmNoOQI8ZAFZS73QHD7AcjJB+4rjzjc1IVUp+PXcBfsrv+6UTbgmRQAx1AcMd9SrKTZH72cO7aTvAjKAIhWTcCHwRSpHW8rpzHOqEpSsFnupoERQg1teG7rKrXK5h2isro8aFjkDnwZVxtpIXArEIlcZIOap4ZAbKNHOlUgNqgmMBMr2LtOvvG/GdHlVFne9gVfZWXQ7xi/N4LWZHt1u5gENzBh62pXwr5reTBM552qz4LKwuQknwdrbWXjgsei08F9JQulsMnJ0K+2W7IWB26MUydXHhqBNfs2Ylit7RQY8w== cltbld@staging-mobile-master.office.mozilla.org
EOF

Install mozilla scripts

On n810 run:

hg clone http://hg.mozilla.org/build/tools
rsync -a tools/buildfarm/mobile/n810-imaging/rootfs/. /.
rm -rf tools
update-rc.d mozilla defaults

Install the uptime-check.py script

cp uptime-check.py /bin/uptime-check.py

TP4

install TP4

rsync -av tp4-source/. root@<devip>:/tools/tp4/.

and on device, fix permissions

chown -R root:root /tools

take image

Insert SD card into card reader and run

cd n810-imaging/
sudo ./moz-get-image.sh /dev/sd? moz-n810-v999 #replace ? and 999 as appropriate

=image card this is only for doing a test image. this is not the general purpose flashing doc

sudo ./moz-image.sh moz-n810-v999 /dev/sd? maemo-n810-???