ARM Kernel with Builroot

martin
hello all, I continue my ongoing fight to build a custom kernel with
"buildroot" I managed to install u-boot but now I have the problem that the
kernel that I created with the buildroot does not work: I get the following
message

MINI2440 # þ

U-Boot 1.3.2-mini2440 (Oct  6 2009 - 12:51:09)

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  Bad block table not found for chip 0
Bad block table not found for chip 0
128 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

Loading from NAND 128MiB 3,3V 8-bit, offset 0x60000
   Image Name:
   Created:      2009-11-09  19:54:25 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1643592 Bytes =  1.6 MB
   Load Address: 31000000
   Entry Point:  31000000
## Booting kernel from Legacy Image at 32000000 ...
   Image Name:
   Created:      2009-11-09  19:54:25 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1643592 Bytes =  1.6 MB
   Load Address: 31000000
   Entry Point:  31000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

-----------------------------------------------------------------------
I used the following configuration: 

Target Architecture
    [*] arm

Target Architecture Variant
    [*] arm920t

Target ABI: 
    [*] EABI

Toolchain
    [*] Enable RPC 
    [*] Use software floating point 
    [*] Enable large file (2GB) support
    [*] Enable IPV6
    [*] Enable toolchain locale/i18n support
    [*] Use software floating point by default
    [*] Build/install c++ compiler

Target filesystem options
    [ ] tar
    [ ] ext2
    [*] jffs2
    Endianess
        [*] little-endian

        Flash Type
            (x) NAND flash with 2kB Page and 128 kB erasesize

Kernel 2.6.30.2
[*] Linux (Advance Configuration)
       Kernel Binary format
          [*]zImage


any ideas?

thanks for helping

Maksim Galemin
Hi martin, 

Linux kernel from http://www.kernel.org/ doesn't contain all necessary
files for mini2440 board. As a result you'll get unusable kernel (actually
you can make diff between official kernel and the one with changes but this
way is a little bit unnatural). Try to compile kernel from Buserror repo, I
wrote how to do this here
http://www.friendlyarm.net/forum/topic/79?lang=en#612.

P.S. Could you please next time before asking the question search the forum
for similar topics? Thanks.

martin
thanks for the reply, I will next time. 
I managed to create a new kernel, with the instructions you gave me. 
but something is not right, not if the problem is in the kernel, or the
FileSystem. or NAND rootfs partition. 
I searched in forum and I have not managed to find a similar error at 100% 

during kernel initialization I get the following error

ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time
Empty flash at 0x00003f48 ends at 0x00004000
Empty flash at 0x00007ffc ends at 0x00008000
Empty flash at 0x0000bffc ends at 0x0000c000
Empty flash at 0x00013f50 ends at 0x00014000
Empty flash at 0x00017f4c ends at 0x00018000
Empty flash at 0x0001bfc4 ends at 0x0001c000
Empty flash at 0x00023f44 ends at 0x00024000
Empty flash at 0x00027fbc ends at 0x00028000


I think the problem may be in the rootfs partition because I have errors in
this partition 

MINI2440 # nand bad

Device 0 bad blocks:
  07f80000
  07fa0000
  07fc0000
  07fe0000
MINI2440 #


I have recreated several times the NAND but still contains the errors in
the NAND BAD

nand scrub
nand createbbt
..........

nand erase kernel
....
mmcinit
.....
fatload mmc 0:1 0x32000000 uImage-micro2440.bin
.....
nand write.e 0x32000000 kernel 
.....

NAND erase: device 0 offset 0x560000, size 0x7aa0000
Skipping bad block at  0x07f80000
Skipping bad block at  0x07fa0000
Skipping bad block at  0x07fc0000
Skipping bad block at  0x07fe0000


MINI2440 # nand info
Device 0: NAND 128MiB 3,3V 8-bit, page size 2048, sector size 128 KiB


MINI2440 # fatload mmc 0:1 0x32000000 mini2440.rootfs.jffs2
reading mini2440.rootfs.jffs2

24477696 bytes read
MINI2440 # nand write.jffs2 0x32000000 rootfs 1758000

NAND write: device 0 offset 0x560000, size 0x1758000

Writing data at 0x1cb7800 -- 100% complete.
 24477696 bytes written: OK
MINI2440 #

might these rulings the cause of the error during initialization?

thanks again

martin
hi all, well I managed to run the custom kernel and filesystem on jaffs
also personalized with the buildroot. 
but as nothing can be easy :-( :-( :-( :-( 
I do not get to finish initializing, stays at: 

Creating 4 MTD partitions on "NAND 128MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
ftl_cs: FTL header not found.
0x000000040000-0x000000060000 : "u-boot-env"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "kernel"
ftl_cs: FTL header not found.
0x000000560000-0x000008000000 : "root"
ftl_cs: FTL header not found.


I've seen higher on the initialization gives the following error, anyone
knows what is that? 

greetings

----------------------------------------------------------------
-----------------------------------------------------------------

Loading from NAND 128MiB 3,3V 8-bit, offset 0x60000
   Image Name:
   Created:      2009-11-11   9:01:10 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2001524 Bytes =  1.9 MB
   Load Address: 30008000
   Entry Point:  30008000
## Booting kernel from Legacy Image at 32000000 ...
   Image Name:
   Created:      2009-11-11   9:01:10 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2001524 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.31 (root@debian) (gcc version 4.3.2 (Sourcery G++ Lite
2008q3-
72) ) #1 Wed Nov 11 03:47:02 EST 2009
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, (c) 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: root=/dev/mtdblock3 rootfstype=jffs2
console=ttySAC0,115200

PID hash table entries: 256 (order: 8, 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: 60700KB available (3508K code, 417K data, 128K init, 0K highmem)
SLUB: Genslabs=11, 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)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
MINI2440: Option string mini2440=0tb
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,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
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
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
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
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)
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c486e300,c4872304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)
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: 0xf1 (Samsung NAND 128MiB 3,3V
8-bi
t)
Creating 4 MTD partitions on "NAND 128MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
ftl_cs: FTL header not found.
0x000000040000-0x000000060000 : "u-boot-env"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "kernel"
ftl_cs: FTL header not found.
0x000000560000-0x000008000000 : "root"
ftl_cs: FTL header not found.
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
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
s3c2440-ts s3c2440-ts: Starting
  Created group ts filter len 12 depth 2 close 10 thresh 6
  Created Median ts filter len 20 depth 2 dec 24
  Created Mean ts filter len 4 depth 2 thresh 65535
  Created Linear ts filter depth 2
s3c2440-ts s3c2440-ts: 4 filter(s) initialized
s3c2440-ts s3c2440-ts: successfully loaded
input: s3c2410 TouchScreen as /devices/virtual/input/input1
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-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
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
Registered led device: led1
Registered led device: led2
Registered led device: led3
Registered led device: led4
Registered led device: backlight
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c2440-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
s3c2440-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
mmc0: new SD card at address 0001
mmcblk0: mmc0:0001 E0805 121 MiB
 mmcblk0: p1
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.20.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
s3c2410-rtc s3c2410-rtc: hctosys: invalid date/time
VFS: Mounted root (jffs2 filesystem) on device 31:3.
Freeing init memory: 128K
Populating /dev using udev: done
Initializing random number generator... done.
Starting network...
ip: RTNETLINK answers: File exists

Maksim Galemin
1. Open ./project_build_arm/uclibc/root/etc/inittab file in your buildroot
folder;

2. Find next text:

#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

3. Replace it with the text:

ttySAC0::respawn:/sbin/getty -L ttySAC0 115200 vt100 # GENERIC_SERIAL

4. Enjoy;

5. Please, please, please (!) read the book "Building Embedded Linux
Systems" by Karim Yaghmour (O'Reilly Media).