DM&P xLinux Setup Reference

Home : Products | Technical Support 2005/06/09

The default user name is "root" and password is "password". Use "root" to login in X-Linux to setup your environment.

Setup Files

Modify those files to build your own environment:

File Name Description
/boot/linux.img Linux kernel.
/boot/2.x.x.config Linux kernel configuration file.
/usr/www Our web pages are here.
/etc/init.d/rcS It will be ran first and you can add your initial programs into it. We add statement assign our IP in this file.
/etc/ppp/pap-secrets User name and password file for PPP dial-up.
/etc/fstab This file makes it possible to automate the mounting of certain file systems, especially at system start-up.
/etc/ftpaccess This file controls who gets into the FTP server and how.
/etc/inetd.conf This is the default configuration file for the inetd (super-server) daemon.
/etc/inittab This file plays a crucial role in the boot sequence.
/etc/lilo.conf This file is used by lilo to determine which operating system or kernel to start, as well as to know where to install itself.
/etc/profile It work as autoexec.bat under DOS and will be run automatically. We start inetd on /etc/profile.
/etc/securetty This file allows you to specify which TTY devices the root user is allowed to login on.
/etc/services This file contains information regarding the known services available in the DARPA Internet.

Utilities

Run those commands via keyboard or scripts. List of important commands/scripts:

Command Path Description
ppp-on /usr/sbin Start a ppp connection.
ppp-off /usr/sbin Stop a ppp connection.
httpd /sbin Start a HTTP server.
dhcpcd /sbin Get IP address from DHCP server.
ifconfig /sbin Configure a network interface.
fsck.ext2 /sbin Check and repair a Linux EXT2 file system
fdisk /sbin Partition table manipulator for Linux.
mke2fs /sbin Create a Linux second extended file system
setserial /bin Get/set Linux serial port information.

TinyLogin commands: (refer to http://tinylogin.busybox.net/TinyLogin.html)

Path Command
/bin adduser, addgroup, deluser, delgroup, login, su
/sbin sulogin
/usr/sbin passwd

Commands listed below are implemented by BusyBox: (You can go to http://www.busybox.net/downloads/BusyBox.html to get more information.)

Path Command
/bin ash, cat, chgrp, chmod, chown, cp, date, dd, df, dmesg, echo, egrep, false, fgrep, grep, gunzip, gzip, hostname, kill, ln, ls, mkdir, mknod, mktemp, more, mount, mv, pidof, ping, ps, pwd, rm, rmdir, sed, sh, sleep, sync, tar, touch, true, umount, uname, usleep, vi, zcat
/sbin halt, ifconfig, init, klogd, pivot_root, poweroff, reboot, route, swapoff, swapon, syslogd, insmod, lsmod, rmmod
/usr/bin [, basename, bunzip2, bzcat, chvt, clear, cmp, cut, deallocvt, dirname, du, env, expr, find, free, head, hexdump, id, install, killall, logger, openvt, readlink, reset, sort, strings, tail, tee, test, time, tr, tty, uniq, unzip, uptime, wc, wget, which, whoami, xargs, yes
/usr/sbin chroot

Install Your Program

This is a example form our Mity-Mite demo box Linux version. We wrote simple LCM library under Linux.

FTP server is enabled on our Linux DOC/MDM that can use FTP to upload programs. The default user name is "root" and password is "password". Install Linux (RedHat, Mandrake, SuSE...) on a powerful PC to develop applications is recommended. Write and compile programs then upload it to Mity-Mite/Tiny module via FTP to test. Kill the process if program is not correct. Repeat those steps until programs are okay. There is a example:

  1. We create a directory "/demo".

  2. Put lcd(LCD driver), dmp.bmp (DM&P logo, will loaded by lcd) and lcd_time (send time to display every 0.5 second) into "/demo".

  3. Write a script "demo" to load lcd and lcd_time.

    
    #!/bin/sh./lcd&
    sleep 5
    ./lcd_time&

  4. Remember to change mode of upload files to executable

    
    chmod +x ./lcd
    chmod +x ./lcd_time
    chmod +x ./demo

  5. Run "demo" to test. If programs are not correct,use "ps" to find process ID of program to kill it. Go to step 2 until programs are okay.

    
    # ps
      PID  Uid     Stat Command
        1 0         S    init
        2 0         S    [keventd]
        3 0         S    [ksoftirqd_CPU0]
        4 0         S    [kswapd]
        5 0         S    [bdflush]
        6 0         S    [kupdated]
       11 0         S    -sh
       14 0         S    ./ftpd
       17 0         S    /usr/httpd/wnsd -p 80
       19 0         S    ./lcd
       21 0         S    ./lcd_time
       22 0         R    ps
    # kill 21
    # kill 22

Also, you can lunch "demo" script at /etc/profile to run it automatically when program is okay.

Hint
Before uploading your programs, use "ldd" to check share library dependency. Upload share library to /lib first if need.


[root@/root/grlcd]# ldd lcd
        libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x4002c000)
        libm.so.6 => /lib/libm.so.6 (0x4006e000)
        libc.so.6 =>  /lib/libc.so.6 (0x40090000)
        /lib/ld-linux.so.2 =>  /lib/ld-linux.so.2 (0x40000000)
[root@/root/grlcd]#

Enable Disk Writable

We only set root filesystem can be read because embedded system will be power-off at any time. If any data want to be saved into disk, re-mount disk writable is needed. For example: user want to use FTP to upload file, he should use telnet to xLinux and do those steps:


# mount -o remount,rw / (mount root filesystem readable/writable)
# (use FTP to upload files...)
# sync (flush filesystem buffers)
# mount -o remount,ro / (mount root filesystem read only)

How to Use PPP Dial-Up ?

Modify configuration files with information from your ISP. We recommend to use FTP to download it, modify it, then, upload it. We assume you connect modem to COM1 (our environment: ICOP-6042 + modem on COM1).
  1. /etc/ppp/pap-secrets

    This file contain user's account, you can see first line:

    
    my_username  ppp0  my_password
    

    "my_username" is your dial-up account user name, "my_password" is password. You should change them with yours.

  2. /usr/sbin/ppp-on

    
    #!/bin/sh
    pppd nodetach lock modem crtscts /dev/ttyS0 38400 noipdefault defaultroute noauth \
    name my_username connect "chat -v '' ATDT123456789 CONNECT" &
    

    You should replace "my_username" with your user name as "/etc/ppp/pap-secrets". \ "ATDT123456789" is AT command to dial to ISP. You should replace "123456789" with your ISP's phone number.

Now, you can type "ppp-on" to dial-up to your ISP and "ppp-off" to hang-up. Type "ifconfig" to display network configuration, you can find device "eth0" and "ppp0". Any problem, mail us to help you to dial-up.

Enable PPP Server Function to Accept PPP Dial-Up

  1. /etc/inittab

    You can find those two lines on /etc/inittab:

    
    # remove '#' of next line to enable PPP server function, but ppp client function will not work
    #ttyS0::respawn:/sbin/mgetty -D -a modem ttyS0

    Remember to remount root filesystem readable/writable and remove '#' of "#ttyS0".

  2. /etc/ppp/options.ttyS0

    Use mv to restore /etc/ppp/options.ttyS0:

    
    # mv /etc/ppp/options.ttyS0.pppd /etc/ppp/options.ttyS0

    /etc/ppp/options.ttyS0 is needed for PPP server.

  3. PPP account

    Default use name and password for PPP client to dial-up are "pppuser" and "xlinux". If you want to add other user account, just duplicate line 2 of "/etc/ppp/pap-secrets" and replace "pppuser" with new user name and "xlinux" with new password:

    
    my_username  ppp0  my_password *
    pppuser      *     xlinux      *

    After doing that, login in as root and do those steps:

    
    # adduser new_user_name (add new user)
    # passwd new_user_name  (change user's password)

    Because accepting PPP dial-up will run mgetty which read account data from system to verify user, we have to add user account to accord with /etc/ppp/pap-secrets.

  4. Run "sync" command and reboot xLinux.

If you enable PPP server function, PPP client dial-up function of xLinux will not work.

Enable Serial Console

Flow those steps to add serial console into X-Linux R5:

  1. Download patch file for R5a: r5a_patch.zip (774 KB)

  2. Use ketboard or TELNET to X-Linux device and run:
    "mount -o remount,rw /" to make root file system can be read/wrote. Refer to Enable Disk Writable

  3. Extract the ZIP file and use FTP to upload those files:
    profile      -> /etc
    inittab      -> /etc
    securetty    -> /etc
    syslinux.cfg -> /boot
    linux.img    -> /boot
    

  4. Run "sync" and reboot the device.

  5. Use a cross RS-232 cable to connect to X-Linux and your PC.

  6. Run terminal program and set COM parameters:
    Baud Rate    = 9600
    Parity Bit   = No
    Data Bits    = 8
    Stop Bits    = 1
    Flow Control = OFF
    

  7. Turn on X-Linux device. You can get message from serial port and login now.
When /dev/ttyS0 is used by serial console, PPP client or server function will not work. You can enable one of them or use another serial port (ex: /dev/ttyS1) for serial console or PPP.

Run X-Linux on M6117D Series

Because more functions added into X-Linux, it need more RAM and storage. X-Linux R5 use 4 MB RAM for /var and /tmp for temporary usage. Disable them from file /etc/init.d/rcS to decrease RAM requirement that X-Linux R5 can be run on M6117D SBC with 8 MB RAM. Also, you have to set root filesystem can be read and wrote for /var and /tmp. If more memory is needed, remove unused services (web server) or download X-Linux kernel configuration file to make smaller kernel.

Use USB Mass Storage

USB function is enabled in X-Linux kernel. After enabling USB in BIOS, X-Linux can find USB mass storeage device. When USB storage is plugged, Linux will find SCSI devices:

   hub.c: new USB device 00:01.2-1, assigned address 2
   scsi0 : SCSI emulation for USB Mass Storage devices
     Vendor: Usb       Model: Flash Disk        Rev: 1.11
     Type:   Direct-Access                      ANSI SCSI revision: 02
   Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
   SCSI device sda: 129024 512-byte hdwr sectors (66 MB)
   sda: Write Protect is off
    sda: sda1 sda2 < >

Mount USB storage:


~ # mount /dev/sda1 /mnt

Now, you can read/write USB storage. Linux kernel in X-Linux only support EXT2 and FAT16/32 file system. If you other file system on USB storage, X-Linux can not recognize it. Beside, before removing your USB storage, please unmount USB device first. Also, USB keyboard can work with X-Linux.

Install Vortex86 Audio Driver

For X-Linux R5.1, the audio driver sis7019.o is at /sbin. To install Vortex86 audio driver, run those


~ # insmod /sbin/ac97_codec.o
~ # insmod /sbin/sis7019.o

You can add it into /etc/profile to automatically install.

Reference Links

Linux Kernel http://www.kernel.org/
SysLinux http://syslinux.zytor.com/
BusyBox http://www.busybox.net/
TinyLogin http://tinylogin.busybox.net/
Linux NetKit ftp://ftp.uk.linux.org/pub/linux/Networking
WU-FTPD http://www.wu-ftpd.org/
WN Server http://hopf.math.nwu.edu/
udhcp http://udhcp.busybox.net/

Technical Support

If you have problems on ICOP/DMP boards, feel free to mail to soc@dmp.com.tw please.We will do our best to answer your question.


DMP Electronics Inc. All rights reserved. Email us: info@dmp.com.tw