[klibc] Fwd: why mtd root device number is __makedev(0,254)

zheng shi neversetsun at gmail.com
Mon Mar 22 22:17:03 PDT 2010


Hi,
Sorry for having posted the same topic twice in mail list.
How do you think my patch?
Do I have a wrong understanding about Root_MTD related stuff?


---------- Forwarded message ----------
From: zheng shi <neversetsun at gmail.com>
Date: Mon, Mar 22, 2010 at 10:32 PM
Subject: Re: [klibc] why mtd root device number is __makedev(0,254)
To: Mike Waychison <mikew at google.com>
Cc: klibc <klibc at zytor.com>


Hi,
__makedev(0, 254) is used to invoke mount_mtd_root function.
But mount_mtd_root needs root_dev_name (/dev/mtdblockX) which is still
absent from /dev since udev is absent.
In fact mtdblockX has been created under /sys/block/ at the stage when
flash driver probes flash partitions.

So I'm curious why mtd block devices have to treated specially as NFS
root device.
And it can be handled in "usr/kinit/name_to_dev.c"

Here's my patch:

--- a/usr/kinit/name_to_dev.c     2009-01-05 03:28:03.000000000 +0800
+++ b/usr/klibc-1.5.15/usr/kinit/name_to_dev.c       2010-03-08
12:07:49.000000000 +0800
@@ -145,8 +145,8 @@
       if (!strcmp(name, "ram")) /* /dev/ram - historic alias for /dev/ram0 */
               return Root_RAM0;

-       if (!strncmp(name, "mtd", 3))
-               return Root_MTD;

       len = strlen(name);
       s = alloca(len + 1);



On Mon, Mar 22, 2010 at 2:26 PM, Mike Waychison <mikew at google.com> wrote:
>
> On 2/25/10 1:13 AM, zheng shi wrote:
>>
>> Hi,
>> I'm wondering when /proc/cmdline has "root=/dev/mtdblockX",
>> name_to_dev_t_real will return __makedev(0,254) for root device's device
>> number
>> which is weired. I think we need to create the device on the fly from
>> information in sysfs.
>>
>
> This dev_t is a special one internal to kinit that is used internally to special case mtdblock root command lines.  It's an implementation artifact that is a little confusing when looking at the output, but it should work..
>
> I believe the use of /dev/mtdblockX requires the device node to be already present in the initramfs fwiw.
>
>> Maybe I have mistaken something. Is there any clue?
>>
>> --
>> Regards, Shizheng
>>
>>
>>
>> _______________________________________________
>> klibc mailing list
>> klibc at zytor.com
>> http://www.zytor.com/mailman/listinfo/klibc
>



--
Regards, Shizheng



-- 
Regards, Shizheng



More information about the klibc mailing list