i.MX233 – Getting a Linux system running

I know that there are many guides online about how to make a Linux system running from SD card on a i.MX233 chipset, especially since Olimex has made several development kits with this CPU (I am also basing my i.MX233 posts on a Olimex Olinuxino Micro).

I am doing this project as my university final project, and meanwhile that I am still struggling to start the actual documentation, I thought that since anyways it would be smart to write down some steps for the final documentation, hey, why wouldn’t I instead just write some notes down here on my site, and I could easily fetch them later on to a more official document, letting people in the meanwhile to (hopefully) find some use to my work, and maybe I could even get people point out mistakes or suggest additions to my notes (if I would first just be able to get rid of all the Spam and open the discussion functionality on posts…..).

Anyways I just started from the basics pretty much. I wanted to get up a Linux machine to be able to operate on the SD card, and also as an environment for development and compilation for the newly brang up system on i.MX233. For that you have a free software from Oracle called Virtualbox – it is VM (Virtual Machine) manager. It is used for simulating a real computer. You create a setup, give it the amount of RAM you want (I gave for instance 2GB), the amount of hard disk space, and after that it acts just like a real PC. At this state you are not able to boot it up yet, I mean you can, but it will complain like a real computer does when you have nothing on the hard disk. What you need is an iso-file, an image of a disc. You could use whatever iso you want, you could have iso of a Windows installation DVD and you could use that. I however downloaded the Ubuntu 14.04.1 LTS 64b (for 64b I needed to go to my real PC BIOS, to activate the Intel 64b hardware simulation option, or similar, can’t remember the exact name but by default BIOS had it disabled). All I needed to do was to “insert” the iso file for the PC configuration I did earlier, and I pressed on turn on the computer in Virtualbox manager. After that the computer “booted” from the Ubuntu installation disc and I needed to do a normal installation as I would do on a real computer.

After that the next steps were to research online how to make an SD card for the i.MX233. The embedded Linux SD images most often come in two parts – first there is a smaller boot image, or files, which take care of booting up the device and bringing up the Linux kernel. Then the second part is the “root fs” – the root filesystem that has all the applications and tools that make the operating system usable for a user. So for creating the SD card I found pretty good instructions on Olimex website, in the Olimex git repository. The instructions included links to download the kernel image (for the boot partition), and the root-fs archive. I’ll also refer to the instructions below (with added corrections where necessary):

Short description about how to make bootable SD card with Linux file system for OLinuXino boards

(NOTE - this example is given with "sdc1 and sdc2" device but it could enumerate differently on your host, so confirm what it enumerates as before running fdisk!)

1. Insert the card reader to the Linux host.
2. Un-mount the card reader, i.e. 'sudo umount /dev/sdc1'
3. run fdisk, 'sudo fdisk /dev/sdc'
4. Press 'p' to show the partitions on the card
5. Press 'd' to delete a partition. Repeat to remove all partitions
6. Press 'n' to create a new partition
7. Press 'p' to select the primary partition
8. Press '1' to create partition 1 on the card
9. Press Enter to start from first block
10. Type '+32MB' to create the 32MB partitions (with +16MB I always got at the end of the dd operation message saying that not enough memory left on the device, either this or a malfunctioning SD card caused me issues at first)
11. Press 't' to change the newly created partition type
12. Enter '53' for the new partition type
13. Press 'n' to create a second partition, select 'p'(primary), then '2'(number)
14. Press Enter to accept all default settings, until the option about the last sector to use
14b. As I have a 8GB SD card, I wanted to be sure there wouldn't be any problems as some High Capacity cards can sometimes cause problems. Thus here I put +2GB, to make the root-fs use the next 2GB, and the rest 6GB would end up unused. One can easily just ignore this step but I wanted to be sure it will work, since anyways I will not need all the 8GB (maybe I will revisit the step later on if need be)
15. Press 'w' to write the partitions to the card and exit the fdisk
16. Format the second partition on the SD card - run 'sudo mkfs.ext2 /dev/sdc2' command.
17. Mount the second partition on the card:
18. If you do not have the mmc mounting point created yet, create one with 'sudo mkdir /mnt/mmc'
19. Run 'sudo mount /dev/sdc2 /mnt/mmc' to mount the partition as the mmc card
20. Copy the supplied files - OLinuXino_Debian_FS.tgz(the debian FS) and imx233-Olinuxino.zip(boot image) for example in your home/user directory, unzip imx233-Olinuxino.zip to imx233-Olinuxino.img
21. Enter the mounted sd card directory - cd /mnt/mmc
22. Untar the rootfs to the card 'sudo tar -xzf /home/user/OLinuXino_Debian_FS.tgz' to put down the root filesystem. Note that in Debian FS you can use 'apt-get install .....' command
for login use
user:root
password:RootPass
23. Copy the boot image in sdb1 device using dd, i.e. type - 'sudo dd if=/home/user/imx233-Olinuxino.img of=/dev/sdc1
24. Type 'cd', 'sync' and umount sd card - 'sudo umount /dev/sdc2'

So those instructions were pretty good by default but I did have to change the step for fdisk for the first partition, as every time I was trying to write the boot image filed with dd to sdc1 I received a message at the end about not enough space left .Sure enough, the boot image is exactly 16MB but it seems that maybe fdisk was creating the boot partition a bit smaller than the offset +16MB that I first attempted to create. Then, when attempting to boot the SD card from the debug UART I would just get following kind of messages everytime I put on the power:

0x8020a01d
0x80502008
0x8020a01d
0x8020a01d
0x80501003

After I changed SD cards and set the boot partition to be 32MB, I was able to finally boot the device! Here’s an exerpt from the bootlog:


HTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFC
PowerPrep start initialize power...
Battery Voltage = 0.69V
No battery or bad battery detected!!!.Disabling battery voltage ▒HTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFC
PowerPrep start initialize power...
Battery Voltage = 2.00V
No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nLLCMay 11 201215:26:EMI_CTRL 0x1C08404init_ddr_mt46v32m10Frac 0x92926192
LLLLLLLFCLJUncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3_OLinuXinoR4 (hehopmajieh@hehopmajieh-office) (gcc version 4.7.1 20120421 (prerelease) (GCC) ) #11 PREEMPT Mon May 21 10:27:52 EEST 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: iMX233-OLinuXino low cost board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd console=ttyAM0,115200 root=/dev/mmcblk0p2 rw rootwait ssp1=mmc
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 57208k/57208k available, 8328k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xfde00000 - 0xffe00000 ( 32 MB)
vmalloc : 0xc4800000 - 0xf0000000 ( 696 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0026000 ( 120 kB)
.text : 0xc0026000 - 0xc033d000 (3164 kB)
.data : 0xc0356000 - 0xc0381a00 ( 175 kB)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:224
Console: colour dummy device 80x30
console [ttyAM0] enabled
Calibrating delay loop... 226.91 BogoMIPS (lpj=1134592)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
NET: Registered protocol family 16
regulator: vddd: 800 1575 mV at 1550 mV fast normal
regulator: vdddbo: 800 1575 mV fast normal
regulator: vdda: 1500 2275 mV at 1750 mV fast normal
regulator: vddio: 2800 3575 mV at 3300 mV fast normal
regulator: overall_current: fast normal
regulator: mxs-duart-1: fast normal
regulator: mxs-bl-1: fast normal
regulator: mxs-i2c-1: fast normal
regulator: mmc_ssp-1: fast normal
regulator: mmc_ssp-2: fast normal
regulator: charger-1: fast normal
regulator: power-test-1: fast normal
regulator: cpufreq-1: fast normal
i.MX IRAM pool: 28 KB@0xc4808000
bio: create slab at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource mxs clock source
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
...
Debian GNU/Linux 6.0 debian ttyAM0

debian login: root
Password:
Last login: Thu Jan 1 02:00:41 EET 1970 on ttyAM0
Linux debian 2.6.35.3_OLinuXinoR4 #11 PREEMPT Mon May 21 10:27:52 EEST 2012 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@debian:~#

That’s it! Pretty simple, right?

Now first thing I did was of course change the password to something a bit easier to remember. To make the system extremely secure, I chose the password root, for the root user (I dont have any network interfaces even available so nothing to worry currently). After that I wanted to try if the root-fs would, by some chance, have Python interpreter available:

root@debian:~# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@debian:~# python
-bash: python: command not found
root@debian:~#

Darn. Too bad.

I need Python for my thesis project (see more details in my projects page) so I will need to work on getting Python a part of the root-fs. After some research it turned out not to be as easy as I had thought – I would need to make my own rootfs from scratch, and to be able to do that, I would need to run the QEMU hardware emulator, that requires some output files from the kernel build, thus I will in fact also build the kernel myself. This is actually not that bad, because in any case I will want to write some drivers, and for writing drivers one needs the header files for the specific kernel. After building the kernel myself, I will surely know where the headers reside. However all of that will require a bit more time, so I decided to split it to a different article to be followed.

Leave a Reply