* why ubimkvol can't recognize /dev/ubi0?
[not found] <4781288A.8080407@mail.ustc.edu.cn>
@ 2008-01-06 19:14 ` 时正
[not found] ` <4781BDEB.7000207@mail.ustc.edu.cn>
2008-01-07 7:49 ` Adrian Hunter
0 siblings, 2 replies; 5+ messages in thread
From: 时正 @ 2008-01-06 19:14 UTC (permalink / raw)
To: linux-mtd
Hi all,
I wanna have a try of ubifs on nandsim, and do as what the ubifs wiki
tells me
(http://osl.sed.hu/wiki/ubifs/index.php/Download_the_source).
1. compile, install and boot the new kernel(2.6.23)
the configuration option for ubi and nandsim is default turned on as module.
2. make the mtd-utils to produce ubimkvol
3. create a ubi when I got the error
# modprobe nandsim
# modprobe ubi mtd=0
# ls /dev/ubi0 -l
crw-rw---- 1 root root 253, 0 2007-12-25 01:46 /dev/ubi0
# ls /sys/class/ubi -l
drwxr-xr-x 3 root root 0 2007-12-25 01:46 ubi0
-r--r--r-- 1 root root 4096 2007-12-25 01:49 version
# ubimkvol /dev/ubi0 -n 0 -N test -s 20MiB
libubi error: readdir failed on "/sys/class/ubi"
readdir: No such file or directory
ubimkvol error: "/dev/ubi0" is not an UBI device node
it's so strange about the readdir failure, because there is the ubi0
entry in sysfs.
did I miss any step, such as kernel configuration or mtd-tools installation?
Thanks a lot!
best wishes, shizheng
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why ubimkvol can't recognize /dev/ubi0?
[not found] ` <4781BDEB.7000207@mail.ustc.edu.cn>
@ 2008-01-07 5:51 ` shizheng
[not found] ` <4781BFA6.4010207@mail.ustc.edu.cn>
0 siblings, 1 reply; 5+ messages in thread
From: shizheng @ 2008-01-07 5:51 UTC (permalink / raw)
To: linux-mtd, vinit.agnihotri
By default nandsim creates device of 8MB.
# cat /proc/mtd
dev: size erasesize name
mtd0: 08000000 00004000 "NAND simulator partition 0"
>
> Vinit Agnihotri wrote:
>> yeah & 1 more...use mtdram instead of nandsim.
>> modprobe mtdram=40960 will create mtd device of size 40MB,
>> besides that you can write small tool for creating & deleting volumes,
>> its simple.
>> you can find ioctl's & structures code in include/mtd/ubi-user.h.
>>
>> --Vinit.
>>
>> On Jan 6, 2008 1:23 PM, Vinit Agnihotri <vinit.agnihotri@gmail.com> wrote:
>>
>>> You have loaded Nandsim with default, may be theres not enough space
>>> on nandsim to create 20Mib volume,
>>> I guess by default nandsim creates device of 8MB. you can check it by
>>> looking a /proc/mtd.
>>> so try creating volume of smaller size or pass appropriate module
>>> parameters to nandsim module,
>>> do a modinfo nandsim or straight way have look in its code, I assume
>>> that you have proper privileges to run ubimkvol.
>>> still I dont have justification for that strange error, but try this out.
>>>
>>> --Vinit.
>>>
>>>
>>> On Jan 6, 2008 11:14 AM, 时正 <shizheng@mail.ustc.edu.cn> wrote:
>>>
>>>> Hi all,
>>>> I wanna have a try of ubifs on nandsim, and do as what the ubifs wiki
>>>> tells me
>>>> (http://osl.sed.hu/wiki/ubifs/index.php/Download_the_source).
>>>>
>>>> 1. compile, install and boot the new kernel(2.6.23)
>>>> the configuration option for ubi and nandsim is default turned on as module.
>>>>
>>>>
>>>> 2. make the mtd-utils to produce ubimkvol
>>>>
>>>> 3. create a ubi when I got the error
>>>> # modprobe nandsim
>>>> # modprobe ubi mtd=0
>>>> # ls /dev/ubi0 -l
>>>> crw-rw---- 1 root root 253, 0 2007-12-25 01:46 /dev/ubi0
>>>> # ls /sys/class/ubi -l
>>>> drwxr-xr-x 3 root root 0 2007-12-25 01:46 ubi0
>>>> -r--r--r-- 1 root root 4096 2007-12-25 01:49 version
>>>> # ubimkvol /dev/ubi0 -n 0 -N test -s 20MiB
>>>> libubi error: readdir failed on "/sys/class/ubi"
>>>> readdir: No such file or directory
>>>> ubimkvol error: "/dev/ubi0" is not an UBI device node
>>>>
>>>> it's so strange about the readdir failure, because there is the ubi0
>>>> entry in sysfs.
>>>>
>>>> did I miss any step, such as kernel configuration or mtd-tools installation?
>>>>
>>>> Thanks a lot!
>>>>
>>>> best wishes, shizheng
>>>>
>>>>
>>>> ______________________________________________________
>>>> Linux MTD discussion mailing list
>>>> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>>>>
>>>>
>>>
>>> --
>>> Life is so short. So, follow some rules. Forgive quickly, believe
>>> slowly, love truly, laugh loudly & never avoid anything that makes U
>>> smile.
>>>
>>>
>>
>>
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why ubimkvol can't recognize /dev/ubi0?
[not found] ` <4781BFA6.4010207@mail.ustc.edu.cn>
@ 2008-01-07 5:59 ` shizheng
0 siblings, 0 replies; 5+ messages in thread
From: shizheng @ 2008-01-07 5:59 UTC (permalink / raw)
To: linux-mtd, vinit.agnihotri
>
> By default nandsim creates device of 8MB.
>
~~~~~~ Sorry, this shold be 128MB :-)
> # cat /proc/mtd
> dev: size erasesize name
> mtd0: 08000000 00004000 "NAND simulator partition 0"
>
> >/
> />/ Vinit Agnihotri wrote:
> />>/ yeah & 1 more...use mtdram instead of nandsim.
> />>/ modprobe mtdram=40960 will create mtd device of size 40MB,
> />>/ besides that you can write small tool for creating & deleting volumes,
> />>/ its simple.
> />>/ you can find ioctl's & structures code in include/mtd/ubi-user.h.
> />>/
> />>/ --Vinit.
> />>/
> />>/ On Jan 6, 2008 1:23 PM, Vinit Agnihotri <vinit.agnihotri at gmail.com <http://lists.infradead.org/mailman/listinfo/linux-mtd>> wrote:
> />>/
> />>>/ You have loaded Nandsim with default, may be theres not enough space
> />>>/ on nandsim to create 20Mib volume,
> />>>/ I guess by default nandsim creates device of 8MB. you can check it by
> />>>/ looking a /proc/mtd.
> />>>/ so try creating volume of smaller size or pass appropriate module
> />>>/ parameters to nandsim module,
> />>>/ do a modinfo nandsim or straight way have look in its code, I assume
> />>>/ that you have proper privileges to run ubimkvol.
> />>>/ still I dont have justification for that strange error, but try this out.
> />>>/
> />>>/ --Vinit.
> />>>/
> />>>/
> />>>/ On Jan 6, 2008 11:14 AM, 时正 <shizheng at mail.ustc.edu.cn <http://lists.infradead.org/mailman/listinfo/linux-mtd>> wrote:
> />>>/
> />>>>/ Hi all,
> />>>>/ I wanna have a try of ubifs on nandsim, and do as what the ubifs wiki
> />>>>/ tells me
> />>>>/ (http://osl.sed.hu/wiki/ubifs/index.php/Download_the_source).
> />>>>/
> />>>>/ 1. compile, install and boot the new kernel(2.6.23)
> />>>>/ the configuration option for ubi and nandsim is default turned on as module.
> />>>>/
> />>>>/
> />>>>/ 2. make the mtd-utils to produce ubimkvol
> />>>>/
> />>>>/ 3. create a ubi when I got the error
> />>>>/ # modprobe nandsim
> />>>>/ # modprobe ubi mtd=0
> />>>>/ # ls /dev/ubi0 -l
> />>>>/ crw-rw---- 1 root root 253, 0 2007-12-25 01:46 /dev/ubi0
> />>>>/ # ls /sys/class/ubi -l
> />>>>/ drwxr-xr-x 3 root root 0 2007-12-25 01:46 ubi0
> />>>>/ -r--r--r-- 1 root root 4096 2007-12-25 01:49 version
> />>>>/ # ubimkvol /dev/ubi0 -n 0 -N test -s 20MiB
> />>>>/ libubi error: readdir failed on "/sys/class/ubi"
> />>>>/ readdir: No such file or directory
> />>>>/ ubimkvol error: "/dev/ubi0" is not an UBI device node
> />>>>/
> />>>>/ it's so strange about the readdir failure, because there is the ubi0
> />>>>/ entry in sysfs.
> />>>>/
> />>>>/ did I miss any step, such as kernel configuration or mtd-tools installation?
> />>>>/
> />>>>/ Thanks a lot!
> />>>>/
> />>>>/ best wishes, shizheng
> />>>>/
> />>>>/
> />>>>/ ______________________________________________________
> />>>>/ Linux MTD discussion mailing list
> />>>>/ http://lists.infradead.org/mailman/listinfo/linux-mtd/
> />>>>/
> />>>>/
> />>>/
> />>>/ --
> />>>/ Life is so short. So, follow some rules. Forgive quickly, believe
> />>>/ slowly, love truly, laugh loudly & never avoid anything that makes U
> />>>/ smile.
> />>>/
> />>>/
> />>/
> />>/
> />>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: why ubimkvol can't recognize /dev/ubi0?
2008-01-06 19:14 ` why ubimkvol can't recognize /dev/ubi0? 时正
[not found] ` <4781BDEB.7000207@mail.ustc.edu.cn>
@ 2008-01-07 7:49 ` Adrian Hunter
2008-01-15 8:08 ` Artem Bityutskiy
1 sibling, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2008-01-07 7:49 UTC (permalink / raw)
To: ext 时正; +Cc: linux-mtd
时正 wrote:
> Hi all,
> I wanna have a try of ubifs on nandsim, and do as what the ubifs wiki
> tells me
> (http://osl.sed.hu/wiki/ubifs/index.php/Download_the_source).
>
> 1. compile, install and boot the new kernel(2.6.23)
> the configuration option for ubi and nandsim is default turned on as module.
>
>
> 2. make the mtd-utils to produce ubimkvol
>
> 3. create a ubi when I got the error
> # modprobe nandsim
> # modprobe ubi mtd=0
> # ls /dev/ubi0 -l
> crw-rw---- 1 root root 253, 0 2007-12-25 01:46 /dev/ubi0
> # ls /sys/class/ubi -l
> drwxr-xr-x 3 root root 0 2007-12-25 01:46 ubi0
> -r--r--r-- 1 root root 4096 2007-12-25 01:49 version
> # ubimkvol /dev/ubi0 -n 0 -N test -s 20MiB
> libubi error: readdir failed on "/sys/class/ubi"
> readdir: No such file or directory
> ubimkvol error: "/dev/ubi0" is not an UBI device node
>
> it's so strange about the readdir failure, because there is the ubi0
> entry in sysfs.
>
> did I miss any step, such as kernel configuration or mtd-tools installation?
>
> Thanks a lot!
>
> best wishes, shizheng
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>From b96f4481662bd7ac247d4d5a25b27f7d8afffb92 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
Date: Mon, 7 Jan 2008 09:47:17 +0200
Subject: ubi-utils: fix bug using readdir
Library functions never reset errno to zero, so if you want
to use its value to check for errors then you must set it to zero
before calling the library function (in this case readdir).
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
ubi-utils/src/libubi.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c
index 855aa82..be06f70 100644
--- a/ubi-utils/src/libubi.c
+++ b/ubi-utils/src/libubi.c
@@ -872,9 +872,13 @@ int ubi_get_info(libubi_t desc, struct ubi_info *info)
}
info->lowest_dev_num = INT_MAX;
- while ((dirent = readdir(sysfs_ubi))) {
+ while (1) {
int dev_num, ret;
+ errno = 0;
+ dirent = readdir(sysfs_ubi);
+ if (!dirent)
+ break;
/*
* Make sure this direntry is a directory and not a symlink -
* Linux puts symlinks to UBI volumes on this UBI device to the
@@ -1022,9 +1026,14 @@ int ubi_get_dev_info1(libubi_t desc, int dev_num, struct ubi_dev_info *info)
return -1;
info->lowest_vol_num = INT_MAX;
- while ((dirent = readdir(sysfs_ubi))) {
+
+ while (1) {
int vol_id, ret, devno;
+ errno = 0;
+ dirent = readdir(sysfs_ubi);
+ if (!dirent)
+ break;
ret = sscanf(dirent->d_name, UBI_VOL_NAME_PATT, &devno, &vol_id);
if (ret == 2 && devno == dev_num) {
info->vol_count += 1;
--
1.4.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: why ubimkvol can't recognize /dev/ubi0?
2008-01-07 7:49 ` Adrian Hunter
@ 2008-01-15 8:08 ` Artem Bityutskiy
0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2008-01-15 8:08 UTC (permalink / raw)
To: Adrian Hunter; +Cc: linux-mtd, 时正
On Mon, 2008-01-07 at 09:49 +0200, Adrian Hunter wrote:
> From b96f4481662bd7ac247d4d5a25b27f7d8afffb92 Mon Sep 17 00:00:00 2001
> From: Adrian Hunter <ext-adrian.hunter@nokia.com>
> Date: Mon, 7 Jan 2008 09:47:17 +0200
> Subject: ubi-utils: fix bug using readdir
>
> Library functions never reset errno to zero, so if you want
> to use its value to check for errors then you must set it to zero
> before calling the library function (in this case readdir).
>
> Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Thanks, committed.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-15 8:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4781288A.8080407@mail.ustc.edu.cn>
2008-01-06 19:14 ` why ubimkvol can't recognize /dev/ubi0? 时正
[not found] ` <4781BDEB.7000207@mail.ustc.edu.cn>
2008-01-07 5:51 ` shizheng
[not found] ` <4781BFA6.4010207@mail.ustc.edu.cn>
2008-01-07 5:59 ` shizheng
2008-01-07 7:49 ` Adrian Hunter
2008-01-15 8:08 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox