Mini how tos:
By default the Acme boards get the IP address from the DHCP server on your LAN this article explains how to set a static IP address
Insert the Acme board bootable microSD card in a Linux PC. If you are using Ubuntu Linux it will mount the microSD file system on /media directory.
Edit the file /media/etc/network/interfaces placing # chars on these lines:
#allow-hotplug eth0
#iface eth0 inet dhcp
Uncomment the iface eth0 inet static line and tailor the details for your local setup, for example:
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.90
netmask 255.255.255.0
gateway 192.168.1.1
Be sure to use the right path to the microSD /media/etc/network/interfaces and not
/etc/network/interfaces to avoid tho change the IP address of your PC instead
of Acme board.
If you don't have a Linux PC get access to the same file using Winscp. Change it and restart your Acme board.
If you need to get the IP address manually from the DHCP server on your LAN simply shut down the eth0 interface:
debarm:~# ifdown eth0
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:04:25:a8:9d:5e
Sending on LPF/eth0/00:04:25:a8:9d:5e
Sending on Socket/fallback
DHCPRELEASE on eth0 to 10.55.98.1 port 67
eth0: link down
and bring it back up by typing:
debarm:~# ifup eth0
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
ADDRCONF(NETDEV_UP): eth0: link is not ready
Listening on LPF/eth0/00:04:25:a8:9d:5e
Sending on LPF/eth0/00:04:25:a8:9d:5e
Sending on Socket/fallback
eth0: link up (100/Full)
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPOFFER from 10.55.98.1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 10.55.98.1
bound to 10.55.98.19 -- renewal in 33627 seconds.
debarm:~#
it comes up and grabs its IP (in this case 10.55.98.19 )
This articles explains how to set system date using theLinux command date and hwclock
Your Acme board has two clocks:
- One called System Clock that is a software clock maintained by the Linux Operating System
- Another called Real Time Clock (RTC) and implemented in hardware inside the Atmel CPU. This clock is backed by a Lithium battery when the power supply is off to mantain the clock until next the power-up
Setting the System Clock
date is the Linux command to manage the systems clock.
To read the currently System Clock type:
debarm:~# date
Fri Oct 8 17:44:42 CEST 2010
To set it type:
debarm:~# date -s "8 OCT 2010 18:45:00"
Fri Oct 8 18:45:00 CEST 2010
This time is valid while the board is on. When you turn it off, the system clock is lost.
Setting the Real Time Clock
To read the Hardware CLock type:
debarm:~# hwclock -r
Fri Oct 8 17:46:43 2010 -0.004115 seconds
This time is read at startup from the Linux Kernel and mantained with the on-board RTC Lithium battery.
To set the Hardware Clock with the System Clock value type:
debarm:~# hwclock -w
Now check it typing:
debarm:~# date
Fri Oct 8 18:49:02 CEST 2010
debarm:~# hwclock -r
Fri Oct 8 18:49:10 2010 -0.004076 seconds
debarm:~#
When you access to the Acme board command line you get a prompt like this:
debarm:~#
If more Acme boards or other Linux systems are reacheable on your LAN it could be important to select different names then
debarm each system to avoid giving commands to the wrong system.
Change the hostname on a running system
The hostname is saved in /etc/hostname.
Change it for example with myboard by typing:
debarm:~# echo "myboard" > /etc/hostname
debarm:~# /etc/init.d/hostname.sh start
Then logout typing:
debarm:~# logout
Login again and your prompt will be:
myboard:~#
This article explains how to automount a USB stick when inserted and unmount it automatically when unplugged
Install the required packages
The automounter facility is managed by autofs. ”Autofs controls the operation of the automount daemons. The automount daemons automatically mount filesystems when they are used and unmount them after a period of inactivity. This is done based on a set of pre-configured maps”.
To install autofs type:
debarm:~# apt-get update
...
debarm:~# apt-get install autofs
...
Configure autofs
Insert an USB stick and check on which device it appears by typing:
debarm:/# dmesg
...
usb 1-2: new full speed USB device using at91_ohci and address 2
scsi0 : usb-storage 1-2:1.0
scsi 0:0:0:0: Direct-Access UDISK PDU01-8G 8AH2.0 0.00 PQ: 0 ANSI: 2
sd 0:0:0:0: [sda] 15794176 512-byte logical blocks: (8.08 GB/7.53 GiB)
...
sd 8:0:0:0: [sda] Assuming drive cache: write through
sda:
...
In this case the device is /dev/sda. If your USB stick has more than one partition you will see sda1, sda2, etc. for each partition.
Edit the file /etc/auto.master adding this line:
/var/autofs/removable /etc/auto.removable --timeout=2
Where:
- /var/autofs/removable is the directory where your USB stick will be mounted
- /etc/auto.removable is another file that we have to create
- --timeout=2 tells that the device will be umounted after 2 seconds of idling
Now create the file /etc/auto.removable with this contents:
usbstick -fstype=vfat,rw,umask=002 :/dev/sda
Then restart autofs typing:
debarm:/# /etc/init.d/autofs restart
Now move to the /var/autofs/removable directory:
debarm:/# cd /var/autofs/removable
debarm:/var/autofs/removable# ls
debarm:/var/autofs/removable# ls usbstick
[ .. list on my files on the usbstick ]
As you can see the usbstick directory will appear when requested and disappear after 2 seconds.
Related links
Change the Ethernet setting on the fly
To change the Ethernet parms on the fly type this command:
debarm:~# mii-tool [-F mode] eth0
...
Where mode can be:
- 100baseTx-HD
- 100baseTx-FD
- 10baseT-HD
- 10baseT-FD
The setting will be valid until the next system reboot.
Mii-tool Man page
Change the Ethernet setting at the end
Edit the /etc/network/interfaces file and the bold line if you are using
the dchp:
auto eth0
iface eth0 inet dhcp
up mii-tool -F 10baseT-HD eth0
or this line if you are using a static IP configuration:
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
up mii-tool -F 10baseT-HD eth0
the reboot or type:
debarm:~# ifdown eth0
...
debarm:~# ifup eth0
...