User:SNMoore

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Mac OS X Recipe 1: Install MacPorts)
 
(Mac OS X Recipe 2: Build & Install dfu-util)
Line 50: Line 50:
 
     The MacPorts installation is not outdated and so was not updated
 
     The MacPorts installation is not outdated and so was not updated
 
     selfupdate done!
 
     selfupdate done!
 +
 +
 +
== Mac OS X Recipe 2: Build & Install dfu-util ==
 +
 +
===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
 +
 +
===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.
 +
 +
===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
 +
 +
===Install Pre-Requisites: libusb===
 +
''Finder > Applications > Utilities > Terminal.app''
 +
 +
$ sudo port install libusb
 +
    --->  Installing libusb 0.1.12_0
 +
 +
===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.
 +
 +
===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.
 +
     
 +
===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
 +
 +
===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
 +
 +
===Patch to work around NULL dev->config structures on OS X ([http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=672 Bug #672])===
 +
 +
Either get the patch content out of [http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=672 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
 +
 +
===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

Revision as of 13:57, 7 August 2007

Contents

Mac OS X Recipe 1: Install MacPorts

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

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

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.

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!


Mac OS X Recipe 2: Build & Install dfu-util

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

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.

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

Install Pre-Requisites: libusb

Finder > Applications > Utilities > Terminal.app

$ sudo port install libusb
    --->  Installing libusb 0.1.12_0

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.

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.
      

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

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

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

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
Personal tools

Mac OS X Recipe 1: Install MacPorts

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

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

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.

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!