ReferencePlatforms/Test/Maemo

From MozillaWiki
Jump to: navigation, search

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-???