I'm trying to make work an embedded linux on a CSB337 board with AT91RM9200 (ARM920T). I compile the kernel 3.2.63 using at91rm9200_defconfig. I see the kernel booting but I have a problem with rootfs (initrd). I will try to explain the context but if it's not necessary you can go directly to kernel messages at the end of the topic.
As I understood (I am a new in the embedded linux world), I have a choice for mounting the rootfs: initramfs, initrd, nfs or jffs2 (directly from the flash). My first goal is to make work linux, no matter how. So all solutions are acceptable for me but I have to choose one to start with. The solution with jffs2 seems to be the most difficult because my flash is already formated as TFS (almost unknown filesystem from MicroMonitor bootloader). The solution with nfs could be great (at least for tests) but I have difficulties to make work nfs even between two linux PCs. So, at final, I have to choose between initramfs and initrd. I have decided to start with initrd because I believe that it's more flexible to do modifications than initramfs.
To create the rootfs I have used busybox with a minimum configuration (deleted all applets except "Init utilities", static compile). After that, I compress the rootfs as img.gz and send it on the target memory by tftp (at the same maner as zImage). I use the kernel booting arguments: "root=/dev/ram0 rw initrd=0x20100000,307331". As a result, I have this kernel output:
Uncompressing Linux... done, booting the kernel.
Linux version 3.2.63 (vadim@vadim-ESPRIMO-Mobile-U9200) (gcc version 4.8.3 20140320 (prerelease
) (Sourcery CodeBench Lite 2014.05-29) ) #11 PREEMPT Fri Nov 7 23:50:05 CET 2014
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
CPU: VIVT data cache, VIVT instruction cache
Machine: Cogent CSB337
Memory policy: ECC disabled, Data cache writeback
AT91: Detected soc type: at91rm9200
AT91: Detected soc subtype: Unknown
AT91: sram at 0x200000 of 0x4000 mapped at 0xfef74000
Clocks: CPU 184 MHz, master 46 MHz, main 3.686 M
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
Kernel command line: root=/dev/ram0 rw initrd=0x20100000,307331
PID hash table entries: 64 (order: -4, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 16MB = 16MB total
Memory: 10856k/10856k available, 5528k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc1800000 - 0xfee00000 ( 982 MB)
lowmem : 0xc0000000 - 0xc1000000 ( 16 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc04c022c (4833 kB)
.init : 0xc04c1000 - 0xc04e7000 ( 152 kB)
.data : 0xc04e8000 - 0xc05157e0 ( 182 kB)
.bss : 0xc0515804 - 0xc05370a8 ( 135 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:192
AT91: 96 gpio irqs in 3 banks
Console: colour dummy device 80x30
console [tty0] enabled
Calibrating delay loop... 22.78 BogoMIPS (lpj=113920)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
AT91: Power Management
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 57 (SDA) and 58 (SCL)
Switching to clocksource 32k_counter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
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
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 21
io scheduler noop registered
io scheduler deadline registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
console [ttyS0] enabled
brd: module loaded
loop: module loaded
nbd: registered device at major 43
physmap platform flash device: 00800000 at 10000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID 0x
000017
Intel/Sharp Extended Query Table at 0x0031
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Creating 1 MTD partitions on "physmap-flash.0":
0x000000000000-0x000000800000 : "uMON flash"
Generic platform RAM MTD, (c) 2004 Simtec Electronics
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffe0000 (irq 13)
eth0: Link now 100-FullDuplex
eth0: AT91 ethernet at 0xfefbc000 int=24 100-FullDuplex (5a:0b:01:d8:14:00)
eth0: Intel LXT971A PHY
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
at91_cf: probe of at91_cf failed with error -22
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 23, io mem 0x00300000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
USB Serial support registered for Keyspan - (without firmware)
USB Serial support registered for Keyspan 1 port adapter
USB Serial support registered for Keyspan 2 port adapter
USB Serial support registered for Keyspan 4 port adapter
usbcore: registered new interface driver keyspan
keyspan: v1.1.5:Keyspan USB to Serial Converter Driver
USB Serial support registered for MCT U232
usbcore: registered new interface driver mct_u232
mct_u232: z2.1:Magic Control Technology USB-RS232 converter driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mousedev: PS/2 mouse device common for all mice
at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
AT91 Real Time Clock driver.
rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc1
rtc-ds1307 0-0068: 56 bytes nvram
i2c /dev entries driver
AT91 Watchdog Timer enabled (5 seconds, nowayout)
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
input: gpio-keys as /devices/platform/gpio-keys/input/input0
UDF-fs: warning (device ram0): udf_fill_super: No partition found (1)
List of all partitions:
1f00 8192 mtdblock0 (driver?)
No filesystem could mount root, tried: reiserfs cramfs minix vfat msdos iso9660 ufs udf
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
[<c0014058>] (unwind_backtrace+0x0/0xe8) from [<c0384af4>] (panic+0x64/0x190)
[<c0384af4>] (panic+0x64/0x190) from [<c04c1bec>] (mount_block_root+0x1cc/0x20c)
[<c04c1bec>] (mount_block_root+0x1cc/0x20c) from [<c04c1e0c>] (mount_root+0xe4/0x10c)
[<c04c1e0c>] (mount_root+0xe4/0x10c) from [<c04c1f94>] (prepare_namespace+0x160/0x1c0)
[<c04c1f94>] (prepare_namespace+0x160/0x1c0) from [<c04c1860>] (kernel_init+0xf4/0x124)
[<c04c1860>] (kernel_init+0xf4/0x124) from [<c000f76c>] (kernel_thread_exit+0x0/0x8)
The question is: what is my problem? I can imagine that there is no filesystem support but in my kernel configuration I have:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
...
If it's necessary I can provide my .config file.
Thank you in advance for all your comments.
After comments left in this post (see below), I have tried to compile the kernel by buildroot with integrated initramfs. Now it looks better but still not working.
Uncompressing Linux... done, booting the kernel.
Linux version 3.2.63 (vadim@vadim-ESPRIMO-Mobile-U9200) (gcc version 4.8.3 20140320 (prerelea
se) (Sourcery CodeBench Lite 2014.05-29) ) #2 PREEMPT Tue Nov 11 21:30:05 CET 2014
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
CPU: VIVT data cache, VIVT instruction cache
Machine: Cogent CSB337
Memory policy: ECC disabled, Data cache writeback
AT91: Detected soc type: at91rm9200
AT91: Detected soc subtype: Unknown
AT91: sram at 0x200000 of 0x4000 mapped at 0xfef74000
Clocks: CPU 184 MHz, master 46 MHz, main 3.686 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 7874
Kernel command line: mem=31M
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 31MB = 31MB total
Memory: 18672k/18672k available, 13072k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc2000000 - 0xfee00000 ( 974 MB)
lowmem : 0xc0000000 - 0xc1f00000 ( 31 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc04dcadc (4947 kB)
.init : 0xc04dd000 - 0xc0c24000 (7452 kB)
.data : 0xc0c24000 - 0xc0c51680 ( 182 kB)
.bss : 0xc0c516a4 - 0xc0c72b68 ( 134 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:192
AT91: 96 gpio irqs in 3 banks
Console: colour dummy device 80x30
console [tty0] enabled
Calibrating delay loop... 22.78 BogoMIPS (lpj=113920)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
AT91: Power Management
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 57 (SDA) and 58 (SCL)
Switching to clocksource 32k_counter
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
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
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 36
io scheduler noop registered
io scheduler deadline registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
console [ttyS0] enabled
brd: module loaded
loop: module loaded
nbd: registered device at major 43
physmap platform flash device: 00800000 at 10000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID
0x000017
Intel/Sharp Extended Query Table at 0x0031
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Creating 1 MTD partitions on "physmap-flash.0":
0x000000000000-0x000000800000 : "uMON flash"
Generic platform RAM MTD, (c) 2004 Simtec Electronics
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffe0000 (irq 13)
eth0: Link now 100-FullDuplex
eth0: AT91 ethernet at 0xfefbc000 int=24 100-FullDuplex (5a:0b:01:d8:14:00)
eth0: Intel LXT971A PHY
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
at91_cf: probe of at91_cf failed with error -22
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 23, io mem 0x00300000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
USB Serial support registered for Keyspan - (without firmware)
USB Serial support registered for Keyspan 1 port adapter
USB Serial support registered for Keyspan 2 port adapter
USB Serial support registered for Keyspan 4 port adapter
usbcore: registered new interface driver keyspan
keyspan: v1.1.5:Keyspan USB to Serial Converter Driver
USB Serial support registered for MCT U232
usbcore: registered new interface driver mct_u232
mct_u232: z2.1:Magic Control Technology USB-RS232 converter driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mousedev: PS/2 mouse device common for all mice
at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
AT91 Real Time Clock driver.
rtc-ds1307 0-0068: rtc core: registered ds1307 as rtc1
rtc-ds1307 0-0068: 56 bytes nvram
i2c /dev entries driver
AT91 Watchdog Timer enabled (5 seconds, nowayout)
at91_mci at91_mci: 4 wire bus mode not supported - using 1 wire
at91_mci at91_mci: probe failed, err -22
at91_mci: probe of at91_mci failed with error -22
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
input: gpio-keys as /devices/platform/gpio-keys/input/input0
Freeing init memory: 7452K
usb 1-2: new low-speed USB device number 2 using at91_ohci
usb 1-2: device descriptor read/64, error -62
Starting logging: OK
usb 1-2: device descriptor read/64, error -62
Initializing random number generator... usb 1-2: new low-speed USB device number 3 using at91_ohci
usb 1-2: device descriptor read/64, error -62
done.
Starting network...
usb 1-2: device descriptor read/64, error -62
usb 1-2: new low-speed USB device number 4 using at91_ohci
Have you already tried Buildroot? It provides various options, how to package your rootfs. One of these options is to integrate initramfs directly into kernel. I would start with this option. You don't even need special kernel params to start rootfs, if it is embedded into your kernel.
Please beware, that kernel with embedded initramfs is bigger and hence bootloader must reserve enough space for the kernel, i.e. address space between load address of the kernel binary and address, where kernel will be extracted and stated.
If you already have a working kernel tree, you can configure BR to use it via local.mk.