Compiling the mini2440 kernel

Thanks to BusError there is a mini2440 kernel available here:

http://code.google.com/p/mini2440/

It took me a little while to get it to compile and i thought i’d post a guide to help anyone else having trouble. Compilation was done using Fedora 11. I used the livecd to install and added some packages afterwards. The main ones are those recommended for openembedded. The page to look at is here:

http://wiki.openembedded.net/index.php/OEandYourDistro

I used:

su -c "yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc gcc-c++ help2man perl-ExtUtils-MakeMaker"

At first the build generated various errors which were resolved by installing more packages. Unfortunately I do not remember which ones but i’ve attached a list of all packages i currently have installed in case you get stuck. In each case simply googling the error resulted in a post advising to install a particular package. After that everything worked!

The script i used to build the kernel was based very closely on the one modified by BusError. If i remember correctly I had to change a path near the end of the script. I’ve attached a copy of the exact same script which worked for reference.

You run the script by simply typing:

sudo sh mini2440-bootstrap-v2.sh

On my laptop using an Intel T7400 CPU this takes about 30-45 minutes depending on the download speeds.

If you use the default install path you should have u-boot.bin and uImage along with some other files in the directory:

/usr/src/mini2440/output

If you don’t then something has gone wrong so go back and check the various error messages in the terminal and fix them!

You can then flash these files as per normal.

Downloads:

Fedora 11 Installed packages

Mini2440 build script

Probing the mini2440 I2C bus

I’m fairly new to electronics and i’ve certainly never used I2C before so I built a simple circuit based on a DS1621 I2C thermometer as a test. I got this for a couple of pounds from the seller ‘crodnet’ on ebay.

I found an old 2.5″ laptop drive connector which wasn’t large enough to fit on CON5 so i chopped it up and put it on the camera interface. I wired up the SDA and SCL lines along with 3.3V and GND to the veroboard. I also soldered a couple of LEDs, one for the power light and the other wired up through a transistor with the base connected to the thermostat output on the DS1621. This pin can be programmed to go high at a particular temperature.

I then plugged it in and powered up the mini2440. Running i2cdetect showed a new device at 0x48. The other devices are the onboard EEPROM. Looking at the datasheet for the DS1621 the temperature can be read from the location 0xAA. I was able to observe the temperature in hex through i2cget. Converting the output 0x0016 to decimal gives 22.0 degrees. The sensor is pretty neat, it responds almost immediately to the presence of your finger.

Below are the I2C commands i used. I installed i2c tools using opkg.

root@mini2440:~# i2cdetect -l
i2c-0    i2c           s3c2410-i2c                         I2C adapter

root@mini2440:~# i2cdetect s3c2410-i2c
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

root@mini2440:~# watch --interval=1  i2cget -y s3c2410-i2c 0x48 0xAA w

Every 1.0s: i2cget -y s3c2410-i2c 0x48 0xAA w      Tue Sep 15 23:31:25 2009
0x0016

Below is a picture of the device..it looks like a right mess but it works great!

DSC_0032

The next stage is compile the driver from the lmsensors package…