Difference between revisions of "Cross MorphOS binutils"

From Freepascal Amiga wiki
Jump to: navigation, search
(short manual how to create cross binutils for morphos on linux)
(No difference)

Revision as of 15:53, 16 May 2020

How to create binutils (as, ld) needed for FreePascal crosscompiling to MorphOS on a linux system.

One needs:

  • working linux with gcc (e.g. ubuntu: sudo apt install build-essentials)
  • flex, bison (e.g. ubuntu: sudo apt install flex bison)
  • xz-utils (e.g. ubuntu: sudo apt install xz-utils)
  • latest sdk source from MorphOS source page (e.g. sdk-source-20200422)


  1. unpack the source (e.g. tar -xJf sdk-source-20200422.tar.xz)
    • we only need the sdk-source/binutils folder, therefore its possible to only unpack that directory (e.g. when using GUI tools to unpack)
  2. enter the sdk-source/binutils folder (e.g. cd sdk-source/binutils)
  3. unpack the binutils-x.xx.tar.xz inside (e.g. tar -xJf binutils-2.34.tar.xz)
  4. apply the patch for the same version number with patch -p0 <./binutils-x.xx-morphos.diff (e.g. patch -p0 <./binutils-2.34-morphos.diff)
    • make sure you have the same version number of diff file as the directory
  5. create a new directory build (e.g. mkdir build)
  6. enter that directory (e.g. cd build)
  7. configure the morphos binutils (e.g. ../binutils-2.34/configure CFLAGS="-DMORPHOS_TARGET" --target=ppc-morphos --enable-plugins=no --disable-initfini-array)
  8. compile the cross binutils for morphos (e.g. make)
  9. you will find the compiled tools in the build directory, we are most interested in directories "gas" the assembler and "ld" the linker
  10. copy and rename the assembler to /usr/bin with prefix powerpc-morphos (e.g. cp gas/as-new /usr/bin/powerpc-morphos-as)
  11. copy and rename the linker to /usr/bin with prefix powerpc-morphos (e.g. cp ld/ld-new /usr/bin/powerpc-morphos-ld)

Finished!