Kernel Patches for FriendlyARMs Mini2440 ARMv4 developer Board

The “mini2440” is a ARMv4 developer Board with an Samsung S3C2440 ARM processor.

I was able to update the existing Kernelsources made for 2.6.32 for kernel 2.6.37-1 which was the latest at the time of writing.

Patches are below, together with a bit of information.

See the googlegroups-link for further duscussion.

In order to be able to get the Board up and running, you need to be able to use linux, a compiler, the patch-command, and have a running ARM-Crosscompiler toolchain installed.

How to apply the patch / build your own kernel

Download vanilla / unpatched kernel from www.kernel.org (http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.1.tar.bz2)

Extract into a folder, cd into it run

patch -p1 < PATH-TO-PATCHFILE.patch

Put “mini2440_defconfig” into arch/arm/configs folder, overwriting existing configfiles. Or backup your existing file first, it’s up to you.

Setup your toolchain.

Run “make mini2440_defconfig”.

Run “make menuconfig” to refine the configuration or run simliar commands.

Run “make” to compile

Run “make uImage” to create uImage for uboot or anything else, whatever you prefer and need.

Patches

This is my mini2440 kernel configuration file. I included some nonsestuff here, like powersaving-governors and ipv6. Just to play around. Feel free to kick this stuff out if you don’t need it.

The linux kernel 2.6.37-1 patchfile itself. Feel free to run it against the latest stable “2.6.37-1” available on www.kernel.org. I have had several problems getting the kernel to recognize my sdcard which holds my roofs. I made it “working” enabling “mmc debug”. But this was not a nice thing to do, because it was utterly slow, filled my dmesg-log, hitted the /var/log partition on the card hard and was ugly. I patched the sd-host-code after some googling (drivers/mmc/host/s3cmci.c). The sd/mmc patch is included in the big patchfile. Kudos to the original author, I don’t know where i found the 2 lines of code anymore.

The console output when booting mini2440, from uboot until login. Just for documentation purposes. I know, my sd-card has a few bad sectors.

U-Boot 1.3.2-mini2440 (Aug  7 2010 - 01:06:43)

I2C:   ready
DRAM:  64 MB
NOR Flash not found. Use hardware switch and 'flinit'
Flash:  0 kB
NAND:  1024 MiB
Found Environment offset in OOB..
USB:   S3C2410 USB Deviced
In:    serial
Out:   serial
Err:   serial
MAC: 08:08:11:18:12:27
Hit any key to stop autoboot:  0 
mmc: Probing for SDHC ...
===============> MMC CMD Timeout
mmc: No answer to CMD8 trying SD
trying to detect SD Card...
Manufacturer:       0x41, OEM "42"
Product name:       "SD512", revision 1.0
Serial number:      599788425
Manufacturing date: 1/2007
CRC:                0x28, b0 = 1
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=3453
size = 2329935872
SD Card detected RCA: 0x2 type: SD

1954136 bytes read
## Booting kernel from Legacy Image at 31000000 ...
   Image Name:   Linux-2.6.37.1
   Created:      2011-02-21  19:26:23 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1954072 Bytes =  1.9 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37.1 (croessler@atom) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #3 Mon Feb 21 20:23:13 CET 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttySAC0 noinitrd root=/dev/mmcblk0p2 rw rootfstype=ext2 mini2440=3tb rootdelay=4 init=/sbin/init
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: 60928k/60928k available, 4608k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
    vmalloc : 0xc4800000 - 0xf6000000   ( 792 MB)
    lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0027000   ( 124 kB)
      .text : 0xc0027000 - 0xc039596c   (3515 kB)
      .data : 0xc0396000 - 0xc03b7d40   ( 136 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing pending status 02000000
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
gpiochip_add: gpios 288..303 (GPIOK) failed to register
gpiochip_add: gpios 320..334 (GPIOL) failed to register
gpiochip_add: gpios 352..353 (GPIOM) failed to register
NET: Registered protocol family 16
MINI2440: Option string mini2440=3tb
MINI2440: LCD 0:240x320 1:800x480 2:1024x768 [3:240x320] 4:640x480
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
s3c-adc s3c24xx-adc: attached adc driver
S3C24XX CPU Frequency driver, s3c244x cpu support
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.23.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
msgmni has been set to 119
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM (writable)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung )
Creating 4 MTD partitions on "nand":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000060000 : "u-boot-env"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "kernel"
ftl_cs: FTL header not found.
0x000000560000-0x000040000000 : "root"
ftl_cs: FTL header not found.
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c4810300,c4814304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)
usbmon: debugfs is not available
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
s3c2410_udc: debugfs dir creation failed -19
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
mice: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
samsung-ts s3c2440-ts: driver attached, registering input device
input: S3C24XX TouchScreen as /devices/virtual/input/input1
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, sw SDIO IRQ
s3c-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
usbcore: registered new interface driver ushc
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
ALSA device list:
  No soundcards found.
