README.gettingstarted
EMAC.Inc
June 16 2005
NZG

This document contains a short introduction to the EMAC uClinux distro and some useful information
for getting started with uClinux.

1. What is uClinux:
uClinux is an embedded mmuless Linux distribution. It is typically much smaller than a standard Linux distribution, and doesn't support fork calls(but does support vfork). uClinux uses the standard uClibc library by default. Programming for uClinux is done almost exactly like programming for Linux,programmers just must be aware of size and memory constraints, and cannot use fork.

2. What is EMAC uClinux:
EMAC uClinux is standard uClinux with a couple enhancements which are detailed in the patches directory. Released distro's are pre-configured and tested versions, pre-build compressed binaries of the versions are stored in the u-boot-pkg directory. EMAC tries to provide the most common and requested features in it's distribution, if you have something that you feel needs be there, please send in a support request and we'll try to get a version out there.

3. Logging in
The default password for the SoM-5282EM is
emac_inc
This can be changed with the password command, but will revert back to default if the non-volatile RAM is corrupted(such as by removing the board from the socket) unless the OS is reflashed with the modified /etc/passwd file replacing the default one.


4. Non-Volatile settings:
The SoM-5282EM distro's make use of the cfnram driver, which mounts the internal RAM of the 5282 processor as a filesystem. This filesystem is then formatted and used to hold the /etc/ directory.
The internal RAM of the processor has special pins for backing it up while the rest of the processor is off. The SoM-5282EM connect to these backup pins through the VSTBY pin. If the carrier provides battery backed power (as the SoM-100ES does) then this area will survive power cycles, and will even survive reflashing the OS, providing power is never removed from the module(the module is kept in socket).


5. Using the clock:
The SoM-5282EM has a hardware clock, which can be controlled just like a standard linux RTC with the hwclock and date commands. It does not have alarm capability.
The hwclock maintains the time while powered down via it's battery backup voltage, which comes through the card fingers. Therefore removing the card from the socket will unset the clock.

examples:
 
setting the hardware clock:
hwclock --set --date 060114322005
(set the clock to june 1st 2:32PM 2005)

updating the date command with the hwclock:
hwclock --hctosys

updating the hwclock with the date setting:
hwclock --systohc

6. Using the MMC
For EMAC distro's >= R3, the SoM-100ES's MMC is supported.
By default this is mounted read only by /etc/rc2. This can be changed my modifying rc2, or manually remounting the MMC. Note that if the MMC is mounted read/write, it will need to be unmounted before rebooting/removal or the it's filesystem could be corrupted.

examples:

umounting the MMC:
umount /mmc

partitioning the mmc

fdisk /dev/mmc

mounting partition 1 of the MMC read only(with an ext2 filesystem on it):

mount -r -t ext2 /dev/mmc1 /mmc

mounting it read/write:

mount -t ext2 /dev/mmc1 /mmc

reformatting the MMC partition with an ext2 filesystem

mke2fs /dev/mmc1


Using the General purpose IO
The general purpose IO module can be controlled via the egp program.
type egp with no arguements to get a discription of it's syntex.


Using the LCD
By default the lcd driver is loaded expecting a 2 row LCD. This can easily be modified
to by reloading the lcd driver with different parameters.
i.e.
rmmod lcd447
insmod lcd447 disp_rows=4

The current data in the LCD buffer is mirrored by the driver and can be seen by reading
the proc/lcd file

Writing to the LCD is done using standard POSIX read/write commands.
i.e
echo "hello world">/dev/lcd
will print hello world on the LCD with carriage return and linefeed(provided by echo)
The LCD driver uses the same API as the sourceforge lcd-mod function and should be compatible with most programs designed for it.


Rebuilding the OS:
Full source to the OS and all drivers and patches is provided via ftp, CVS, and on CD's shipped with the hardware. The order of updates is typically - CVS->ftp->CD.
All the OS's are pre-built at EMAC using the stable tools package m68k-elf-tools-20031003.sh, which is provided in the ftp's Tools section.


Other OS's
The SoM-5282EM can use a standard uClinux distribution, or any other OS compatible with the MCF5282EVB, the only real stumbling block will be the swapping of serial ports 1&3, which is patched in the EMAC uClinux distribution.