From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Tue, 26 Apr 2016 07:43:29 +0200 Subject: [U-Boot] RFC: i.MX6 write U-Boot to NAND In-Reply-To: References: Message-ID: <571F0001.8080504@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Sergey, 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. bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany