[U-Boot] RFC: i.MX6 write U-Boot to NAND

Sergey Kubushyn ksi at koi8.net
Tue Apr 26 08:58:20 CEST 2016


On Tue, 26 Apr 2016, Stefan Roese wrote:

OK, if nobody worked on this so far I'll bite the bullet -- working on a
NAND boot only i.mx6 module right now at my day job and need manufacturing
tools for production. Just didn't want to re-invent the wheel and mess with
somebody's else work...

Will try to submit a patch by the end of week if nothing come into the way.

> Hi Sergey, Hi Heiko,
>
> On 26.04.2016 07:43, Heiko Schocher wrote:
>>  add Stefano to Cc as he is the imx6 custodian,
>>
>>  Am 25.04.2016 um 22:29 schrieb Sergey Kubushyn:
>> >  Hi everybody,
>> > 
>> >  It looks like using kobs-ng utility is the only way to make a bootable
>> >  NAND
>> >  for i.MX6 and their siblings. There might be other utilities I'm not
>> >  aware
>> >  of but that doesn't change anything -- you need Linux (or whatever that
>> >  utility runs on) running on your board to create and write all those
>> >  FCB and
>> >  other parts onto a virgin raw NAND device.
>>
>>  Yes, I stumbled over that too recently ...
>> 
>> >  This makes initial programming a cumbersome and complicated operation.
>> >  One
>> >  can not program NAND on a development machine as it is easy to do with
>> >  e.g.
>> >  SD Card -- the OS must run on the same board where that NAND is
>> >  because NAND
>> >  is not removable.
>> > 
>> >  It is possible, of course, to assemble something on an SD Card and use
>> >  that
>> >  to program NAND but that assumes there is an SD Card slot on a target
>> >  system
>> >  and some means to tell it to boot off of SD Card. However it is not
>> >  always a
>> >  case -- there might be boards with NAND as only storage device 
>> >  available.
>> >  That leaves only Serial/USB boot as only options for initial boot on a
>> >  virgin board. However it does not provide means for writing the NAND
>> >  U-Boot
>> >  into actual NAND.
>> > 
>> >  There are many different varieties of NAND chips so those FCB and other
>> >  structures are not generic i.e. they can not be defined beforehead and
>> >  just
>> >  prepended to the actual U-Boot image. Even if we have made those a
>> >  configuration parameters there are still bad block tables that are chip
>> >  specific so they should be discovered first i.e. FCB should be built
>> >  dynamically based on NAND scanning results.
>> > 
>> >  Sure, one can write a custom first stage SPL that would've booted the
>> >  actual
>> >  U-Boot via the same Serial/USB interface and run it but then what? Let's
>> >  assume the target board doesn't have ethernet so it would make it
>> >  impossible
>> >  to mount rootfs over NFS and no other storage devices available. It is
>> >  still
>> >  possible to load Linux kernel and bare minimal rootfs in initramfs
>> >  image but
>> >  that's a lot of serial downloading just for initializing NAND...
>> > 
>> >  It would be nice to have a U-Boot command that would've allowed
>> >  initial NAND
>> >  setup and writing NAND U-Boot image to it properly updating the headers.
>>
>>  Yes, that would be great!
>> 
>> >  There might be other ways to do this that I might've overlooked...
>> > 
>> >  Does anybody knows a ready-made solution or works on something
>> >  suitable for
>> >  this purpose? I don't want to re-invent the wheel starting my own
>> >  solution
>> >  so it would've been good to hear from other guys who might've solved 
>> >  this
>> >  dilemma.
>>
>>  Sorry, I do not know another way.
>> 
>> >  Any thoughts?
>>
>>  I think, an U-Boot command which writes the headers into the nand would
>>  be a good thing.
>>
>>  tools/imximage.c is may the wrong place, as the infos in FCB and DBBT
>>  are dependend on the boards nand.
>
> I've missed such a tool a few years ago while porting U-Boot & Linux
> to a i.MX6 based NAND booting board as well. And noticed since then
> that barebox has included such a tool:
>
> http://lists.infradead.org/pipermail/barebox/2014-March/018202.html
>
> Perhaps its not too much work to port this tool over to U-Boot?
> Just an idea...
>
> Thanks,
> Stefan
>
>

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************


More information about the U-Boot mailing list