This (short) tutorial concerns Dingux development, from a Linux (on Intel) platform. First we go through the installation of the toolchain (the cross compiler and all the stuff that goes along), and then an example of compilation.
Note: I use mostly the command line, but you can of course use equivalent graphical tools if you prefer.
Contents |
Installing the toolchain
- Grab the latest dingux_toolchain from the Dingoo-Linux download page.
- Extract it:
tar -jxvf dingux_toolchain_20091022.tar.bz2
- Copy the extracted folder to /opt:
sudo cp -r mipsel-linux-uclibc /opt/
- Add /opt/mipsel-linux-uclibc/usr/bin to your path:
export PATH="${PATH}:/opt/mipsel-linux-uclibc/usr/bin/"
(you might want to add this line to your shell's config file so that you don't have to retype it every time you open a new terminal. For instance if you use bash, add it at the end of .bashrc in your home folder) And we're done. Now let's check that it works.
Using the toolchain
We use the cross-compiler exactly as we would use the regular GCC, except that instead of invoking gcc, g++, ld, etc., we use mipsel-linux-gcc, mipsel-linux-g++, mipsel-linux-ld, etc.
If using a makefile, you can for instance put
CC = mipsel-linux-gcc CXX = mipsel-linux-g++
in the beginning.
Or when porting existing software that use the configure script:
./configure --host=mipsel-linux --target=mipsel-linux
Hello Dingoo
Let's check that the toolchain works, with the traditionnal 'Hello World' program.
- Open your favorite text editor, create a file hello.c, and type in it:
#include <stdio.h> int main(void) { printf("Hello Dingoo\n"); return 0; }
- Compile it using the newly installed crosscompiler:
mipsel-linux-gcc -o hello hello.c
- Place the binary on the Dingoo. When it is plugged in USB, you can connect by FTP to 10.1.0.2, username "root" and no password. Otherwise, you can always transfer it manually on the MiniSD card.
[email protected]:~/Dingoo/hello$ ftp 10.1.0.2 Connected to 10.1.0.2. 220 Operation successful Name (10.1.0.2:tenoch): root 230 Operation successful Remote system type is UNIX. Using binary mode to transfer files. ftp> cd local 250 Operation successful ftp> put hello local: hello remote: hello 200 Operation successful 150 Ok to send data 226 Operation successful 5767 bytes sent in 0.00 secs (46162.6 kB/s) ftp> exit 221 Operation successful
- Now we have two choices to launch the exe, either remotely, from our computer, or directly on the Dingoo. For the first one, we connect to the Dingoo via telnet, change to the directory where we put the exe, and run it:
[email protected]:~/Dingoo/hello$ telnet 10.1.0.2 Trying 10.1.0.2... Connected to 10.1.0.2. Escape character is '^]'. / # cd usr/local/ /boot/local # ./hello Hello Dingoo
Success!
Second choice: from the Dingoo's interface with gmenu2x, go to the tab "Applications", select "Explorer", navigate to "hello" and launch it. The screen will flash to the terminal, and if you're fast enough, you can read "Hello Dingoo" at the bottom before gmenu2x comes back. To check that, go to the tab "Settings" and choose "Terminal". It will display for 5 seconds the last things written to the standard output.
Notes
The convention is apparently to use the ".dge" file extention for Dingux executables, but it is not necessary. gmenu2x might rely on this when doing automatic scanning, though (to check ?).
Problems
- If you're using Linux and the telnet fails with timeout error, check if your kernel loaded the cdc_ether/usbnet drivers:
lsmod | grep -i cdc_ether
- If the output of this command returns nothing, you have to compile/install the module by hand, or try to use a fresh kernel of a distribution like Ubuntu.