Cross Toolchain [x86]

Cross Toolchain [x86] u7-20111011

No permission to download
SDK
x86 toolchain

Revision History
Rev: V0.10
Date: 19/Oct/2010
Author: Kent Tsai
Description: Initial draft



1. Introduction
This document provides detailed description to create the cross compile environment and build your application for QNAP NAS. It also provides how to run your own application at startup in QNAP NAS system.



2. Install the x86 toolchain
Please follow the steps to install/uninstall toolchain on your host Linux machine

To Install:​
As root, decompress the toolchain to the “/” folder
Bash:
tar zxvf cross-project-x86.u7-20101019.tar.gz -C /

To Uninstall:​
As root, remove /opt/cross-project/x86
Bash:
rm -rf /opt/cross-project/x86



3. Test if “hello world” worked in x86 platform

Please follow the steps to test “hello world” program
Bash:
chroot /opt/cross-project/x86/sys-root
cd /src/hello_world_project
gcc -o hello_world hello_world.c
scp hello_world admin@xxx.xxx.xxx.xxx:/root
ssh admin@xxx.xxx.xxx.xxx /root/hello_world
(xxx.xxx.xxx.xxx is your NAS IP)

It works if you can see the output “Hello World!!!!!!!!!!!!!!!!!!!!!!!”



4. Cross-compiling and testing your application
4.1 Cross-compiling your application

Please follow the steps
A. Put your project in /opt/cross-project/x86/sys-root/src/myproject
B.​
Bash:
chroot /opt/cross-project/x86/sys-root
cd /src/myproject
C. use gcc or make to compile your project​



4.2 Testing the binary of your application

Please follow the steps
A. scp your_binary admin@xxx.xxx.xxx.xxx:/root​
B. Use ssh to login to your NAS​
C. Run your_binary (./your_binary)​



4.3 Running your own application at startup

Please follow the steps
A. scp your_binary admin@xxx.xxx.xxx.xxx:/root​
B. Use ssh to login to your NAS​
Bash:
mount -t ext2 /dev/sdx6 /tmp/config
cp /root/your_binary /tmp/config
C. create your own autorun.sh script in /tmp/config/autorun.sh
Bash:
touch /tmp/config/autorun.sh
chown +x /tmp/config/autorun.sh
umount /tmp/config

Note: you can also refer to QNAP wiki to make your autorun.sh script http://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup



5. Additional libraries

If you are going to cross-compile some packages, they might miss some libraries. Get the libraries source code first, and follow standard procedure to compile/install it.

For example, to compile libpng, follow the steps
A. Download libpng source to /opt/cross-project/x86/sys-root/src
Bash:
wget http://prdownloads.sourceforge.net/libpng/libpng-1.4.4.tar.gz?download
chroot /opt/cross-project/x86/sys-root
cd /src
tar zxvf libpng-1.4.4.tar.gz
cd libpng-1.4.4
./configure
make
make install


6. Important Notes

Question:
When I use scp to upload binary to NAS, the ram disk is full, how can I do?​
Answer:
Change the target directory to hard disk​
ex: scp your_binary admin@xxx.xxx.xxx.xxx:/mnt/HDA_ROOT​
scp your_binary admin@xxx.xxx.xxx.xxx:/share/MD0_DATA​

Question:
The log of my application will cause ram disk full, how can I don?​
Answer:
Usually open source or application might save logs, to prevent ram disk full, always make sure the log file has been size rotated or save it to hard disks​
(Ram disk full will cause your system abnormal and unstable)​
Author
Silas Mariusz
Downloads
16
Views
805
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Silas Mariusz

Similar resources

Cross Toolchain [ARM] Silas Mariusz
Cross Compiler for QNAP NAS ARM platform devices
0.00 star(s) 0 ratings
Downloads
9
Updated