background image

UC-7400-LX Plus User’s Manual 

Managing Embedded Linux 

 

3-4

The following instructions give the steps required to save the firmware file to the UC-7400-LX 
Plus RAM disk, and then upgrade the firmware. 

1.

 

Type the following commands to enable the RAM disk: 

#upramdisk 

#cd /mnt/ramdisk 

2.

 

Type the following commands to use the UC-7400-LX Plus’s built-in FTP client to transfer 
the firmware file (

FWR_UC7400P_Va b_Build_YY MM DD HH

) from the PC to the 

UC-7400-LX Plus: 

/mnt/ramdisk> ftp <destination PC’s IP> 

Login Name: xxxx 

Login Password: xxxx 

ftp> bin 

ftp> get FWR UC7400P V1.3 Build 07052922 

  192.168.3.127  -  PuTTY 

 

root@Moxa:/mnt/ramdisk# ftp 192.168.3.193 
Connected to 192.168.3.193 (192.168.3.193). 
220 TYPSoft FTP Server 1.10 ready… 
Name (192.168.3.193:root): root 
331 Password required for root. 
Password: 
230 User root logged in. 
Remote system type is UNIX. 
Using binary mode to transfer files. 
ftp> cd newsw 
250 CWD command successful. “/C:/ftproot/newsw/” is current directory. 
ftp> bin 
200 Type set to I. 
ftp> ls 
200 Port command successful. 
150 Opening data connection for directory list. 
drw-rw-rw-    1  ftp  ftp     0  Nov  30  10:03  . 
drw-rw-rw-    1  ftp  ftp     0  Nov  30  10:03  . 
-rw-rw-rw-    1  ftp  ftp  12904012  Nov  29  10:24  FWR_UC7400P_V1.3_Build_07052922
Transfer complete. 
ftp> get FWR_UC7400P_V1.3_Build_07052922 
local: FWR_UC7400P_V1.3_Build_070529 remote: FWR_UC7400P_V1.3_Build_07052922 
200 Port command successful. 
150 Opening data connection for FWR_UC7400P_V1.3_Build_07052922 
226 Transfer complete. 
12904012 bytes received in 2.17 secs (5925.8 kB/s) 
ftp>   

 

 

 

 

 

 

 

 

Summary of Contents for UC-7400-LX Plus

Page 1: ...UC 7400 LX Plus User s Manual Sixth Edition December 2010 www moxa com product 2010 Moxa Inc All rights reserved Reproduction without permission is prohibited ...

Page 2: ...es the right to make improvements and or changes to this manual or to the products and or the programs described in this manual at any time Information provided in this manual is intended to be accurate and reliable However Moxa assumes no responsibility for its use or for any infringements on the rights of third parties that may result from its use This product might include unintentional technic...

Page 3: ...ain Linux 2 16 Checking the Flash Memory Space 2 17 Compiling Hello c 2 17 Uploading and Running the Hello Program 2 18 Developing Your First Application 2 18 Testing Environment 2 18 Compiling tcps2 c 2 19 Uploading and Running the tcps2 release Program 2 20 Testing Procedure Summary 2 22 Chapter 3 Managing Embedded Linux 3 1 System Version Information 3 2 System Image Backup 3 2 Upgrading the Fi...

Page 4: ...e 5 1 Before Programming Your Embedded System 5 2 Caution When Using File Systems 5 2 Using RAM File System Instead of Flash File System 5 2 Flash Memory Map 5 2 Linux Tool Chain Introduction 5 3 Debugging with GDB 5 4 Device API 5 5 RTC Real time Clock 5 5 Buzzer 5 5 WDT Watch dog Timer 5 6 UART 5 9 LCM 5 11 KeyPad 5 11 Make File Example 5 12 Chapter 6 Software Lock 6 1 Appendix A System Commands...

Page 5: ...ns All models come with 8 RS 232 422 485 serial ports dual 10 100 Mbps Ethernet ports a PCMCIA interface for wireless LAN communication and CompactFlash and USB ports for mass storage for disk expansion The following topics are covered in this chapter Overview Software Architecture Journaling Flash File System JFFS2 Software Package ...

Page 6: ...erating system provides an open software operating system for your software program development Software written for desktop PCs can be easily ported to the UC 7400 LX Plus platform with a GNU cross compiler without needing to modify the source code All of the necessary device drivers such as a PCMCIA wireless LAN module and keypad LCM and buzzer control are also included with the UC 7400 LX Plus ...

Page 7: ...en puts a file system directly on the flash instead of emulating a block device It is designed for use on flash ROM chips and recognizes the special write requirements of a flash ROM chip JFFS2 implements wear leveling to extend the life of the flash disk and stores the flash directory structure in the RAM A log structured file system is maintained at all times The system is always consistent even...

Page 8: ...nylogin login and user manager utility telnet telnet client program ftp FTP client program smtpclient email utility scp Secure file transfer Client Program Daemons pppd dial in out over serial port daemon snmpd snmpd agent daemon telnetd telnet server daemon inetd TCP server manager program ftpd ftp server daemon apache web server daemon sshd secure shell server nfs user server network file system...

Page 9: ...e Ethernet Interface Modifying Network Settings with the Serial Console Modifying Network Settings over the Network Using IPv6 Command Utilities Configuring the WLAN through the PCMCIA Interface Connecting to 3G Networks through the PCMCIA Interface Test Program Developing Hello c Installing the Tool Chain Linux Checking the Flash Memory Space Compiling Hello c Uploading and Running the Hello Prog...

Page 10: ...ecting the UC 7400 LX Plus to a PC There are two ways to connect the UC 7400 LX Plus to a PC 1 Through the serial console port and 2 via Telnet over the network Serial Console The serial console port gives users a convenient way of connecting to the UC 7400 LX Plus console utility This method is particularly useful when using the computer for the first time The signal is transmitted over a direct ...

Page 11: ...8 4 126 and netmask to 255 255 255 0 To connect to your local LAN with a hub or switch use a straight through Ethernet cable The default IP addresses and netmasks are shown above To log in type the Login name and password as requested The default values are both root Login root Password root You can proceed with configuring network settings of the target computer when you reach the bash command sh...

Page 12: ...ample of the configuration that is required Linux Users From a Linux machine use the ssh command to access the UC 7400 LX Plus Console utility through an SSH connection ssh 192 168 3 127 Select yes to complete the connection root bee_notebook root ssh 192 168 3 127 The authenticity of host 192 168 3 127 192 168 3 127 can t be established RSA key fingerprint is 8b ee ff 84 41 25 fc cd 2a f2 92 8f c...

Page 13: ... below 2 network addresses need to be modified address network netmask and broadcast The default IP addresses are 192 168 3 127 for LAN1 and 192 168 4 127 for LAN2 with default netmask of 255 255 255 0 We always want the loopback interface auto eth0 eth1 lo iface lo inet loopback embedded ethernet LAN1 iface eth0 inet static address 192 168 3 127 network 192 168 3 0 netmask 255 255 255 0 broadcast...

Page 14: ... need to reboot the UC 7400 LX Plus Modifying Network Settings over the Network IP settings can be activated over the network but the new settings will not be saved to the flash ROM without modifying the file etc network interfaces For example type the command ifconfig eth0 192 168 1 1 to change the IP address of LAN1 to 192 168 1 1 root Moxa ifconfig eth0 192 168 1 1 root Moxa etc network Using I...

Page 15: ...Live 0xbf0b4000 ixp400 709672 1 ixp400_eth Live 0xbf005000 moxa_da66x_misc 14456 0 Live 0xbf000000 root Moxa Setting up an IPv6 address Use ifconfig to configure the network interface Type ifconfig h to see how to use this command root Moxa ifconfig h BusyBox v1 14 1 2009 10 29 18 42 35 CST multi call binary Usage ifconfig a interface address Configure a network interface Options add ADDRESS PREFI...

Page 16: ... s SIZE Send SIZE data bytes in packets default 56 I iface IP Use interface or IP address as source q Quiet only displays output at start and when finished Assuming there is a device with IPv6 address fe80 217 9aff febb 489c on the network issue the following command to get a response from the device ping6 fe80 217 9aff febb 489c Configuring the WLAN through the PCMCIA Interface The following IEEE...

Page 17: ... address 192 168 4 127 network 192 168 4 0 netmask 255 255 255 0 broadcast 192 168 4 255 embedded ethernet LAN3 iface eth2 inet static address 192 168 5 127 network 192 168 5 0 netmask 255 255 255 0 broadcast 192 168 5 255 3 Additional WLAN parameters are contained in the file RT2500STA dat To open the file navigate to the RT2500STA folder and invoke vi or type the command vi etc Wireless RT2500ST...

Page 18: ... sets the wireless mode Setting Explanation 0 11b g mixed 1 11b only 2 11g only SSID sets the softAP SSID Setting Any 32 byte string NetworkType sets the wireless operation mode Setting Explanation Infra Infrastructure mode uses access points to transmit data Adhoc Adhoc mode transmits data from host to host Channel sets the channel Setting Explanation 0 auto 1 to 14 the channel you want to use Au...

Page 19: ...hex numbers TxBurst WPA pre shared key Setting 8 to 64 ASCII characters WPAPSK enables or disables TxBurst Setting 8 to 63 ASCII or 64 HEX characters TurboRate enables or disables TurboRate Setting Explanation 0 disable 1 enable BGProtection sets 11b 11g protection this function is for engineering testing only Setting Explanation 0 auto 1 always on 2 always off ShortSlot enables or disables the sh...

Page 20: ...tting 1 to 2347 FragThreshold sets the fragment threshold Setting 256 to 2346 Example 1 Configure wireless LAN to link to AP that is OPEN NONE Authentication Encryption Default CountryRegion 0 WirelessMode 0 SSID DN_3Com NetworkType Infra Channel 0 AuthMode OPEN EncrypType NONE DefaultKeyID 1 Key1Str 0123456789 Key2Str Key3Str Key4Str WPAPSK 1111111111 TXBurst 0 TurboRate 0 BGProtection 0 ShortSlo...

Page 21: ...r WPAPSK 1111111111 TXBurst 0 TurboRate 0 BGProtection 0 ShortSlot 0 TxRate 0 RTSThreshold 2312 FragThreshold 2312 PSMode CAM Example 3 Configure wireless LAN to link to AP that is WPAPSK TKIP Authentication Encryption Default CountryRegion 0 WirelessMode 0 SSID DN_3Com NetworkType Infra Channel 0 AuthMode WPAPSK EncrypType TKIP DefaultKeyID 1 Key1Str 0123456789 Key2Str Key3Str Key4Str WPAPSK 1111...

Page 22: ...GE datacard Swisscom Unlimited 5 in 1 are controlled through dev noz0 By configuring the pppd dial out script the UC 7400 LX Plus can connect to the 3G network Plug the 3G Card into the Cardbus Slot The UC 7400 LX Plus supports plug and play feature for the supported 3G datacards When the 3G datacard is inserted the UC 7400 LX Plus will detect the card automatically You may use the command dmesg t...

Page 23: ...onfig to check the ppp0 interface 192 168 3 127 PuTTY root Moxa ifconfig ppp0 ppp0 Link encap Point to Point Protocol inet addr 221 120 39 32 P t P 10 64 64 64 Mask 255 255 255 255 UP POINTPOINT RUNNING NOARP MULTICAST MTU 1500 Metric 1 RX packets 13 errors 0 dropped 0 overruns 0 frame 0 TX packets 14 errors 0 dropped 0 overruns 0 carrier 0 Collisions 0 txqueuelen 3 RX bytes 382 382 0 B TX bytes 3...

Page 24: ...onal UC 7400 LX Plus units if needed x x86 Cross Compiler Installing the Tool Chain Linux The PC must have the Linux Operating System pre installed before installing the UC 7400 LX Plus GNU Tool Chain Fedora core and compatible versions are recommended The Tool Chain requires about 100 MB of hard disk space on your PC The UC 7400 LX Plus Tool Chain software is located on the UC 7400 LX Plus CD To ...

Page 25: ...grams Here we use Hello c as an example to show you how to compile and run your applications Type the following commands from your PC to copy the files used for this example from the CD to your computer s hard drive cd tmp mkdir example cp r mnt cdrom example tmp example To compile the program go to the Hello subdirectory and issue the following commands cd example hello make You should receive th...

Page 26: ...uild an application The procedure outlined in the following subsections will show you how to build a TCP server program with serial port communication that runs on the UC 7400 LX Plus Testing Environment The tcps2 example demonstrates a simple application program that delivers transparent bi directional data transmission between the UC 7400 LX Plus serial and Ethernet ports As illustrated in the f...

Page 27: ... xscale_be gcc o tcps2 release tcps2 c xscale_be strip s tcps2 release xscale_be gcc o tcpsp release tcpsp c xscale_be strip s tcpsp release xscale_be gcc ggdb o tcps2 debug tcps2 c xscale_be gcc ggdb o tcpsp debug tcpsp c You have new mail in var spool mail root root server11 1st_application 1s root server11 1st_application 11 total 92 rw r r 1 root root 514 Nov 27 11 52 Makefile rwxr xr x 1 root...

Page 28: ...sfer files ftp bin 200 Type set to I ftp put tcps2 release local tcps2 release remote tcps2 release 277 Entering Passive Mode 192 168 3 127 82 253 150 Opening BINARY mode data connection for tcps2 release 226 Transfer complete 4996 bytes sent in 0 00013 seconds 3 9e 04 Kbytes s ftp ls 227 Entering Passive Mode 192 168 3 127 106 196 150 Opening ASCII mode data connection for bin ls rw 1 root root 8...

Page 29: ...ing tcps2 release root Moxa ps ef PID Uid VmSize Stat Command 1 root 1296 S init 2 root S keventd 3 root S ksoftirqd_CPU0 4 root S kswapd 5 root S bdflush 6 root S kupdated 7 root S mtdblockd 8 root S khubd 10 root S jffs2_gcd_mtd3 32 root D ixp425_csr 34 root S ixp425 eth0 36 root D ixp425 eth1 38 root 1256 S stdef 46 root 1368 S usr sbin inetd 52 root 4464 S usr sbin httpd 53 nobody 4480 S usr s...

Page 30: ...t you typed on PC1 will appear on PC2 s screen The testing environment is illustrated in the following figure However note that there are limitations to the example program tcps2 c tcps2 c RS 232 LAN PC 2 PC 1 Write data to PC1 Receive LAN data Read serial data Send data to PC2 Serial Rx Buffer LAN Rx Buffer NOTE The tcps2 c application is a simple example designed to give users a basic understand...

Page 31: ...s units The following topics are covered in this chapter System Version Information System Image Backup Upgrading the Firmware Loading Factory Defaults Enabling and Disabling Daemons Starting a Program Automatically at Run Level Adjusting the System Time Setting the Time Manually Write current system time to RTC NTP Client Updating the Time Automatically Cron Daemon for Executing Scheduled Command...

Page 32: ...irmware The UC 7400 LX Plus bios kernel and user file system are combined into one firmware file which can be downloaded from Moxa s website www moxa com The name of the file has the form FWR_UC7400P_Va b_Build_YY MM DD HH with a b indicating the firmware version and YY MM DD HH indicating the build date and time To upgrade the firmware download the firmware file to a PC and then transfer the file...

Page 33: ...Available Use Mounted on dev mtdblock2 14 0M 11 2M 2 8M 80 dev ram15 1 7M 18 0k 1 6M 1 dev dev ram0 499 0k 34 0k 440 0k 7 var dev mtdblock3 15 8M 2 6M 13 1M 17 tmp dev mtdblock3 15 8M 2 6M 13 1M 17 home dev mtdblock3 15 8M 2 6M 13 1M 17 etc root Moxa upramdisk root Moxa df h Filesystem Size Used Available Use Mounted on dev mtdblock2 14 0M 11 2M 2 8M 80 dev ram15 1 7M 18 0k 1 6M 1 dev dev ram0 499...

Page 34: ...o 192 168 3 193 192 168 3 193 220 TYPSoft FTP Server 1 10 ready Name 192 168 3 193 root root 331 Password required for root Password 230 User root logged in Remote system type is UNIX Using binary mode to transfer files ftp cd newsw 250 CWD command successful C ftproot newsw is current directory ftp bin 200 Type set to I ftp ls 200 Port command successful 150 Opening data connection for directory ...

Page 35: ...to write file Completed 100 Now upgrade the file directory Format MTD device dev mtd5 MTD device dev mtd5 erase 128 Kibyte 20000 100 complete Wait to write file Completed 100 Now upgrade the new configuration file Upgrade the firmware is OK Rebooting Loading Factory Defaults To load the system s factory default settings press the reset to default button for at least 5 seconds Doing so will destroy...

Page 36: ...etc apache 682 bin 380 S bin portmap 685 root 1176 S bin sh login 690 root 464 S bin snmpd 694 nobody 3012 S usr bin httpd k start d etc apache 695 nobody 3012 S usr bin httpd k start d etc apache 696 nobody 3012 S usr bin httpd k start d etc apache 697 nobody 3012 S usr bin httpd k start d etc apache 698 nobody 3012 S usr bin httpd k start d etc apache 701 root 352 S bin reportip 714 root 1176 S ...

Page 37: ...ve a higher priority RUNFILE the file name 192 168 3 127 PuTTY root Moxa ect rc d rc3 d ls S19nfs common S25nfs user server S99showreadyled S20snmpd S55ssh S24pcmcia S99rmnologin root Moxa ect rc d rc3 d ln s root tcps2 release S60tcps2 root Moxa ect rc d rc3 d ls S19nfs common S25nfs user server S99rmnologin S20snmpd S55ssh S99showreadyled S24pcmcia S60tcps2 root Moxa etc rc d rc3 d KxxRUNFILE st...

Page 38: ... 2 root SWN ksoftirqd 0 3 root SW events 0 4 root SW khelper 13 root SW kblockd 0 14 root SW khubd 24 root SW pdflush 25 root SW pdflush 27 root SW aio 0 26 root SW kswapd0 604 root SW mtdblockd 609 root SW pccardd 611 root SW pccardd 625 root SWN jffs2_gcd_mtd3 673 root 500 S bin inetd 674 root 1264 S root tcps2 release 679 root 3004 S usr bin httpd k start d etc apache 682 bin 380 S bin portmap ...

Page 39: ...e date Use the following command to query the RTC time hwclock Use the following command to set the system time date MMDDhhmmYYYY MM Month DD Date hhmm hour and minute YYYY Year Use the following command to set the RTC time hwclock w Write current system time to RTC The following figure illustrates how to update the system time and set the RTC time 192 168 3 127 PuTTY root Moxa date Fri Jun 23 23 ...

Page 40: ...Refer to Chapter 2 for instructions on how to configure the Ethernet interface and see Chapter 4 for DNS configuration information Updating the Time Automatically In this subsection we show how to use a shell script to update the time automatically Example shell script to update the system time periodically bin sh ntpdate time nist gov You can use the time server s ip address or domain name direct...

Page 41: ...ing example demonstrates how to use Cron How to use cron to update the system time and RTC time every day at 8 00 STEP1 Write a shell script named fixtime sh and save it to home bin sh ntpdate time nist gov hwclock systohc exit 0 STEP2 Change the mode of fixtime sh chmod 755 fixtime sh STEP3 Modify the file etc cron d crontab to run fixtime sh at 8 00 every day Add the following line to the end of...

Page 42: ...n mount process will fail If that happens type umount mnt sda to un mount the USB device manually The UC 7420 LX Plus only supports certain types of flash disk USB mass storage devices The Following USB flash disks are supported San Sandisk Cruzer mini 128MB Sandisk Cruzer Crossfire 1GB Sandisk Cruzer mini 2GB Intel Flash Memory 128MB Abocom 128MB PQI 256MB Transcend JetFlash 1G Transcend JetFlash...

Page 43: ...il If that happens type umount mnt hda to un mount the CF device manually The UC 7400 LX Plus only supports certain types of CF mass storage device The following devices are supported Transcend CompactFlash 45x 2GB Transcend CompactFlash 80x 4GB SanDisk CompactFlash Ultra II 1GB PRETEC Compactflash 128M PRETEC Compactflash 256M ADATA Compactflash 120X 4G Some CF mass storage devices and hard disks...

Page 44: ...functions The following topics are covered in this chapter Telnet FTP DNS Web Service Apache IPTABLES NAT NAT Example Enabling NAT at Bootup Dial up Service PPP PPPoE NFS Network File System Setting up the UC 7400 LX Plus as an NFS Server Setting up the UC 7400 LX Plus as an NFS Client Mail SNMP OpenVPN IPv6 to IPv4 Tunneling ...

Page 45: ...eed to edit three configuration files etc hosts etc resolv conf and etc nsswitch conf etc hosts is the first file that the Linux system reads to resolve the host name and IP address etc resolv conf is the most important file that you need to edit when using DNS for the other programs For example before using ntpdate time nist goc to update the system time you will need to add the DNS server addres...

Page 46: ... Save your CGI page to the following directory home httpd www cgi bin Before you modify the homepage use a browser such as Microsoft Internet Explore or Mozilla Firefox from your PC to test if the Apache Web Server is working Type the LAN1 IP address in the browser s address box to open the homepage E g if the default IP address is still active type http host ip address in the address box To open ...

Page 47: ...ot root 268 Dec 19 2002 printenv rwxr xr x 1 root root 757 Aug 24 1999 test cgi root Moxa usr www cgi bin IPTABLES IPTABLES is an administrative tool for setting up maintaining and inspecting the Linux kernel s IP packet filter rule tables Several different tables are defined with each table containing built in chains and user defined chains Each chain is a list of rules that apply to a certain ty...

Page 48: ...net when it the computer does not have an actual IP address REDIRECT a special form of DNAT that re sends packets to a local host independent of the destination IP address C Mangle Table includes two chains PREROUTING chain pre processes packets before the routing process OUTPUT chain processes packets after the routing process It has three extensions TTL MARK TOS The following figure shows the IP...

Page 49: ...dprobe iptable_filter NOTE IPTABLES plays the role of packet filtering or NAT Take care when setting up the IPTABLES rules If the rules are not correct remote hosts that connect through a LAN or PPP may be denied access We recommend using the serial console to set up the IPTABLES Click on the following links for more information about iptables http www linuxguruz com iptables http www netfilter or...

Page 50: ...iptables P OUTPUT ACCEPT iptables P FORWARD ACCEPT iptables t nat P PREROUTING ACCEPT iptables t nat P OUTPUT ACCEPT iptables t nat P POSTROUTING ACCEPT In this example the policy accepts outgoing packets and denies incoming packets Append or delete rules Usage iptables t table AI INPUT OUTPUT FORWARD io interface p tcp udp icmp all s IP network sport ports d IP network dport ports j ACCEPT DROP A...

Page 51: ... s 192 168 0 24 dport 137 139 j ACCEPT Example 7 Log TCP packets that visit UC 7400 LX Plus s port 25 iptables A INPUT i eth0 p tcp dport 25 j LOG Example 8 Drop all packets from MAC address 01 02 03 04 05 06 iptables A INPUT i eth0 p all m mac mac source 01 02 03 04 05 06 j DROP NAT NAT Network Address Translation protocol translates IP addresses used on one network to different IP addresses used...

Page 52: ...enable NAT when the UC 7400 LX Plus boots up The following script is an example bin bash If you put this shell script in the home nat sh Remember to chmod 744 home nat sh Edit the rc local file to make this shell startup automatically vi etc rc d rc local Add a line in the end of rc local home nat sh EXIF eth0 This is an external interface for setting up a valid IP address EXNET 192 168 4 0 24 Thi...

Page 53: ...ea Network WAN NOTE Click on the following links for more information about ppp http tldp org HOWTO PPP HOWTO index html http axion physics ubc ca ppp linux html The pppd daemon is used to connect to a PPP server from a Linux system For detailed information about pppd see the man page Example 1 Connecting to a PPP server over a simple dial up connection The following command is used to connect to ...

Page 54: ...utility dev Specify the callout serial port 115200 The baudrate debug Log status in syslog crtscts Use hardware flow control between computer and modem at 115200 this is a must modem Indicates that this is a modem device pppd will hang up the phone before and after making the call defaultroute Once the PPP link is established make it the default route if you have a PPP link to the Internet this is...

Page 55: ...ss as your own and the P t P address or point to point address the address of your server Here s what it looks like on one machine lo Link encap Local Loopback inet addr 127 0 0 1 Bcast 127 255 255 255 Mask 255 0 0 0 UP LOOPBACK RUNNING MTU 2000 Metric 1 RX packets 0 errors 0 dropped 0 overrun 0 ppp0 Link encap Point to Point Protocol inet addr 192 76 32 3 P t P 129 67 1 165 Mask 255 255 255 0 UP ...

Page 56: ... ttyM0 115200 crtscts modem 192 168 16 1 192 168 16 2 login auth You should also add the following line to the file etc ppp pap secrets The first star lets everyone log in The second star lets every host connect The pair of double quotation marks is to use the file etc passwd to check the password The last star is to let any IP connect The following example does not check the username and password...

Page 57: ...corresponding password for the account 5 Edit the file etc ppp options and add the following line plugin pppoe 192 168 3 127 PuTTY Wait for up n milliseconds after the connect script finishes for a valid PPP packet from the peer At the end of this time or when a valid PPP packet is received from the peer pppd will commence negotiation by sending its first LCP packet The default value is 1000 1 sec...

Page 58: ...of files across a network NFS allows users to develop applications for the UC 7400 LX Plus without worrying about the amount of disk space that will be available The UC 7400 LX Plus supports NFS protocol for both client and server NOTE Click on the following links for more information about NFS http www tldp org HOWTO NFS HOWTO index html http nfs sourceforge net nfs howto client html http nfs sou...

Page 59: ...ient sync Sync data to memory and flash disk async The async option instructs the server to lie to the client telling the client that all data has been written to the stable storage Example 1 tmp rw no_root_squash In this example the UC 7400 LX Plus shares the tmp directory to everyone giving everyone both read and write authority The root user on the client machine will have the same level of acc...

Page 60: ...client that takes an email message body and passes it on to an SMTP server It is suitable for applications that use email to send alert messages or important logs to a specific user NOTE Click on the following link for more information about smtpclient http www engelschall com sw smtpclient To send an email message use the smtpclient utility which uses SMTP protocol Type smtpclient help to see the...

Page 61: ...1 17 system 9 1 3 1 octet string The MIB module to describe generic objects for network interface sub layers 18 system 9 1 3 2 octet string The MIB module for SNMPv2 entities 19 system 9 1 3 3 octet string The MIB module for managing TCP implementations 20 system 9 1 3 4 octet string The MIB module for managing IP and ICMP implementations 21 system 9 1 3 5 octet string The MIB module for managing ...

Page 62: ...files and key files reside Once established all operations will be performed in that directory Setup 1 Ethernet Bridging for Private Networks on Different Subnets 1 Set up four machines as shown in the following diagram OpenVPN A OpenVPN B Host A LAN1 192 168 2 171 Host B LAN1 192 168 4 172 LAN1 192 168 8 174 LAN1 192 168 2 173 local net local net t e n r e t n I t e n r e t n I LAN2 192 168 4 174...

Page 63: ... is not a great idea but this system doesn t support etc sysconfig network scripts ifcfg eth1 ifcfg_vpn while read f1 f2 f3 f4 r3 do if f1 iface a f2 iface a f3 inet a f4 static then i expr 0 while do if i gt 5 then break fi i expr i 1 read f1 f2 case f1 in address IPADDR f2 netmask NETMASK f2 broadcast BROADCAST f2 esac done break fi done etc network interfaces get the ip address of the specified...

Page 64: ...terface on tun openvpn mktun dev tap i connect tap device to the bridge brctl addif br0 tap i null ip address of tap device ifconfig tap i 0 0 0 0 promisc up i expr i 1 if i ge maxtap then break fi done null ip address of internal interface ifconfig iface 0 0 0 0 promisc up enable bridge ip ifconfig br0 IPADDR netmask NETMASK broadcast BROADCAST ipf proc sys net ipv4 ip_forward enable IP forwardin...

Page 65: ...tap0 br conf point to the peer remote 192 168 8 174 dev tap0 secret etc openvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 up etc openvpn tap0 br sh Then modify the routing table in etc openvpn tap0 br sh script file Start bin sh etc openvpn tap0 br sh value after net is the subnet behind the remote peer route add net 192 168 4 0 netmask 255 255 255 0 dev br0 ...

Page 66: ...ags Metric Ref Use Iface 192 168 4 0 255 255 255 0 U 0 0 0 br0 192 168 2 0 255 255 255 0 U 0 0 0 br0 192 168 8 0 255 255 255 0 U 0 0 0 eth0 Interface eth1 is connected to the bridging interface br0 to which device tap0 also connects whereas the virtual device tun sits on top of tap0 This ensures that all traffic from internal networks connected to interface eth1 that come to this bridge write to t...

Page 67: ... n r e t n I LAN2 192 168 4 174 LAN2 192 168 8 173 2 The configuration procedure is almost the same as for the previous example The only difference is that you will need to comment out the parameter up in etc openvpn tap0 br conf and etc openvpn tap0 br conf Setup 3 Routed IP 1 Set up four machines as shown in the following diagram OpenVPN A OpenVPN B Host A LAN1 192 168 2 171 Host B LAN1 192 168 ...

Page 68: ... OpenVPN B modify the remote address in the configuration file etc openvpn tun conf remote 192 168 8 173 dev tun secret etc openvpn secrouter key cipher DES EDE3 CBC auth MD5 tun mtu 1500 tun mtu extra 64 ping 40 ifconfig 192 168 4 174 192 168 2 173 up etc openvpn tun sh Then modify the routing table in etc openvpn tun sh script file Start bin sh value after net is the subnet behind the remote pee...

Page 69: ...kets over an IPv4 connection This section will explain how to configure your computer and enable the IPv6 to IPv4 tunneling function Step1 Connect the computer s LAN1 port to the Internet If your Linux system has a static IPv4 address the tunnel can also be statically configured in the network definitions Assume your IPv6 Internet is connected via LAN1 you can configure the IPv6 to IPv4 tunnel thr...

Page 70: ... sh 61 56 74 14 bin bash TUN_INTF tun6to4 The name of the 6to4 tunnel link WAN_LOCAL eth0 WAN_IP ifconfig WAN_LOCAL grep inet addr awk print 2 cut d f 2 WAN_IPV6_IP printf 2002 02x 02x 02x 02x 1 16 echo WAN_IP tr TUN_RELAY 192 88 99 1 6to4 relay address mname module_up oIFS IFS IFS FOUND no for LINE in lsmod do TOK echo LINE cut d f1 if TOK mname then FOUND yes break fi done IFS oIFS if FOUND no t...

Page 71: ... 2002 3d38 4a0e 1 16 Scope Global inet6 addr 61 56 74 14 128 Scope Compat UP RUNNING NOARP MTU 1472 Metric 1 RX packets 0 errors 0 dropped 0 overruns 0 frame 0 TX packets 0 errors 0 dropped 0 overruns 0 carrier 0 collisions 0 txqueuelen 0 RX bytes 0 0 0 B TX bytes 0 0 0 B root Moxa Step 5 Test the 6to4 tunnel with the ping6 command to see if the remote server can echo the PING response If receive ...

Page 72: ...ions are covered in this chapter Before Programming Your Embedded System Caution When Using File Systems Using RAM File System Instead of Flash File System Flash Memory Map Linux Tool Chain Introduction Debugging with GDB Device API RTC Real time Clock Buzzer WDT Watch dog Timer UART LCM KeyPad Make File Example ...

Page 73: ...the write operations As a result the number of write operations on each block reduces Using RAM File System Instead of Flash File System Though data in the RAM file system will be wiped out after a power off this file system has several advantages over the Flash file system They include faster read write access and having no life cycle issue For a timely important application that relays data back...

Page 74: ...xscale_be_1 1 sh Wait for a few minutes while the Tool Chain is installed automatically on your Linux PC Once the host environment has been installed add the directory usr local xscale_be bin to your path and the directory usr local xscale_be man to your manual path You can do this temporarily for the current login session by issuing the following commands export PATH usr local xscale_be bin PATH ...

Page 75: ...42 2000 hello debug This is where 2000 is the network port number on which the server waits for a connection from the client This can be any available port number on the target Following this are the name of the program to be debugged hello debug plus that program s arguments Output similar to the following will be sent to the console Process hello debug created pid 38 2 Use the following command ...

Page 76: ...read time information from RTC It will return the value on argument 3 2 Function RTC_SET_TIME int ioctl fd RTC_SET_TIME struct rtc_time time Description set RTC time Argument 3 will be passed to RTC Buzzer The device node is located at dev console The UC 7400 LX Plus supports Linux standard buzzer control with the UC 7400 LX Plus s buzzer running at a fixed frequency of 100 Hz You must use include...

