2009-06-16 09:03:32 rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75810
Hi,
I'm trying to run rootfs on mmc card, but have a trouble:
Linux version 2.6.30-ADI-2010R1-pre-svn6721 (root@dlnx764) (gcc version 4.1.2 (A
DI svn)) #82 Tue Jun 16 12:15:52 IST 2009
console [early_BFuart0] enabled
early printk enabled on early_BFuart0
Board Memory: 32MB
Kernel Managed Memory: 21MB
Memory map:
fixedcode = 0x00000400-0x00000490
text = 0x00001000-0x000ea160
rodata = 0x000ea160-0x00137974
bss = 0x00138000-0x00147e58
data = 0x00147e58-0x0015a000
stack = 0x00158000-0x0015a000
init = 0x0015a000-0x00173000
available = 0x00173000-0x013ff000
DMA Zone = 0x01400000-0x01500000
Hardware Trace Active and Enabled
Boot Mode: 3
Blackfin support (C) 2004-2009 Analog Devices, Inc.
Compiled for ADSP-BF527 Rev 0.1
Warning: Compiled for Rev 1, but running on Rev 2
Blackfin Linux support by blackfin.uclinux.org/
Processor Speed: 528 MHz core clock and 132 MHz System Clock
NOMPU: setting up cplb tables
Instruction Cache Enabled for CPU0
Data Cache Enabled for CPU0 (write-back)
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 5079
Kernel command line: root=/dev/mmcblk0p1 ro rootdelay=2 init=/bin/init mem=21M m
ax_mem=32M$# clkin_hz=24000000 earlyprintk=serial,uart0,57600 console=tty0 conso
le=ttyBF0,57600
NR_IRQS:119
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 128 (order: 7, 512 bytes)
Console: colour dummy device 80x25
console [tty0] enabled
console handover: boot [early_BFuart0] -> real [ttyBF0]
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory available: 18700k/21504k RAM, (100k init code, 932k kernel code, 448k dat
a, 1024k dma, 296k reserved)
Calibrating delay loop... 1052.67 BogoMIPS (lpj=2105344)
Security Framework initialized
Mount-cache hash table entries: 512
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (16 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 48 KB (42 KB free)
net_namespace: 296 bytes
NET: Registered protocol family 16
Blackfin DMA Controller
ad7160eval_init(): registering device resources
bio: create slab <bio-0> at 0
msgmni has been set to 36
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART
brd: module loaded
loop: module loaded
bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b
ase@ffc00500, dma channel@7
i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base
@ffc01400
mmc_spi spi0.0: ASSUMING 3.2-3.4 V slot power
mmc_spi spi0.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
Waiting 2sec before mounting root device...
mmc_spi spi0.0: requested mode not fully supported
mmc_spi spi0.0: can't change chip-select polarity
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 481 MiB
mmcblk0: p1
VFS: Mounted root (ext2 filesystem) readonly on device 179:1.
Freeing unused kernel memory: 100k freed
Warning: unable to open an initial console.
...here freezes...
I'm running vmImage and passing "root=/dev/mmcblk0p1 ro " to the kernel.
What I'm missing... ?
Regards,
Nikolay
QuoteReplyEditDelete
2009-06-16 09:08:30 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75811
are you sure it froze ? or are you assuming no output == freeze ?
the warning there about missing /dev/console should be your clue that you need to make sure the /dev/ dir on the disk has proper initial device nodes.
otherwise, review the documentation:
docs.blackfin.uclinux.org/doku.php?id=linux-kernel:debug:post_mortem
QuoteReplyEditDelete
2009-06-16 09:52:56 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75815
... you're right - no output. The /dev/console was missing...
Now I have other thing:
<snip>
Freeing unused kernel memory: 100k freed
dma_alloc_init: dma_page @ 0x0015b000 - 256 pages at 0x01400000
init: exec rc failed
init: Booting to single user mode
mode
init: exec of single user shell failed
init: Failed to open /etc/inittab.init: -/bin/sh exec failed
init: -/bin/sh exec failed
Booting to single user mode
init: exec of single user shell failed
init: Failed to open /etc/inittab.init: -/bin/sh exec failed
init: -/bin/sh exec failed
Booting to single user mode
init: exec of single user shell failed
...
<snip>
The /etc/rc and /etc/inittab (but not /etc/inittab.init) are there.
What is "/etc/inittab.init"? Where to get it from? It's not on the rootfs.ext2 ...
QuoteReplyEditDelete
2009-06-16 09:56:28 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75816
verify your /bin/sh is correct
QuoteReplyEditDelete
2009-06-16 10:04:40 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75817
... it seems OK for me:
lrwxrwxrwx 1 root root 7 Jun 16 14:23 /mnt/mmc/bin/sh -> busybox
-rwxr-xr-x 1 root root 266936 Jun 16 14:23 /mnt/mmc/bin/busybox
I've copied from rootfs.ext2 image to the mmc card...
QuoteReplyEditDelete
2009-06-16 10:09:08 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75818
is it FLAT or FDPIC ? if it's FDPIC, do you have all the correct libraries in /lib/ ?
QuoteReplyEditDelete
2009-06-16 10:18:42 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75820
.. it's FDPIC. I suppose all lilbraries are there and are correct.
[root@dlnx764 uclinux-dist]# ls -al /mnt/mmc/lib/
total 2408
drwxr-xr-x 3 root root 1024 Jun 16 14:25 .
drwxr-xr-x 16 root root 1024 Jun 16 14:27 ..
-rwxr-xr-x 1 root root 30344 Jun 16 15:15 ld-uClibc.so.0
-rwxr-xr-x 1 root root 9532 Jun 16 15:15 libcrypt.so.0
-rwxr-xr-x 1 root root 258268 Jun 16 15:15 libc.so.0
-rwxr-xr-x 1 root root 10196 Jun 16 15:16 libdl.so.0
-rwxr-xr-x 1 root root 52072 Jun 16 15:16 libgcc_s.so.1
-rwxr-xr-x 1 root root 322924 Jun 16 15:16 libgfortran.so.1
-rwxr-xr-x 1 root root 452436 Jun 16 15:16 libgfortran.so.3
-rwxr-xr-x 1 root root 24300 Jun 16 15:16 libgomp.so.1
-rwxr-xr-x 1 root root 66700 Jun 16 15:16 libm.so.0
-rwxr-xr-x 1 root root 89056 Jun 16 15:16 libmudflap.so.0
-rwxr-xr-x 1 root root 93456 Jun 16 15:16 libmudflapth.so.0
-rwxr-xr-x 1 root root 1744 Jun 16 15:16 libnsl.so.0
-rwxr-xr-x 1 root root 80916 Jun 16 15:16 libobjc.so.2
-rwxr-xr-x 1 root root 43208 Jun 16 15:16 libpthread.so.0
-rwxr-xr-x 1 root root 1756 Jun 16 15:16 libresolv.so.0
-rwxr-xr-x 1 root root 3248 Jun 16 15:16 librt.so.0
-rwxr-xr-x 1 root root 819304 Jun 16 15:16 libstdc++.so.6
-rwxr-xr-x 1 root root 9716 Jun 16 15:16 libthread_db.so.1
-rwxr-xr-x 1 root root 4056 Jun 16 15:16 libutil.so.0
-rwxr-xr-x 1 root root 58256 Jun 16 15:15 libz.so.1
drwxr-xr-x 3 root root 1024 Jun 16 14:24 modules
[root@dlnx764 uclinux-dist]#
QuoteReplyEditDelete
2009-06-16 10:53:04 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75826
the "uImage" boots and works fine....
What could be wrong?
QuoteReplyEditDelete
2009-06-16 10:56:04 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75828
that isnt the same thing -- the code is running out of ramfs there. there could be a problem with mmc, or ext2, or ext2 on mmc.
why dont you boot the uImage, mount the ext2 mmc from that image, and then try executing things out of the ext2 mount.
QuoteReplyEditDelete
2009-06-16 11:05:21 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75829
The "uImage" is on the same ext2 partition on the mmc card. The u-Boot reads the ext2 and load uImage (and other stuff) fine (at least seems to). That makes me belive that the card and ext2 on it should be good.
I worked on similar way till now - have a card with FAT partition and "uImage" and "rootfs.ext2" on it. First load uImage and then trough the /dev/loop interface load the rootfs.ext2 and switch_root to it. That worked, but I'd like to run only 'pure' kernel on the RAM. One reason is space, next - memory fragmentation. Hope to get things better with that.
QuoteReplyEditDelete
2009-06-16 11:08:26 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75832
the fact that u-boot can read the card and fs isnt relevant to running it as the root filesystem
QuoteReplyEditDelete
2009-06-16 11:29:12 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75835
Is there any rquirements for the card or for the ext2 to running as a rootfs?
QuoteReplyEditDelete
2009-06-16 11:36:56 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75836
off the top of my head, there shouldnt be anything special to the device or fs in question
QuoteReplyEditDelete
2009-06-16 13:00:25 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75845
i just tested ext2 root on IDE disk and it works fine. all i did to set it up was:
- fdisk the drive as one big partition and declare it as ext2
- rcp over rootfs.ext2
- install it by doing `cat rootfs.ext2 > /dev/sda1`
- reboot
...
VFS: Mounted root (ext2 filesystem) readonly on device 8:1.
...
root:/> uname -a
Linux blackfin 2.6.30-ADI-2010R1-pre #7 Tue Jun 16 12:55:29 EDT 2009 blackfin GNU/Linux
root:/> mount | awk '$1 == "/dev/root"'
/dev/root on / type ext2 (ro,relatime)
root:/> cat /proc/cmdline
root=/dev/sda1 clkin_hz=25000000 earlyprintk=serial,uart1,57600 console=tty0 console=ttyBF0,57600 ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255.0:bf548
-ezkit:eth0:off
QuoteReplyEditDelete
2009-06-16 14:05:45 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75846
erm, that example didnt clearly show that my root was on /dev/sda1 via the mount command, but it was
i just tested BF548-EZKIT's mmc and it worked fine for me as well using pretty much the same method as above (but changing /dev/sda1 to /dev/mmcblk0p1)
...
mmc0: new SD card at address 80ca
mmcblk0: mmc0:80ca SD256 241 MiB
mmcblk0: p1 p2
VFS: Mounted root (ext2 filesystem) on device 179:1.
...
root:/> cat /proc/cmdline
root=/dev/mmcblk0p1 rw clkin_hz=25000000 earlyprintk=serial,uart1,57600 console=tty0 console=ttyBF0,57600 ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255
.0:bf548-ezkit:eth0:off
QuoteReplyEditDelete
2009-06-17 04:15:20 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75854
Now it works!
Thanks Mike!
Now I'm using:
`cat rootfs.ext2 > /dev/sdd1`
instead of mounting rootfs.ext2 image trough the dev/loop0 interface on the host machine and then copy the contents to the MMC card...
QuoteReplyEditDelete
2009-06-17 04:25:02 Re: rootfs on mmc
Mike Frysinger (UNITED STATES)
Message: 75880
that implies whatever you're doing on the host is wrong. you should use something like `cp -a` or `rsync -a` to ransfer files.
also, you should run `e2fsck` on the partition after using that cat trick. the ext2 filesystem embeds size information and the e2fsck will make sure it is fixed to properly fill the entire partition.
QuoteReplyEditDelete
2009-06-17 08:59:06 Re: rootfs on mmc
Nikolay Chokoev (IRELAND)
Message: 75887
Thanks for pointing that!