Twitter E-mail RSS
formats

u-boot bootloader for imx23-olinuxino board

I. Software and Hardware Prerequisite

1.1 Software Prerequisite

GNU cross compiler for ARM processors and git. On Debian distributions install as:

$: sudo apt-get install gcc-arm-linux-gnueabi
$: sudo apt-get install git

1.2 Hardware Prerequisite

SD card with two partitions:

  • the first one for the u-boot
  • the second one for the root filesystem which can fill the rest of the available space

Mark the first partition with the partition ID “53”. Please refer to: Building SD card
On second partition make filesystem of your choise (ext3, ext4..), mount it and copy all required
rootfs data and programs into it.

Kernel and other files used by u-boot will go on directory /boot of rootfs in second partition.

II. Building a kernel 3.x from sources

Download kernel sources:

$: git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

Switch into directory linux-stable to configure and build kernel. See also: building a kernel 3.x for olinuxino

$: cd linux-stable

2.1 Configure kernel

Start from supplied default mxs_defconfig configuration:

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mxs_defconfig
$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig

Select `Boot options —> and make sure Use appended device tree blob to zImage option is not selected:

Boot options —->

-*- Flattened Device Tree support
(0) Compressed ROM boot loader base address
(0) Compressed ROM boot loader BSS address
[ ] Use appended device tree blob to zImage (EXPERIMENTAL)
(console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait) Default kernel command string

Enable driver’s you my need and save configuration and exit.

2.2 Compile kernel

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules

Kernel is ready at arch/arm/boot/uImage.

2.3 Create device tree blob file

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- imx23-olinuxino.dtb

2.4 Install kernel and modules on rootfs

Insert SD card on card reader and mount rootfs partition (/dev/sdb2 in our case) on host’s directory /mnt:

$: sudo mount /dev/sdb2 /mnt
$: ls /mnt

Should be listed rootfs, something like this:

bin dev home lost+found mnt sbin tmp var boot etc lib media proc sys usr

Install kernel, device tree blob file and modules on SD card:

$: sudo cp -a arch/arm/boot/zImage /mnt/boot/
$: sudo mkdir -p /mnt/boot/dts
$: sudo cp -a arch/arm/boot/dts/imx23-olinuxino.dtb /mnt/boot/dts/
$: sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/mnt

U-Boot environment variables are stored on a plain text file named uEnv.txt. uEnv.txt can be stored on SD card. Using your editor, create file uEnv.txt with following content:

#These are the default settings for some useful u-boot variables:
fdt_file=/boot/dts/imx23-olinuxino.dtb
#optargs=
mmcroot=/dev/mmcblk0p2 ro
mmcrootfstype=ext3 rootwait fixrtc

copy uEnv.txt on SD card and exit from kernel directory:

$: sudo cp ./uEnv.txt /mnt/boot/
$: sync
$: sudo umount /mnt
$: cd ../

III. Building u-boot from sources

Compile process for u-boot is depend on the “elftosb” tool. Obtain the elftosb archive, extract and compile:

$: wget ftp://ftp.denx.de/pub/tools/elftosb-10.12.01.tar.gz
$: tar xzf elftosb-10.12.01.tar.gz
$: cd elftosb-10.12.01/
$: make LIBS=”-lstdc++ -lm” elftosb

To install elftosb tool, copy binary to the your $PATH:

$: sudo cp bld/linux/elftosb /usr/local/bin/
$: cd ../

Next, download u-boot and switch into u-boot directory:

$: git clone git://git.denx.de/u-boot.git
$: cd u-boot

We want SD with two partition and kernel to be stored on second partiton in /boot directory. This is fixed with
following patch. Download and apply patch:

$: wget https://raw.github.com/eewiki/u-boot-patches/master/v2013.07/0001-mx23_olinuxino-uEnv.txt-bootz-n-fixes.patch
$: patch -p1 < 0001-mx23_olinuxino-uEnv.txt-bootz-n-fixes.patch

Now, configure and build u-boot:

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mx23_olinuxino_config
$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 u-boot.sb

Flash the u-boot binary into the SD card:

$: sudo dd if=u-boot.sb of=/dev/sdb1 bs=512 seek=4

Last step is to insert the card into the imx23-olinuxino board and boot.

Below is boot listing for imx23-olinuxino-maxi board runing Yocto rootfs:

HTLLCLC

U-Boot 2013.07-dirty (Aug 12 2013 – 12:29:23)

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
SD/MMC found on device 0
178 bytes read in 174 ms (1000 Bytes/s)
Importing environment from mmc (uEnv.txt)…
Checking if uenvcmd is set …
Running default loadzimage …
3430360 bytes read in 1164 ms (2.8 MiB/s)
9088 bytes read in 204 ms (43 KiB/s)
Booting from mmc …
Kernel image @ 0x42000000 [ 0x000000 – 0x3457d8 ]
## Flattened Device Tree blob at 41000000
Booting using the fdt blob at 0x41000000
Loading Device Tree to 43b63000, end 43b6837f … OK

Starting kernel …

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.11.0-rc1-next-20130717 (devel@laptop) (gcc versi3
[ 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 Lod
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pa6
[ 0.000000] Kernel command line: console=ttyAMA0,115200 root=/dev/mmcblk0p2 =
[ 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: 52632K/65536K available (4619K kernel code, 274K rwdata,)
[ 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 – 0xc0624254 (6257 kB)
[ 0.000000] .init : 0xc0625000 – 0xc065a268 ( 213 kB)
[ 0.000000] .data : 0xc065c000 – 0xc06a0988 ( 275 kB)
[ 0.000000] .bss : 0xc06a0988 – 0xc0bfc150 (5486 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 eves
[ 0.000000] Console: colour dummy device 80×30
[ 0.000000] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingr
[ 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.070000] Calibrating delay loop… 226.09 BogoMIPS (lpj=1130496)
[ 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 0xc0469d48 – 0xc0469da0
[ 0.090000] devtmpfs: initialized
[ 0.100000] 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 PL012
[ 0.360000] console [ttyAMA0] enabled
[ 0.400000] bio: create slab 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] pps_core: LinuxPPS API ver. 1 registered
[ 0.470000] pps_core: Software ver. 5.3.6 – Copyright 2005-2007 Rodolfo Giom>
[ 0.470000] PTP clock support registered
[ 0.480000] Advanced Linux Sound Architecture Driver Initialized.
[ 0.490000] Switched to clocksource mxs_timer
[ 0.780000] NET: Registered protocol family 2
[ 0.790000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.800000] TCP bind hash table entries: 512 (order: 2, 18432 bytes)
[ 0.810000] TCP: Hash tables configured (established 512 bind 512)
[ 0.810000] TCP: reno registered
[ 0.820000] UDP hash table entries: 256 (order: 2, 20480 bytes)
[ 0.820000] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[ 0.830000] NET: Registered protocol family 1
[ 0.840000] RPC: Registered named UNIX socket transport module.
[ 0.850000] RPC: Registered udp transport module.
[ 0.850000] RPC: Registered tcp transport module.
[ 0.860000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.870000] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.960000] NFS: Registering the id_resolver key type
[ 0.970000] Key type id_resolver registered
[ 0.970000] Key type id_legacy registered
[ 0.980000] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
[ 0.990000] msgmni has been set to 102
[ 1.010000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[ 1.020000] io scheduler noop registered (default)
[ 1.030000] of_dma_request_slave_channel: dma-names property missing or empty
[ 1.030000] uart-pl011 80070000.serial: no DMA platform data
[ 1.040000] 8006c000.serial: ttyAPP0 at MMIO 0x8006c000 (irq = 135) is a 800l
[ 1.050000] mxs-auart 8006c000.serial: Found APPUART 3.0.0
[ 1.080000] usbcore: registered new interface driver asix
[ 1.090000] usbcore: registered new interface driver ax88179_178a
[ 1.090000] usbcore: registered new interface driver cdc_ether
[ 1.100000] usbcore: registered new interface driver r815x
[ 1.100000] usbcore: registered new interface driver smsc95xx
[ 1.110000] usbcore: registered new interface driver net1080
[ 1.120000] usbcore: registered new interface driver cdc_subset
[ 1.120000] usbcore: registered new interface driver zaurus
[ 1.130000] usbcore: registered new interface driver cdc_ncm
[ 1.140000] ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver
[ 1.140000] usbcore: registered new interface driver usb-storage
[ 1.160000] ci_hdrc ci_hdrc.0: doesn’t support gadget
[ 1.160000] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 1.170000] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 1.200000] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 1.210000] hub 1-0:1.0: USB hub found
[ 1.220000] hub 1-0:1.0: 1 port detected
[ 1.230000] mousedev: PS/2 mouse device common for all mice
[ 1.240000] stmp3xxx-rtc 8005c000.rtc: rtc core: registered 8005c000.rtc as 0
[ 1.250000] i2c /dev entries driver
[ 1.260000] stmp3xxx_rtc_wdt stmp3xxx_rtc_wdt: initialized watchdog with heas
[ 1.310000] mxs-mmc 80010000.ssp: initialized
[ 1.330000] usbcore: registered new interface driver usbhid
[ 1.330000] usbhid: USB HID core driver
[ 1.350000] TCP: cubic registered
[ 1.360000] NET: Registered protocol family 17
[ 1.360000] Key type dns_resolver registered
[ 1.380000] registered taskstats version 1
[ 1.380000] mmc0: host does not support reading read-only switch. assuming w.
[ 1.400000] stmp3xxx-rtc 8005c000.rtc: setting system clock to 2012-08-07 19)
[ 1.430000] mmc0: new high speed SDHC card at address b368
[ 1.440000] ALSA device list:
[ 1.440000] No soundcards found.
[ 1.450000] mmcblk0: mmc0:b368 3.73 GiB
[ 1.480000] mmcblk0: p1 p2
[ 1.500000] EXT3-fs (mmcblk0p2): recovery required on readonly filesystem
[ 1.510000] EXT3-fs (mmcblk0p2): write access will be enabled during recovery
[ 1.540000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 1.690000] hub 1-1:1.0: USB hub found
[ 1.700000] hub 1-1:1.0: 3 ports detected
[ 1.980000] usb 1-1.1: new high-speed USB device number 3 using ci_hdrc
[ 2.110000] smsc95xx v1.0.4
[ 2.210000] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-ci_hdrc.0-1.5
[ 2.310000] usb 1-1.2: new high-speed USB device number 4 using ci_hdrc
[ 4.690000] kjournald starting. Commit interval 5 seconds
[ 5.160000] EXT3-fs (mmcblk0p2): recovery complete
[ 5.160000] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
[ 5.170000] VFS: Mounted root (ext3 filesystem) readonly on device 179:2.
[ 5.180000] devtmpfs: mounted
[ 5.190000] Freeing unused kernel memory: 212K (c0625000 – c065a000)
INIT: version 2.88 booting
Error opening /dev/fb0: No such file or directory
Starting udev
/etc/rcS.d/S04udev: line 38: /tmp/uname: Read-only file system
touch: /tmp/uname: Read-only file system
/etc/rcS.d/S04udev: line 39: /tmp/cmdline: Read-only file system
touch: /tmp/cmdline: Read-only file system
/etc/rcS.d/S04udev: line 40: /tmp/devices: Read-only file system
touch: /tmp/devices: Read-only file system
touch: /tmp/atags: Read-only file system
Starting Bootlog daemon: bootlogd: cannot allocate pseudo tty: No such file or y
bootlogd.
[ 13.000000] EXT3-fs (mmcblk0p2): using internal journal
Caching udev devnodes
Populating dev cachemv: can’t rename ‘/tmp/uname’: No such file or directory
ALSA: Restoring mixer settings…
/usr/sbin/alsactl: load_state:1686: No soundcards found…
Failed to read MAC for usb0; skiping device.
Configuring network interfaces… Could not read interface wlan1 flags: No suche
Failed to initialize driver interface
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFADDR: No such device
route: SIOCADDRT: No such device
[ 17.160000] smsc95xx 1-1.1:1.0 eth0: hardware isn’t capable of remote wakeup
done.
Starting portmap daemon…
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting advanced power management daemon: No APM support in kernel
(failed.)
Starting syslogd/klogd: done
* Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
…done.
Starting Telephony daemon
Stopping Bootlog daemon: bootlogd.

Yocto (Built by Poky 7.0.1) 1.2.1 imx233-olinuxino-maxi ttyAMA0

imx233-olinuxino-maxi login: root
root@imx233-olinuxino-maxi:~#

Home imx23-olinuxino bootloader's u-boot bootloader for imx23-olinuxino board