Posted by: Wildan Maulana | August 24, 2007

ngw100 issues #2 [solved]

1.

~ # strace mount /dev/mmcblk0p2 /mnt/rahasia
execve(“/bin/mount”, [“mount”, “-t”, “ext2”, “/dev/mmcblk0p2”, “/mnt/rahasia”], [/* 6 vars */]) = 0

mmap(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aab0000
stat(“/etc/ld-uClibc.so.cache”, {st_mode=S_IFREG|0644, st_size=2417, …}) = 0
open(“/etc/ld-uClibc.so.cache”, O_RDONLY) = 3
mmap(NULL, 2417, PROT_READ, MAP_SHARED, 3, 0) = 0x2aab1000
close(3) = 0
open(“/lib/libc.so.0”, O_RDONLY) = 3
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aab2000
read(3, “\177ELF\1\2\1\3\30\255\1″…, 4096) = 4096
mmap(NULL, 241664, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aab3000
mmap(0x2aab3000, 211664, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2aab3000
mmap(0x2aae7000, 8240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x33) = 0x2aae7000
mmap(0x2aaea000, 14124, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2aaea000
close(3) = 0
munmap(0x2aab2000, 4096) = 0
munmap(0x2aab1000, 2417) = 0
ioctl(0, TCGETS, {B115200 opost isig icanon echo …}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo …}) = 0
umask(022) = 022
open(“/dev/null”, O_RDWR|O_NOFOLLOW) = 3
close(3) = 0
brk(0) = 0x12000
brk(0x13000) = 0x13000
getuid() = 0
geteuid() = 0
lstat64(“/etc/mtab”, {st_mode=S_IFREG|0644, st_size=1049, …}) = 0
stat64(“/sbin/mount.ext2”, 0x7faf5a2c) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_BLOCK, ~[TRAP SEGV], NULL, 8) = 0
mount(“/dev/mmcblk0p2”, “/mnt/rahasia”, “ext2”, MS_MGC_VAL, NULL) = -1 ENXIO (No such device or address)
rt_sigprocmask(SIG_UNBLOCK, ~[TRAP SEGV], NULL, 8) = 0
write(2, “mount: “, 7mount: ) = 7
write(2, “/dev/mmcblk0p2″, 14/dev/mmcblk0p2) = 14
write(2, ” is not a valid block device\n”, 29 is not a valid block device
) = 29
_exit(32) = ?
Process 67 detached
~ #

After investigating for a while .., i found some thing strange about major number allocated to sdcard/mmc partitions, take a look at /proc/partitions entry :

# cat /proc/partitions
major minor #blocks name

31 0 128 mtdblock0
31 1 8000 mtdblock1
31 2 64 mtdblock2
31 3 8448 mtdblock3
253 0 1990656 mmcblk0
253 1 1464719 mmcblk0p1
253 2 525357 mmcblk0p2

And major number of mmc 1st and 2nd partition at /dev directory :

# ls -lah /dev/mmcblk0*
brwxrwxrwx 1 root root 254, 0 Aug 14 2007 /dev/mmcblk0
brwxrwxrwx 1 root root 254, 1 Aug 14 2007 /dev/mmcblk0p1
brwxrwxrwx 1 root root 254, 2 Aug 14 2007 /dev/mmcblk0p2
brwxrwxrwx 1 root root 254, 3 Aug 14 2007 /dev/mmcblk0p3
brwxrwxrwx 1 root root 254, 4 Aug 14 2007 /dev/mmcblk0p4

There are 2 mistakes here …, 1). dev/mmcblk0* have wrong major number and wrong type, it should be have major number = 7 and type b (block (buffered special file))

To fix it, just delete all /dev/mmcblk* and recreate it whit mknode :

# mknod -m=660 /dev/mmcblk0 b 253 0
# mknod -m=660 /dev/mmcblk0p1 b 253 1
# mknod -m=660 /dev/mmcblk0p2 b 253 2
Usefull links that can help to solve this issue :

http://lists.arm.linux.org.uk/pipermail/linux-arm/2005-August/010369.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: