ELDK Notes
From Noah.org
Revision as of 18:00, 8 April 2010 by Root (talk | contribs) (→Cross Compiling inotify-java-2.0.1-source for PPC on a x86 host)
Contents
Cross-compile with ELDK
Install ELDK
Download and install ELDK - Embedded Linux Development Kit. The following script shows what to do. I have been using version 4.2 of ppc-linux-x86.
sudo mkdir /opt wget http://ftp.denx.de/pub/eldk/4.2/ppc-linux-x86/iso/ppc-2008-04-01.iso sudo mkdir /media/adhoc sudo chmod a+rwx /media/adhoc sudo mount -o loop ppc-2008-04-01.iso /media/adhoc cd /media/adhoc sudo ./install cd /opt/eldk/ source eldk_init ppc_7xx echo $ARCH
Cross Compiling inotify-java-2.0.1-source for PPC on a x86 host
This is a particularly stupid package.
#!/bin/sh tar jxf inotify-java-2.0.1-source.tbz2 cd inotify-java-2.0.1-source source /opt/eldk/eldk_init ppc_7xx export CROSS_COMPILE=ppc_7xx- export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16 echo "Hack the Makefile to force it to use 'ppc_7xx-g++'". sed -i -e "s/\([^-]\)g++/\1ppc_7xx-g++/" ./data/make/Makefile echo "Add version property to the build.xml ant controller." version=`basename $PWD | sed -n 's/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p'` sed -i -e "/<project name=/a \ <property name='version' value='${version}' \/>" build.xml # ant build ant compile-release ant jar cd ./dist cp ../build/native/libinotify-java.so.2.0 ./. ln -sf libinotify-java.so.2 libinotify-java.so ln -sf libinotify-java.so.2.0 libinotify-java.so.2 echo "The .jar and .so files are located in $(pwd)" ls -l . echo "Finished with the inotify-java."
Notes: Cross Compiling JavaX-USB for PPC on a x86 host
The environment file that you will source later on this process sets the wrong CROSS_COMPILE variable. I just force it to CROSS_COMPILE=ppc_7xx-. Then I had to also hack the Makefile in JavaX-USB to force it to use ppc_7xx-gcc instead of gcc.
#!/bin/sh # # This builds the javax-usb JNI and jar files. # This assumes that the source tarballs are # in the current working directory. # # # Options may be set here. # export JAVAX_USB_INSTALL_PATH=/opt/javax-usb export BUILD_PATH=`pwd` # 0. Prepare final destination of jar files. # CLASSPATH will need to be updated to # point to the jar files in this directory. mkdir -p ${JAVAX_USB_INSTALL_PATH} # # 1. jsr80.jar # cd ${BUILD_PATH} tar jxf javax-usb_1.0.2.tar.bz2 cd ${BUILD_PATH}/javax-usb ant clean ant all cp ./lib/jsr80.jar ${JAVAX_USB_INSTALL_PATH}/. echo "Finished with the first jar." # # 2. jsr80_ri.jar # cd ${BUILD_PATH} tar jxf javax-usb-ri_1.0.2.tar.bz2 cd ${BUILD_PATH}/javax-usb-ri export CLASSPATH=/opt/javax-usb/jsr80.jar:${CLASSPATH} ant clean ant all cp ./lib/jsr80_ri.jar ${JAVAX_USB_INSTALL_PATH}/. echo "Finished with the second jar." # # 3. jsr80_linux.jar, libJavaxUsb.so, javax.usb.properties # # Now for the hard part... cd ${BUILD_PATH} tar jxf javax-usb-ri-linux_1.0.2.tar.bz2 cd ${BUILD_PATH}/javax-usb-ri-linux source /opt/eldk/eldk_init ppc_7xx export CLASSPATH=/opt/javax-usb/jsr80.jar:/opt/javax-usb/jsr80_ri.jar:$CLASSPATH export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16 export CROSS_COMPILE=ppc_7xx- echo "Hack the Makefile to force it to use 'ppc_7xx-gcc'". sed -i -e "s/\([^-]\)gcc/\1ppc_7xx-gcc/" jni/Makefile ant clean ant all cp lib/javax.usb.properties ${JAVAX_USB_INSTALL_PATH}/. cp lib/jsr80_linux.jar ${JAVAX_USB_INSTALL_PATH}/. cp lib/libJavaxUsb.so ${JAVAX_USB_INSTALL_PATH}/. echo "Finished with the third jar."
ERROR: ppc_7xx-gcc: CROSS_COMPILE variable is not set or invalid
This is a common error. This is the result of a mismatch between ELDK and PERC.