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

Sergey Kubushyn ksi at koi8.net
Mon Apr 25 22:29:04 CEST 2016


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.

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.

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.

Any thoughts?

---
******************************************************************
*  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