TCP cubic registered
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-rtc s3c2410-rtc: setting system clock to 2011-02-21 17:27:41 UTC (1298309261)
Waiting 4sec before mounting root device...
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
mmc0: new SD card at address 0002
mmcblk0: mmc0:0002 SD512 492 MiB 
 mmcblk0: p1 p2
EXT2-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem) on device 179:2.
Freeing init memory: 124K
INIT: version 2.86 booting
.udev/ already exists on the static /dev! (warning).
Starting the hotplug events dispatcher: udevdudevd (826): /proc/826/oom_adj is deprecated, please use /proc/826/oom_score_adj instead.
.
Synthesizing the initial hotplug events...done.
Waiting for /dev to be fully populated...uncorrectable error : 
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
uncorrectable error : 
end_request: I/O error, dev mtdblock0, sector 8
Buffer I/O error on device mtdblock0, logical block 1
end_request: I/O error, dev mtdblock0, sector 16
Buffer I/O error on device mtdblock0, logical block 2
uncorrectable error : 
end_request: I/O error, dev mtdblock0, sector 24
Buffer I/O error on device mtdblock0, logical block 3
uncorrectable error : 
end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
done.
Setting the system clock.
Activating swap...done.
Setting the system clock.
Cleaning up ifupdown....
Loading kernel modules...done.
Checking file systems...fsck 1.41.3 (12-Oct-2008)
done.
Setting kernel variables (/etc/sysctl.conf)...done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...Ignoring unknown interface lo=lo.
done.
INIT: Entering runlevel: 2

Debian GNU/Linux 5.0 mini2440 ttySAC0

mini2440 login: 

Several System information from within the running Board:

mini2440:/sys/devices# ls platform/

dm9000        s3c2410-rtc   s3c2440-uart.0     s3c24xx-iis    s3c24xx_led.5
gpio-keys     s3c2410-wdt   s3c2440-uart.1     s3c24xx_led.1  s3c24xx_uda134x.0
power         s3c2440-i2c   s3c2440-uart.2     s3c24xx_led.2  uevent
s3c2410-lcd   s3c2440-nand  s3c2440-usbgadget  s3c24xx_led.3
s3c2410-ohci  s3c2440-sdi   s3c24xx-adc        s3c24xx_led.4

mini2440:/sys/devices# ls system/

clocksource  cpu  s3c2440-core  s3c2442-core  s3c24xx-dma  timekeeping  timer

mini2440:/sys/devices# ls virtual/

bdi    gpio  input  misc  net    tty  vtconsole
block  graphics  mem    mtd   sound  vc

mini2440:/sys/devices# uname -a

Linux mini2440 2.6.37.1 #3 Mon Feb 21 20:23:13 CET 2011 armv4tl GNU/Linux

Linux kernel version information:

Linux version 2.6.37.1 (croessler@atom) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #3 Mon Feb 21 20:23:13 CET 2011

SD-Partinfo:

/dev/mmcblk0p1 = boot with uImage, ext2, 16MB
/dev/mmcblk0p2 = rootfs, ext2, ~500MB

u-boot bootcommand

console=ttySAC0 noinitrd root=/dev/mmcblk0p2 rw rootfstype=ext2 mini2440=3tb rootdelay=4 init=/sbin/init

mini2440:/etc/network# cat /proc/cpuinfo

