![]() |
[Solved] /dev/mmcblk* missing when in /sbin/preinit?
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 |
Re: /dev/mmcblk* missing when in /sbin/preinit?
/home is mounted on /etc/event.d/rcS-late. Way after preinit.
|
Re: /dev/mmcblk* missing when in /sbin/preinit?
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 |
Re: /dev/mmcblk* missing when in /sbin/preinit?
Quote:
I don't have the list with me right now, but you can check dependencies in lsmod. |
Re: /dev/mmcblk* missing when in /sbin/preinit?
Quote:
(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 |
Re: /dev/mmcblk* missing when in /sbin/preinit?
Can you try to do
ls -lR /sys/block/mmcblk*/ in preinit, after loading the modules? |
Re: /dev/mmcblk* missing when in /sbin/preinit?
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 |
Re: [Solved] /dev/mmcblk* missing when in /sbin/preinit?
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 |
Re: [Solved] /dev/mmcblk* missing when in /sbin/preinit?
@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). |
Re: [Solved] /dev/mmcblk* missing when in /sbin/preinit?
Quote:
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. |
Re: [Solved] /dev/mmcblk* missing when in /sbin/preinit?
Thanks reinob! Yes I think you're right about udev creating the devices.
I had no idea there was such a thing called udev & udevd & did a quick read on them. http://en.wikipedia.org/wiki/Udev Key points there: - "Unlike traditional Unix systems, where the device nodes in the /dev directory have been a static set of files, the Linux udev device manager dynamically provides only the nodes for the devices actually present on a system." - "udev executes entirely in user space" - means each user possibly sees different sets of devices, and explains why devices available later are different from devices available in early stages of boot up. - "runs as a daemon on a Linux system and listens (via netlink socket) to uevents the kernel sends out if a new device is initialized or a device is removed from the system. The system provides a set of rules that match against exported values of the event and properties of the discovered device. A matching rule will possibly name and create a device node and run configured programs to set-up and configure the device." /etc/init.d/rcS also has following under prepare_start_udev(): echo -n "Mounting a tmpfs over /dev..." mount -n -o size=$tmpfs_size,mode=0755,noatime -t tmpfs none /dev ... and if one checks for mounts in the N900, there should be an entry that says: none on /dev type tmpfs (rw,noatime,size=10240k,mode=755) ... coupled with the user space architecture, probably explains why /dev looks quite different during preinit. ... in addition, 92-n770.rules has following rules (for creation of devices; corresponding to point 3 above): KERNEL=="mmcblk*", IMPORT{program}="/lib/udev/mmc_id $env{PHYSDEVPATH}" KERNEL=="mmcblk*p*", env{SLOT_NUM}!="", NAME="mmcblk$env{SLOT_NUM}p%n" KERNEL=="mmcblk*", env{SLOT_NUM}!="", NAME="mmcblk$env{SLOT_NUM}" ... & yes, mmc_id seems to be the part that fixes IDs of the MMC... which just gave me a still-not-so-solid-but-workable idea on how to reliably identify MMC devices during boot. :) (ls -al /sys/block/mmcblk0 | grep device , trace its link to /sys/class/mmc_host/mmc1, and cat /sys/class/mmc_host/mmc1/slot_name. kh |
All times are GMT. The time now is 01:08. |
vBulletin® Version 3.8.8