EM2416 Linux User Manual
EM2416 Linux User Manual
EM2416 Linux User Manual
com
www.armdesigner.com
www.armdesigner.com
Rev V1.0 V1.1 Date 2010-3-20 2010-01-05 Description The initial released Version The Second released Version
www.armdesigner.com
Catalogue
EM2416 LINUX USER MANUAL .......................................................................................................0 1 HARDWARE ENVIRONMENT.........................................................................................................4 1.1 HARDWARE PREPARATION ...............................................................................................................4 1.2 HARDWARE CONNECTION ................................................................................................................4
1.2.1Serial port .................................................................................................................................4 1.2.2 IROM Mode Download ............................................................................................................5 1.2.3 Network communication ..........................................................................................................5
2 SOFTWARE ENVIRONMENT..........................................................................................................5 2.1 BUILD LINUX WORKING ENVIRONMENT .........................................................................................5 3 BURN LINUX INTO EM2416............................................................................................................5 3.1 U-BOOT PREPARATION .....................................................................................................................6
3.1.1 configure files in SD Card ........................................................................................................6 3.1.2 Set U-boot Environment Variables...........................................................................................9
4 INSTALL CROSS COMPILER ....................................................................................................14 5 COMPILE UBOOT SOURCE PACKAGE ....................................................................................17 5.1 UNZIP THE UBOOT SOURCE PACKAGE .........................................................................................17 5.3 COMPILE U-BOOT.BIN ....................................................................................................................17 6 COMPILE LINUX KERNEL SOURCE PACKAGE .....................................................................18 6.1 UNZIP THE LINUX KERNEL SOURCE PACKAGE ...............................................................................18 6.2 CONFIGURATION STEPS .................................................................................................................18 6.3 COMPILE THE ZIMAGE ...................................................................................................................20 7. GENERATE THE ROOT FILE SYSTEM IMAGE (YAFFS) ......................................................21 7.1 FILE SYSTEM DIRECTORY ..............................................................................................................21 7.2 GENERATE THE IMAGE FILE YAFFS ................................................................................................21 8. DEVICE DRIVERS AND TEST .....................................................................................................22 8.1 ETHERNET DEVICE DRIVERS TEST(PING) ......................................................................................22
8.1.1 Test Steps .............................................................................................................................. 22
www.armdesigner.com
8.3.3 Insert USB mass Storage Device...........................................................................................29
9. DEVELOP APPLICATION IN THE HOST...................................................................................34 9.1 WRITE HELLO CODE .....................................................................................................................34 9.2 COMPILE HELLO ............................................................................................................................35 10. DOWNLOAD THE APPLICATION TO THE EM2416 BOARD..............................................35 10.1 COPY BY U DISK .........................................................................................................................35 APPENDIX A :NETWORK SERVICE ..............................................................................................36 APPENDIX B: DEVELOPMENT IN QT ...........................................................................................39
www.armdesigner.com
1. Hardware Environment
1.1 Hardware preparation
Hardware preparation : +5V/2a external power supply DB9 cross serial cable, to connect PC and COM1 of EM2416 Ethernet cable PC to run Ubuntu9.10 or Windows EM2416 development board Optional items: LCD, earphone/MIC, mouse/U disk, MMC card, SD card
1.2.1Serial port
Serial port is use to display information of the development board, but also to send command to the board. Connect PC and COM1 of the development board with serial cable that provided by Boardcon. In the host, the HyperTerminal in Windows can communicate with EM2416 serial port.
www.armdesigner.com
2. Software Environment
2.1 Build Linux Working Environment
Before the development, user needs to install the software Ubuntu to build Linux working environment. Please refer to the corresponding information for the installation.
Root file system: rootfs.yaffs2 (file system image file) These files are in LINUX/image of the CD-ROM. User can install Linux system with the image files. Note: command prompt in HOST terminal is ' $ ', and it's '#' in DNW.
www.armdesigner.com
www.armdesigner.com
Figure 3.1 2) Click Browse on the right of the Bootloader, select u-boot-movi.bin in CD-ROM 3) Click Browse on the right of the Kernel, select zImage in CD-ROM 4) Click Browse on the right of the Specific Sector , select rootfs.yaffs2 in CD-ROM, and type 3600000 into the Sector , as shown in figure 3.2
www.armdesigner.com
Figure 3.2 5) Click START . Below is the picture shows the burning is successful.
Figure 3.3
www.armdesigner.com
6) Reopen the uboot_writer, click Browse on the right of the Specific Sector , select u-boot-nand.bin in CD-ROM, and type 3800000 into the Sector. Click START , you can get the information as follows:
Figure 3.4 7) It means the system has already burned into SD successfully.
www.armdesigner.com
Figure 3.7 Select 115200 for the Bits per second. Leave Data bits, Parity and Stop bits on the default settings (shown). Select None for the Flow Control. Click OK.
10
www.armdesigner.com
Figure 3.8
Go to File ->save (shown). You can double click EM2416 to open the Hyperterminal next time, shown in figure 3.10
Figure 3.9
11
www.armdesigner.com
Figure 3.10 Open the Hyperterminal, insert the SD card(has burned Sdbootloader) into the SD connector, set the board boot from SD card mode. SD card mode: (Boot Mode Switch: Push the Boot mode switch at Nor Flash Side) Then power on the development board. If Bootloader has been launched successfully, it will appear the UBOOT booting information as shown in figure 3.11, press any keys to enter the Uboot command mode within 3 seconds.
12
www.armdesigner.com
Figure 3.11
Then set board boot from the Nand flash(Boot Mode Switch: Push the Boot mode switch at Nand Flash Side), and then reboot the board, and then press space to enter the uboot command mode, run the follow command to set the U-BOOT environment variables. Please input the following commands:
# setenv bootcmd nand read.jffs2 C0008000 40000 400000;bootm C0008000 # set bootargs "noinitrd console=ttySAC0,115200 root=/dev/mtdblock2 rootfstype=yaffs2 init=/linuxrc" # saveenv
13
www.armdesigner.com
In the last line, add the following command after ' fi '. As shown in figure 4.1 export PATH=$PATH:/usr/local/arm/4.2.2-eabi/usr/bin
14
www.armdesigner.com
Figure 4.1 Save it and exit. And execute the command: $ source ~/.bashrc
Input the following command, we can get the version information on the compiler. $ arm-linux-gcc -v
15
www.armdesigner.com
16
www.armdesigner.com
5. Compile UBOOT
5.1 Unzip the UBOOT Source Package
Create a directory EM2416 in Ubuntu and modify its rights to make user can modify the file in the directory directly. $ sudo mkdir /EM2416 /EM2416 R
Note: book is the user name in UBUNTU defined when installed the system. User can modify it according to the host user name. Create a new folder tftpboot in root file for the storage of uboot.binzImage and so on. $ sudo mkdir /tftpboot /tftpboot -R
Move into the EM2416 directory, unzip the Uboot source package. Please execute the following command: $ cd /EM2416 $ tar xjvf /media/cdrom/linux/u-boot-1.3.4.tar.bz2
17
www.armdesigner.com
Figure 5.2
18
www.armdesigner.com
(1) Select Load an Alternate Configuration File with Up and Down key, then press Enter
19
www.armdesigner.com
Click "exit" to move back to the terminal input interface and save it.
20
www.armdesigner.com
21
www.armdesigner.com
$ sudo tar jxvf /media/cdrom/LINUX/root_qtopia.tar.bz2 root_qtopia R $ sudo chown book:book
It generates the file system yaffs by the command: $ mkyaffs2image 0 root_qtopia root_EM2416.yaffs Note: don't forget to type the argument 0. If not, it will appear the information as follows:
After that, please follow the steps in 3.3.3 to burn the file system image.
22
www.armdesigner.com
23
www.armdesigner.com
3Select the following 4 options:MMC support, MMC debugging, Sansung S3C High Speed MMC Interface support and Support Scatter and Gather in HS-MMC.
24
www.armdesigner.com
25
www.armdesigner.com
2 Select the following options: Support for Host-side USB, USB device filesystem and OHCI HCD support.
26
www.armdesigner.com
4After that, select the following options: USB Human Interface Device (full HID) support and /dev/hiddev raw HID device support.
27
www.armdesigner.com
5) Exit to Device Drivers, and then select SCIS device support
6select the following options:SCSI device support, legacy /proc/scsi/ support and SCSI disk support.
28
www.armdesigner.com
29
www.armdesigner.com
30
www.armdesigner.com
As we have already added the support for USB mouse/keyboard in the kernel, then insert USB mass storage device( e.g. U disk) to USB interface, it will display the enumeration and driver information on the console. The following figure shows the information when inserted a 2G U disk.
31
www.armdesigner.com
# mount -t vfat /dev/sda1 /usbdisk List the contents of the U disk, we can view it by the file browser in QT. # ls /usbdisk
32
www.armdesigner.com
2Select Touchscreen interface
33
www.armdesigner.com
4) Select Samsung S3C2410 touchscreen driver to make it support touch screen. As follows:
34
www.armdesigner.com
35
www.armdesigner.com
36
www.armdesigner.com
# echo nameserver 218.108.248.248 >>/etc/resolv.conf The command above Add DNS service in the development board.
A.2 ping
The ping command helps determine if the network is able to communicate with another network. Input the command: ping c 3 192.168.0.1 The command will send test packages three times continuous to verify if the network can communicate normal. It will display the information If connected.
Configure DNS, user can PING the address of the network domain directly. As shown:
37
www.armdesigner.com
If EM2416 is connected to LAN and one computer provides the telnet service, you can login this computer by telnet in EM2416. But first of all, you must have the user name and password. Supposing the IP of the computer with telnet service is 192.168.0.7, user can login the computer by the command: telnet 192.168.0.7 Input the user name and password to connect to the remote computer.
Login BBS by telent If EM2416 can connect to the Internet, user can login BBS by the development board. Configure the gateway with the command route. route add default gw 192.168.0.1
38
www.armdesigner.com
Appendix B: Development in QT
boardcon provides the QTOPIA resource in the
CD-ROM/LINUX/ROOT/qtopia-free-src-2.2.0 .tar.bz2. 1. Set environment variables: we have installed g++ in the chapter 3. 2. Install X11 library files and development kit Execute the command to install X11 development kit: $ sudo apt-get install x-dev libx11-dev x11proto-xext-dev libxext-dev
libqt3-mt-dev
39
www.armdesigner.com
$ sudo mkdir -p /usr/X11R6/include Copy the X11directory $ sudo cp -rf /usr/include/X11 /usr/X11R6/include
3. Compile and install the library that Qtopia depends on 1) Compile and install the library jpeg The source code is /TOOLS/linux/jpegsrc.v6b.tar.gz, unzip it and it generates a jpeg-6b directory. Configure it by the command: $ ./configure --enable-shared --enable-static \ --prefix=/usr/local/arm/4.2.2-eabi/usr/arm-linux \ --build=i386 --host=arm
Modify the generated Makefile, as follows: CC= gcc AR= ar rc AR2= ranlib toCC= arm-linux-gcc toAR= arm-linux-ar rc to AR2= arm-linux-ranlib
Execute the command for compilation and installation: $ make $ sudo make install-lib
It will generate some head file in /usr/local/arm/4.2.2-eabi/usr/arm-linux/include directory, also some jpeg library file in lib directory. 2) Compile and install uuid library The source code is e2fsprogs-1.40.2.tar.gz in /TOOLS/linux. Unzip and compile it refer to the INSTALL file. For the cross compilation, please specify the cross compiler tool
40
www.armdesigner.com
chain and the target board when execute "./configure ". Execute the following command: $ tar xzf e2fsprogs-1.40.2.tar.gz $ cd e2fsprogs-1.40.2/ $ mkdir build; cd build $ ../configure --with-cc=arm-linux-gcc --with-linker=arm-linux-ld --enable-elf-shlibs --host=arm -prefix=/usr/local/arm/4.2.2-eabi/usr/arm-linux $ make $ sudo make install-libs The last command install some head file and libraries in include and lib directory , such as uuid/uuid.hlibuuid.alibuuid.so and so on. 3) Compile and install zlib library Its source code is zlib-1.2.3.tar.gz in /TOOLS/linux. Unzip and configure it: ./configure --shared --prefix=/usr/local/arm/4.2.2-eabi/usr/arm-linux Then modify the generated Makefile. Below are the results added the prefix arm-linux- CC=arm-linux-gcc LDSHARED=arm-linux-gcc -shared -Wl,-soname,libz.so.1 CPP=arm-linux-gcc -E AR=arm-linux-ar rc RANLIB=arm-linux-ranlib Finally compile and install the library. $ make $ sudo make install
41
www.armdesigner.com
4) Compile and install png library Its source code is libpng-1.2.23.tar.bz2 in /TOOLS/linux/. Unzip it and copy makefile in its directory. As follows: $ cp scripts/makefile.linux ./Makefile Then modify the generated Makefile. Below are the results added the prefix arm-linux- AR_RC=arm-linux-ar rc CC=arm-linux-gcc RANLIB=arm-linux-ranlib prefix=/usr/local/arm/4.2.2-eabi/usr/arm-linux
Finally compile and install the library. $ make $ sudo make install 5) Compile and install touch screen ts library. The source code is tslib-1.3.tar.bz2 in /TOOLS/linux. Unzip it and enter its directory,
execute the following command: $ ./autogen.sh $ echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache $ ./configure --host=arm-linux --cache-file=arm-linux.cache --enable-inputapi=no --prefix=/usr/local/arm/4.2.2-eabi/usr/arm-linux Modify the following code before Make: char *defaulttseventtype="UCB1x00"; to char *defaulttseventtype="H3600";
42
www.armdesigner.com
In order to avoid the error libtool:link: only absolute run-paths are allowed, add the absolute path for rpath in plugins/Makefile, as follows: #LDFLAGS :=$(LDFLAGS) -rpath $(PLUGIN_DIR) LDFLAGS :=$(LDFLAGS) -rpath `cd $(PLUGIN_DIR) && pwd` Finally compile and install the library. $ make $ sudo make install 4. Modify and compile QT with patch $cd /EM2416 $tar xjvf /media/cdrom/LINUX/ROOT/qtopia-free-src-2.2.0.tar.bz2 $ cd qtopia-free-2.2.0 Input the command $ patch p1 < qtopia-EM2416.patch $ echo'yes'|./configure -depths 16,24 -thread -lts' -qte '-embedded -xplatform linux-arm-g++ -qconfig -tslib gif qpe please
-no-qvfb -qpe
-system-jpeg
linux-arm-g++ '-no-xft'
-displaysize
320x240 '
-qt2
' -no-xft'
43
www.armdesigner.com
Execute "make" for compilation, it will generate the executable file and the library file in the following directories. Qtopia/bin Qtopia/lib Qtopia/plugins Execute "make install " for installation. The command wil copy all the necessary
directories and files to the qtopia/image/opt/Qtopia directory. $ make $ make install 5. Install and start QT in the development board The root file system of the board is stored in CD-ROM/LINUX/ROOT/root_qtopia.tar.bz2. And the QT source code is in /LINUX/ROOT/qtopia-free-src-2.2.0.tar.bz2. Unzip them and input the command: $ cd /EM2416 $ tar xjvf /media/cdrom/LINUX/ROOT/root_qtopia.tar.bz2 $ sudo chown book:book root_qtopia -R
44
www.armdesigner.com
root_qtopia is the file system, which can be changed to yaffs format and burned into the development board. If user download the compiled QT system into the root_qtopia, please do the following step to support the new Qtopia in root_qtopia directory: 1 copy the recompiled qtopia/image/opt/ to the root directory. $ cd /EM2416/qtopia-free-2.2.0 $ cp rf qtopia/image/opt /EM2416/root_qtopia 2 modify the file property of the root_qtopia $ cd /EM2416/root_qtopia $ chmod $ cd dev +x etc/init.d/rcS
$ sudo mknod console c 5 1 $ sudo mknod null c 1 3 After generates the new root file system, please update the file system referring to the chapter 8.
45