User:SNMoore
From Openmoko
m (Category changes: -User, +Advanced End User) |
m (→Get the Latest Openmoko Firmware: linkfix) |
||
Line 300: | Line 300: | ||
===Get the Latest Openmoko Firmware=== | ===Get the Latest Openmoko Firmware=== | ||
− | The two images listed here are just examples; pick appropriate ones, see [[ | + | The two images listed here are just examples; pick appropriate ones, see [[Flashing the Neo 1973]] |
''Finder > Applications > Utilities > Terminal.app'' | ''Finder > Applications > Utilities > Terminal.app'' |
Latest revision as of 15:53, 22 October 2008
[edit] Mac OS X Recipe 1: Install MacPorts
[edit] Install MacPorts
See http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts
Install X11 before Xcode Tools; that way the X11 SDK will be automatically selected when installing Xcode Tools
Install all the GCC variants when installing Xcode Tools
- Customize > Cross Development > all
[edit] Verify shell environment
Finder > Applications > Utilities > Terminal.app
$ cat ~/.profile # Your previous .profile (if any) is saved as .profile.mpsaved # Setting the path for MacPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH export DISPLAY=:0.0
[edit] Verify gcc & make
Finder > Applications > Utilities > Terminal.app
$ gcc_select --list Available compiler versions: 3.3 3.3-fast 4.0
$ which gcc make /usr/bin/gcc /usr/bin/make
$ gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make --version GNU Make 3.80 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[edit] Update MacPorts
Finder > Applications > Utilities > Terminal.app
$ sudo port selfupdate MacPorts base version 1.5 installed Downloaded MacPorts base version 1.5 The MacPorts installation is not outdated and so was not updated selfupdate done!
[edit] Mac OS X Recipe 2: Build & Install dfu-util
[edit] Install Pre-Requisites: Subversion
Finder > Applications > Utilities > Terminal.app
$ sudo port install subversion ---> Installing apr 1.2.9_0 ---> Installing db44 4.4.20_1+darwin_8 ---> Installing expat 2.0.1_0 ---> Installing libiconv 1.11_4+darwin_8 ---> Installing ncursesw 5.6_0+darwin_8 ---> Installing ncurses 5.6_0+darwin_8 ---> Installing readline 5.2.001_0 ---> Installing sqlite3 3.4.1_0+darwin_8 ---> Installing apr-util 1.2.8_2 ---> Installing gettext 0.16.1_0 ---> Installing zlib 1.2.3_1 ---> Installing openssl 0.9.8e_0+darwin_8 ---> Installing neon 0.26.3_1 ---> Installing subversion 1.4.4_0
$ which svn /opt/local/bin/svn
$ svn --version svn, version 1.4.4 (r25188) compiled Aug 4 2007, 17:32:39 Copyright (C) 2000-2006 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme
[edit] Install Pre-Requisites: autoconf & automake
Finder > Applications > Utilities > Terminal.app
$ sudo port install autoconf automake ---> Installing perl5.8 5.8.8_0+darwin_8 ---> Installing p5-locale-gettext 1.05_0 ---> Installing help2man 1.36.4_0+darwin_8 ---> Installing libtool 1.5.24_0 ---> Installing m4 1.4.9_0 ---> Installing autoconf 2.61_1 ---> Installing automake 1.10_0
$ which autoconf automake /opt/local/bin/autoconf /opt/local/bin/automake
$ autoconf --version autoconf (GNU Autoconf) 2.61 Copyright (C) 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille.
$ automake --version automake (GNU automake) 1.10 Written by Tom Tromey <tromey@redhat.com> and Alexandre Duret-Lutz <adl@gnu.org>. Copyright 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[edit] Install Pre-Requisites: pkg-config
Finder > Applications > Utilities > Terminal.app
$ sudo port install pkgconfig ---> Installing pkgconfig 0.22_0
$ which pkg-config /opt/local/bin/pkg-config
$ pkg-config --version 0.22
[edit] Install Pre-Requisites: libusb
Finder > Applications > Utilities > Terminal.app
$ sudo port install libusb ---> Installing libusb 0.1.12_0
[edit] Verify Existing Pre-Requisites: gcc & make
Finder > Applications > Utilities > Terminal.app
$ which gcc make /usr/bin/gcc /usr/bin/make
$ gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make --version GNU Make 3.80 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[edit] Get the dfu-util source code using Subversion
Finder > Applications > Utilities > Terminal.app
$ mkdir -p /Volumes/OE/workspace/tools $ cd /Volumes/OE/workspace/tools
$ svn checkout http://svn.openmoko.org/trunk/src/host/dfu-util/ A dfu-util/m4 A dfu-util/configure.ac A dfu-util/src A dfu-util/src/dfu.c A dfu-util/src/commands.c A dfu-util/src/dfu.h A dfu-util/src/main.c A dfu-util/src/commands.h A dfu-util/src/sam7dfu.c A dfu-util/src/Makefile.am A dfu-util/src/sam7dfu.h A dfu-util/src/usb_dfu.h A dfu-util/COPYING A dfu-util/Makefile.am A dfu-util/autogen.sh Checked out revision 2648.
[edit] Configure dfu-util, installing into the MacPorts /opt/local tree
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/tools/dfu-util
$ ./autogen.sh $ ./configure --prefix=/opt/local
[edit] Use a dirty little hack to avoid the static build of dfu-util
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/tools/dfu-util
$ sed -i.bak '/bin_PROGRAMS =/ s/dfu-util_static.*$//g' src/Makefile
[edit] Patch to work around NULL dev->config structures on OS X (Bug #672)
Either get the patch content out of Bug #672, or use one I created: http://www.snmoore.net/openmoko/patches/dfu-util-osx_null_config.patch
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/tools/dfu-util
$ wget http://www.snmoore.net/openmoko/patches/dfu-util-osx_null_config.patch $ patch -p0 < dfu-util-osx_null_config.patch
[edit] Patch to work around byteswap.h and endian.h errors on OS X
Index: src/main.c =================================================================== --- src/main.c (revision 3079) +++ src/main.c (working copy) @@ -26,9 +26,35 @@ #include <getopt.h> #include <usb.h> #include <errno.h> -#include <byteswap.h> -#include <endian.h> + +// #include <byteswap.h> + +#ifndef _BYTESWAP_H +#define _BYTESWAP_H + +//#warning "byteswap.h is an unportable GNU extension! Don't use!" + +static inline unsigned short bswap_16(unsigned short x) { + return (x>>8) | (x<<8); +} + +static inline unsigned int bswap_32(unsigned int x) { + return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16)); +} + +static inline unsigned long long bswap_64(unsigned long long x) { + return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) | +(bswap_32(x>>32)); +} + +#endif + + + + +#include <machine/endian.h> + #include "dfu.h" #include "usb_dfu.h" #include "sam7dfu.h"
[edit] Build and Install dfu-util
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/tools/dfu-util
$ make $ sudo make install
$ which dfu-util /opt/local/bin/dfu-util
$ dfu-util --version dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY You need to specify one of -D or -U Usage: dfu-util [options] ... -h --help Print this help message -V --version Print the version number -l --list List the currently attached DFU capable USB devices -d --device vendor:product Specify Vendor/Product ID of DFU device -c --cfg config_nr Specify the Configuration of DFU device -i --intf intf_nr Specify the DFU Interface number -a --alt alt Specify the Altsetting of the DFU Interface by name or by number -t --transfer-size Specify the number of bytes per USB Transfer -U --upload file Read firmware from device into <file> -D --download file Write firmware from <file> into device -R --reset Issue USB Reset signalling once we're finished
[edit] Mac OS X Recipe 3: Use dfu-util to flash the firmware
WARNING: this works ok for me and my Neo, but try this at your own risk
Note that I found it was usually necessary to disconnect and reconnect the USB cable each time I ran dfu-util, sometimes waiting a few seconds
[edit] Get the Latest Openmoko Firmware
The two images listed here are just examples; pick appropriate ones, see Flashing the Neo 1973
Finder > Applications > Utilities > Terminal.app
$ mkdir -p /Volumes/OE/workspace/images $ cd /Volumes/OE/workspace/images
$ wget http://buildhost.openmoko.org/tmp/deploy/images/uImage-2.6.21.6-moko11-r1_0_0_2388_0-fic-gta01.bin $ wget http://buildhost.openmoko.org/tmp/deploy/images/openmoko-devel-image-fic-gta01-20070803091138.rootfs.jffs2
[edit] Boot the Neo1973 Into uBoot Mode
Hold the Alt button whilst pressing the Power button
[edit] Verify the DFU Interface
Disconnect & reconnect the USB cable
Finder > Applications > Utilities > Terminal.app
$ dfu-util --list dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY Found Runtime: [0x1457:0x5119] devnum=0, cfg=0, intf=2, alt=0, name="USB Device Firmware Upgrade" Found Runtime: [0x05ac:0x8205] devnum=0, cfg=0, intf=2, alt=0, name="UNDEFINED"
Note that the 0x1457:0x5119 device is my Neo, the other is (I think) the Bluetooth adapter on my MacBook Pro
[edit] Flash the Kernel
Disconnect & reconnect the USB cable
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/images
$ sudo dfu-util -d 0x1457:0x5119 -a 3 -R -D ./uImage-2.6.21.6-moko11-r1_0_0_2388_0-fic-gta01.bin dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY Opening USB Device 0x1457:0x5119... Found Runtime: [0x1457:0x5119] devnum=0, cfg=0, intf=0, alt=3, name="kernel" Claiming USB DFU Interface... Setting Alternate Setting ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing Transfer Size = 0x1000 bytes_per_hash=31814 Starting download: [##################################################] finished! state(2) = dfuIDLE, status(0) = No error condition is present Done! Resetting USB to switch back to runtime mode
[edit] Flash the Root Filesystem
Disconnect & reconnect the USB cable
Finder > Applications > Utilities > Terminal.app
$ cd /Volumes/OE/workspace/images
$ sudo dfu-util -d 0x1457:0x5119 -a 5 -R -D ./openmoko-devel-image-fic-gta01-20070803091138.rootfs.jffs2 dfu-util - (C) 2007 by OpenMoko Inc. This program is Free Software and has ABSOLUTELY NO WARRANTY Opening USB Device 0x1457:0x5119... Found Runtime: [0x1457:0x5119] devnum=0, cfg=0, intf=0, alt=5, name="rootfs" Claiming USB DFU Interface... Setting Alternate Setting ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing Transfer Size = 0x1000 bytes_per_hash=644874 Starting download: [##################################################] finished! state(2) = dfuIDLE, status(0) = No error condition is present Done! Resetting USB to switch back to runtime mode
[edit] Boot the Neo1973 Normally
Just press the Power button
Work in progress... updating for Max OS X 10.5 Leopard
[edit] Mac OS X Recipe 1: Install MacPorts
[edit] Install MacPorts
See http://www.macports.org/install.php
Install X11 before Xcode Tools; that way the X11 SDK will be automatically selected when installing Xcode Tools
[edit] Verify shell environment
After a recent install of MacPorts 1.6.0, the .profile file was not created - if you encounter the same problem just create ~/.profile to have the same entries as below
Finder > Applications > Utilities > Terminal.app
$ cat ~/.profile # Your previous .profile (if any) is saved as .profile.mpsaved # Setting the path for MacPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH export MANPATH=/opt/local/share/man:$MANPATH export DISPLAY=:0.0
[edit] Verify gcc & make
Finder > Applications > Utilities > Terminal.app
$ which gcc make /usr/bin/gcc /usr/bin/make
$ gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin9.0
[edit] Update MacPorts
Finder > Applications > Utilities > Terminal.app
$ sudo port selfupdate MacPorts base version 1.600 installed Downloaded MacPorts base version 1.600 The MacPorts installation is not outdated and so was not updated selfupdate done!
[edit] Install GNU awk
Some MacPorts ports such as sqlite3 fail to install using the standard OS X version of awk; they clearly require GNU awk, so I'd recommend switching to GNU awk before installing any other ports
Finder > Applications > Utilities > Terminal.app
$ sudo port install gawk ---> Installing expat 2.0.1_0 ---> Installing libiconv 1.12_0 ---> Installing ncursesw 5.6_1 ---> Installing ncurses 5.6_0 ---> Installing gettext 0.17_3 ---> Installing gawk 3.1.6_0
$ sudo ln -s /opt/local/bin/gawk /opt/local/bin/awk
$ which awk /opt/local/bin/awk
$ awk --version GNU Awk 3.1.6 Copyright (C) 1989, 1991-2007 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
After this, explicitly close and start a new shell - if you don't something weird occurs whereby running awk still executes the original OS X version, even though the new GNU version is first on the path!
[edit] Mac OS X Recipe 2: Build & Install dfu-util
[edit] Install Pre-Requisites: Subversion
Finder > Applications > Utilities > Terminal.app
$ sudo port install subversion ---> Installing apr 1.2.12_1+darwin_9 ---> Installing db44 4.4.20_1 ---> Installing gmake 3.81_0 ---> Installing readline 5.2.012_1 ---> Installing sqlite3 3.5.9_0 ---> Installing apr-util 1.2.12_0 ---> Installing zlib 1.2.3_1 ---> Installing openssl 0.9.8g_0 ---> Installing neon 0.26.4_1 ---> Installing subversion 1.4.6_0
$ which svn /opt/local/bin/svn
$ svn --version svn, version 1.4.6 (r28521) compiled May 26 2008, 14:45:27 Copyright (C) 2000-2007 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme
[edit] Install Pre-Requisites: autoconf & automake
Finder > Applications > Utilities > Terminal.app
$ sudo port install autoconf automake ---> Installing perl5.8 5.8.8_2+darwin_9 ---> Installing p5-locale-gettext 1.05_0 ---> Installing help2man 1.36.4_1 ---> Installing m4 1.4.11_0 ---> Installing autoconf 2.62_0 ---> Installing automake 1.10.1_0
$ which autoconf automake /opt/local/bin/autoconf /opt/local/bin/automake
$ autoconf --version autoconf (GNU Autoconf) 2.62 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/old-licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille.
$ automake --version automake (GNU automake) 1.10.1 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Tom Tromey <tromey@redhat.com> and Alexandre Duret-Lutz <adl@gnu.org>.
[edit] Install Pre-Requisites: pkg-config
Finder > Applications > Utilities > Terminal.app
$ sudo port install pkgconfig ---> Installing pkgconfig 0.23_0
$ which pkg-config /opt/local/bin/pkg-config
$ pkg-config --version 0.23
[edit] Install Pre-Requisites: libusb
Finder > Applications > Utilities > Terminal.app
$ sudo port install libusb ---> Installing libusb 0.1.12_1
[edit] Verify Existing Pre-Requisites: gcc & make
Finder > Applications > Utilities > Terminal.app
$ which gcc make /usr/bin/gcc /usr/bin/make
$ gcc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin9.0
[edit] Get the dfu-util source code using Subversion
Finder > Applications > Utilities > Terminal.app
$ mkdir -p ~/Documents/workspace/openmoko/tools $ cd ~/Documents/workspace/openmoko/tools
$ svn checkout http://svn.openmoko.org/trunk/src/host/dfu-util/ A dfu-util/m4 A dfu-util/configure.ac A dfu-util/doc A dfu-util/doc/dfu-util.1 A dfu-util/src A dfu-util/src/dfu.c A dfu-util/src/commands.c A dfu-util/src/dfu.h A dfu-util/src/main.c A dfu-util/src/commands.h A dfu-util/src/sam7dfu.c A dfu-util/src/Makefile.am A dfu-util/src/sam7dfu.h A dfu-util/src/usb_dfu.h A dfu-util/COPYING A dfu-util/Makefile.am A dfu-util/autogen.sh Checked out revision 4448.
[edit] Configure dfu-util, installing into the MacPorts /opt/local tree
Finder > Applications > Utilities > Terminal.app
$ cd ~/Documents/workspace/openmoko/tools/dfu-util
$ ./autogen.sh configure.ac:7: installing `m4/install-sh' configure.ac:7: installing `m4/missing' src/Makefile.am: installing `m4/depcomp'
$ ./configure --prefix=/opt/local --datadir=/opt/local
[edit] TODO fix echo -e problem causing corrupt dfu-verion.h
[edit] TODO work out how to get rid of the unwanted static build
[edit] TODO patch for byteswap.h etc
[edit] IGNORE EVERYTHING BELOW HERE - work in progress, that doesn't actually work...
[edit] Mac OS X Recipe 4: Boot from SD Card
[edit] Commentary
This is somewhat more complex than it really ought to be. We want to re-partition and re-format the SD Card to have two partitions:
- Boot partition: FAT, 8MB
- Root partition: Ext2, remainder
Note that it does not appear to matter if the boot partition is FAT16 or FAT32.
Unfortunately, the default image shipped on the FreeRunner does not provide a tool to format using FAT, and a default Mac OS X install does not provide a tool to format using Ext2. Luckily, there is a project on SourceForge that adds Ext2 support to OS X...
[edit] Install Pre-Requisites: Mac OS X Ext2 Filesystem
Download and install the Mac OS X Ext2 filesystem from http://sourceforge.net/projects/ext2fsx/ On my Leopard/Intel MacBook Pro I used the 1.4d4 version.
Note that you will be asked to reboot your Mac after the installation has completed.
[edit] Connect the SD Card to your Mac
I use a very cheap Integral Mobile Card Reader, though any Mac compatible SD Card reader should suffice.
[edit] Re-Partition and Re-Format the SD Card: GUI
Finder > Applications > Utilities > Disk Utility.app
Select the relevant disk corresponding to the SD Card, and switch to the Partition pane:
Adjust the 'Volume Scheme' to use 2 partitions, and configure the first partition as 'MS-DOS (FAT)' with a size of 8MB, and an appropriate name (I use 'boot'):
Configure the second partition as 'Ext2 File System' using the remainder of the space available, and an appropriate name (I use 'root'):
Apply the changes and wait whilst the two new partitions are formatted:
[edit] Obtain the Kernel and Root Filesystem Images
Grab a suitable kernel image and root filesystem image from http://buildhost.openmoko.org/daily/
The kernel image (*.bin file) will be copied to the boot partition, whilst the root filesystem (*.rootfs.tar.gz file) will be uncompressed to the root partition.
Finder > Applications > Utilities > Terminal.app
$ ls -la total 309752 drwxr-xr-x 7 simon staff 238 29 Jun 16:12 . drwxr-xr-x 6 simon staff 204 29 Jun 13:56 .. -rw-r--r--@ 1 simon staff 55705600 27 Jun 07:38 Openmoko-openmoko-qtopia-x11-image-glibc-ipk-P1-Snapshot-20080622-om-gta02.rootfs.jffs2 -rw-r--r--@ 1 simon staff 40502925 27 Jun 07:46 Openmoko-openmoko-qtopia-x11-image-glibc-ipk-P1-Snapshot-20080622-om-gta02.rootfs.tar.gz -rw-r--r--@ 1 simon staff 1764808 27 Jun 07:33 uImage-2.6.24+git13+9250c1fc7d6f62075d14ad8f396748490a55d61e-r0-om-gta02.bin
[edit] Install the SD Card in the Phone
Ideally, it should be possible to copy all the files to the SD Card using the Mac itself i.e. from Finder. This does work ok for the kernel image, but I have not yet got it to work successfully for the root filesystem.
Hence all the next steps use the SD Card installed in the phone, and SFTP/SSH to copy the files etc.
[edit] Copy the Kernel Image to the Boot Partition on the SD Card
The kernel image (*.bin) file must be placed on the boot partition (the first, 8MB FAT partition created earlier), and should be named uImage.bin
Finder > Applications > Utilities > Terminal.app
$ cp uImage-2.6.24+git13+9250c1fc7d6f62075d14ad8f396748490a55d61e-r0-om-gta02.bin uImage.bin
$ sftp root@192.168.0.202 sftp> cd /media/card sftp> put uImage.bin sftp> exit
$ ssh -l root 192.168.0.202 root@om-gta02:~# ls -la /media/card drwxr-xr-x 3 root root 16384 Apr 27 00:34 . drwxr-xr-x 11 root root 0 Feb 1 2000 .. drwxr-xr-x 2 root root 1024 Jun 29 2008 .Trashes -rwxr-xr-x 1 root root 4096 Jun 29 2008 ._.Trashes -rwxr-xr-x 1 root root 1764808 Apr 27 00:34 uImage.bin
[edit] Uncompress the File System Image to the Root Partition on the SD Card
The file system image (*.rootfs.tar.gz) file must be copied and uncompressed to the root partition (the second, Ext2 partition created earlier).
WARNING! This is very slow... about 30mins to copy the image to the phone.
Finder > Applications > Utilities > Terminal.app
$ sftp root@192.168.0.202 sftp> cd /media/mmcblk0p2 sftp> put Openmoko-openmoko-qtopia-x11-image-glibc-ipk-P1-Snapshot-20080622-om-gta02.rootfs.tar.gz
$ ssh -l root 192.168.0.202 root@om-gta02:~# cd /media/mmcblk0p2/ root@om-gta02:/media/mmcblk0p2# tar xzvf Openmoko-openmoko-qtopia-x11-image-glibc-ipk-P1-Snapshot-20080622-om-gta02.rootfs.tar.gz
TODO: sort the rest of this out
[edit] Re-Partition the SD Card: Command Line
Finder > Applications > Utilities > Terminal.app
$ sudo fdisk -e /dev/disk1
fdisk: 1> erase fdisk:*1>
fdisk:*1> edit 1 Starting Ending #: id cyl hd sec - cyl hd sec [ start - size] ------------------------------------------------------------------------ 1: 00 0 0 0 - 0 0 0 [ 0 - 0] unused Partition id ('0' to disable) [0 - FF]: [0] (? for help) b Do you wish to edit in CHS mode? [n] Partition offset [0 - 990976]: [63] Partition size [1 - 990913]: [990913] 16384 fdisk:*1>
fdisk:*1> edit 2 Starting Ending #: id cyl hd sec - cyl hd sec [ start - size] ------------------------------------------------------------------------ 2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused Partition id ('0' to disable) [0 - FF]: [0] (? for help) 83 Do you wish to edit in CHS mode? [n] Partition offset [0 - 990976]: [16447] Partition size [1 - 974529]: [974529] fdisk:*1>
fdisk:*1> print Disk: /dev/disk1 geometry: 983/16/63 [990976 sectors] Offset: 0 Signature: 0xAA55 Starting Ending #: id cyl hd sec - cyl hd sec [ start - size] ------------------------------------------------------------------------ 1: 0B 0 1 1 - 1023 254 63 [ 63 - 16384] Win95 FAT-32 2: 83 1023 254 63 - 1023 254 63 [ 16447 - 974529] Linux files* 3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused 4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused fdisk:*1>
fdisk:*1> write Device could not be accessed exclusively. A reboot will be needed for changes to take effect. OK? [n] y Writing MBR at offset 0. fdisk: 1>
fdisk: 1> quit
[edit] Format the Boot Partition
TODO: Should be using newfs, but newfs complains that the BOOT partition is already mounted. And unmounting the BOOT partition makes /dev/disk1 disappear, hence newfs cannot operate on it...
So, how do we get the device node present (for newfs to work), but without the boot partition being mounted?