Processor   : ARM920T rev 0 (v4l)
BogoMIPS    : 201.93
Features    : swp half thumb 
CPU implementer : 0x41
CPU architecture: 4T
CPU variant : 0x1
CPU part    : 0x920
CPU revision    : 0
Hardware    : MINI2440
Revision    : 0000
Serial      : 0000000000000000

mini2440:/etc/network# free

             total       used       free     shared    buffers     cached
Mem:         61052      17108      43944          0       1176       9164
-/+ buffers/cache:       6768      54284
Swap:            0          0          0

mini2440:/# ps aux

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.2  1.1   2024   676 ?        Ss   18:38   0:00 init [2]  
root         2  0.0  0.0      0     0 ?        S    18:38   0:00 [kthreadd]
root         3  0.3  0.0      0     0 ?        S    18:38   0:01 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    18:38   0:00 [kworker/0:0]
root         5  0.0  0.0      0     0 ?        S    18:38   0:00 [kworker/u:0]
root         6  0.0  0.0      0     0 ?        S<   18:38   0:00 [khelper]
root         7  0.0  0.0      0     0 ?        S    18:38   0:00 [kworker/u:1]
root        10  0.0  0.0      0     0 ?        S<   18:38   0:00 [netns]
root       132  0.0  0.0      0     0 ?        S    18:38   0:00 [sync_supers]
root       134  0.0  0.0      0     0 ?        S    18:38   0:00 [bdi-default]
root       135  0.0  0.0      0     0 ?        S<   18:38   0:00 [kintegrityd]
root       137  0.0  0.0      0     0 ?        S<   18:38   0:00 [kblockd]
root       143  0.0  0.0      0     0 ?        S    18:38   0:00 [khubd]
root       146  0.0  0.0      0     0 ?        S    18:38   0:00 [kseriod]
root       153  0.0  0.0      0     0 ?        S<   18:38   0:00 [kmmcd]
root       248  0.0  0.0      0     0 ?        S    18:38   0:00 [kswapd0]
root       301  0.0  0.0      0     0 ?        S    18:38   0:00 [fsnotify_mark]
root       303  0.0  0.0      0     0 ?        S<   18:38   0:00 [aio]
root       313  0.0  0.0      0     0 ?        S<   18:38   0:00 [crypto]
root       453  0.1  0.0      0     0 ?        S    18:38   0:00 [kworker/0:1]
root       587  0.0  0.0      0     0 ?        S    18:38   0:00 [kapmd]
root       635  0.0  0.0      0     0 ?        S    18:38   0:00 [mtdblock0]
root       640  0.0  0.0      0     0 ?        S    18:38   0:00 [mtdblock1]
root       645  0.0  0.0      0     0 ?        S    18:38   0:00 [mtdblock2]
root       650  0.0  0.0      0     0 ?        S    18:38   0:00 [mtdblock3]
root       673  0.0  0.0      0     0 ?        S<   18:38   0:00 [kpsmoused]
root       688  0.0  0.0      0     0 ?        S<   18:38   0:00 [kondemand]
root       726  0.0  0.0      0     0 ?        S<   18:38   0:00 [usbhid_resume]
root       747  0.3  0.0      0     0 ?        S    18:38   0:01 [mmcqd/0]
root       826  0.9  1.4   2264   876 ?        S<s  18:38   0:03 udevd --daemon
root       917  0.0  0.0      0     0 ?        S    18:38   0:00 [flush-179:0]
root      1001  0.5  1.2   2932   776 ?        S<   18:38   0:01 /bin/sh -e /lib
root      1144  0.5  1.2   2932   776 ?        S<   18:38   0:01 /bin/sh -e /lib
root      1778  0.0  0.8   1612   524 tty1     Ss+  18:39   0:00 /sbin/getty 384
root      1779  0.0  1.9   3004  1216 ttySAC0  Ss   18:39   0:00 /bin/login -- 
root      2218  0.1  2.7   3084  1668 ttySAC0  S    18:40   0:00 -bash
root      2647  0.0  0.0      0     0 ?        S    18:41   0:00 [kworker/0:2]
root      2701  0.0  0.6   2032   372 ?        Ss   18:41   0:00 dhclient3 -pf /
root      3610  0.0  1.5   2532   936 ttySAC0  R+   18:44   0:00 ps aux