Differences

This shows you the differences between the selected revision and the current version of the page.

howto:crosscompile 2011/05/18 12:10 howto:crosscompile 2017/09/06 18:38 current
Line 8: Line 8:
For the cross-compiler ('user' is an example username): For the cross-compiler ('user' is an example username):
-<code>cd /home/user+<code bash>cd /home/user
tar xjf cross-compiler-armv5l.tar.bz2 tar xjf cross-compiler-armv5l.tar.bz2
rm cross-compiler-armv5l.tar.bz2 rm cross-compiler-armv5l.tar.bz2
export PATH=/home/user/cross-compiler-armv5l/bin:$PATH</code> export PATH=/home/user/cross-compiler-armv5l/bin:$PATH</code>
Then you would compile programs with armv5l-tool, e.g. armv5l-gcc Then you would compile programs with armv5l-tool, e.g. armv5l-gcc
 +
 +If you are using configure/make programs, you will need to follow the documentation for cross-compilation. You will also want the programs to be installed in a different directory from /usr/local so you can copy them later. For GNU and compatible programs, it is usually this:
 +<code bash>export CC=armv5l-gcc
 +./configure --host=arm-unknown-linux --prefix=/home/user/arm # example directory
 +make
 +make install</code>
For the native compiler: For the native compiler:
-<code>cd /mnt/HD_a2+<code bash>cd /mnt/HD_a2
tar xjf mini-native-armv5l.tar.bz2 tar xjf mini-native-armv5l.tar.bz2
rm mini-native-armv5l.tar.bz2 rm mini-native-armv5l.tar.bz2
export PATH=/mnt/HD_a2/mini-native-armv5l/usr/bin:$PATH</code> export PATH=/mnt/HD_a2/mini-native-armv5l/usr/bin:$PATH</code>
Then you would compile programs simply with the normal tool name e.g. gcc Then you would compile programs simply with the normal tool name e.g. gcc
- 
-The native compiler, although slow, can actually be quite useful if your cross compiler fails a sanity check, for example. 
Oh, I might point out, these images actually use newer versions of the source components than D-Link used. Oh, I might point out, these images actually use newer versions of the source components than D-Link used.
Line 28: Line 32:
You might get this error when using make with the native compiler. You can either download a patched version here: {{:download:make.gz}} or recompile make, adding the following line to main.c after the includes: You might get this error when using make with the native compiler. You can either download a patched version here: {{:download:make.gz}} or recompile make, adding the following line to main.c after the includes:
-    int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle){}+<code c>int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle){}</code> 
 + 
 +==== Cross vs Native compile ==== 
 + 
 +Since the DNS-323 has only a 400MHz processor, configuring and compiling programs can be a slow process, usually slow enough that you won't be able to just sit there while it processes, but not so slow you have to do something else entirely or leave it on overnight. Native compiling has the advantage of building programs that exactly match the specifications of the device, only linking to libraries that are present, and warning of any errors properly. 
 + 
 +A cross-compiler takes advantage of your PC's CPU, meaning that it will work a lot faster, however the end result might not work 100% on the device. You also need to ensure that the program you are compiling is properly configured for cross-compilation to ARM devices. 
 + 
 +An ideal solution would be to emulate the DNS-323 architecture and kernel, but at much faster speeds. I haven't managed to do this with qemu, it is just as slow as the device itself. 
 + 
 +Usually the best solution, if you are compiling large programs, is to construct your own configuration file, check all the dependencies manually, ensure libraries are linked dynamically, then cross-compile it.
===== Firmware 1.05 ===== ===== Firmware 1.05 =====

Navigation

Personal Tools