* compile error when using MEMREADOOB in do_mounts.c.
@ 2003-01-03 7:56 Paul Wong
2003-01-03 8:52 ` Thomas Gleixner
0 siblings, 1 reply; 7+ messages in thread
From: Paul Wong @ 2003-01-03 7:56 UTC (permalink / raw)
To: linux-mtd
Dear All,
I modified the init/do_mounts.c to want to skip the invalid block. and
than make bzImage, that result say: undefined reference to 'ioctl'. What is
the problem?
Thank you.
best regards,
Paul
****** part of init/do_mounts.c *********
#include <linux/mtd/mtd.h>
static int __init fill_inbuf(void)
{
static unsigned long curptr=0L;
if (exit_code) return -1;
#if 1 // for mtd read and check valid block
{
#define MTDBLOCKSIZE 16384
unsigned char oobbuf[16];
struct mtd_oob_buf oob;
oob.length = 16;
oob.ptr = (unsigned char*)&oobbuf;
for (;(curptr%MTDBLOCKSIZE)==0;
curptr =lseek(crd_infd,MTDBLOCKSIZE,1))
{
oob.start = curptr;
if (ioctl(crd_infd, MEMREADOOB, &oob) != 0)
{
return -1;
}
if (oobbuf[5] == 0xFF)
break;
}
}
#endif
insize = read(crd_infd, inbuf, INBUFSIZ);
if (insize == 0) return -1;
curptr += insize;
inptr = 1;
return inbuf[0];
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-03 7:56 compile error when using MEMREADOOB in do_mounts.c Paul Wong
@ 2003-01-03 8:52 ` Thomas Gleixner
2003-01-03 9:22 ` Paul Wong
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2003-01-03 8:52 UTC (permalink / raw)
To: Paul Wong, linux-mtd
On Friday 03 January 2003 08:56, Paul Wong wrote:
> Dear All,
>
> I modified the init/do_mounts.c to want to skip the invalid block. and
> than make bzImage, that result say: undefined reference to 'ioctl'. What is
> the problem?
ioctl is part of userspace library. You can not use glibc functions inside the
kernel.
What's the deeper sense of this modification ? Bad block handling is done by
the filesystem and the mtd drivers.
--
Thomas
____________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-03 8:52 ` Thomas Gleixner
@ 2003-01-03 9:22 ` Paul Wong
2003-01-04 20:32 ` Thomas Gleixner
0 siblings, 1 reply; 7+ messages in thread
From: Paul Wong @ 2003-01-03 9:22 UTC (permalink / raw)
To: tglx, linux-mtd
Firstly, thanks Thomas,
Let me to explain my system: I separate three partitions of NAND flash
(16MB),
/dev/mtd0 for kernel image , use dd if=xxx.img of=/dev/mtd0
/dev/mtd1 for rootfs image , use dd if=roofts.img of=/dev/mtd1
/dev/mtd2 for jffs2 filesystem
Firstly, system decompress and run the compressed kernel image in mtd0, then
the kernel (kernel 2.4.20)will decompress the rootfs image in mtd1 to
ramdisk. ( I modified the do_mounts.c to do it). Finally, I success to boot
up and run normal. But, I see fill_inbuf() in do_mounts.c, it only use the
read(..) functon to get the content of the rootfs.img (/dev/mtd1), is it
care the bad block??
best regards,
Paul
----- Original Message -----
From: "Thomas Gleixner" <tglx@linutronix.de>
To: "Paul Wong" <paul.wong@digitalview.com>; <linux-mtd@lists.infradead.org>
Sent: Friday, January 03, 2003 4:52 PM
Subject: Re: compile error when using MEMREADOOB in do_mounts.c.
> On Friday 03 January 2003 08:56, Paul Wong wrote:
> > Dear All,
> >
> > I modified the init/do_mounts.c to want to skip the invalid block.
and
> > than make bzImage, that result say: undefined reference to 'ioctl'. What
is
> > the problem?
> ioctl is part of userspace library. You can not use glibc functions inside
the
> kernel.
>
> What's the deeper sense of this modification ? Bad block handling is done
by
> the filesystem and the mtd drivers.
>
> --
> Thomas
> ____________________________________________________
> linutronix - competence in embedded & realtime linux
> http://www.linutronix.de
> mail: tglx@linutronix.de
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-03 9:22 ` Paul Wong
@ 2003-01-04 20:32 ` Thomas Gleixner
2003-01-05 8:49 ` Paul Wong
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2003-01-04 20:32 UTC (permalink / raw)
To: Paul Wong, linux-mtd
On Friday 03 January 2003 10:22, Paul Wong wrote:
> Firstly, thanks Thomas,
>
> Let me to explain my system: I separate three partitions of NAND flash
> (16MB),
> /dev/mtd0 for kernel image , use dd if=xxx.img of=/dev/mtd0
This works only, if you have no bad blocks in your mtd0 partition
> /dev/mtd1 for rootfs image , use dd if=roofts.img of=/dev/mtd1
Same as above
> /dev/mtd2 for jffs2 filesystem
Where do you boot from ? I assume NOR-FLASH. Do you have a bootloader there ?
You should modify your bootloader to program the kernel image either to the
NOR-FLASH itself or to the NAND-FLASH with respect to possible bad blocks .
Then your bootloader should load the kernel image from NAND bad block aware
to RAM for decrompression or you decompress from your NOR-FLASH.
There is no need to have a compressed rootfs. You can also put your root fs on
JFFS2, which has compression too. This will save you RAM-space. Also for this
image you need your NAND and bad block aware bootloader utility to program
the image to the NAND chip.
> Firstly, system decompress and run the compressed kernel image in mtd0,
> then the kernel (kernel 2.4.20)will decompress the rootfs image in mtd1 to
> ramdisk. ( I modified the do_mounts.c to do it). Finally, I success to boot
> up and run normal. But, I see fill_inbuf() in do_mounts.c, it only use the
> read(..) functon to get the content of the rootfs.img (/dev/mtd1), is it
> care the bad block??
No
--
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-04 20:32 ` Thomas Gleixner
@ 2003-01-05 8:49 ` Paul Wong
2003-01-05 9:37 ` Thomas Gleixner
0 siblings, 1 reply; 7+ messages in thread
From: Paul Wong @ 2003-01-05 8:49 UTC (permalink / raw)
To: tglx, linux-mtd
----- Original Message -----
From: "Thomas Gleixner" <tglx@linutronix.de>
To: "Paul Wong" <paul.wong@digitalview.com>; <linux-mtd@lists.infradead.org>
Sent: Sunday, January 05, 2003 4:32 AM
Subject: Re: compile error when using MEMREADOOB in do_mounts.c.
> On Friday 03 January 2003 10:22, Paul Wong wrote:
> > Firstly, thanks Thomas,
> >
> > Let me to explain my system: I separate three partitions of NAND flash
> > (16MB),
> > /dev/mtd0 for kernel image , use dd if=xxx.img of=/dev/mtd0
> This works only, if you have no bad blocks in your mtd0 partition
>
> > /dev/mtd1 for rootfs image , use dd if=roofts.img of=/dev/mtd1
> Same as above
>
> > /dev/mtd2 for jffs2 filesystem
>
> Where do you boot from ? I assume NOR-FLASH. Do you have a bootloader
there ?
> You should modify your bootloader to program the kernel image either to
the
> NOR-FLASH itself or to the NAND-FLASH with respect to possible bad blocks
.
> Then your bootloader should load the kernel image from NAND bad block
aware
> to RAM for decrompression or you decompress from your NOR-FLASH.
> There is no need to have a compressed rootfs. You can also put your root
fs on
> JFFS2, which has compression too. This will save you RAM-space. Also for
this
> image you need your NAND and bad block aware bootloader utility to program
> the image to the NAND chip.
Yes, I modifed the bootloader (in NOR-Flash) that can load kernel image in
/dev/mtd0 (NAND flash) and bad block handling. and I also tried the rootfs
in JFFS2, but the customer do not shutdown the system by keyboard, just
directly power off the unit. then the JFFS2 may be corrupted and cannot boot
up again. The ramdisk is a good solution for this case. So, I want to
modify the do_mounts.c to check the bad block to load the rootfs image to
ramdisk.
>
> > Firstly, system decompress and run the compressed kernel image in mtd0,
> > then the kernel (kernel 2.4.20)will decompress the rootfs image in mtd1
to
> > ramdisk. ( I modified the do_mounts.c to do it). Finally, I success to
boot
> > up and run normal. But, I see fill_inbuf() in do_mounts.c, it only use
the
> > read(..) functon to get the content of the rootfs.img (/dev/mtd1), is it
> > care the bad block??
> No
>
> --
> Thomas
> ________________________________________________________________________
> linutronix - competence in embedded & realtime linux
> http://www.linutronix.de
> mail: tglx@linutronix.de
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-05 8:49 ` Paul Wong
@ 2003-01-05 9:37 ` Thomas Gleixner
2003-01-05 15:56 ` Paul Wong
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2003-01-05 9:37 UTC (permalink / raw)
To: Paul Wong, linux-mtd
On Sunday 05 January 2003 09:49, Paul Wong wrote:
>
> Yes, I modifed the bootloader (in NOR-Flash) that can load kernel image in
> /dev/mtd0 (NAND flash) and bad block handling. and I also tried the rootfs
> in JFFS2, but the customer do not shutdown the system by keyboard, just
> directly power off the unit. then the JFFS2 may be corrupted and cannot
> boot up again. The ramdisk is a good solution for this case. So, I want
> to modify the do_mounts.c to check the bad block to load the rootfs image
> to ramdisk.
JFFS2 can handle a direct power down. The only way you can loose data, is if
you are writing to a file exactly in the moment, when you power down. This
does not lead to a fs corruption. JFFS2 can handle this.
--
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile error when using MEMREADOOB in do_mounts.c.
2003-01-05 9:37 ` Thomas Gleixner
@ 2003-01-05 15:56 ` Paul Wong
0 siblings, 0 replies; 7+ messages in thread
From: Paul Wong @ 2003-01-05 15:56 UTC (permalink / raw)
To: tglx, linux-mtd
Really! this is a good new. I will try this method when I back to office.
Thanks a lots.
Paul
----- Original Message -----
From: "Thomas Gleixner" <tglx@linutronix.de>
To: "Paul Wong" <paul.wong@digitalview.com>; <linux-mtd@lists.infradead.org>
Sent: Sunday, January 05, 2003 5:37 PM
Subject: Re: compile error when using MEMREADOOB in do_mounts.c.
> On Sunday 05 January 2003 09:49, Paul Wong wrote:
> >
> > Yes, I modifed the bootloader (in NOR-Flash) that can load kernel image
in
> > /dev/mtd0 (NAND flash) and bad block handling. and I also tried the
rootfs
> > in JFFS2, but the customer do not shutdown the system by keyboard, just
> > directly power off the unit. then the JFFS2 may be corrupted and cannot
> > boot up again. The ramdisk is a good solution for this case. So, I
want
> > to modify the do_mounts.c to check the bad block to load the rootfs
image
> > to ramdisk.
> JFFS2 can handle a direct power down. The only way you can loose data, is
if
> you are writing to a file exactly in the moment, when you power down. This
> does not lead to a fs corruption. JFFS2 can handle this.
>
> --
> Thomas
> ________________________________________________________________________
> linutronix - competence in embedded & realtime linux
> http://www.linutronix.de
> mail: tglx@linutronix.de
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-01-05 15:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-03 7:56 compile error when using MEMREADOOB in do_mounts.c Paul Wong
2003-01-03 8:52 ` Thomas Gleixner
2003-01-03 9:22 ` Paul Wong
2003-01-04 20:32 ` Thomas Gleixner
2003-01-05 8:49 ` Paul Wong
2003-01-05 9:37 ` Thomas Gleixner
2003-01-05 15:56 ` Paul Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox