In Linux embedded systems, we can write GPRS scripts. The content involves PPP. In this article, we will explain how to perform ppp dialing on the Liod platform to implement GPRS internet access. First, let's take a look at the hardware platform: yidao Liod platform is based on PXA270 ). Operating System: Embedded Linux.
Step 1: If the kernel does not support ppp dialing, recompile the kernel and add support for ppp.
- <*> PPP (point-to-point protocol) support
- [*] PPP multilink support (EXPERIMENTAL)
- <*> PPP support for async serial ports
- <*> PPP support for sync tty ports
- <*> PPP Deflate compression
- <*> PPP BSD-Compress compression
Then re-burn the new kernel image!
Step 2: DownloadPpp-2.4.1 source code package: generate the pppd and chat programs required for dialing.
Source code download URL: ftp://ftp.samba.org/pub/ppp/ decompress the source code package, enter the directory, cross compilation, the cross compiler used here is arm-linux-gcc (version 3.3.2)
- #cd /root/gprs/ppp-2.4.1
- #./configure
- #make CC=arm-linux-gcc
The dialing program is/root/gprs/ppp-2.4.1/pppd, And/root/gprs/ppp-2.4.1/chat program for debugging convenience, I create a new directory named pppdial on the CF card and copy the pppd and chat programs to this directory!
Step 3: configure the dialing script:
Copy the ppp-on, ppp-on-dialer, ppp-off scripts under/root/gprs/ppp-2.4.1/scripts/to/mnt/cf/pppdial, then modify the script:
1. The content of the ppp-on script to be modified is as follows:
- TELEPHONE=*99***1# # The telephone number for the connection
- ACCOUNT= # The account name for logon (as in 'George
- Burns')
- PASSWORD= # The password for this account (and 'Gracie A
- llen')
- LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0
-
- REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0
-
- NETMASK=255.255.255.0 # The proper netmask if needed
-
- # Export them so that they will be available at 'ppp-on-dialer' time.
- export TELEPHONE ACCOUNT
- DIALER_SCRIPT=/mnt/cf/pppdial/ppp-on-dialer
-
- # Initiate the connection
-
- exec /mnt/cf/pppdial/pppd debug lock nocrtscts /dev/ttyS1 19200 \
- asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IP:$REMOTE_IP \
- noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT usepeerdns
2. Modify the ppp-on-dialer script:
- #!/bin/sh
- #
- # This is part 2 of the ppp-on script. It will perform the connection
- # protocol for the desired connection.
- #
- exec /sbin/chat -v \
- TIMEOUT 5 \
- ABORT '\nBUSY\r' \
- ABORT '\nNO ANSWER\r' \
- ABORT '\nRINGING\r\n\r\nRINGING\r' \
- '' AT+CGDCONT=1,IP,CMNET \
- 'OK' AT \
- 'OK-+++\c-OK' ATH0 \
- TIMEOUT 30 \
- OK ATDT$TELEPHONE \
- CONNECT
3. Add the/etc/ppp/resolv. conf file to the Liod board.
- nameserver 211.136.20.203
- nameserver 211.136.18.171
Step 4: connect to gprs
The gprs module connects to the Bluetooth serial port (/dev/ttyS1) on the Board through the serial port, because the ffuart of the Liod board is used for debugging the serial port, even if you log on to the Liod through telnet, however, if the serial port 0 is used to connect to the GPRS module, dialing will fail. this is because debugging information is output from serial port 0, which may interfere with the dialing process.
Disable the default network device: ifconfig eth0 down
Pppd Dialing:./ppp-on
(Note: Disable eth0 before dialing. Otherwise, even if the IP address can be obtained through dialing, the Internet cannot be accessed due to a route error)