Hi guys,
I am trying to cross compile Mihini for Arduino Yun
Arduino Yun runs OpenwRT and has a MIPS processor.
1. Getting the tool chain
Many of the TP-LINK routers have the exact same processor.
So getting the cross tool chain installed was easy.
I have documented it here:
I was able to cross compile a helloworld.c application using this tool chain and execute it successfully on my Yun.
I used an Ubuntu PC for cross compilation.
2. Pre-requisites
I had to install git and cmake on my ubuntu box (sudo ap-t get install cmake git)
used git to fetch the repository:
3. CMake file
I added a file named toolchain.yun-openwrt.cmake to the ~/org.eclipse.mihini/cmake
The contents of this file are:
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
#SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
set( CMAKE_C_COMPILER mips-openwrt-linux-uclibc-gcc )
set( CMAKE_CXX_COMPILER mips-openwrt-linux-uclibc-g++ )
# where is the target environment
set( CMAKE_FIND_ROOT_PATH /home/anurag/openwrt/OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/ )
set( CMAKE_SYSTEM_PROCESSOR mips )
# search for programs in the build host directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(DEFAULT_BUILD true)
4. porting folder
I make a copy of porting/raspberrypi-linaro directory for my yun target by executing the following command ~/org.eclipse.mihini/porting:
cp -avr raspberrypi-linaro/ yun-openwrt/
5. build.sh
I executed ./bin/build.sh -t yun-openwrt and it worked without any errors
6. What should I do next?
I want to execute the commands:
$ make lua luac
$ make modbus_serial
$ make package
But I have the following questions:
- I simply cloned the raspberrpi porting folder, I am sure some stuff needs to be changed there for Arduino Yun, where do I start?
- Arduino Yun already has lua and luac installed, I dont want to package that into my Mihini install package, But when I execute "make package" it will complain about those being missing, how do I take care of that? By modifying the makefile? how will this affect installation when mihini doesnt find lua/luac in the usual location on Arduino Yun
- Can i skip the "make package" step and take the folder generated by build.sh and copy it to Arduino Yun? Yun already has lua/luac installed, what must I change to get it to work this way by simply copying? what folders do I copy?
- Any suggestion on how to go about doing this?
Anurag