A new SD card image for the iMX233-OLinuXino

Download the latest Arch Linux ARM SD card image

First download the latest image for the OLinuXino from http://archlinuxarm.org/platforms/armv5/olinuxino:

[chris@thinkpad Downloads]$ wget http://archlinuxarm.org/os/ArchLinuxARM-olinuxino-latest.img.gz
[chris@thinkpad Downloads]$

Copy the image to your SD card

Now uncompress the image and add a timestamp to make it easier to distinguish different images:

[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 188339953 Jun  4 21:45 ArchLinuxARM-olinuxino-latest.img.gz
[chris@thinkpad Downloads]$ mv ArchLinuxARM-olinuxino-latest.img.gz  ArchLinuxARM-olinuxino-$(date +%Y-%m-%d -r ArchLinuxARM-olinuxino-latest.img.gz).img.gz
[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 188339953 Jun  4 21:45 ArchLinuxARM-olinuxino-2013-06-04.img.gz
[chris@thinkpad Downloads]$ gzip -d ArchLinuxARM-olinuxino-2013-06-04.img.gz
[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 2001731584 Jun  4 21:45 ArchLinuxARM-olinuxino-2013-06-04.img
[chris@thinkpad Downloads]$

The directory listing under http://os.archlinuxarm.org/os/ will also tell you the modification time of the image. Our image has now the name ArchLinuxARM-olinuxino-2013-06-04.img.

The default behaviour of gzip is to delete the .gz file after it decompresses, if you want to keep it use the -c option to uncompress the file to stdout:

[chris@thinkpad Downloads]$ gzip -dc ArchLinuxARM-olinuxino-2013-06-04.img.gz > ArchLinuxARM-olinuxino-$(date +%Y-%m-%d -r ArchLinuxARM-olinuxino-latest.img.gz).img

Write it to the SD card and see if it boots:

[chris@thinkpad Downloads]$ sudo dd if=ArchLinuxARM-olinuxino-2013-06-04.img of=/dev/mmcblk0
3909632+0 records in
3909632+0 records out
2001731584 bytes (2.0 GB) copied, 984.5 s, 2.0 MB/s
[chris@thinkpad Downloads]$

If you are seeing only the number 0x8020a01d when booting, then you have probably forgotten to uncompress the image, for other error messages search Google for IMX23 ROM Error Codes (http://sasamy.narod.ru/IMX23_ROM_Error_Codes.pdf). You can login into your new system with user: root, password: root.

[chris@thinkpad ~]$ minicom oli

Welcome to minicom 2.6.2

OPTIONS: I18n
Compiled on Feb  7 2013, 12:53:19.
Port /dev/ttyUSB0, 10:38:29

Press CTRL-A Z for help on special keys

0x8020a01d
0x8020a01d
HTLLCLC

U-Boot 2013.04 (May 25 2013 - 17:35:37)

CPU:   Freescale i.MX23 rev1.4 at 454 MHz
BOOT:  SSP SD/MMC #0
DRAM:  64 MiB
MMC:   MXS MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0
mmc0 is current device
** File not found /boot/boot.scr **
2468472 bytes read in 820 ms (2.9 MiB/s)
Booting from mmc ...
8476 bytes read in 91 ms (90.8 KiB/s)
## Booting kernel from Legacy Image at 42000000 ...
  Image Name:   Linux-3.7.2-3-ARCH
  Image Type:   ARM Linux Kernel Image (uncompressed)
  Data Size:    2468408 Bytes = 2.4 MiB
  Load Address: 40008000
  Entry Point:  40008000
  Verifying Checksum ... OK
## Flattened Device Tree blob at 41000000
  Booting using the fdt blob at 0x41000000
  Loading Kernel Image ... OK
OK
  Loading Device Tree to 43b67000, end 43b6c11b ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] of_irq_init: children remain, but no parents

Welcome to Arch Linux ARM!

        Expecting device dev-ttyAMA0.device...
[  OK  ] Reached target Remote File Systems.
[  OK  ] Listening on Syslog Socket.
[  OK  ] Listening on LVM2 metadata daemon socket.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Device-mapper event daemon FIFOs.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Listening on udev Control Socket.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Journal Socket.
        Starting Create static device nodes in /dev...
        Starting udev Coldplug all Devices...
        Mounting POSIX Message Queue File System...
        Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Reached target Encrypted Volumes.
        Starting Apply Kernel Variables...
        Starting Setup Virtual Console...
[  OK  ] Set up automount Arbitrary Executable File Formats F...utomount Point.
        Mounting Debug File System...
[  OK  ] Reached target Swap.
        Starting Remount Root and Kernel File Systems...
        Mounting Temporary Directory...
[  OK  ] Started Create static device nodes in /dev.
        Starting udev Kernel Device Manager...
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Mounted Debug File System.
[  OK  ] Mounted Temporary Directory.
[  OK  ] Started Remount Root and Kernel File Systems.
        Starting Load Random Seed...
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
        Starting Recreate Volatile Files and Directories...
        Starting Trigger Flushing of Journal to Persistent Storage...
[  OK  ] Started Load Random Seed.
[  OK  ] Started Recreate Volatile Files and Directories.
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
        Starting Update UTMP about System Reboot/Shutdown...
[  OK  ] Started Update UTMP about System Reboot/Shutdown.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Started Setup Virtual Console.
[  OK  ] Reached target System Initialization.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
        Starting SSH Key Generation...
        Starting Netcfg multi-profile daemon...
        Starting System Logger Daemon...
[  OK  ] Started System Logger Daemon.
        Starting Periodic Command Scheduler...
[  OK  ] Started Periodic Command Scheduler.
        Starting Permit User Sessions...
        Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
        Starting Login Service...
[  OK  ] Started Permit User Sessions.
        Starting Getty on tty1...
[  OK  ] Started Getty on tty1.
[  OK  ] Started Login Service.
[  OK  ] Found device /dev/ttyAMA0.
        Starting Serial Getty on ttyAMA0...
[  OK  ] Started Serial Getty on ttyAMA0.
[  OK  ] Reached target Login Prompts.

Arch Linux 3.7.2-3-ARCH (ttyAMA0)

olinuxino login: [FAILED] Failed to start Netcfg multi-profile daemon.
See 'systemctl status netcfg.service' for details.
[  OK  ] Reached target Network.
        Starting OpenNTP Daemon...
[  OK  ] Started OpenNTP Daemon.
[  OK  ] Started SSH Key Generation.
        Starting OpenSSH Daemon...
[  OK  ] Started OpenSSH Daemon.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.

Arch Linux 3.7.2-3-ARCH (ttyAMA0)

olinuxino login: root
Password:
[root@olinuxino ~]# cat /proc/version
Linux version 3.7.2-3-ARCH (nobody@panda2) (gcc version 4.7.2 (GCC) ) #1 PREEMPT Sat May 25 15:54:00 UTC 2013
[root@olinuxino ~]#

Modify the system as you like

Since CONFIG_ATH9K_HTC=m is enabled for the kernel 3.7.2 my WiFi adapter (TP-LINK TL-WN821N) should work, to see which drivers are enabled have a look at the kernel configuration for the OLinuXino:

Insert the WiFi adapter:

[root@olinuxino ~]# tail /var/log/messages.log
Dec 31 18:01:23 olinuxino systemd[1]: Startup finished in 3.378s (kernel) + 1min 13.278s (userspace) = 1min 16.656s.
Dec 31 18:06:01 olinuxino kernel: [  354.950000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
Dec 31 18:06:02 olinuxino kernel: [  355.650000] cfg80211: Calling CRDA to update world regulatory domain
Dec 31 18:06:03 olinuxino kernel: [  356.640000] usb 1-1: ath9k_htc: Firmware htc_7010.fw requested
Dec 31 18:06:03 olinuxino kernel: [  356.690000] usbcore: registered new interface driver ath9k_htc
Dec 31 18:06:03 olinuxino kernel: [  356.800000] usb 1-1: ath9k_htc: Transferred FW: htc_7010.fw, size: 72992
Dec 31 18:06:03 olinuxino kernel: [  356.880000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 45 credits
Dec 31 18:06:03 olinuxino kernel: [  357.390000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
Dec 31 18:06:04 olinuxino kernel: [  357.460000] ieee80211 phy0: Atheros AR9287 Rev:2
Dec 31 18:06:04 olinuxino systemd-sysctl[1050]: Duplicate assignment of kernel/sysrq in file '/usr/lib/sysctl.d/50-default.conf', ignoring.
[root@olinuxino ~]# iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

[root@olinuxino ~]#

Get a network connection:

[root@olinuxino ~]# nano wconfig
[root@olinuxino ~]# cat wconfig
#!/bin/bash
set -v on
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 4
iwconfig wlan0 essid tuxnet
iwconfig wlan0 key 00000001111111110000000011
ifconfig wlan0 up
dhcpcd wlan0
[root@olinuxino ~]# sh wconfig
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 4
iwconfig wlan0 essid tuxnet
iwconfig wlan0 key 00000001111111110000000011
ifconfig wlan0 up
dhcpcd wlan0
dhcpcd[1114]: version 5.6.8 starting
dhcpcd[1114]: wlan0: sending IPv6 Router Solicitation
dhcpcd[1114]: wlan0: sendmsg: Cannot assign requested address
dhcpcd[1114]: wlan0: broadcasting for a lease
dhcpcd[1114]: wlan0: offered 10.42.0.48 from 10.42.0.1
dhcpcd[1114]: wlan0: acknowledged 10.42.0.48 from 10.42.0.1
dhcpcd[1114]: wlan0: checking for 10.42.0.48
dhcpcd[1114]: wlan0: sending IPv6 Router Solicitation
dhcpcd[1114]: wlan0: sending IPv6 Router Solicitation
dhcpcd[1114]: wlan0: leased 10.42.0.48 for 3600 seconds
dhcpcd[1114]: forked to background, child pid 1140
[root@olinuxino ~]#

Now you should also be able to ssh into the OLinuXino (use ifconfig to find out the IP of your OLinuXino):

[root@olinuxino ~]# ifconfig wlan0 |grep inet
      inet 10.42.0.48  netmask 255.255.255.0  broadcast 10.42.0.255
      inet6 fe80::92f6:52ff:fe0f:b44a  prefixlen 64  scopeid 0x20<link>
[root@olinuxino ~]#
[chris@thinkpad ~]$ ssh root@10.42.0.48
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
51:ae:82:04:b0:51:cc:ee:e9:00:cf:c0:80:e8:78:8c.
Please contact your system administrator.
Add correct host key in /home/chris/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/chris/.ssh/known_hosts:16
RSA host key for 10.42.0.48 has changed and you have requested strict checking.
Host key verification failed.
[chris@thinkpad ~]$ vim .ssh/known_hosts
[chris@thinkpad ~]$ ssh root@10.42.0.48
The authenticity of host '10.42.0.48 (10.42.0.48)' can't be established.
RSA key fingerprint is 51:ae:82:04:b0:51:cc:ee:e9:00:cf:c0:80:e8:78:8c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.42.0.48' (RSA) to the list of known hosts.
root@10.42.0.48's password:
Last login: Wed Dec 31 18:01:43 1969
[root@olinuxino ~]#

Update all packages:

[root@olinuxino ~]# pacman -Syu
:: Synchronizing package databases...
core                      45.0 KiB  86.9K/s 00:01 [######################] 100%
extra                    505.1 KiB  7.55K/s 01:07 [######################] 100%
community                536.9 KiB  6.65K/s 01:21 [######################] 100%
alarm                      5.5 KiB  42.2K/s 00:00 [######################] 100%
aur                       17.2 KiB  11.1K/s 00:02 [######################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Packages (21): acl-2.2.52-1  attr-2.4.47-1  ca-certificates-20130610-1
              dbus-1.6.12-1  e2fsprogs-1.42.8-1  glib2-2.36.3-2  gzip-1.6-1
              hwids-20130607-1  krb5-1.11.3-1  libedit-20130601_3.1-1
              libffi-3.0.13-3  libpipeline-1.2.4-1  libusb-compat-0.1.5-1
              linux-firmware-20130610-1  logrotate-3.8.5-1  pacman-4.1.2-1
              pacman-mirrorlist-20130613-1  pcre-8.33-1  ppp-2.4.5-8
              syslog-ng-3.4.2-1  usbutils-007-1

Total Download Size:    26.02 MiB
Total Installed Size:   85.07 MiB
Net Upgrade Size:       -0.14 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages ...
 attr-2.4.47-1-arm         66.1 KiB  89.0K/s 00:01 [######################] 100%
acl-2.2.52-1-arm         131.7 KiB  6.98K/s 00:19 [######################] 100%
ca-certificates-201...   146.4 KiB  6.82K/s 00:21 [######################] 100%
dbus-1.6.12-1-arm        367.9 KiB  6.76K/s 00:54 [######################] 100%
e2fsprogs-1.42.8-1-arm   674.4 KiB  6.46K/s 01:44 [######################] 100%
pcre-8.33-1-arm          975.8 KiB  6.64K/s 02:27 [######################] 100%
libffi-3.0.13-3-arm       26.6 KiB  6.90K/s 00:04 [######################] 100%
glib2-2.36.3-2-arm      1836.7 KiB  6.56K/s 04:40 [######################] 100%
gzip-1.6-1-arm            71.2 KiB  6.90K/s 00:10 [######################] 100%
hwids-20130607-1-any     288.8 KiB  6.77K/s 00:43 [######################] 100%
krb5-1.11.3-1-arm        962.3 KiB  6.58K/s 02:26 [######################] 100%
libedit-20130601_3....    73.1 KiB  6.24K/s 00:12 [######################] 100%
libpipeline-1.2.4-1-arm   30.3 KiB  6.72K/s 00:05 [######################] 100%
error: failed retrieving file 'linux-firmware-20130610-1-any.pkg.tar.xz' from mirror.archlinuxarm.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
warning: failed to retrieve some files
error: failed retrieving file 'logrotate-3.8.5-1-arm.pkg.tar.xz' from mirror.archlinuxarm.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
warning: failed to retrieve some files
pacman-mirrorlist-2...  1260.0   B  0.00B/s 00:00 [######################] 100%
error: failed retrieving file 'pacman-4.1.2-1-arm.pkg.tar.gz' from mirror.archlinuxarm.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
warning: failed to retrieve some files
error: failed retrieving file 'ppp-2.4.5-8-arm.pkg.tar.xz' from mirror.archlinuxarm.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
warning: failed to retrieve some files
usbutils-007-1-arm        47.4 KiB  6.36K/s 00:07 [######################] 100%
libusb-compat-0.1.5...     9.9 KiB  43.4K/s 00:00 [######################] 100%
syslog-ng-3.4.2-1-arm    359.0 KiB  5.75K/s 01:02 [######################] 100%
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
[root@olinuxino ~]# pacman -Syu
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
alarm is up to date
aur is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Packages (21): acl-2.2.52-1  attr-2.4.47-1  ca-certificates-20130610-1
              dbus-1.6.12-1  e2fsprogs-1.42.8-1  glib2-2.36.3-2  gzip-1.6-1
              hwids-20130607-1  krb5-1.11.3-1  libedit-20130601_3.1-1
              libffi-3.0.13-3  libpipeline-1.2.4-1  libusb-compat-0.1.5-1
              linux-firmware-20130610-1  logrotate-3.8.5-1  pacman-4.1.2-1
              pacman-mirrorlist-20130613-1  pcre-8.33-1  ppp-2.4.5-8
              syslog-ng-3.4.2-1  usbutils-007-1

Total Download Size:    9.60 MiB
Total Installed Size:   85.07 MiB
Net Upgrade Size:       -0.14 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages ...
 linux-firmware-2013...    18.6 MiB  15.0K/s 21:13 [######################] 100%
logrotate-3.8.5-1-arm     28.7 KiB  7.58K/s 00:04 [######################] 100%
pacman-4.1.2-1-arm      1245.6 KiB  7.15K/s 02:54 [######################] 100%
ppp-2.4.5-8-arm          243.2 KiB  11.2K/s 00:22 [######################] 100%
(21/21) checking keys in keyring                   [######################] 100%
(21/21) checking package integrity                 [######################] 100%
(21/21) loading package files                      [######################] 100%
(21/21) checking for file conflicts                [######################] 100%
(21/21) checking available disk space              [######################] 100%
( 1/21) upgrading attr                             [######################] 100%
( 2/21) upgrading acl                              [######################] 100%
( 3/21) upgrading ca-certificates                  [######################] 100%
( 4/21) upgrading dbus                             [######################] 100%
( 5/21) upgrading e2fsprogs                        [######################] 100%
( 6/21) upgrading pcre                             [######################] 100%
( 7/21) upgrading libffi                           [######################] 100%
( 8/21) upgrading glib2                            [######################] 100%
( 9/21) upgrading gzip                             [######################] 100%
(10/21) upgrading hwids                            [######################] 100%
(11/21) upgrading krb5                             [######################] 100%
(12/21) upgrading libedit                          [######################] 100%
(13/21) upgrading libpipeline                      [######################] 100%
(14/21) upgrading libusb-compat                    [######################] 100%
(15/21) upgrading linux-firmware                   [######################] 100%
(16/21) upgrading logrotate                        [######################] 100%
(17/21) upgrading pacman-mirrorlist                [######################] 100%
(18/21) upgrading pacman                           [######################] 100%
>>> Run `pacman-key --init` to set up your pacman keyring.
(19/21) upgrading ppp                              [######################] 100%
warning: /etc/ppp/ip-up.d/00-dns.sh installed as /etc/ppp/ip-up.d/00-dns.sh.pacnew
warning: /etc/ppp/ip-down.d/00-dns.sh installed as /etc/ppp/ip-down.d/00-dns.sh.pacnew
(20/21) upgrading syslog-ng                        [######################] 100%
(21/21) upgrading usbutils                         [######################] 100%
[root@olinuxino ~]#

Install other useful tools:

[root@olinuxino ~]# pacman -Rs netcfg
[root@olinuxino ~]# pacman -Sy netctl wireless_tools dialog wpa_supplicant usb_modeswitch wvdial base-devel vim screen git watchdog fswebcam python2 python2-pip python2-flask

Create a new /etc/rc.local Systemd service that blinks the LED:

[root@olinuxino ~]# vim led_blink
[root@olinuxino ~]# cat led_blink
while [ 1 -eq 1 ]
do
echo 1 > /sys/class/leds/green/brightness
sleep 1
echo 0 > /sys/class/leds/green/brightness
sleep 1
done
[root@olinuxino ~]# chmod +x led_blink
[root@olinuxino ~]# vim /etc/rc.local
[root@olinuxino ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed at the end of the boot process.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

/root/led_blink &
[root@olinuxino ~]# chmod +x /etc/rc.local
[root@olinuxino ~]# vim /etc/systemd/system/rc-local.service
[root@olinuxino ~]# cat /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility

[Service]
# is forking instead of oneshot needed here?
Type=oneshot
ExecStart=/etc/rc.local
TimeoutSec=0
#StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

[root@olinuxino ~]# systemctl enable rc-local.service
ln -s '/etc/systemd/system/rc-local.service' '/etc/systemd/system/multi-user.target.wants/rc-local.service'
[root@olinuxino ~]# systemctl start rc-local.service
[root@olinuxino ~]# systemctl status rc-local.service
rc-local.service - /etc/rc.local Compatibility
          Loaded: loaded (/etc/systemd/system/rc-local.service; enabled)
          Active: active (exited) since Wed 1969-12-31 19:11:55 CST; 16s ago
        Process: 1398 ExecStart=/etc/rc.local (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/rc-local.service
                    ├─1399 /bin/sh /etc/rc.local
                    └─1419 sleep 1

Dec 31 19:11:55 olinuxino systemd[1]: Starting /etc/rc.local Compatibility...
Dec 31 19:11:55 olinuxino systemd[1]: Started /etc/rc.local Compatibility.
[root@olinuxino ~]# #shutdown -h now
[root@olinuxino ~]# reboot
...
All filesystems unmounted.
Deactivating swaps.
All swaps deactivated.
Detaching loop devices.
All loop devices detached.
Detaching DM devices.
All DM devices detached.
Storage is finalized.
[  268.240000] Restarting system.

If your kernel supports it you can also use the heartbeat or default-on trigger:

echo heartbeat >  /sys/class/leds/green/trigger
echo default-on > /sys/class/leds/green/trigger

Most stuff should be explained pretty well in the Arch Wiki, like setting the timezone, for example if you life in Italy, change it to Rome:

[chris@thinkpad ~]$ ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime

Not to forget the Beginners’ Guide.

Fixes for some issues

  1. Most kernel oops and stability issues

To test if you get memory errors you can try to run top -d 0 for some time.

  1. Serial terminal - bad row column count

You can use stty to change this, first get the number of cols and rows on your PC:

[chris@thinkpad ~]$ stty -a | grep rows
speed 38400 baud; rows 33; columns 151; line = 0;

Now change this on your OLinuXino:

[root@olinuxino ~]# stty -a | grep rows
speed 115200 baud; rows 0; columns 0; line = 0;
[root@olinuxino ~]# stty rows 32 columns 151
[root@olinuxino ~]# stty -a | grep rows
speed 115200 baud; rows 32; columns 151; line = 0;
[root@olinuxino ~]#

You can put the stty command into your ~/.bashrc

I’m using only 32 rows because minicom uses one row:

CTRL-A Z for help |115200 8N1 | NOR | Minicom 2.5    | VT102 |      Offline

Now you can tun top or tail -n 20 /var/log/messages.log to see if it uses the entire terminal.

Some tests

We know WiFi is already working but what about 3G, watchdog, webcam, ...

Testing a 3G modem

Plug it in...

[root@olinuxino ~]# tail /var/log/messages.log
Dec 31 21:41:17 olinuxino [    5.600000] systemd[1]: Started Create static device nodes in /dev.
Dec 31 21:41:17 olinuxino [    5.670000] systemd[1]: Started Apply Kernel Variables.
Dec 31 21:41:17 olinuxino [    5.670000] systemd[1]: Starting udev Kernel Device Manager...
Dec 31 21:41:17 olinuxino [    6.830000] systemd-udevd[620]: starting version 204
Dec 31 21:41:53 olinuxino kernel: [  116.030000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
Dec 31 21:41:53 olinuxino kernel: [  116.230000] scsi0 : usb-storage 1-1:1.0
Dec 31 21:41:54 olinuxino kernel: [  117.270000] scsi 0:0:0:0: CD-ROM            USBModem Disk             2.31 PQ: 0 ANSI: 2
Dec 31 21:41:54 olinuxino kernel: [  117.300000] sr0: scsi-1 drive
Dec 31 21:41:54 olinuxino kernel: [  117.300000] cdrom: Uniform CD-ROM driver Revision: 3.20
Dec 31 21:41:54 olinuxino kernel: [  117.370000] sr 0:0:0:0: Attached scsi generic sg0 type 5
[root@olinuxino ~]# dmesg |tail -n15
[  117.370000] sr 0:0:0:0: Attached scsi generic sg0 type 5
[  144.140000] usb 1-1: USB disconnect, device number 2
[  144.540000] usb 1-1: new high-speed USB device number 3 using ci_hdrc
[  144.750000] scsi1 : usb-storage 1-1:1.3
[  145.510000] usbcore: registered new interface driver option
[  145.540000] usbserial: USB Serial support registered for GSM modem (1-port)
[  145.540000] option 1-1:1.0: GSM modem (1-port) converter detected
[  145.650000] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[  145.650000] option 1-1:1.1: GSM modem (1-port) converter detected
[  145.720000] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[  145.720000] option 1-1:1.2: GSM modem (1-port) converter detected
[  145.760000] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[  145.770000] scsi 1:0:0:0: Direct-Access     USBModem Disk             2.31 PQ: 0 ANSI: 2
[  145.820000] sd 1:0:0:0: Attached scsi generic sg0 type 0
[  145.870000] sd 1:0:0:0: [sda] Attached SCSI removable disk
[root@olinuxino ~]# ls /dev/ttyUSB*
/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2
[root@olinuxino ~]#

How to setup a USB 3G Modem under Arch Linux is explained in the ArchWiki: https://wiki.archlinux.org/index.php/USB_3G_Modem.

O.K. this looks good, lets connect to the internet, you need to create the configuration file /etc/wvdial.conf, just google for wvdial.conf and the name of your USB 3G modem and you will likely find a working configuration, mine looks like this:

[root@olinuxino ~]# vim /etc/wvdial.conf
[root@olinuxino ~]# cat /etc/wvdial.conf
[Dialer Defaults]
Phone = *99#
Username = "blau"
Password = "blau"
Stupid Mode = on
Dial Command = ATDT
Modem Type = USB Modem
Modem = /dev/ttyUSB2
Init1 = ATZ
[Dialer nopin]
Init2= AT+CPIN="1234"
Init3= AT+CLCK="SC",0,"1234"
[Dialer umts]
Carrier Check = on
Init2= AT+CGDCONT?
Init3= AT+CGDCONT=1,"IP","internet.eplus.de"
ISDN = off

[root@olinuxino ~]#

Now connect to the internet:

[root@olinuxino ~]# wvdial umts &
[1] 2027
[root@olinuxino ~]#
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CGDCONT?
AT+CGDCONT?
+CGDCONT: 1,"IP","internet.eplus.de","0.0.0.0",0,0
+CGDCONT: 2,"IP","internet.mobilcom","0.0.0.0",0,0
+CGDCONT: 3,"IP","surfo2","0.0.0.0",0,0
+CGDCONT: 4,"IP","web.vodafone.de","0.0.0.0",0,0
+CGDCONT: 5,"IP","internet.eplus.de","0.0.0.0",0,0
OK
--> Sending: AT+CGDCONT=1,"IP","internet.eplus.de"
AT+CGDCONT=1,"IP","internet.eplus.de"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 7200000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Wed Dec 31 18:28:50 1969
--> Pid of pppd: 2030
[  680.890000] PPP generic driver version 2.4.2
--> Using interface ppp0
--> pppd: [1e]
--> pppd: [1e]
--> pppd: [1e]
--> pppd: [1e]
[  681.130000] PPP BSD Compression module registered
[  681.230000] PPP Deflate Compression module registered
--> pppd: [1e]
--> pppd: [1e]
--> local  IP address 10.82.325.111
--> pppd: [1e]
--> remote IP address 10.81.22.14
--> pppd: [1e]
--> primary   DNS address 333.11.111.122
--> pppd: [1e]
--> secondary DNS address 333.11.111.123
--> pppd: [1e]

[root@olinuxino ~]# ping google.de
PING google.de (173.194.65.94) 56(84) bytes of data.
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=1 ttl=48 time=406 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=2 ttl=48 time=336 ms
64 bytes from ee-in-f94.1e100.net (173.194.65.94): icmp_seq=3 ttl=48 time=326 ms

--- google.de ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 326.344/356.281/406.406/35.666 ms
[root@olinuxino ~]#

You may need to wait a bit until the modem switches from usb-storage mode to modem mode, if something does not work then you should post the output of the following commands to http://pastebin.com/ and ask somewhere for help:

[root@olinuxino ~]# tail -n 30 /var/log/messages.log
[root@olinuxino ~]# dmesg |tail -n 30
[root@olinuxino ~]# lsusb
[root@olinuxino ~]# ls /dev/ttyU*

See also Using the OLinuXino Micro and a USB 3G modem to control something via web.

The watchdog

[root@olinuxino ~]# ls /dev/watchdog
ls: cannot access /dev/watchdog: No such file or directory
[root@olinuxino ~]# modprobe watchdog
modprobe: FATAL: Module watchdog not found.
[root@olinuxino ~]# modprobe softdog
modprobe: FATAL: Module softdog not found.
[root@olinuxino ~]# find /lib/modules/ -iname '*watch*'
[root@olinuxino ~]# find /lib/modules/ -iname '*dog*'
[root@olinuxino ~]# dmesg |grep -i watchdog
[root@olinuxino ~]#

Nothing there? You may need to compile your own kernel with watchdog support. See also Using the Watchdog Timer in Linux.

Webcam support

[root@olinuxino ~]# tail /var/log/messages.log
Dec 31 21:49:52 olinuxino kernel: [  594.620000] usb 1-1: new full-speed USB device number 4 using ci_hdrc
Dec 31 21:49:52 olinuxino kernel: [  595.100000] media: Linux media interface: v0.10
Dec 31 21:49:52 olinuxino kernel: [  595.290000] Linux video capture interface: v2.00
Dec 31 21:50:02 olinuxino kernel: [  603.860000] gspca_main: v2.14.0 registered
Dec 31 21:50:02 olinuxino kernel: [  605.420000] gspca_main: gspca_zc3xx-2.14.0 probing 046d:08da
Dec 31 21:50:04 olinuxino kernel: [  606.720000] input: gspca_zc3xx as /devices/80080000.ahb/80080000.usb/ci_hdrc.0/usb1/1-1/input/input0
Dec 31 21:50:04 olinuxino kernel: [  606.760000] usbcore: registered new interface driver gspca_zc3xx
Dec 31 21:50:05 olinuxino kernel: [  607.670000] usbcore: registered new interface driver snd-usb-audio
Dec 31 21:50:05 olinuxino systemd[1]: Starting Sound Card.
Dec 31 21:50:05 olinuxino systemd[1]: Reached target Sound Card.
[root@olinuxino ~]# ls /dev/video*
/dev/video0
[root@olinuxino ~]# fswebcam -r 640x480 -d /dev/video0 test.jpeg
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
--- Capturing frame...
[ 2837.230000] gspca_main: ISOC data error: [19] len=0, status=-18
[ 2837.230000] gspca_main: ISOC data error: [27] len=0, status=-18
[ 2837.260000] gspca_main: ISOC data error: [19] len=0, status=-18
[ 2837.260000] gspca_main: ISOC data error: [27] len=0, status=-18
[ 2837.290000] gspca_main: ISOC data error: [19] len=0, status=-18
[ 2837.290000] gspca_main: ISOC data error: [27] len=0, status=-18
...
approx 100 lines
...
Timed out waiting for frame!

So this does not work!

Have a look at the section The webcam and Screenshots of the post Control your light at home with a Raspberry Pi and Olimex’s MOD-IO2.

Memory usage

[root@olinuxino ~]# cat /proc/version
Linux version 3.7.2-2-ARCH (nobody@panda2) (gcc version 4.7.2 (GCC) ) #1 PREEMPT Thu Jan 17 07:51:19 UTC 2013
[root@olinuxino ~]# cat /proc/meminfo |head -n 10
MemTotal:          52436 kB
MemFree:           10368 kB
Buffers:            6996 kB
Cached:            20988 kB
SwapCached:            0 kB
Active:            12800 kB
Inactive:          20036 kB
Active(anon):       4864 kB
Inactive(anon):       88 kB
Active(file):       7936 kB
[root@olinuxino ~]# ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -10
9.9  0.3  38972   617 /usr/lib/systemd/systemd-journald
5.6  0.1   7040   977 /usr/sbin/syslog-ng -F
4.7  0.3   4600     1 /sbin/init
4.2  0.0   6272   974 /usr/sbin/sshd -D
3.6  0.1   5332  1488 -bash
3.3  0.0   5912  1029 login -- root
2.5  0.3   9112   614 /usr/lib/systemd/systemd-udevd
2.4  0.0   3108   975 /usr/lib/systemd/systemd-logind
2.4  0.0   2692   976 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
2.3 40.9   4804   973 /usr/sbin/crond -n
[root@olinuxino ~]# shutdown -h now

See also How to check the memory usage of your embedded Linux system.

TV-Out

If you have a look at the kernel configuration under https://github.com/archlinuxarm/PKGBUILDs/blob/e34f592ccb9ac1b4f01361ee21bf62efc1c00678/core/linux-olinuxino/config, you will see that the framebuffer driver is enabled:

#
# Frame buffer hardware drivers
#
# CONFIG_FB_ARMCLCD is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_TMIO is not set
# CONFIG_FB_SMSCUFX is not set
# CONFIG_FB_UDL is not set
# CONFIG_FB_VIRTUAL is not set
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_BROADSHEET is not set
# CONFIG_FB_AUO_K190X is not set
CONFIG_FB_MXS=y

#
# Console display driver support
#
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y

But there is still no /dev/fb0 device:

[root@olinuxino ~]# ls /dev/fb*
ls: cannot access /dev/fb*: No such file or directory
[root@olinuxino ~]# fbset
open /dev/fb0: No such file or directory
[root@olinuxino ~]#

To be continued.

My kernel

Insert the SD card into your PC, download the kernel, check the md5sum and boot it:

[chris@thinkpad Downloads]$ wget https://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.7.6/sd_mmc_bootstream.raw
[chris@thinkpad Downloads]$ wget https://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.7.6/MD5SUM.TXT
[chris@thinkpad Downloads]$ md5sum -c MD5SUM.TXT
md5sum: imx23-olinuxino.dtb: No such file or directory
imx23-olinuxino.dtb: FAILED open or read
sd_mmc_bootstream.raw: OK
md5sum: zImage: No such file or directory
zImage: FAILED open or read
md5sum: WARNING: 2 listed files could not be read
[chris@thinkpad Downloads]$ sudo dd if=sd_mmc_bootstream.raw of=/dev/mmcblk0p1
7252+0 records in
7252+0 records out
3713024 bytes (3.7 MB) copied, 1.52752 s, 2.4 MB/s
[chris@thinkpad Downloads]$

You can ignore these FAILED open or read errors this only means that we’ve skipped downloading imx23-olinuxino.dtb and zImage but the MD5SUM.TXT contains the checksum’s for these files.

There may be already newer kernels, have a look into the kernel directory under https://sourceforge.net/projects/janncc/files/olinuxino/kernel/.

Booting...

Arch Linux 3.7.6-dirty (ttyAMA0)

olinuxino login: root
Password:
Last login: Wed Dec 31 18:00:43 on ttyAMA0
[root@olinuxino ~]# uname -r
3.7.6-dirty
[root@olinuxino ~]# cat /proc/version
Linux version 3.7.6-dirty (chris@thinkpad) (gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded3
[root@olinuxino ~]# cat /proc/meminfo |head -n 10
MemTotal:          52180 kB
MemFree:           18224 kB
Buffers:            3704 kB
Cached:            18112 kB
SwapCached:            0 kB
Active:            10356 kB
Inactive:          15812 kB
Active(anon):       4372 kB
Inactive(anon):       56 kB
Active(file):       5984 kB
[root@olinuxino ~]

See also Building a kernel 3.x for the iMX233-OLinuXino.

Connect automatically to a WiFi network

First use wifi-menu to scan for networks and enter the password:

[root@olinuxino ~]# wifi-menu

This will also create a configuration file named after your network:

[root@olinuxino ~]# vim /etc/netctl/wlan0-AndroidAP
[root@olinuxino ~]# cat /etc/netctl/wlan0-AndroidAP
Description='Automatically generated profile by wifi-menu'
Interface=wlan0
Connection=wireless
Security=wpa
ESSID=AndroidAP
IP=dhcp
Key=123abc123456
[root@olinuxino ~]# iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

[root@olinuxino ~]# ifconfig wlan0 down
[root@olinuxino ~]# ping google.de
ping: unknown host google.de
[root@olinuxino ~]# netctl start wlan0-AndroidAP
[root@olinuxino ~]# ping google.de
PING google.de (173.194.70.94) 56(84) bytes of data.
64 bytes from fa-in-f94.1e100.net (173.194.70.94): icmp_seq=1 ttl=49 time=1317 ms
64 bytes from fa-in-f94.1e100.net (173.194.70.94): icmp_seq=2 ttl=49 time=349 ms

--- google.de ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1007ms
rtt min/avg/max/mdev = 349.969/833.531/1317.094/483.563 ms, pipe 2
[root@olinuxino ~]# netctl enable wlan0-AndroidAP
ln -s '/etc/systemd/system/netctl@wlan0\x2dAndroidAP.service' '/etc/systemd/system/multi-user.target.wants/netctl@wlan0\x2dAndroidAP.service'
[root@olinuxino ~]# reboot
...
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started Login Service.
[  OK  ] Found device /dev/ttyAMA0.
        Starting Serial Getty on ttyAMA0...
[  OK  ] Started Serial Getty on ttyAMA0.
[  OK  ] Reached target Login Prompts.

Arch Linux 3.7.2-3-ARCH (ttyAMA0)

olinuxino login: [  OK  ] Found device TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287].
        Starting Automatically generated profile by wifi-menu...
[  OK  ] Started Automatically generated profile by wifi-menu.
[  OK  ] Reached target Network.
        Starting OpenNTP Daemon...
[  OK  ] Started OpenNTP Daemon.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.

Arch Linux 3.7.2-3-ARCH (ttyAMA0)

olinuxino login: root
Password:
Last login: Wed Dec 31 23:51:43 on ttyAMA0
[root@olinuxino ~]# ping google.de
PING google.de (173.194.70.94) 56(84) bytes of data.
64 bytes from fa-in-f94.1e100.net (173.194.70.94): icmp_seq=1 ttl=49 time=795 ms
64 bytes from fa-in-f94.1e100.net (173.194.70.94): icmp_seq=2 ttl=49 time=55.4 ms

--- google.de ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 55.406/425.547/795.688/370.141 ms
[root@olinuxino ~]# netctl disable wlan0-AndroidAP
rm '/etc/systemd/system/multi-user.target.wants/netctl@wlan0\x2dAndroidAP.service'
[root@olinuxino ~]#

In /etc/netctl/examples/ there are also other example configurations, just copy them to /etc/netctl/.

[root@olinuxino ~]# ls /etc/netctl/examples/
bonding          pppoe           wireless-wep
bridge           tunnel-he-ipv6  wireless-wep-string-key
ethernet-custom  tuntap          wireless-wpa
ethernet-dhcp    vlan-dhcp       wireless-wpa-config
ethernet-static  vlan-static     wireless-wpa-configsection
mobile_ppp       wireless-open   wireless-wpa-static
[root@olinuxino ~]#

See also: https://wiki.archlinux.org/index.php/Netctl

Build a new SD card image that includes your changes

This is a a dirty work around, a better way would be to use one of the the distro-builder scripts for Arch Linux ARM, have a look at the docs, especially distcc cross-compiling, but this would take much longer.

I will just use dd to create a backup of my SD card:

[chris@thinkpad ~]$ sudo sh -c 'dd if=/dev/mmcblk0 | gzip > /home/chris/olinuxino_image.img.gz'

To restore the SD card or to write the image to another SD card one can use the following command:

[chris@thinkpad ~]$ sudo sh -c 'gzip -dc /home/chris/olinuxino_image.img.gz | dd of=/dev/mmcblk0'

But I won’t upload a complete image of my SD card because it may contain sensible data like passwords and private SSH keys.

What to do next

You may want to resize the root partition of your SD card so that it uses the entire free space, to do this you may have to delete the swap partition and recreate it later, you can enable it with echo 1 >/proc/sys/vm/swappiness; mkswap /dev/mmcblk0p3 && swapon /dev/mmcblk0p3 when you need it.

The PKGBUILDs for the olinuxino kernel could be useful too: