Recent Linux on the EDB93xx-based SIM.ONE
(2017-02-02)

SIM.ONE board

I recently had to bring up a fresh Linux 4.x-based system on the EDB93xx-based (ARMv4T ARM920T) SimpleMachines SIM.ONE single-board computer. Here is how I did it.

Getting to Bootloader (U-Boot) Prompt

First, my SIM.ONE had one of the buggy serial cables. Apparently there was some kind of production failure on these, so the modem CTS+DTS lines were swapped. What I did was:

After this the U-Boot prompt came up nicely.

Resources

Toolchain

The latest Linaro GCC toolchain is what I usually use to compile recent kernels. For compiling the userspace for the SIM.ONE you need to use a compiler built for ARMv4T or the stuff just won't work. I got the Debian rootfs on a memory card for the SIM.ONE so I needed not bother about this part.

Download the toolchain and install it such that it is always in your path. A good way is to install it in /var/linus/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/ then add this to a file called /etc/profile.d/crosscompilers.sh

CS_BASE=/var/linus/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/
export PATH=$PATH:${CS_BASE}/bin
export MANPATH=$MANPATH:${CS_BASE}/share/doc/gcc-linaro-arm-linux-gnueabihf/man/

Simple Root Filesystem

As always you can get a simple root filesystem up and running on the machine from roots filesystem generator. Here is a CPIO archive:

Extract this to the first partion of an MMC/SD card with and EXT4 filesystem. The card can be ridculously small, no gigabytes required. Just extract the CPIO archive like so:

mount /dev/mmcblk0p1 /mnt
cd /mnt
cpio -d -i -F /home/linus/rootfs-simone.cpio
cd
umount /mnt

Debian Root Filesystem

If you want a more fully-fledged root filesystem you need to install Debian or something.

I created a Debian rootfs by going to the daily snapshots of the current armel (supports ARMv4 and later) version of Debian and downloading vmlinuz and initrd for Versatile. Bootstrap Debian in QEMU something like so (for a 2GB SD card, that is the magical 2013265920 value, that is the size of the card in bytes, if you wanna find out what it is just dd if=/dev/mmcblk0 of=test.bin and check the size of the file unless you want to figure it out by thinking):

$ qemu-img create -f raw hda.img 2013265920
$ qemu-system-arm -L . -kernel  vmlinuz-3.16.0-4-versatile -initrd initrd.gz -hda hda.img -m 256 -M versatilepb

There is a long complex graphical (textmode) installer ... yeah I hope you know how to set up Debian, else you have to learn it.

Modifying the Root Filesystem

After setting it up the rootfs can be tailored for the SIM.ONE thusly:

$ fdisk hda.img
Command (m for help): p
Device   Boot     Start       End  Blocks  Id System
hda.img1           2048   3913727 1955840  83 Linux
(...)

The first partition start at 2048 which means 2048*512 = 1048576 bytes into the disk image, so:

$ mount -o loop,offset=1048576 hda.img /mnt/<mountpoint>
$ cd /mnt/<mountpoint>
$ cd etc
(edit rc.local)
$ cd
$ umount /mnt/<mountpoint>
$ dd if=hda.img of=/dev/mmcblk0

I edit the /etc/rc.local file to contain at least this, because I like to have this pulsating life sign from my system so I know it's up and kicking:

echo "heartbeat" > /sys/class/leds/platform\:rdled/trigger

Kernel

I use this simone.mak file to build a kernel for the SIM.ONE, copy the simone.mak file to your linux/ git tree or base dir and simply:

> make -f simone.mak config
> make -f simone.mak build

Notice that this Makefile enables a few configs necessary for booting Debian, such as control groups, devtmpfs etc.

Upload a uImage on SIM.ONE with U-Boot

Attach minicom to the serial port, 56000bps, 8N1, press the reset button on the target. Hit ENTER a few times to get to the U-Boot prompt, then type something like so to download and boot a kernel over ethernet (the start address is very important and significant):

SIM.ONE> set serverip 192.168.1.32 ; set ipaddr 192.168.1.35 ; tftpboot 0xc0200000 uImage ; bootm

Prebuilt images

Boot crawl

On my machine it looks like so:

SIM.ONE> set serverip 192.168.1.32 ; set ipaddr 192.168.1.35 ; tftpboot 0xc0200000 uImage ; bootm
TFTP from server 192.168.1.32; our IP address is 192.168.1.35
Filename 'uImage'.
Load address: 0xc0200000
Loading: ###############################################################T ###
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##########
done
Bytes transferred = 2708704 (2954e0 hex)
## Booting image at c0200000 ...
   Image Name:   SIM.ONE kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2708640 Bytes =  2.6 MB
   Load Address: c0008000
   Entry Point:  c0008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 4.1.0-rc7-00012-g31c0f7283091-dirty (linus@localhost.localdomain) (gcc version 4.9.3 20150113 (prerelease) (Linaro GCC 4.9-25
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c000717f
CPU: VIVT data cache, VIVT instruction cache
Machine: Simplemachines Sim.One Board
Memory policy: Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8016
Kernel command line: console=ttyAM0 root=/dev/mmcblk0p1 rootwait video=ep93xxfb
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 27136K/32768K available (3816K kernel code, 182K rwdata, 1012K rodata, 128K init, 126K bss, 5632K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xc6000000 - 0xff000000   ( 912 MB)
    lowmem  : 0xc0000000 - 0xc5800000   (  88 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc04bf454   (4830 kB)
      .init : 0xc04c0000 - 0xc04e0000   ( 128 kB)
      .data : 0xc04e0000 - 0xc050db40   ( 183 kB)
       .bss : 0xc050db40 - 0xc052d518   ( 127 kB)
NR_IRQS:120
VIC @fefb0000: id 0x00041190, vendor 0x41
VIC @fefc0000: id 0x00041190, vendor 0x41
sched_clock: 40 bits at 983kHz, resolution 1017ns, wraps every 2199023255074ns
Calibrating delay loop... 99.73 BogoMIPS (lpj=498688)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
Initializing cgroup subsys blkio
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc0008200 - 0xc0008258
devtmpfs: initialized
clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
ep93xx clock: PLL1 running at 400 MHz, PLL2 at 192 MHz
ep93xx clock: FCLK 200 MHz, HCLK 100 MHz, PCLK 50 MHz
ep93xx-dma ep93xx-dma-m2p: EP93xx M2P DMA ready
ep93xx-dma ep93xx-dma-m2m: EP93xx M2M DMA ready
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 2, 20480 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 1, 12288 bytes)
UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 256 (order: 0, 7168 bytes)
jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
graphics fb0: registered. Mode = 640x400-16
Serial: AMBA driver
apb:uart1: ttyAM0 at MMIO 0x808c0000 (irq = 52, base_baud = 0) is a AMBA
console [ttyAM0] enabled
apb:uart2: ttyAM1 at MMIO 0x808d0000 (irq = 54, base_baud = 0) is a AMBA
apb:uart3: ttyAM2 at MMIO 0x808e0000 (irq = 55, base_baud = 0) is a AMBA
nbd: registered device at major 43
physmap platform flash device: 00800000 at 60000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID 0x000017
Intel/Sharp Extended Query Table at 0x0031
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Searching for RedBoot partition table in physmap-flash.0 at offset 0x7e0000
No RedBoot partition table detected in physmap-flash.0
ep93xx-spi ep93xx-spi.0: EP93xx SPI Controller at 0x808a0000 irq 53
eth0: ep93xx on-chip ethernet, IRQ 39, 01:02:93:12:15:07
usbcore: registered new interface driver rtl8150
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-platform: OHCI generic platform driver
ohci-platform ohci-platform: Generic Platform OHCI controller
ohci-platform ohci-platform: new USB bus registered, assigned bus number 1
ohci-platform ohci-platform: irq 56, io mem 0x80020000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
ep93xx-rtc ep93xx-rtc: rtc core: registered ep93xx-rtc as rtc0
i2c /dev entries driver
ep93xx-wdt ep93xx-wdt: EP93XX watchdog, driver version 0.4 (nCS1 disable detected)
spi0.0: using irq 64 for MMC card detection
mmc_spi spi0.0: SD/MMC host mmc0, no WP, no poweroff
NET: Registered protocol family 10
NET: Registered protocol family 17
NET: Registered protocol family 15
ep93xx-rtc ep93xx-rtc: setting system clock to 2015-06-17 17:07:20 UTC (1434560840)
Waiting for root device /dev/mmcblk0p1...
mmc0: host does not support reading read-only switch, assuming write-enable
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 SD02G 1.87 GiB 
 mmcblk0: p1 p2 < p5 >
EXT3-fs (mmcblk0p1): error: couldn't mount because of unsupported optional features (240)
EXT2-fs (mmcblk0p1): error: couldn't mount because of unsupported optional features (244)
random: nonblocking pool is initialized
EXT4-fs (mmcblk0p1): recovery complete
EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:1.
Freeing unused kernel memory: 128K (c04c0000 - c04e0000)
systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
systemd[1]: Detected architecture 'arm'.

Welcome to Debian GNU/Linux 8 (jessie)!

systemd[1]: Failed to insert module 'autofs4'
systemd[1]: Set hostname to .
systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such fil.
systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
systemd[1]: Started Forward Password Requests to Wall Directory Watch.
systemd[1]: Expecting device dev-ttyAM0.device...
         Expecting device dev-ttyAM0.device...
systemd[1]: Starting Remote File Systems (Pre).
[  OK  ] Reached target Remote File Systems (Pre).
systemd[1]: Reached target Remote File Systems (Pre).
systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.
systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
systemd[1]: Starting Paths.
[  OK  ] Reached target Paths.
systemd[1]: Reached target Paths.
systemd[1]: Starting Encrypted Volumes.
[  OK  ] Reached target Encrypted Volumes.
systemd[1]: Reached target Encrypted Volumes.
systemd[1]: Expecting device dev-disk-by\x2duuid-4fb070fa\x2dc43b\x2d4afc\x2db443\x2d7513e2013c78.device...
         Expecting device dev-disk-by\x2duuid-4fb070fa\x2dc43...13c78.device...
systemd[1]: Starting Root Slice.
[  OK  ] Created slice Root Slice.
systemd[1]: Created slice Root Slice.
systemd[1]: Starting User and Session Slice.
[  OK  ] Created slice User and Session Slice.
systemd[1]: Created slice User and Session Slice.
systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
systemd[1]: Starting Delayed Shutdown Socket.
[  OK  ] Listening on Delayed Shutdown Socket.
systemd[1]: Listening on Delayed Shutdown Socket.
systemd[1]: Starting Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket (/dev/log).
systemd[1]: Listening on Journal Socket (/dev/log).
systemd[1]: Starting udev Control Socket.
[  OK  ] Listening on udev Control Socket.
systemd[1]: Listening on udev Control Socket.
systemd[1]: Starting udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
systemd[1]: Listening on udev Kernel Socket.
systemd[1]: Starting Journal Socket.
[  OK  ] Listening on Journal Socket.
systemd[1]: Listening on Journal Socket.
systemd[1]: Starting System Slice.
[  OK  ] Created slice System Slice.
systemd[1]: Created slice System Slice.
systemd[1]: Started File System Check on Root Device.
systemd[1]: Starting system-getty.slice.
[  OK  ] Created slice system-getty.slice.
systemd[1]: Created slice system-getty.slice.
systemd[1]: Starting system-serial\x2dgetty.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
systemd[1]: Created slice system-serial\x2dgetty.slice.
systemd[1]: Starting Increase datagram queue length...
         Starting Increase datagram queue length...
systemd[1]: Started Set Up Additional Binary Formats.
systemd[1]: Mounting Debug File System...
         Mounting Debug File System...
systemd[1]: Started Create list of required static device nodes for the current kernel.
systemd[1]: Starting udev Coldplug all Devices...
         Starting udev Coldplug all Devices...
systemd[1]: Mounted Huge Pages File System.
systemd[1]: Mounted POSIX Message Queue File System.
systemd[1]: Starting Create Static Device Nodes in /dev...
         Starting Create Static Device Nodes in /dev...
systemd[1]: Starting Load Kernel Modules...
         Starting Load Kernel Modules...
systemd[1]: Starting Slices.
[  OK  ] Reached target Slices.
systemd[1]: Reached target Slices.
[  OK  ] Started Increase datagram queue length.
systemd[1]: Started Increase datagram queue length.
[  OK  ] Mounted Debug File System.
systemd[1]: Mounted Debug File System.
[  OK  ] Started Load Kernel Modules.
systemd[1]: Started Load Kernel Modules.
[  OK  ] Started Create Static Device Nodes in /dev.
systemd[1]: Started Create Static Device Nodes in /dev.
[  OK  ] Started udev Coldplug all Devices.
systemd[1]: Started udev Coldplug all Devices.
systemd[1]: Starting udev Kernel Device Manager...
         Starting udev Kernel Device Manager...
systemd[1]: Mounted Configuration File System.
systemd[1]: Starting Apply Kernel Variables...
         Starting Apply Kernel Variables...
systemd[1]: Mounted FUSE Control File System.
systemd[1]: Starting Syslog Socket.
[  OK  ] Listening on Syslog Socket.
systemd[1]: Listening on Syslog Socket.
systemd[1]: Starting Journal Service...
         Starting Journal Service...
[  OK  ] Started Journal Service.
systemd[1]: Started Journal Service.
systemd-udevd[475]: starting version 215
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started Apply Kernel Variables.
         Starting Copy rules generated while the root was ro...
         Starting LSB: Set preliminary keymap...
[  OK  ] Started Copy rules generated while the root was ro.
[  OK  ] Found device /dev/ttyAM0.
[  OK  ] Started LSB: Set preliminary keymap.
         Starting Remount Root and Kernel File Systems...
[  *** ] (1 of 2) A start job is running for Remount Root and...39s / no limit)EXT4-fs (mmcblk0p1): re-mounted. Opts: errors=remount-ro
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[  OK  ] Reached target Remote File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
         Starting LSB: Prepare console...
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started Create Volatile Files and Directories.
systemd-journald[477]: Received request to flush runtime journal from PID 1
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
[  OK  ] Started LSB: Prepare console.
[  OK  ] Found device /dev/disk/by-uuid/4fb070fa-c43b-4afc-b443-7513e2013c78.
         Activating swap /dev/disk/by-uuid/4fb070fa-c43b-4afc...7513e2013c78...
[  OK  ] Created slice system-ifup.slice.
         Starting LSB: Set console font and keymap...
         Starting Update UTMP about System Boot/Shutdown...
         Starting LSB: Raise network interfaces....
Adding 133116k swap on /dev/mmcblk0p5.  Priority:-1 extents:1 across:133116k SS
[  OK  ] Activated swap /dev/disk/by-uuid/4fb070fa-c43b-4afc-b443-7513e2013c78.
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target Swap.
[  OK  ] Started LSB: Set console font and keymap.
[  OK  ] Started LSB: Raise network interfaces..
         Starting ifup for eth0...
[  OK  ] Started ifup for eth0.
[  OK  ] Reached target Network.
[  OK  ] Reached target Network is Online.
         Starting LSB: RPC portmapper replacement...
[  OK  ] Started LSB: RPC portmapper replacement.
[  OK  ] Reached target RPC Port Mapper.
         Starting LSB: NFS support files common to client and server...
[  OK  ] Started LSB: NFS support files common to client and server.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Timers.
[  OK  ] Reached target Basic System.
         Starting OpenBSD Secure Shell server...
[  OK  ] Started OpenBSD Secure Shell server.
         Starting Deferred execution scheduler...
[  OK  ] Started Deferred execution scheduler.
         Starting Regular background program processing daemon...
[  OK  ] Started Regular background program processing daemon.
         Starting /etc/rc.local Compatibility...
         Starting Login Service...
         Starting LSB: exim Mail Transport Agent...
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
         Starting System Logging Service...
         Starting Permit User Sessions...
[  OK  ] Started /etc/rc.local Compatibility.
[FAILED] Failed to start Login Service.
See 'systemctl status systemd-logind.service' for details.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started System Logging Service.
         Stopping Login Service...
[  OK  ] Stopped Login Service.
         Starting Login Service...
         Starting Serial Getty on ttyAM0...
[  OK  ] Started Serial Getty on ttyAM0.
[  OK  ] Reached target Login Prompts.

Debian GNU/Linux 8 SIMONE ttyAM0

SIMONE login: