public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* help: bootloader for loading kernel from mtdblock device on flash........
@ 2003-02-03 11:24 Vishal
  2003-02-03 12:47 ` Holger Schurig
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vishal @ 2003-02-03 11:24 UTC (permalink / raw)
  To: linux-mtd

Hi all,
  I am a mtd newbie, and have been assigned the task of writting a boot 
loader that can boot a kernel file placed in a mtdblock device, on NAND 
flash( Samsung K9F2808U08). I would like suggestions on going about with 
this process. If some one could take some time to at least list down the 
steps involved in the same, it would be of immense help me.
  Thanks in Advance!!
regards,
Vishal

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-03 11:24 help: bootloader for loading kernel from mtdblock device on flash Vishal
@ 2003-02-03 12:47 ` Holger Schurig
  2003-02-03 17:52 ` Charles Manning
  2003-02-03 19:04 ` Thomas Gleixner
  2 siblings, 0 replies; 10+ messages in thread
From: Holger Schurig @ 2003-02-03 12:47 UTC (permalink / raw)
  To: linux-mtd

>   I am a mtd newbie, and have been assigned the task of writting a boot
> loader 

Use an existing one and adapt it, see for example into eCos/Redboot or into 
u-boot.sourceforge.net.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-03 11:24 help: bootloader for loading kernel from mtdblock device on flash Vishal
  2003-02-03 12:47 ` Holger Schurig
@ 2003-02-03 17:52 ` Charles Manning
  2003-02-03 19:04 ` Thomas Gleixner
  2 siblings, 0 replies; 10+ messages in thread
From: Charles Manning @ 2003-02-03 17:52 UTC (permalink / raw)
  To: Vishal, linux-mtd

There is a bootloader in the YAFFS CVS that works with a YAFFS formatted 
image. Luckily there is also a tool for converting the image into YAFFS 
format too.

-- Charles

On Tue, 04 Feb 2003 00:24, Vishal wrote:
> Hi all,
>   I am a mtd newbie, and have been assigned the task of writting a boot
> loader that can boot a kernel file placed in a mtdblock device, on NAND
> flash( Samsung K9F2808U08). I would like suggestions on going about with
> this process. If some one could take some time to at least list down the
> steps involved in the same, it would be of immense help me.
>   Thanks in Advance!!
> regards,
> Vishal
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-03 11:24 help: bootloader for loading kernel from mtdblock device on flash Vishal
  2003-02-03 12:47 ` Holger Schurig
  2003-02-03 17:52 ` Charles Manning
@ 2003-02-03 19:04 ` Thomas Gleixner
  2003-02-04  3:21   ` Vishal
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Gleixner @ 2003-02-03 19:04 UTC (permalink / raw)
  To: Vishal, linux-mtd

On Monday 03 February 2003 12:24, Vishal wrote:
> Hi all,
>   I am a mtd newbie, and have been assigned the task of writting a boot
> loader that can boot a kernel file placed in a mtdblock device, on NAND
> flash( Samsung K9F2808U08). I would like suggestions on going about with
> this process. If some one could take some time to at least list down the
> steps involved in the same, it would be of immense help me.
What CPU architecture ?
-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-03 19:04 ` Thomas Gleixner
@ 2003-02-04  3:21   ` Vishal
  2003-02-04  7:35     ` Thomas Gleixner
  0 siblings, 1 reply; 10+ messages in thread
From: Vishal @ 2003-02-04  3:21 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd

Its for an ARM7 core.
I have the block driver for the JFFS on NAND Flash ready. I have the 
basic bootloader code. I was wondering whether i can do the proceed in 
the following way :
1. take the read/verify  code from the JFFS block driver for NAND flash, 
and put it in my bootloader code
2. The driver code that i copy will have a lot of kernel API calls...so 
i need to incorporate those also into my driver.
3. finally use this functionality achieved to read a kernel.bin file 
from the /dev/mtdblock device and load it.
 or is there  any other workaroud?

Thomas Gleixner wrote:

>On Monday 03 February 2003 12:24, Vishal wrote:
>
>>Hi all,
>>  I am a mtd newbie, and have been assigned the task of writting a boot
>>loader that can boot a kernel file placed in a mtdblock device, on NAND
>>flash( Samsung K9F2808U08). I would like suggestions on going about with
>>this process. If some one could take some time to at least list down the
>>steps involved in the same, it would be of immense help me.
>>
>What CPU architecture ?
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-04  3:21   ` Vishal
@ 2003-02-04  7:35     ` Thomas Gleixner
  2003-02-04  9:30       ` Vishal
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Gleixner @ 2003-02-04  7:35 UTC (permalink / raw)
  To: Vishal; +Cc: linux-mtd

On Tuesday 04 February 2003 04:21, Vishal wrote:
> Its for an ARM7 core.
> I have the block driver for the JFFS on NAND Flash ready. I have the
> basic bootloader code. I was wondering whether i can do the proceed in
> the following way :
> 1. take the read/verify  code from the JFFS block driver for NAND flash,
> and put it in my bootloader code
> 2. The driver code that i copy will have a lot of kernel API calls...so
> i need to incorporate those also into my driver.
> 3. finally use this functionality achieved to read a kernel.bin file
> from the /dev/mtdblock device and load it.
>  or is there  any other workaroud?
Yep. copy your compressed kernel image in chunks of blocksize to your 
NAND-FLASH. Reserve enough spare in the case you have bad blocks. 
Provide a bad block aware read function and modify the decompressor in the 
kernel to read the image via this function from NAND. 
Then you don't need JFFS2 inside the bootloader. 
Then your NAND-CHIP has to have min. 2 Partitions 
1 for the kernel Image and 1 for the root-fs. You do not mount the partition, 
where your kernel image is stored.

Another way is to use YAFFS for your root-fs. YAFFS is NAND-aware too and 
provides bootloader code for booting the kernel from a YAFFS partition. Same 
procedure: 2 partitions (boot = YAFFS, root = JFFS2). You can mount your boot 
partition and update the kernel via normal fs access.

-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-04  7:35     ` Thomas Gleixner
@ 2003-02-04  9:30       ` Vishal
  2003-02-04 10:38         ` Thomas Gleixner
  0 siblings, 1 reply; 10+ messages in thread
From: Vishal @ 2003-02-04  9:30 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd

Thomas Gleixner wrote:

>On Tuesday 04 February 2003 04:21, Vishal wrote:
>
>>Its for an ARM7 core.
>>I have the block driver for the JFFS on NAND Flash ready. I have the
>>basic bootloader code. I was wondering whether i can do the proceed in
>>the following way :
>>1. take the read/verify  code from the JFFS block driver for NAND flash,
>>and put it in my bootloader code
>>2. The driver code that i copy will have a lot of kernel API calls...so
>>i need to incorporate those also into my driver.
>>3. finally use this functionality achieved to read a kernel.bin file
>>from the /dev/mtdblock device and load it.
>> or is there  any other workaroud?
>>
>Yep. copy your compressed kernel image in chunks of blocksize to your 
>NAND-FLASH. Reserve enough spare in the case you have bad blocks. 
>Provide a bad block aware read function and modify the decompressor in the 
>kernel to read the image via this function from NAND. 
>Then you don't need JFFS2 inside the bootloader. 
>Then your NAND-CHIP has to have min. 2 Partitions 
>1 for the kernel Image and 1 for the root-fs. You do not mount the partition, 
>where your kernel image is stored.
>
>

hmm....correct me if i am wrong but what you are saying is i have a char 
device /dev/mtd1 (right??) on which i store the kernel image. this 
partition will never be mounted. The kernel image is stored on this 
device in chunks of blocksize.
   Now while reading from this device on bootup, i read from the char 
device, and generate blocks of the known size in memory, carry out error 
checking and correction on each block. and when the whole of the kernel 
has been read, i run it...right?
Pardon me if i am wrong.

regards,
Vishal

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-04  9:30       ` Vishal
@ 2003-02-04 10:38         ` Thomas Gleixner
  2003-02-04 11:01           ` Vishal
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Gleixner @ 2003-02-04 10:38 UTC (permalink / raw)
  To: Vishal; +Cc: linux-mtd

On Tuesday 04 February 2003 10:30, Vishal wrote:
> >Yep. copy your compressed kernel image in chunks of blocksize to your
> >NAND-FLASH. Reserve enough spare in the case you have bad blocks.
> >Provide a bad block aware read function and modify the decompressor in the
> >kernel to read the image via this function from NAND.
> >Then you don't need JFFS2 inside the bootloader.
> >Then your NAND-CHIP has to have min. 2 Partitions
> >1 for the kernel Image and 1 for the root-fs. You do not mount the
> > partition, where your kernel image is stored.
>
> hmm....correct me if i am wrong but what you are saying is i have a char
> device /dev/mtd1 (right??) on which i store the kernel image. this
> partition will never be mounted. The kernel image is stored on this
> device in chunks of blocksize.
>    Now while reading from this device on bootup, i read from the char
> device, and generate blocks of the known size in memory, carry out error
> checking and correction on each block. and when the whole of the kernel
> has been read, i run it...right?
> Pardon me if i am wrong.
You don't need to implement a character device. Implement raw NAND access with 
ECC and bad block handling (just skip a bad block, when you program your 
image) in your bootloader. So you can program your kernel image in chunks of 
blocksize into the NAND chip. On boot you provide a small function, which can 
read the kernel image out of the nand-flash. You can do this by copying the 
hole image to RAM and then start the kernel, or load just the decompressor 
portion of the kernel image and modify the decompressor code, so it can read 
the chunks from your NAND-chip.

I'm not sure, why you want to do all this, if there is an out of the box 
solution in YAFFS ? 

-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-04 10:38         ` Thomas Gleixner
@ 2003-02-04 11:01           ` Vishal
  2003-02-04 11:51             ` Thomas Gleixner
  0 siblings, 1 reply; 10+ messages in thread
From: Vishal @ 2003-02-04 11:01 UTC (permalink / raw)
  To: tglx; +Cc: linux-mtd

Thomas Gleixner wrote:

>On Tuesday 04 February 2003 10:30, Vishal wrote:
>
>>>Yep. copy your compressed kernel image in chunks of blocksize to your
>>>NAND-FLASH. Reserve enough spare in the case you have bad blocks.
>>>Provide a bad block aware read function and modify the decompressor in the
>>>kernel to read the image via this function from NAND.
>>>Then you don't need JFFS2 inside the bootloader.
>>>Then your NAND-CHIP has to have min. 2 Partitions
>>>1 for the kernel Image and 1 for the root-fs. You do not mount the
>>>partition, where your kernel image is stored.
>>>
>>hmm....correct me if i am wrong but what you are saying is i have a char
>>device /dev/mtd1 (right??) on which i store the kernel image. this
>>partition will never be mounted. The kernel image is stored on this
>>device in chunks of blocksize.
>>   Now while reading from this device on bootup, i read from the char
>>device, and generate blocks of the known size in memory, carry out error
>>checking and correction on each block. and when the whole of the kernel
>>has been read, i run it...right?
>>Pardon me if i am wrong.
>>
>You don't need to implement a character device. Implement raw NAND access with 
>ECC and bad block handling (just skip a bad block, when you program your 
>image) in your bootloader. So you can program your kernel image in chunks of 
>blocksize into the NAND chip. On boot you provide a small function, which can 
>read the kernel image out of the nand-flash. You can do this by copying the 
>hole image to RAM and then start the kernel, or load just the decompressor 
>portion of the kernel image and modify the decompressor code, so it can read 
>the chunks from your NAND-chip.
>
>I'm not sure, why you want to do all this, if there is an out of the box 
>solution in YAFFS ? 
>
let me explain the problem in more detail here
the thing is that currently i have a boot loader code which reads from a 
char device /dev/mtd/ on NAND where only the kernel image is placed. Bad 
blocks on the /dev/mtd device can cause problems loading the kernel 
which is why i was asked to move the kernel to /dev/mtdblock (which is 
 runs a JFFS), and change the boot loader accordingly.
     Thats the reson why i was thinking in terms of using a  char driver.
  As per your suggestion of using YAFFS, what kind of effort would it 
require to get going on this system where JFFS had been completely 
cutomised? will it require any changes for the kind of flash(samsung 
K9F2808U0B) we are using?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: help: bootloader for loading kernel from mtdblock device on flash........
  2003-02-04 11:01           ` Vishal
@ 2003-02-04 11:51             ` Thomas Gleixner
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Gleixner @ 2003-02-04 11:51 UTC (permalink / raw)
  To: Vishal; +Cc: linux-mtd

On Tuesday 04 February 2003 12:01, Vishal wrote:
> let me explain the problem in more detail here
> the thing is that currently i have a boot loader code which reads from a
> char device /dev/mtd/ on NAND where only the kernel image is placed. Bad
> blocks on the /dev/mtd device can cause problems loading the kernel
> which is why i was asked to move the kernel to /dev/mtdblock (which is
>  runs a JFFS), and change the boot loader accordingly.
>      Thats the reson why i was thinking in terms of using a  char driver.
>   As per your suggestion of using YAFFS, what kind of effort would it
> require to get going on this system where JFFS had been completely
> cutomised? will it require any changes for the kind of flash(samsung
> K9F2808U0B) we are using?
No changes, just create well sized partitions.
-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-02-04 11:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-03 11:24 help: bootloader for loading kernel from mtdblock device on flash Vishal
2003-02-03 12:47 ` Holger Schurig
2003-02-03 17:52 ` Charles Manning
2003-02-03 19:04 ` Thomas Gleixner
2003-02-04  3:21   ` Vishal
2003-02-04  7:35     ` Thomas Gleixner
2003-02-04  9:30       ` Vishal
2003-02-04 10:38         ` Thomas Gleixner
2003-02-04 11:01           ` Vishal
2003-02-04 11:51             ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox