Building a kernel 3.x for the iMX233-OLinuXino

OLinuXino-MICRO with TP-LINK TL-WN821N (ath9k_htc)
Overview
This tutorial is based on https://github.com/koliqi/imx23-olinuxino.
Note
I will update this guide from time to time. If you want to keep an older version of this guide as reference then print it into an PDF file. I’ve tweaked the printing style of my blog a bit, so it should look pretty well. An example: Building a kernel 3.x for the iMX233-OLinuXino-v3.7.10.pdf, Building a kernel 3.x for the iMX233-OLinuXino-v3.9.4.pdf.
The cross compiler
You will need an ARM bare metal cross-compiler, I’m using the one from Launchpad:
- https://launchpad.net/gcc-arm-embedded/+download
- https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
Extract the tarball somewhere and add the compiler to the $PATH, e.g. edit your ~/.bashrc file and add a line like this:
export PATH=$PATH:$HOME/local/gcc-arm-none-eabi-4_7-2013q3/bin
[chris@thinkpad linux-stable]$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[chris@thinkpad linux-stable]$
You may also need to install some 32 bit libs if you are using a 64 bit OS, just execute arm-none-eabi-gcc --version then have a look at the error messages or use ldd to print the shared library dependencies and install the necessary packages.
[chris@thinkpad ~]$ ldd $(which arm-none-eabi-gcc)
linux-gate.so.1 => (0xf7779000)
libm.so.6 => /lib/libm.so.6 (0xf76f6000)
libc.so.6 => /lib/libc.so.6 (0x4a582000)
/lib/ld-linux.so.2 (0x4a55f000)
[chris@thinkpad ~]$
- Fedora: sudo yum install glibc.i686 libstdc++.i686 zlib.i686 ncurses-libs.i686
- Ubuntu: ...
Or use your package manager to try the compiler that your distribution ships:
- Fedora: sudo yum install arm-none-eabi-gcc-cs
- Ubuntu: ...
Getting the code
[chris@thinkpad OLinuXino]$ git clone https://github.com/koliqi/imx23-olinuxino
Cloning into 'imx23-olinuxino'...
remote: Counting objects: 72, done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 72 (delta 24), reused 62 (delta 14)
Unpacking objects: 100% (72/72), done.
[chris@thinkpad OLinuXino]$ cd imx23-olinuxino
[chris@thinkpad imx23-olinuxino]$ git fetch origin 3.12-rc2
From https://github.com/koliqi/imx23-olinuxino
* branch 3.12-rc2 -> FETCH_HEAD
[chris@thinkpad imx23-olinuxino]$ git checkout 3.12-rc2
Switched to branch '3.12-rc2'
[chris@thinkpad imx23-olinuxino]$
Get the kernel source:
[chris@thinkpad imx23-olinuxino]$ cd kernel
[chris@thinkpad kernel]$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Cloning into 'linux-stable'...
remote: Counting objects: 3000082, done.
remote: Compressing objects: 100% (469603/469603), done.
remote: Total 3000082 (delta 2521093), reused 2981126 (delta 2502295)
Receiving objects: 100% (3000082/3000082), 620.49 MiB | 624 KiB/s, done.
Resolving deltas: 100% (2521093/2521093), done.
Checking out files: 100% (41502/41502), done.
[chris@thinkpad kernel]$ cd linux-stable/
[chris@thinkpad linux-stable]$ gitk --all
[chris@thinkpad linux-stable]$
You can use gitk to visualize the commit history.
[chris@thinkpad linux-stable]$ git checkout master
Already on 'master'
[chris@thinkpad linux-stable]$ git pull
Already up-to-date.
[chris@thinkpad linux-stable]$ git checkout v3.12
Note: checking out 'v3.12'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 5e01dc7... Linux 3.12
[chris@thinkpad linux-stable]$
If you are not familiar with git or have a slow internet connection, you can get the stable kernel sources as zip file too (less than 90 MB):
[chris@thinkpad kernel]$ wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.12.tar.bz2
[chris@thinkpad kernel]$ tar xvjf linux-3.12.tar.bz2
[chris@thinkpad kernel]$ mv linux-3.12 linux-stable
Building the kernel
Patching the kernel
With Git you can easily view the differences between different kernel versions, for example the removable SD card patch is not longer necessary because broken-cd (broken chip detect) has been added to the device tree:
[chris@thinkpad linux-stable]$ git diff v3.9.4 v3.10.11 arch/arm/boot/dts/imx23-olinuxino.dts
diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts
index e7484e4..d107c4a 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -29,6 +29,7 @@
pinctrl-names = "default";
pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_pins_fixup>;
bus-width = <4>;
+ broken-cd;
status = "okay";
};
[chris@thinkpad linux-stable]$
Add i2c support:
[chris@thinkpad linux-stable]$ patch -p1 <../0001-ARM-imx23-olinuxino-Add-i2c-support.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
patching file arch/arm/boot/dts/imx23.dtsi
Hunk #1 succeeded at 306 with fuzz 2 (offset -1 lines).
Hunk #2 succeeded at 472 (offset -1 lines).
[chris@thinkpad linux-stable]$
To get a spi device we need to apply the following patch:
[chris@thinkpad linux-stable.git]$ curl -L http://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.12-rc3/0005-ARM-imx23-olinuxino-Add-spidev.patch/download -o 0005-ARM-imx23-olinuxino-Add-spidev.patch
[chris@thinkpad linux-stable.git]$ patch -p1 < 0005-ARM-imx23-olinuxino-Add-spidev.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
[chris@thinkpad linux-stable]$
Some I2C and SPI usage examples are available here: iMX233-OLinuXino: Current State.
If something goes wrong while patching you can use git-cola, which is a powerful git GUI, to revert any patch so you don’t have to download the kernel source again.
[chris@thinkpad linux-stable]$ git-cola
[chris@thinkpad linux-stable]$
Or use the command line:
[chris@thinkpad linux-stable]$ git clean -fd
Removing dotconfig
Removing drivers/staging/net/
Removing drivers/usb/otg/
[chris@thinkpad linux-stable]$ git reset --hard HEAD
HEAD is now at 85cdabb Linux 3.10.11
[chris@thinkpad linux-stable]$
Kernel configuration: built-in vs modular
Kernel modules are like drivers on Windows and you have two possibilities, either built them as loadable modules or compile them into the kernel, I have built them into the kernel, so that I don’t have to care about copying them to the rootfs.
Built-in vs modular
Most configuration options are tristate: they can be either not built at all, built directly into your kernel (*), or built as a module (M). Modules are stored externally on the filesystem, whereas built-in items are built directly into the kernel image itself.
There is an important difference between built-in and modular: with a few exceptions, the kernel makes no attempt whatsoever to load any external modules when you might need them (it is left up to the user). While certain other parts of the system may have load-on-demand facilities, and there are some automatic module loading utilities available, it is recommended that you build hardware support and kernel features directly into the kernel. The kernel can then ensure the functionality and hardware support is available whenever it needs it.
Of course, for some parts of the configuration, built-in is an absolute requirement. For example, if your root partition was an ext2 filesystem, your system would not boot if ext2 was built as a module (the system would have to look on the root partition to find the ext2 module, but it cannot look on the root partition unless it already has ext2 support loaded!).
Further reading: http://tldp.org/HOWTO/Module-HOWTO/
Configure the kernel
[chris@thinkpad linux-stable]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- mxs_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
[chris@thinkpad linux-stable]$
You can override the default configuration with my .config but this is not necessary:
[chris@thinkpad linux-stable]$ wget http://www.jann.cc/_downloads/dotconfig
[chris@thinkpad linux-stable]$ cp dotconfig .config
Run menuconfig to make some changes on the kernel configuration:
[chris@thinkpad linux-stable]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
Select Boot options ---> and select following options:
Boot options --->
[*] Use appended device tree blob to zImage (EXPERIMENTAL)
[*] Supplement the appended DTB with traditional ATAG information
Kernel command line type (Use bootloader kernel arguments if available) --->
() Default kernel command string
Change default kernel command string (not mandatory, gets overridden by bootlets or U-Boot):
Kernel command line type (Use bootloader kernel arguments if available) --->
(console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait) Default kernel command string
Kernel command line type (Use bootloader kernel arguments if available) --->
Networking Support:
[*] Networking support --->
[*] Wireless --->
--- Wireless
<*> cfg80211 - wireless configuration API
[ ] nl80211 testmode command (NEW)
[ ] enable developer warnings (NEW)
[ ] cfg80211 regulatory debugging (NEW)
[*] enable powersave by default (NEW)
[ ] cfg80211 DebugFS entries (NEW)
[*] cfg80211 wireless extensions compatibility
<*> Generic IEEE 802.11 Networking Stack (mac80211)
Default rate control algorithm (Minstrel) --->
[ ] Enable mac80211 mesh networking (pre-802.11s) support (NEW)
[*] Enable LED triggers
[ ] Export mac80211 internals in DebugFS (NEW)
[ ] Trace all mac80211 debug messages (NEW)
[ ] Select mac80211 debugging features (NEW) --->
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
<*> Atheros Wireless Cards --->
--- Atheros Wireless Cards
[ ] Atheros wireless debugging (NEW)
[*] Atheros bluetooth coexistence support (NEW)
<*> Atheros 802.11n wireless cards support
[ ] Atheros ath9k AHB bus support (NEW)
[ ] Atheros ath9k debugging (NEW)
[*] Atheros ath9k rate control (NEW)
<*> Atheros HTC based wireless cards support
[ ] Atheros ath9k_htc debugging (NEW)
< > Linux Community AR9170 802.11n USB support (NEW)
< > Atheros mobile chipsets support (NEW)
<*> Atheros AR5523 wireless driver support (NEW)
<*> Ralink driver support --->
--- Ralink driver support
<*> Ralink rt2500 (USB) support
<*> Ralink rt2501/rt73 (USB) support
<*> Ralink rt27xx/rt28xx/rt30xx (USB) support
[*] rt2800usb - Include support for rt33xx devices (NEW)
[*] rt2800usb - Include support for rt35xx devices (EXPERIMENTAL) (NEW)
[*] rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)
[ ] rt2800usb - Include support for unknown (USB) devices (NEW)
[ ] Ralink debug output (NEW)
<*> Realtek wireless card support
[*] Debugging output for rtlwifi driver family (NEW)
<*> Realtek rtlwifi family of devices (NEW) --->
--- Realtek rtlwifi family of devices
<*> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter
[ ] Debugging output for rtlwifi driver family
If you are using the iMX233-OLinuXino-MAXI the smsc95xx driver for the Ethernet device should be enabled:
Device Drivers --->
[*] Network device support --->
USB Network Adapters --->
<*> Multi-purpose USB Networking Framework
<*> SMSC LAN95XX based USB 2.0 10/100 ethernet devices
Enable GPIO and LED support in sysfs:
Device Drivers --->
-*- GPIO Support --->
[*] /sys/class/gpio/... (sysfs interface)
*** Memory mapped GPIO drivers: ***
<*> Generic memory-mapped GPIO controller support (MMIO platform device)
-*- LED Support --->
-*- LED Class Support
** LED drivers ***
<*> LED Support for GPIO connected LEDs
<*> PWM driven LED Support
-*- LED Trigger support
*** LED Triggers ***
<*> LED Timer Trigger
<*> LED One-shot Trigger
<*> LED Heartbeat Trigger
<*> LED backlight Trigger
[*] LED CPU Trigger
<*> LED GPIO Trigger
<*> LED Default ON Trigger
Enable support for USB 3G modems:
Device Drivers --->
[*] USB support --->
<*> USB Modem (CDC ACM) support
<*> USB Serial Converter support --->
[*] USB Generic Serial Driver
<*> USB driver for GSM and CDMA modems
[*] Network device support --->
<*> PPP (point-to-point protocol) support
<*> PPP support for async serial ports
Enable CGROUPS, AUTOFS4, FANOTIFY and DEVTMPFS (recommended for systemd):
General setup --->
[*] Control Group support --->
File systems --->
[*] Filesystem wide access notification
<*> Kernel automounter version 4 support (also supports v3)
Device Drivers --->
Generic Driver Options --->
[*] Maintain a devtmpfs filesystem to mount at /dev
[*] Automount devtmpfs at /dev, after the kernel mounted the rootfs
Webcam support:
Use lsusb to get the device id of your webcam, mine is 046d:08da, then google for 046D:08DA chipset, so I found out that my webcam uses the ZC0302 chipset and that I have to enable the ZC3XX USB Camera Driver.
Device Drivers --->
<*> Multimedia support --->
[*] Cameras/video grabbers support
[*] Media USB Adapters --->
<*> USB Video Class (UVC)
<*> GSPCA based webcams --->
# Select your device from the list or just everything
<*> ZC3XX USB Camera Driver // 046d:08da Logitech QuickCam
[*] V4L platform devices --->
Watchdog timer support:
Device Drivers --->
[*] Watchdog Timer Support --->
-*- WatchDog Timer Driver Core
<*> Software watchdog
<*> Freescale STMP3XXX & i.MX23/28 watchdog
You will also need to install a watchdog daemon [root@alarm ~]# pacman -Sy watchdog and configure it, have a look here.
I2C support:
Device Drivers --->
<*> I2C support --->
--- I2C support
<*> I2C device interface
I2C Hardware Bus support --->
*** I2C system bus drivers (mostly embedded / system-on-chip) ***
<*> GPIO-based bitbanging I2C
<*> Freescale i.MX28 I2C interface
[*] I2C Core debugging messages
[*] I2C Algorithm debugging messages
[*] I2C Bus debugging messages
SPI device driver support:
Device Drivers --->
[*] SPI support --->
--- SPI support
[*] Debug support for SPI drivers
*** SPI Master Controller Drivers ***
-*- Utilities for Bitbanging SPI masters
<*> GPIO-based bitbanging SPI Master
<*> Freescale MXS SPI controller
*** SPI Protocol Masters ***
<*> User mode SPI device driver support
Enable dynamic printk() support (CONFIG_DYNAMIC_DEBUG):
Kernel hacking --->
printk and dmesg options --->
[*] Enable dynamic printk() support
To avoid problems with dev-ttyAMA0.device under Arch Linux ARM like:
[ TIME ] Timed out waiting for device dev-ttyAMA0.device.
[DEPEND] Dependency failed for Serial Getty on ttyAMA0.
add CONFIG_FHANDLE to your kernel-configfile. It can be found using menuconfig the following way (credit):
General setup --->
[*] open by fhandle syscalls
Exit and save .config:
...
HOSTCC scripts/basic/fixdep
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
[chris@thinkpad linux-stable]$
Make a backup of your configuration for later use:
[chris@thinkpad linux-stable]$ cp .config ../dotconfig
[chris@thinkpad linux-stable]$
To be sure to built all modules directly into the kernel and not as loadable modules you can execute the following command: sed -i 's/=m/=y/g' .config and diff ../dotconfig .config to see what has changed.
Compile the kernel
[chris@thinkpad linux-stable]$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage modules
scripts/kconfig/conf --silentoldconfig Kconfig
WRAP arch/arm/include/generated/asm/auxvec.h
WRAP arch/arm/include/generated/asm/bitsperlong.h
WRAP arch/arm/include/generated/asm/cputime.h
WRAP arch/arm/include/generated/asm/current.h
WRAP arch/arm/include/generated/asm/emergency-restart.h
WRAP arch/arm/include/generated/asm/errno.h
WRAP arch/arm/include/generated/asm/exec.h
WRAP arch/arm/include/generated/asm/ioctl.h
...
CC arch/arm/boot/compressed/string.o
SHIPPED arch/arm/boot/compressed/fdt_rw.c
SHIPPED arch/arm/boot/compressed/fdt.h
SHIPPED arch/arm/boot/compressed/libfdt.h
SHIPPED arch/arm/boot/compressed/libfdt_internal.h
CC arch/arm/boot/compressed/fdt_rw.o
SHIPPED arch/arm/boot/compressed/fdt_ro.c
CC arch/arm/boot/compressed/fdt_ro.o
SHIPPED arch/arm/boot/compressed/fdt_wip.c
CC arch/arm/boot/compressed/fdt_wip.o
SHIPPED arch/arm/boot/compressed/fdt.c
CC arch/arm/boot/compressed/fdt.o
CC arch/arm/boot/compressed/atags_to_fdt.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
AS arch/arm/boot/compressed/lib1funcs.o
SHIPPED arch/arm/boot/compressed/ashldi3.S
AS arch/arm/boot/compressed/ashldi3.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 0 modules
[chris@thinkpad linux-stable]$
The Kernel is ready at arch/arm/boot/zImage.
Create device tree blob .dtb file
[chris@thinkpad linux-stable]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- imx23-olinuxino.dtb
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
DTC arch/arm/boot/dts/imx23-olinuxino.dtb
[chris@thinkpad linux-stable]$
Join zImage and imx23-olinuxino.dtb into a new file zImage_dtb
[chris@thinkpad linux-stable]$ cat arch/arm/boot/zImage arch/arm/boot/dts/imx23-olinuxino.dtb > arch/arm/boot/zImage_dtb
Note
If you want to repeat this procedure, start with clean-up:
[chris@thinkpad imx23-olinuxino]$ cd kernel/linux-stable/
[chris@thinkpad linux-stable]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- distclean
Bootlets
[chris@thinkpad linux-stable]$ cd ../../boot/elftosb-0.3/
[chris@thinkpad elftosb-0.3]$ sudo ln -s `pwd`/elftosb2 /usr/sbin/
[chris@thinkpad elftosb-0.3]$ which elftosb2
/usr/sbin/elftosb2
[chris@thinkpad elftosb-0.3]$
You can also build elftosb from source, have a look here.
[chris@thinkpad elftosb-0.3]$ cd ..
[chris@thinkpad boot]$ tar xzf imx-bootlets-src-10.05.02.tar.gz
[chris@thinkpad boot]$ cd imx-bootlets-src-10.05.02/
[chris@thinkpad imx-bootlets-src-10.05.02]$ patch -p1 < ../imx23_olinuxino_bootlets.patch
patching file linux.db
patching file linux_prep/board/imx23_olinuxino_dev.c
patching file linux_prep/cmdlines/imx23_olinuxino_dev.txt
patching file linux_prep/core/setup.c
patching file linux_prep/include/mx23/platform.h
patching file linux_prep/Makefile
patching file Makefile
patching file uboot.db
[chris@thinkpad imx-bootlets-src-10.05.02]$ cat linux_prep/cmdlines/imx23_olinuxino_dev.txt
noinitrd console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
noinitrd console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
noinitrd console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
[chris@thinkpad imx-bootlets-src-10.05.02]$ ln -s ../../kernel/linux-stable/arch/arm/boot/zImage_dtb ./zImage
[chris@thinkpad imx-bootlets-src-10.05.02]$ ls -l ./zImage
lrwxrwxrwx. 1 chris chris 52 Aug 23 12:27 ./zImage -> ../../kernel/linux-stable/arch/arm/boot/zImage_dtb
[chris@thinkpad imx-bootlets-src-10.05.02]$
If you have stability issues (kernel oops) on the iMX233-OLinuXino-MICRO edit the file boot_prep/init-mx23.c and set the EMI speed (dram clock) to 96MHz down from 133MHz, to do this you have to uncomment the line that says #define EMI_96M:
[chris@thinkpad imx-bootlets-src-10.05.02]$ vim boot_prep/init-mx23.c
[chris@thinkpad imx-bootlets-src-10.05.02]$ grep -i "#define EMI_96M" boot_prep/init-mx23.c
#define EMI_96M
[chris@thinkpad imx-bootlets-src-10.05.02]$
Or if you have a soldering iron you can remove R17, then it should run at full speed without kernel oops (msg363).
Build the bootlets:
[chris@thinkpad imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi- clean
rm -rf *.sb
rm -f sd_mmc_bootstream.raw
rm -f linux_prep/board/*.o
...
Files:
rm -f power_prep.o eabi.o
Build output:
make[1]: Leaving directory `/home/chris/tools/imx23-olinuxino/bootlets/imx-bootlets-src-10.05.02/power_prep'
[chris@thinkpad imx-bootlets-src-10.05.02]$
[chris@thinkpad imx-bootlets-src-10.05.02]$ make CROSS_COMPILE=arm-none-eabi-
by using the pre-build command line
# force building linux_prep
make clean -C linux_prep
make[1]: Entering directory `/home/chris/tools/imx23-olinuxino/boot/imx-bootlets-src-10.05.02/linux_prep'
Cleaning...
Files:
rm -rf ./core/entry.o ./core/resume.o ./core/cmdlines.o ./core/setup.o ./core/keys.o ./board/stmp378x_dev.o ./hw/lradc-buttons.o ./output-target/linux_prep.ld
Build output:
rm -rf ./output-target
Build system:
rm -rf ./include/arch
make[1]: Leaving directory `/home/chris/tools/imx23-olinuxino/boot/imx-bootlets-src-10.05.02/linux_prep'
cross-compiling linux_prep
make -C linux_prep ARCH=mx23 BOARD=imx23_olinuxino_dev
...
FILL | addr=0x00002c00 | len=0x00000018 | pattern=0x00000000
CALL | addr=0x00002000 | arg=0x00000000
LOAD | addr=0x40008000 | len=0x00384862 | crc=0x63a8934a
JUMP | addr=0x00002000 | arg=0x00000000
#@echo "generating U-Boot boot stream image"
#elftosb2 -z -c ./uboot_prebuilt.db -o imx23_uboot.sb
echo "generating kernel bootstream file sd_mmc_bootstream.raw"
generating kernel bootstream file sd_mmc_bootstream.raw
#Please use cfimager to burn xxx_linux.sb. The below way will no
#work at imx28 platform.
rm -f sd_mmc_bootstream.raw
dd if=/dev/zero of=sd_mmc_bootstream.raw bs=512 count=4
4+0 records in
4+0 records out
2048 bytes (2.0 kB) copied, 2.6967e-05 s, 75.9 MB/s
dd if=imx23_linux.sb of=sd_mmc_bootstream.raw ibs=512 seek=4 \
conv=sync,notrunc
7240+1 records in
7241+0 records out
3707392 bytes (3.7 MB) copied, 0.0153837 s, 241 MB/s
To install bootstream onto SD/MMC card, type: sudo dd if=sd_mmc_bootstream.raw of=/dev/sdXY where X is the correct letter for your sd or mmc device (to check, do a ls /dev/sd*) and Y is the partition number for the bootstream
[chris@thinkpad imx-bootlets-src-10.05.02]$
Prepare the SD card
1. Copy a current ARCH Linux ARM image to the SD card
I’m using the latest image from here: http://archlinuxarm.org/platforms/armv5/olinuxino, I’ve changed some configuration files and updated all packages, see also A new SD card image for the iMX233-OLinuXino.
[chris@thinkpad Downloads]$ gzip -d ArchLinuxARM-olinuxino-latest.img.gz [chris@thinkpad Downloads]$ sudo dd if=ArchLinuxARM-olinuxino-latest.img of=/dev/mmcblk0You can use nearly every image made for the OLinuXino, even a Debian image would be possible. The above image is a complete SD card image with 3 partitions, that means you don’t have to partition your SD card manually, just dd the image to the card. If you are using only a rootfs (root filesystem) you will have to create at least 2 partitions, one for the kernel /dev/mmcblk0p1 and one for the rootfs /dev/mmcblk0p2 and maybe a third as swap. The instructions to partition your SD card should be written there where you have downloaded your rootfs. You may also need to change the kernel command line string when using another image.
2. Modify the root filesystem
Now you have the chance to edit some configuration files or copy extra stuff to the SD card, just mount the second partition:
[chris@thinkpad ~]$ sudo mkdir /mnt/olinuxino/ [chris@thinkpad ~]$ sudo mount /dev/mmcblk0p2 /mnt/olinuxino/ [chris@thinkpad ~]$ sudo vim /mnt/olinuxino/root/led_blink [chris@thinkpad ~]$ cat /mnt/olinuxino/root/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 [chris@thinkpad ~]$If you have built some kernel modules as loadable modules (<M>) then you have to copy them to the SD card too:
[chris@thinkpad linux-stable]$ su -c "make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- INSTALL_MOD_PATH=/mnt/olinuxino modules_install" Password: INSTALL drivers/usb/gadget/g_cdc.ko INSTALL drivers/usb/gadget/g_acm_ms.ko INSTALL drivers/usb/gadget/g_hid.ko INSTALL drivers/usb/gadget/g_mass_storage.ko INSTALL drivers/usb/gadget/g_serial.ko INSTALL drivers/usb/gadget/libcomposite.ko INSTALL drivers/usb/gadget/u_ether.ko INSTALL drivers/usb/gadget/u_serial.ko INSTALL drivers/usb/gadget/usb_f_acm.ko INSTALL drivers/usb/gadget/usb_f_ecm.ko INSTALL drivers/usb/gadget/usb_f_obex.ko INSTALL drivers/usb/gadget/usb_f_serial.ko DEPMOD 3.12.0-00006-gc650f6b [chris@thinkpad linux-stable]$ ls /mnt/olinuxino/lib/modules/3.12.0-00006-gc650f6b/kernel/drivers/usb/gadget/ g_acm_ms.ko g_cdc.ko g_hid.ko g_mass_storage.ko g_serial.ko libcomposite.ko u_ether.ko usb_f_acm.ko usb_f_ecm.ko usb_f_obex.ko usb_f_serial.ko u_serial.ko [chris@thinkpad linux-stable]$Then umount the SD card:
[chris@thinkpad ~]$ sudo umount /mnt/olinuxino
3. Copy the kernel to the SD card
Now we are overriding the default kernel from our SD card image with our newly create one. The only problem that I can see here is that your first partition must be large enough for the kernel else you would also override the second partition.
[chris@thinkpad imx-bootlets-src-10.05.02]$ sudo dd if=sd_mmc_bootstream.raw of=/dev/mmcblk0p1 8678+0 records in 8678+0 records out 4443136 bytes (4.4 MB) copied, 1.63538 s, 2.7 MB/s [chris@thinkpad imx-bootlets-src-10.05.02]$I’ve uploaded my kernel here: https://sourceforge.net/projects/janncc/files/olinuxino/kernel/
[root@alarm ~]# uname -r 3.12.0-dirty [root@alarm ~]#The -dirty tag means that the working tree contains modifications which have not been committed to the current git branch (v3.12), e.g. the patches from above.
If you have a working network connection on your OLinuXino then you can also download and install the new kernel directly on it:
[root@olinuxino ~]# curl -L http://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.12/sd_mmc_bootstream.raw/download -o sd_mmc_bootstream.raw [root@olinuxino ~]# dd if=sd_mmc_bootstream.raw of=/dev/mmcblk0p1 8678+0 records in 8678+0 records out 4443136 bytes (4.4 MB) copied, 1.63538 s, 2.7 MB/s [root@olinuxino ~]#
Booting (Systemd)
[chris@thinkpad ~]$ minicom oli
Welcome to minicom 2.6.2
OPTIONS: I18n
Compiled on Feb 7 2013, 12:53:19.
Port /dev/ttyUSB0, 17:12:24
Press CTRL-A Z for help on special keys
HTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFC
PowerPrep start initialize power...
Battery Voltage = 0.68V
No battery or bad battery detected!!!.Disabling battery voltage measurements./6
EMI_CTRL 0x1C084040
FRAC 0x92926192
init_ddr_mt46v32m16_133Mhz
power 0x00820710
Frac 0x92926192
start change cpu freq
hbus 0x00000003
cpu 0x00010001
LLLLLLLFCLJ[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.10.11-dirty (chris@thinkpad) (gcc version 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615] (GNU Tools3
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: Freescale MXS (Device Tree), model: i.MX23 Olinuxino Low Cost Board
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: noinitrd console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 64MB = 64MB total
[ 0.000000] Memory: 50856k/50856k available, 14680k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xc4800000 - 0xff000000 ( 936 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc07ba0f0 (7881 kB)
[ 0.000000] .init : 0xc07bb000 - 0xc08009d0 ( 279 kB)
[ 0.000000] .data : 0xc0802000 - 0xc0855a30 ( 335 kB)
[ 0.000000] .bss : 0xc0855a30 - 0xc0db7f08 (5514 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] of_irq_init: children remain, but no parents
[ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[ 0.000000] ... MAX_LOCKDEP_SUBCLASSES: 8
[ 0.000000] ... MAX_LOCK_DEPTH: 48
[ 0.000000] ... MAX_LOCKDEP_KEYS: 8191
[ 0.000000] ... CLASSHASH_SIZE: 4096
[ 0.000000] ... MAX_LOCKDEP_ENTRIES: 16384
[ 0.000000] ... MAX_LOCKDEP_CHAINS: 32768
[ 0.000000] ... CHAINHASH_SIZE: 16384
[ 0.000000] memory used by lock dependency info: 3695 kB
[ 0.000000] per task-struct memory footprint: 1152 bytes
[ 0.060000] Calibrating delay loop... 227.32 BogoMIPS (lpj=1136640)
[ 0.070000] pid_max: default: 32768 minimum: 301
[ 0.070000] Mount-cache hash table entries: 512
[ 0.080000] CPU: Testing write buffer coherency: ok
[ 0.080000] Setting up static identity map for 0xc05675d0 - 0xc0567628
[ 0.090000] devtmpfs: initialized
[ 0.110000] pinctrl core: initialized pinctrl subsystem
[ 0.110000] regulator-dummy: no parameters
[ 0.120000] NET: Registered protocol family 16
[ 0.120000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.170000] Serial: AMBA PL011 UART driver
[ 0.180000] 80070000.serial: ttyAMA0 at MMIO 0x80070000 (irq = 17) is a PL011 rev2
[ 0.360000] console [ttyAMA0] enabled
[ 0.410000] bio: create slab <bio-0> at 0
[ 0.420000] mxs-dma 80004000.dma-apbh: initialized
[ 0.430000] mxs-dma 80024000.dma-apbx: initialized
[ 0.440000] usb0_vbus: 5000 mV
[ 0.440000] SCSI subsystem initialized
[ 0.450000] usbcore: registered new interface driver usbfs
[ 0.450000] usbcore: registered new interface driver hub
[ 0.460000] usbcore: registered new device driver usb
[ 0.460000] Linux video capture interface: v2.00
[ 0.470000] pps_core: LinuxPPS API ver. 1 registered
[ 0.470000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.480000] PTP clock support registered
[ 0.480000] Advanced Linux Sound Architecture Driver Initialized.
[ 0.500000] Switching to clocksource mxs_timer
[ 0.510000] cfg80211: Calling CRDA to update world regulatory domain
[ 0.800000] FS-Cache: Loaded
[ 0.810000] CacheFiles: Loaded
[ 0.880000] NET: Registered protocol family 2
[ 0.890000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.900000] TCP bind hash table entries: 512 (order: 2, 18432 bytes)
[ 0.900000] TCP: Hash tables configured (established 512 bind 512)
[ 0.910000] TCP: reno registered
[ 0.920000] UDP hash table entries: 256 (order: 2, 20480 bytes)
[ 0.920000] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[ 0.930000] NET: Registered protocol family 1
[ 0.940000] RPC: Registered named UNIX socket transport module.
[ 0.950000] RPC: Registered udp transport module.
[ 0.950000] RPC: Registered tcp transport module.
[ 0.960000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.960000] NetWinder Floating Point Emulator V0.97 (double precision)
[ 1.060000] NFS: Registering the id_resolver key type
[ 1.060000] Key type id_resolver registered
[ 1.070000] Key type id_legacy registered
[ 1.070000] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 1.080000] msgmni has been set to 99
[ 1.110000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 1.120000] io scheduler noop registered (default)
[ 1.130000] of_dma_request_slave_channel: dma-names property missing or empty
[ 1.140000] uart-pl011 80070000.serial: no DMA platform data
[ 1.140000] 8006c000.serial: ttyAPP0 at MMIO 0x8006c000 (irq = 136) is a 8006c000.serial
[ 1.150000] mxs-auart 8006c000.serial: Found APPUART 3.0.0
[ 1.180000] PPP generic driver version 2.4.2
[ 1.190000] usbcore: registered new interface driver rt2500usb
[ 1.190000] usbcore: registered new interface driver rt73usb
[ 1.200000] usbcore: registered new interface driver rt2800usb
[ 1.210000] usbcore: registered new interface driver ath9k_htc
[ 1.210000] usbcore: registered new interface driver ar5523
[ 1.220000] usbcore: registered new interface driver asix
[ 1.220000] usbcore: registered new interface driver ax88179_178a
[ 1.230000] usbcore: registered new interface driver cdc_ether
[ 1.240000] usbcore: registered new interface driver smsc95xx
[ 1.240000] usbcore: registered new interface driver net1080
[ 1.250000] usbcore: registered new interface driver cdc_subset
[ 1.260000] usbcore: registered new interface driver zaurus
[ 1.260000] usbcore: registered new interface driver cdc_ncm
[ 1.270000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.280000] usbcore: registered new interface driver cdc_acm
[ 1.280000] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 1.290000] usbcore: registered new interface driver usb-storage
[ 1.300000] usbcore: registered new interface driver usbserial
[ 1.300000] usbcore: registered new interface driver usbserial_generic
[ 1.310000] usbserial: USB Serial support registered for generic
[ 1.320000] usbcore: registered new interface driver option
[ 1.320000] usbserial: USB Serial support registered for GSM modem (1-port)
[ 1.330000] imx_usb 80080000.usb: pinctrl get/select failed, err=-19
[ 1.340000] ci_hdrc ci_hdrc.0: doesn't support gadget
[ 1.350000] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 1.360000] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 1.390000] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 1.400000] hub 1-0:1.0: USB hub found
[ 1.410000] hub 1-0:1.0: 1 port detected
[ 1.420000] mousedev: PS/2 mouse device common for all mice
[ 1.430000] stmp3xxx-rtc 8005c000.rtc: rtc core: registered 8005c000.rtc as rtc0
[ 1.440000] i2c /dev entries driver
[ 1.440000] usbcore: registered new interface driver uvcvideo
[ 1.450000] USB Video Class driver (1.1.1)
[ 1.450000] gspca_main: v2.14.0 registered
[ 1.460000] usbcore: registered new interface driver gspca_zc3xx
[ 1.470000] stmp3xxx_rtc_wdt stmp3xxx_rtc_wdt: initialized watchdog with heartbeat 19s
[ 1.480000] softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)
[ 1.530000] mxs-mmc 80010000.ssp: initialized
[ 1.540000] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.560000] usbcore: registered new interface driver usbhid
[ 1.560000] usbhid: USB HID core driver
[ 1.580000] TCP: cubic registered
[ 1.590000] NET: Registered protocol family 17
[ 1.590000] mmc0: host does not support reading read-only switch. assuming write-enable.
[ 1.600000] Key type dns_resolver registered
[ 1.610000] mmc0: new high speed SDHC card at address 1234
[ 1.620000] registered taskstats version 1
[ 1.630000] mmcblk0: mmc0:1234 SA04G 3.63 GiB
[ 1.640000] stmp3xxx-rtc 8005c000.rtc: setting system clock to 1970-01-01 00:00:04 UTC (4)
[ 1.670000] mmcblk0: p1 p2 p3
[ 1.690000] ALSA device list:
[ 1.700000] No soundcards found.
[ 12.450000] kjournald starting. Commit interval 5 seconds
[ 13.160000] EXT3-fs (mmcblk0p2): using internal journal
[ 13.170000] EXT3-fs (mmcblk0p2): recovery complete
[ 13.170000] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
[ 13.180000] VFS: Mounted root (ext3 filesystem) on device 179:2.
[ 13.200000] devtmpfs: mounted
[ 13.200000] Freeing unused kernel memory: 276K (c07bb000 - c0800000)
[ 13.780000] systemd[1]: systemd 204 running in system mode. (+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Welcome to Arch Linux ARM!
[ 13.850000] systemd[1]: Failed to insert module 'ipv6'
[ 13.860000] systemd[1]: Set hostname to <olinuxino>.
[ 14.650000] systemd[1]: Cannot add dependency job for unit netcfg.service, ignoring: Unit netcfg.service failed to load: No such file or directory..
[ 14.670000] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such .
[ 14.690000] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[ 14.710000] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 14.720000] systemd[1]: Expecting device dev-ttyAMA0.device...
Expecting device dev-ttyAMA0.device...
[ 14.750000] systemd[1]: Expecting device dev-ttyAPP1.device...
Expecting device dev-ttyAPP1.device...
[ 14.780000] systemd[1]: Expecting device dev-ttyAPP0.device...
Expecting device dev-ttyAPP0.device...
[ 14.810000] systemd[1]: Starting Remote File Systems.
[ OK ] Reached target Remote File Systems.
[ 14.840000] systemd[1]: Reached target Remote File Systems.
[ 14.840000] systemd[1]: Starting Syslog Socket.
[ OK ] Listening on Syslog Socket.
[ 14.870000] systemd[1]: Listening on Syslog Socket.
[ 14.870000] systemd[1]: Starting LVM2 metadata daemon socket.
[ OK ] Listening on LVM2 metadata daemon socket.
[ 14.900000] systemd[1]: Listening on LVM2 metadata daemon socket.
[ 14.900000] systemd[1]: Starting Delayed Shutdown Socket.
[ OK ] Listening on Delayed Shutdown Socket.
[ 14.930000] systemd[1]: Listening on Delayed Shutdown Socket.
[ 14.930000] systemd[1]: Starting Device-mapper event daemon FIFOs.
[ OK ] Listening on Device-mapper event daemon FIFOs.
[ 14.970000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[ 14.970000] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[ OK ] Listening on /dev/initctl Compatibility Named Pipe.
[ 15.010000] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[ 15.020000] systemd[1]: Starting udev Kernel Socket.
[ OK ] Listening on udev Kernel Socket.
[ 15.050000] systemd[1]: Listening on udev Kernel Socket.
[ 15.050000] systemd[1]: Starting udev Control Socket.
[ OK ] Listening on udev Control Socket.
[ 15.080000] systemd[1]: Listening on udev Control Socket.
[ 15.080000] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.
[ 15.090000] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[ 15.100000] systemd[1]: Starting Paths.
[ OK ] Reached target Paths.
[ 15.130000] systemd[1]: Reached target Paths.
[ 15.130000] systemd[1]: Starting Journal Socket.
[ OK ] Listening on Journal Socket.
[ 15.160000] systemd[1]: Listening on Journal Socket.
[ 15.160000] systemd[1]: Starting Create static device nodes in /dev...
Starting Create static device nodes in /dev...
[ 15.220000] systemd[1]: Starting udev Coldplug all Devices...
Starting udev Coldplug all Devices...
[ 15.290000] systemd[1]: Mounted POSIX Message Queue File System.
[ 15.310000] systemd[1]: Starting Journal Service...
Starting Journal Service...
[ OK ] Started Journal Service.
[ 15.400000] systemd[1]: Started Journal Service.
[ 15.400000] systemd[1]: Starting Encrypted Volumes.
[ OK ] Reached target Encrypted Volumes.
[ 15.440000] systemd[1]: Reached target Encrypted Volumes.
[ 15.460000] systemd[1]: Starting Apply Kernel Variables...
Starting Apply Kernel Variables...
[ 15.690000] systemd[1]: Started Load Kernel Modules.
[ 15.710000] systemd[1]: Mounted FUSE Control File System.
[ 15.710000] systemd[1]: Mounted Configuration File System.
[ 15.780000] systemd[1]: Starting Setup Virtual Console...
Starting Setup Virtual Console...
[ 15.850000] systemd[1]: Mounted Huge Pages File System.
[ 15.890000] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 15.970000] systemd[1]: Started Set Up Additional Binary Formats.
[ 15.990000] systemd[1]: Mounting Debug File System...
Mounting Debug File System...
[ 16.070000] systemd[1]: Starting Swap.
[ OK ] Reached target Swap.
[ 16.100000] systemd[1]: Reached target Swap.
[ 16.100000] systemd[1]: Started File System Check on Root Device.
[ 16.130000] systemd[1]: Starting Remount Root and Kernel File Systems...
Starting Remount Root and Kernel File Systems...
[ 16.220000] systemd[1]: Mounting Temporary Directory...
Mounting Temporary Directory...
[ OK ] Started Create static device nodes in /dev.
[ 16.670000] systemd[1]: Started Create static device nodes in /dev.
[ OK ] Started Apply Kernel Variables.
[ 16.760000] systemd[1]: Started Apply Kernel Variables.
[ OK ] Mounted Debug File System.
[ 16.820000] systemd[1]: Mounted Debug File System.
[ OK ] Started Remount Root and Kernel File Systems.
[ 16.900000] systemd[1]: Started Remount Root and Kernel File Systems.
[ 16.900000] systemd[1]: Starting Load Random Seed...
Starting Load Random Seed...
[ 17.030000] systemd[1]: Starting udev Kernel Device Manager...
Starting udev Kernel Device Manager...
[ OK ] Mounted Temporary Directory.
[ 17.530000] systemd-udevd[68]: starting version 204
[ OK ] Started 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 Trigger Flushing of Journal to Persistent Storage.
[ OK ] Started Recreate Volatile Files and Directories.
Starting Update UTMP about System Reboot/Shutdown...
[ OK ] Started Setup Virtual Console.
[ OK ] Started Update UTMP about System Reboot/Shutdown.
[ OK ] Started udev Coldplug all Devices.
[ 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 OpenNTP Daemon...
Starting System Logger Daemon...
[ OK ] Started System Logger Daemon.
Starting /etc/rc.local Compatibility...
Starting Periodic Command Scheduler...
[ OK ] Started Periodic Command Scheduler.
Starting OpenSSH Daemon...
[ OK ] Started OpenSSH Daemon.
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 ] Found device /dev/ttyAPP0.
Starting Serial Getty on ttyAPP0...
[ OK ] Started Serial Getty on ttyAPP0.
[ OK ] Found device /dev/ttyAMA0.
Starting Serial Getty on ttyAMA0...
[ OK ] Started Serial Getty on ttyAMA0.
[ OK ] Started /etc/rc.local Compatibility.
[ OK ] Started Login Service.
Arch Linux 3.10.11-dirty (ttyAMA0)
olinuxino login: [ OK ] Started OpenNTP Daemon.
[ TIME ] Timed out waiting for device dev-ttyAPP1.device.
[DEPEND] Dependency failed for Serial Getty on ttyAPP1.
[ OK ] Reached target Login Prompts.
[ OK ] Reached target Multi-User System.
[ OK ] Reached target Graphical Interface.
Arch Linux 3.10.11-dirty (ttyAMA0)
olinuxino login: root
Password:
Last login: Wed Dec 31 18:01:05 on ttyAPP0
[root@olinuxino ~]# cat /proc/version
Linux version 3.10.11-dirty (chris@thinkpad) (gcc version 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615] (GNU Tools for ARM Embedd3
[root@olinuxino ~]#
Testing a USB WiFi device
TP-LINK TL-WN821N (ath9k_htc)

TP-LINK TL-WN821N (ath9k_htc)
Plug it in:
[root@alarm ~]# uname -r
3.7.0-rc3-23170-g89e4757
[root@alarm ~]#
[ 124.780000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 124.950000] usb 1-1: ath9k_htc: Firmware htc_7010.fw requested
[ 125.280000] usb 1-1: ath9k_htc: Transferred FW: htc_7010.fw, size: 72992
[ 125.360000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 45 credits
[ 125.810000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[ 125.870000] ieee80211 phy0: Atheros AR9287 Rev:2
[root@alarm ~]# lsusb
Bus 001 Device 002: ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@alarm ~]# tail /var/log/messages.log
Dec 31 18:00:43 alarm kernel: [ 11.830000] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
Dec 31 18:00:43 alarm kernel: [ 11.840000] VFS: Mounted root (ext3 filesystem) on device 179:2.
Dec 31 18:00:43 alarm kernel: [ 11.850000] Freeing init memory: 140K
Dec 31 18:00:43 alarm [ 21.320000] systemd-udevd[63]: starting version 186
Dec 31 18:02:06 alarm kernel: [ 124.780000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
Dec 31 18:02:07 alarm kernel: [ 124.950000] usb 1-1: ath9k_htc: Firmware htc_7010.fw requested
Dec 31 18:02:07 alarm kernel: [ 125.280000] usb 1-1: ath9k_htc: Transferred FW: htc_7010.fw, size: 72992
Dec 31 18:02:07 alarm kernel: [ 125.360000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 45 credits
Dec 31 18:02:08 alarm kernel: [ 125.810000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
Dec 31 18:02:08 alarm kernel: [ 125.870000] ieee80211 phy0: Atheros AR9287 Rev:2
[root@alarm ~]#
[root@alarm ~]# dmesg |tail -n 15
[ 11.850000] Freeing init memory: 140K
[ 21.320000] systemd-udevd[63]: starting version 186
[ 124.780000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 124.950000] usb 1-1: ath9k_htc: Firmware htc_7010.fw requested
[ 125.280000] usb 1-1: ath9k_htc: Transferred FW: htc_7010.fw, size: 72992
[ 125.360000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 45 credits
[ 125.810000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[ 125.820000] ath: EEPROM regdomain: 0x809c
[ 125.820000] ath: EEPROM indicates we should expect a country code
[ 125.820000] ath: doing EEPROM country->regdmn map search
[ 125.820000] ath: country maps to regdmn code: 0x52
[ 125.820000] ath: Country alpha2 being used: CN
[ 125.820000] ath: Regpair used: 0x52
[ 125.870000] ieee80211 phy0: Atheros AR9287 Rev:2
[ 125.910000] Registered led device: ath9k_htc-phy0
[root@alarm ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 metric 1
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 4 bytes 260 (260.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 260 (260.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@alarm ~]# 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@alarm ~]#
Setting up a WiFi connection
- Create a shared WiFi connection on your laptop:
- Configure the WiFi connection on the OlinuXino:
[root@alarm ~]# ifconfig wlan0 down [root@alarm ~]# iwconfig wlan0 mode ad-hoc [root@alarm ~]# iwconfig wlan0 channel 4 [root@alarm ~]# iwconfig wlan0 essid tuxnet [root@alarm ~]# iwconfig wlan0 key 73598253812539275395295235 [root@alarm ~]# ifconfig wlan0 up [ 1516.620000] wlan0: Trigger new scan to find an IBSS to join [root@alarm ~]# [ 1519.000000] wlan0: Trigger new scan to find an IBSS to join [ 1522.000000] wlan0: Trigger new scan to find an IBSS to join [ 1524.000000] wlan0: Creating new IBSS network, BSSID a2:1c:4f:5c:ef:c4 [root@alarm ~]# dhcpcd wlan0 dhcpcd[237]: version 5.5.6 starting dhcpcd[237]: all: not configured to accept IPv6 RAs dhcpcd[237]: wlan0: broadcasting for a lease dhcpcd[237]: wlan0: offered 10.42.0.48 from 10.42.0.1 dhcpcd[237]: wlan0: acknowledged 10.42.0.48 from 10.42.0.1 dhcpcd[237]: wlan0: checking for 10.42.0.48 dhcpcd[237]: wlan0: leased 10.42.0.48 for 3600 seconds dhcpcd[237]: forked to background, child pid 263 [root@alarm ~]# ping google.de PING google.de (173.194.66.94) 56(84) bytes of data. 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=1 ttl=47 time=404 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=2 ttl=47 time=293 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=3 ttl=47 time=322 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=4 ttl=47 time=340 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=5 ttl=47 time=329 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=6 ttl=47 time=319 ms 64 bytes from we-in-f94.1e100.net (173.194.66.94): icmp_req=7 ttl=47 time=336 ms --- google.de ping statistics --- 7 packets transmitted, 7 received, 0% packet loss, time 6008ms rtt min/avg/max/mdev = 293.687/335.357/404.750/31.696 ms [root@alarm ~]#Another possibility to configure your wireless network is wifi-menu, it ships with netcfg pacman -S netcfg dialog wpa_supplicant, it scans for available networks, just select one and enter your password.
Often wifi-menu fails to connect in the first try but succeeds the second time, so try it at least two times. For an example to connect automatically to a WPA2 secured network see here: Connect automatically to a WiFi network.
LogiLink WL0084B (rt2800usb)

LogiLink WL0084B (rt2800usb)
This WiFi device still makes some problems:
[root@alarm ~]#
[ 2450.670000] usb 1-1: new high-speed USB device number 3 using ci_hdrc
[ 2450.920000] phy1 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0580 with err.
[ 2450.930000] phy1 -> rt2800_init_eeprom: Error - Invalid RT chipset 0xc3a8 detected.
[ 2450.940000] phy1 -> rt2x00lib_probe_dev: Error - Failed to allocate device.
[ 2450.960000] usb 1-1: USB disconnect, device number 3
[ 2451.260000] usb 1-1: new high-speed USB device number 4 using ci_hdrc
[ 2451.510000] phy2 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0580 with err.
[ 2451.520000] phy2 -> rt2800_init_eeprom: Error - Invalid RT chipset 0xc3a8 detected.
[ 2451.530000] phy2 -> rt2x00lib_probe_dev: Error - Failed to allocate device.
[ 2451.550000] usb 1-1: USB disconnect, device number 4
[ 2451.850000] usb 1-1: new high-speed USB device number 5 using ci_hdrc
[ 2452.100000] phy3 -> rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0580 with err.
[ 2452.110000] phy3 -> rt2800_init_eeprom: Error - Invalid RT chipset 0xc3a8 detected.
[ 2452.120000] phy3 -> rt2x00lib_probe_dev: Error - Failed to allocate device.
[ 2452.140000] usb 1-1: USB disconnect, device number 5
...
This device uses the Ralink RT5370 chipset and is working out-of-the-box on my laptop, so it should be possible to get it working.
[chris@thinkpad ~]$ cat /etc/redhat-release
Fedora release 17 (Beefy Miracle)
[chris@thinkpad ~]$ uname -r
3.6.10-2.fc17.x86_64
[chris@thinkpad ~]$ lsusb |grep Ralink
Bus 001 Device 010: ID 148f:5370 Ralink Technology, Corp.
[chris@thinkpad ~]$
Since guanx has mentioned it in the comments I’ve tried the WL0084B with a USB hub and it works:
[root@alarm ~]#
[ 159.050000] usb 1-1: new high-speed USB device number 10 using ci_hdrc
[ 159.290000] usb 1-1: device descriptor read/all, error -71
[ 159.360000] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 206.390000] usb 1-1: new high-speed USB device number 12 using ci_hdrc
[ 206.540000] hub 1-1:1.0: USB hub found
[ 206.560000] hub 1-1:1.0: 4 ports detected
[ 250.280000] usb 1-1.4: new high-speed USB device number 13 using ci_hdrc
[ 250.500000] usb 1-1.4: reset high-speed USB device number 13 using ci_hdrc
[ 250.660000] phy8 -> rt2x00_set_chip: Info - Chipset detected - rt: 5390, rf: 5370, rev: 0502.
[ 250.670000] ieee80211 phy8: Selected rate control algorithm 'minstrel_ht'
[ 250.690000] phy8 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'.
[ 250.700000] Registered led device: rt2800usb-phy8::radio
[ 250.710000] Registered led device: rt2800usb-phy8::assoc
[ 250.720000] Registered led device: rt2800usb-phy8::quality
[ 253.110000] phy8 -> rt2x00lib_request_firmware: Info - Firmware detected - version: 0.33.
[ 253.990000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[ 254.010000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[ 254.030000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[ 254.050000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 2, TXop: 0.
[root@alarm ~]# sh wconfig
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 4
iwconfig wlan0 essid tuxnet
iwconfig wlan0 key 73598253812539275395295235
ifconfig wlan0 up
[ 1003.540000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 2, CWmax: 3, Aifs: 2, TXop: 47.
[ 1003.560000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 94.
[ 1003.580000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 4, CWmax: 10, Aifs: 3, TXop: 0.
[ 1003.600000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 4, CWmax: 10, Aifs: 7, TXop: 0.
[ 1003.690000] wlan0: Selected IBSS BSSID 16:da:e7:1c:a6:67 based on configured SSID
dhcpcd wlan0
dhcpcd[340]: sending commands to master dhcpcd process
[ 1003.810000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 2, CWmax: 3, Aifs: 2, TXop: 47.
[root@alarm ~]#
[ 1003.830000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 94.
[ 1003.850000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 4, CWmax: 10, Aifs: 3, TXop: 0.
[ 1003.870000] phy8 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 4, CWmax: 10, Aifs: 7, TXop: 0.
[root@alarm ~]# ping google.de
PING google.de (74.125.230.248) 56(84) bytes of data.
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=1 ttl=53 time=55.6 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=2 ttl=53 time=213 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=3 ttl=53 time=53.8 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=4 ttl=53 time=62.0 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=5 ttl=53 time=60.2 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=6 ttl=53 time=58.5 ms
64 bytes from par08s10-in-f24.1e100.net (74.125.230.248): icmp_seq=7 ttl=53 time=56.5 ms
--- google.de ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6008ms
rtt min/avg/max/mdev = 53.875/80.093/213.750/54.627 ms
[root@alarm ~]# 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 73598253812539275395295235
ifconfig wlan0 up
dhcpcd wlan0
[root@alarm ~]#
But then I don’t need such a small WiFi adapter the hub is larger than the OLinuXino )-;
I will test it with a scope, maybe a bigger capacitor will do it, the power supply was already a strong 5.0 A device.
EDIMAX EW-7811UN (rtl8192cu)

EDIMAX EW-7811UN (rtl8192cu)
This adapter is also really tiny and works without problems.
References/Further Reading
- A new SD card image for the iMX233-OLinuXino
- iMX233-OLinuXino: Current State
- U-Boot for the iMX233-OLinuXino
- Arch Linux ARM: Network tools missing
- http://www.eewiki.net/display/linuxonarm/iMX233-OLinuXino
- http://g-lab.ca/building-a-kernel-3-12-rc2-for-the-imx23-olinuxino/
- PKGBUILDs: https://github.com/archlinuxarm/PKGBUILDs/tree/e34f592ccb9ac1b4f01361ee21bf62efc1c00678/core/linux-olinuxino
Last updated: 2014-11-12