Reply
Thread Tools
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#1
Hi.

/dev/mmcblk* missing when in /sbin/preinit?
Anyone knows what I need to do to get them to appear?

At various spots in preinit, i tried following command:
find / > /zlog.txt

zlog.txt somehow only shows a few devices.
mmcblk* is missing.
Tried above command even jst before preinit executes /sbin/init, but no diff...
I had also ensured various mmc kernel modules are loaded.

I wanted to mount /dev/mmcblk0p2 but can't coz of above.

Strange thing is, it is the same file system that is booted to. So, after full boot up, I can see /dev/mmcblk* files.
I did a grep in /etc/event.d also but can't find a clue.

I am doing above on a freshly PR1.3 flashed N900.

Thanks n best regards,

kh

Last edited by bozoid; 2012-12-13 at 06:16.
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#2
/home is mounted on /etc/event.d/rcS-late. Way after preinit.
 

The Following 2 Users Say Thank You to reinob For This Useful Post:
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#3
thanks yes i am aware.
am trying to move rootfs to emmc.
am also aware another thread discusses rootfs on emmc.
that one didnt work for me, and i had some personal prefs as well.

so, am still wondering how i can get /dev/mmcblk* devices during preinit stage? anyone?

kh
 
Posts: 1,225 | Thanked: 1,905 times | Joined on Feb 2011 @ Quezon City, Philippines
#4
Originally Posted by bozoid View Post
thanks yes i am aware.
am trying to move rootfs to emmc.
am also aware another thread discusses rootfs on emmc.
that one didnt work for me, and i had some personal prefs as well.

so, am still wondering how i can get /dev/mmcblk* devices during preinit stage? anyone?

kh
You need to insmod the OMAP HSMMC drivers and the filesystem drivers yourself.

I don't have the list with me right now, but you can check dependencies in lsmod.
__________________
N9 PR 1.3 Open Mode + kernel-plus for Harmattan
@kenweknot, working on Glacier for Nemo.
 
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#5
Originally Posted by Hurrian View Post
You need to insmod the OMAP HSMMC drivers and the filesystem drivers yourself.

I don't have the list with me right now, but you can check dependencies in lsmod.
Thanks! But still no go...

(Checking that makes me feel more & more that /sbin/preinit is just quite broken... modules it loads are very short but yet it has script commands that access mmc partitions)

The modules are (in order they should be loaded):
mbcache ext2 jbd ext3 mmc_core mmc_block omap_hsmmc

I've loaded them in that manner; lsmod from within preinit shows them loaded but still no /dev/mmcblk* devices.

I happen to looked at /bootmenu.sh this time round & saw something interesting in it:

# eMMC and SD
cd /dev; /sbin/MAKEDEV input; cd /
insmod $MODULE_PATH/mmc_core.ko
insmod $MODULE_PATH/mmc_block.ko
insmod $MODULE_PATH/omap_hsmmc.ko
rm -f /dev/mmcblk*
sleep 2
for p in /sys/block/mmcblk*/ /sys/block/mmcblk*/mmcblk*p*/; do
n=`basename $p`
rm -f /dev/$n
mknod /dev/$n b `cat $p/dev | sed "s/:/ /g"`
done

More devices appeared in /dev but still no /dev/mmcblk*...

Best regards,

kh
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#6
Can you try to do

ls -lR /sys/block/mmcblk*/

in preinit, after loading the modules?
 
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#7
I'm sorry I forgot to respond to this!
Came across this thread again when I was debugging some stuff.

Anyway, I've found the solution.

Modules must be loaded using insmod or similar in preinit in this order:
mmc_core mmc_block omap_hsmmc mbcache jbd ext2 ext3
(ext2 only as necessary)

mmcblk* will only show under /sys/block after a bit of time (ie: 1 second).
So, a sleep of 1 second was added in my script after loading above modules.

Then..., in my case, using various dev files under /sys/block/mmcblk*, I had some commands do following:
mknod /dev/mmcblk0 b 179 0
(where the last 2 values are obtained from dev files; ie: /sys/block/mmcblk0/dev)

That created devices in /dev for me.

I've got that all in some loop and script in my preinit script of course...

Thanks again for the help!

kh
 

The Following 2 Users Say Thank You to bozoid For This Useful Post:
Posts: 95 | Thanked: 66 times | Joined on Mar 2012
#8
Oh, one thing to note. One might want to identify the correct storage to do further stuff from this...
(ie: find the eMMC or the storage card).

As noted in other threads (rootfs on emmc), N900 swaps mmcblk0 and mmcblk1 at some point after preinit.

The solution I did was to use sfdisk -l, coupled with some greps, etc, to identify the partition (in a very flaky way, by looking at count of cylinders).
I noted that both eMMC & SD use the same kernel drivers... hence trying to identify them by hardware type proved a bit difficult.
Didn't try too hard to find other ways yet.

Options I can think of offhand to identify the storage are:
- lshal
- parameters of the device in /sys/block/mmcblk*
- probably some storage label tool.

kh
 

The Following 2 Users Say Thank You to bozoid For This Useful Post:
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#9
@bozoid,

Thanks for your findings!

I haven't investigated this yet, but I think the /dev/mmcblk* devices are created by udev, which is started in /etc/init.d/rcS, which is the first script run by upstart after /sbin/preinit passes control to it.

Have a look in /etc/udev/rules.d/92-n770.rules as well as /lib/udev/mmc_id (which provides a suitable name to udev). mmc_id gives the SLOT_NUM 1 to the external MMC and SLOT_NUM 0 to the internal MMC (even though the kernel appears to detect the external MMC first and then the internal one, so udev effectively swaps the slot numbers).
 

The Following 2 Users Say Thank You to reinob For This Useful Post:
Posts: 1,225 | Thanked: 1,905 times | Joined on Feb 2011 @ Quezon City, Philippines
#10
Originally Posted by reinob View Post
(even though the kernel appears to detect the external MMC first and then the internal one, so udev effectively swaps the slot numbers).
Physically, the SD card is wired to the first MMC interface on the OMAP.

I speculate this was to aid during testing/development of the N900, as IIRC the only way you're feeding the OMAP ROM with an easily replacable (NAND doesn't count) second stage bootloader was by writing it to the first MMC device.
__________________
N9 PR 1.3 Open Mode + kernel-plus for Harmattan
@kenweknot, working on Glacier for Nemo.
 
Reply


 
Forum Jump


All times are GMT. The time now is 07:37.