Benutzer-Werkzeuge

Webseiten-Werkzeuge


programming:cross_compile_ppc

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

programming:cross_compile_ppc [2013/12/16 13:53] (aktuell)
idefix angelegt
Zeile 1: Zeile 1:
 +====== ​ Cross Compile for PPC  ======
 +First install eldk described [[IceCube#​Installing_ELDK|here]].
 +
 +=====  Automake and Autoconf ​ =====
 +We use automake and autoconf, because cmake cannot cross compile yet.
 +At first we need some files for automake:
 +<​code>​
 +touch NEWS
 +touch README
 +touch AUTHORS
 +touch ChangeLog
 +</​code>​
 +
 +Create a autogen.sh:
 +<​code>​
 +#!/bin/sh
 +rm -f config.cache
 +rm -f acconfig.h
 +
 +autoreconf --force --install -I config -I m4
 +#autoconf
 +#autoheader
 +#automake --add-missing
 +
 +./configure "​$@"​
 +
 +echo
 +echo "Now type '​make'​ to compile."​
 +</​code>​
 +
 +We have the following directory structure:
 +<​code>​
 +/
 + -> i2c
 +</​code>​
 +
 +Now create a file called configure.ac:​
 +<​code>​
 +AC_INIT(icecube,​ 0.1)
 +AC_PREREQ(2.5)
 +AC_CONFIG_SRCDIR([i2c/​readMax6633.c])
 +AC_CONFIG_AUX_DIR(config)
 +
 +AM_INIT_AUTOMAKE(1.8)
 +
 +AC_PROG_CC
 +
 +dnl Checks for header files.
 +AC_CONFIG_HEADER(config.h)
 +AC_HEADER_STDC
 +AC_CONFIG_FILES([Makefile i2c/​Makefile])
 +AC_OUTPUT
 +</​code>​
 +
 +And a file Makefile.am:​
 +<​code>​
 +EXTRA_DIST = autogen.sh configure
 +SUBDIRS = i2c
 +</​code>​
 +
 +In the directory i2c create a file Makefile.am:​
 +<​code>​
 +INCLUDES = -I/​usr/​local/​eldk/​ppc_6xx/​usr/​include
 +
 +bin_PROGRAMS = readMax6633
 +readMax6633_SOURCES = readMax6633.c
 +</​code>​
 +
 +Now execute the script autogen.sh with:
 +<​code>​
 +./​autogen.sh --host=ppc-6xx --prefix=/​usr/​local/​eldk/​ppc_6xx/​usr/​local
 +</​code>​
 +
 +To cross-compile now do the following:
 +<​code>​
 +export CROSS_COMPILE=ppc_6xx-
 +make
 +</​code>​
 +
 +=====  cmake  =====
 +Create a file CMakeLists.txt:​
 +<​code>​
 +project (ICECUBE)
 +
 +SET(CMAKE_C_FLAGS "​-O"​)
 +add_subdirectory(i2c)
 +</​code>​
 +
 +And a file i2c/​CMakeLists.txt:​
 +<​code>​
 +add_executable (readMax6633 readMax6633.c)
 +</​code>​
 +
 +Now execute:
 +<​code>​
 +CC=ppc_6xx-gcc cmake .
 +</​code>​
 +
  
programming/cross_compile_ppc.txt · Zuletzt geändert: 2013/12/16 13:53 von idefix