Page 77: ...illiseconds to a maximum of 60 seconds 3 The user API The user application must include moxadevic h and link to moxalib a A makefile example is shown below all arm elf gcc Wl elf2flt o xxxx xxxx c lmoxalib int swtd_open void Description Open a file handle to control the watchdog This is the first step to using the watchdog in your application Input None Output The return value is the file handle I...

Page 78: ...status of the watchdog function unsigned long time the function will return the current time period Output 0 if OK An error occurs if you see a non zero value Use the function errno to retrieve the error code int swtd_ack int fd Description Acknowledge the watchdog When the user application enables the watchdog it needs to call this function periodically with time predefined by the user in the app...

Page 79: ...e not fixed your system will reboot again and again 5 User application example Example 1 include stdio h include stdlib h include string h include moxadevice h int main int argc char argv int fd fd swtd_open if fd 0 printf Open watchdog device fail n exit 1 swtd_enable fd 5000 enable it and set it 5 seconds while 1 do user application want to do swtd_ack fd swtd_close fd exit 0 The makefile is sho...

Page 80: ...unction end user application kill sonpid SIGUSR1 swtd_close swtdfd exit 1 The makefile is shown below all arm elf gcc Wl elf2flt o xxxx xxxx c lmoxalib UART The normal tty device node is located at dev ttyM0 ttyM15 and the modem tty device node is located at dev cum0 cum15 The UC 7400 LX Plus supports Linux standard termios control The Moxa UART Device API allows you to configure ttyM0 to ttyM7 as...

Page 81: ...ust call ioctl with MOXA_GET_SPECIAL_BAUD_RATE to get the actual baudrate Example for setting the baudrate include moxadevice h include termios h struct termios term int fd speed fd open dev ttyM0 O_RDWR tcgetattr fd term term c_cflag CBAUD CBAUDEX term c_cflag B4000000 tcsetattr fd TCSANOW term speed 500000 ioctl fd MOXA_SET_SPECIAL_BAUD_RATE speed Example for getting the baudrate include moxadev...

Page 82: ... to all spaces in the current row and move the cursor to the 0 column of this row int ioctl fd IOCTL_LCM_GET_XY lcm_xy_t pos Get the current cursor position The value will be returned in argument 3 int ioctl fd IOCTL_LCM_BACK_LIGH_ON NULL Turns the LCM backlight on int ioctl fd IOCTL_LCM_BACK_LIGHT_OFF NULL Turns the LCM backlight off KeyPad The device node is dev keypad The key value is defined i...

Page 83: ...e File Example The following Makefile file example codes are copied from the Hello example on the UC 7400 LX Plus CD ROM CC xscale_be gcc CPP xscale_be gcc SOURCES hello c OBJS SOURCES c o all hello hello OBJS CC o LDFLAGS LIBS clean rm f OBJS hello core gdb ...

Page 84: ...ility program setkey setkey ABigKey Note set an empty string to clear the encryption key in the target computer by setkey 2 Develop and compile your program on the development PC 3 Run the utility program binencryptor on the development PC to encrypt your program with an encryption key binencryptor yourProgram ABigKey 4 Upload the encrypted program file to the target computer by FTP or NFS and tes...

Page 85: ...ption key installed you will get the following error message Error Inconsistency detected by ld so dynamic link h 62 elf_get_dynamic_info Assertion bad dynamic tag failed 2 If you try to run an encrypted program on an embedded computer that has a different encryption key installed you will get the following error message Error Segmentation fault ...

Page 86: ...been running File Manager 1 cp copy file 2 ls list file 3 ln make symbolic link file 4 mount mount and check file system 5 rm delete file 6 chmod change file owner group user 7 chown change file owner 8 chgrp change file group 9 sync sync file system let system file buffer be saved to hardware 10 mv move file 11 pwd display now file directly 12 df list now file system space 13 mkdir make new direc...

Page 87: ...nt the number of bytes words and lines in files Network 1 ping ping to test network 2 route routing table manager 3 netstat display network status 4 ifconfig set network ip address 5 tftp trivial file transfer protocol 6 arp manipulate the system ARP cache 7 ifdown shutdown a network interface 8 ifup bring up a network interface 9 ip TCP IP interface configuration and routing utility 10 ping6 ping...

Page 88: ...tory 16 dirname strip non directory suffix from file name 17 expr evaluate expressions 18 false do nothing unsuccessfully 19 head output the first part of files 20 id print real and effective UIDs and GIDs 21 mkfifo make FIFOs named pipes 22 nice run a program with modified scheduling priority 23 nohup run a command immune to hangups with output to a non tty 24 reset terminal initialization 25 tru...

Reviews: