Home > Code > Multilink for Palm

Multilink for Palm

October 9th, 2007

This is a (long) sort-of-technical post about solving some problems with a very useful tool for Palm OS development, Multilink. I had it working great on MacOSX/PPC, but upgraded to an Intel Mac, where prc-tools doesn’t work anymore. So, since I just spent altogether too long trying to get this thing working on Windows/Cygwin, I figured I should document the steps I took to get it up and running, since the instructions on the site are kind of old and no longer entirely accurate.Essentially, the problem with this tool is that it depends on libbfd (generated by bintools). This is mentioned by the developer, but the supplied libs for Cygwin don’t actually work (they might have with Cygwin b20, but they don’t anymore). Worse, they permit a compile of the tool, but fail silently during use. So, my Make script was running, but nothing would link.Anyway, I’m writing this down so that I don’t forget the next time, and so that the information is out there for others. Palm OS development is a dying craft, but you never know when this info will prove useful.

So… to build Multilink, check out the following instructions. If you just want to use my pre-built binaries, I’ve zipped them up and you can get them here. See below for more information.

Building Multilink

Step 1: Install Cygwin

  1. Download Cygwin and run Setup.exe.

  2. In addition to the default packages, you should select at least the following (others may be required, but I don’t think so):

    • binutils
    • gcc (selects gcc-core and gcc-g++)
    • gcc-mingw (selects gcc-mingw-core and gcc-mingw-g++)
    • gdb
    • gdbm
    • make
    • patch
    • pkg-config
  3. Let Cygwin do its thing, and you’re good.

Step 2: Install prc-tools

There are two options for this: use the prebuilt Cygwin packages or build it from scratch. I’m only going to deal with the first option (but don’t worry — we’ll be compiling some stuff soon).

  1. Go to the prc-tools site and download the 2.3 releases called

    • prc-tools-2.3-cygwin.tar.bz2
    • prc-tools-arm-2.3-cygwin.tar.bz22.

Put these into a folder call ‘cyginstall’ or whatever you want to call it at an easy to find location.

  1. Run the Cygwin installer (setup.exe) again. This time, instead of using the default “Install from Internet”, choose “Install from Local Directory”, click through the next screen (keep the defaults), and then at the field called “Local Package Directory”, enter or browse to the folder you used to store the .bz2 files in step 2.

  2. At the next screen, you should see the two packages (prc-tools and prc-tools-arm). Enable them and complete the installer.

Step 3: Get the Palm SDK

You need an account at ACCESS (and potentially at Palm, depending on what OS features you’re using). For now, I’m going to assume a simple install of the ACCESS SDK (adding the Palm headers is easy, if you need to do it later).

  1. Once you’re in the the top secret developer area of ACCESS, follow the link labelled “Garnet OS Development Tools”. Then the link (under ACCESS SDKs) called “Core Garnet OS SDK”

  2. Get these two downloads: – Garnet OS SDK (68K) R3 PRC tools Generic UNIX – Garnet OS 68K API SDK (Fall 2004 Update) (for PRC-Tools)

  3. Create a folder at C:\PalmDev

  4. Untar the “Garnet OS SDK (68K) R3 PRC tools Generic UNIX” download into your PalmDev folder. It should have resolved to a folder called “sdk-5r3”.

  5. Rename it to “sdk-5r4”.

  6. Unzip the “Garnet OS 68K API SDK (Fall 2004 Update)” to the PalmDev folder. Overwrite any older files with the newer ones.

  7. Open a Cygwin terminal window and type: mount c:\\PalmDev /PalmDev to create a Cygwin “mountpoint” for your PalmDev folder.

  8. Now type (still in Cygwin)

    palmdev-prep

    You should see:

    Checking SDKs in /PalmDev
      sdk-5r4 headers in 'include', libraries in 'lib'

    When GCC is given no -palmos options, SDK '5r4' will be used by default
    Writing SDK details to configuration files...
    ...done

    Presuming that you do, you’re in good shape, and can probably compile Palm code as-is. All that remains is getting Multilink setup.

Step 4: Download and build some source code

In order to successfully build Multilink, we need to build new versions of a couple of libraries and a header file related to the ‘bintools’ package. The trick is, we need to build them for the m68k-palmos target. These files are automatically built when compiling prc-tools yourself, but since we took the easy way out, we don’t have them.

To solve this, we’re going to do a partial build of prc-tools (the bintools part), and get the libraries and header file in question.

  1. Download these two archives:

  2. Copy them to your Cygwin home folder (C:\cygwin\home\(username))

  3. Perform the following sequence of commands in a Cygwin terminal window

    cd
    tar xf binutils-2.14.tar.bz2
    tar xfz prc-tools-2.3.tar.gz
    cat prc-tools-2.3/binutils-2.14.palmos.diff | patch -p0
    cd prc-tools-2.3
    ln -s ../binutils-2.14 binutils
    cd ..
    mkdir build
    cd build
    ../prc-tools-2.3/configure --target=m68k-palmos --enable-languages=c,c++
      (note: all on one line!)
    cd binutils
    make all info

  4. If it worked and you don’t have any errors, congratulations! If it didn’t work, you might be missing some system libraries, in which case you should examine the error, determine which package is missing (it should be pretty obvious) and install it via Cygwin’s setup.exe installer.

  5. You need the following files:

    • bfd.h
    • libbfd.a
    • libintl.a

    cd
    cp build/binutils/bfd/bfd.h /PalmDev/sdk-5r4/include/
    cp build/binutils/bfd/libbfd.a /PalmDev/sdk-5r4/lib/
    cp build/binutils/intl/libintl.a /PalmDev/sdk-5r4/lib/

Step 5: Download, build and install Multilink

Almost done. All we need to do is get Multilink built and installed.

  1. Download Multilink and copy it to your Cygwin home directory.

  2. Open the archive with:

    cd
    tar xfz multilink.tgz
    cd multilink

  3. There are a few things we have to fix in the Makefile before we build. Use the editor of your choice (I would recommend that you use something which won’t mangle the Unix line endings like metapad or e, but it might not matter):

    • Change the line:

       PILOT_DIR = /usr/local/pilot
      

      to read:

       PILOT_DIR = /PalmDev/sdk-5r4
      
    • Change the line:

       LIBS = -L${PILOT_DIR}/lib -lbfd -liberty
      

      to read:

       LIBS = -L${PILOT_DIR}/lib -lbfd -liberty -lintl
      
  • Change:

         CC = gcc
    

    to:

         CC = gcc -Dfalse=0
    
  • And put a ‘#’ character at the beginning of the line:

         @test `whoami` = root || (echo "Must be root to install"; false)
    

    to disable it (Cygwin doesn’t support sudo). It now looks like:

         # @test `whoami` = root || (echo "Must be root to install"; false)
    
  • Done. Save it and return to the Cygwin terminal (if you’re not already there).

  1. Build Multilink:

    make
    make install

DONE!

The pre-compiled binaries

Inside the archive are two folders, “buildstuff” and “dist”.

“buildstuff” contains the header and 2 library files the above instructions generate. Presuming that you’re using the prc-tools 2.3 Cygwin distro, you can use them to build your own Multilink, without needing to build them yourself.

“dist” contains the built Multilink .o, .exe and .man files. Again, presuming that you’re using the 2.3 Cygwin distro, you can probably bypass all of the above, and simply put these at the indicated locations. YMMV.

Categories: Code Tags: ,
Comments are closed.