mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* imx53 internal boot from NAND
@ 2012-03-26  8:47 guenter.gebhardt
  2012-03-26  9:09 ` AW: " Matthias Fend
  2012-03-27  5:32 ` Robert Schwebel
  0 siblings, 2 replies; 5+ messages in thread
From: guenter.gebhardt @ 2012-03-26  8:47 UTC (permalink / raw)
  To: barebox


[-- Attachment #1.1: Type: text/plain, Size: 387 bytes --]

Hello,

I tried to use barebox in order to boot from NAND.

The ROM loader needs a FCB (Firmware Configuration Block) table at the 
beginning of the flash (according to chapter 7.5.2.2 of the reference 
manual).
I looked at the existing imx53 boards within the barebox sources but I 
founx that no one used this mode there.

Has someone done this or can give me some advice?

-- Gebhardt

[-- Attachment #1.2: Type: text/html, Size: 648 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* AW: imx53 internal boot from NAND
  2012-03-26  8:47 imx53 internal boot from NAND guenter.gebhardt
@ 2012-03-26  9:09 ` Matthias Fend
  2012-03-26 14:46   ` Antwort: " guenter.gebhardt
  2012-03-27  5:32 ` Robert Schwebel
  1 sibling, 1 reply; 5+ messages in thread
From: Matthias Fend @ 2012-03-26  9:09 UTC (permalink / raw)
  To: guenter.gebhardt, barebox

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]

Hi,

For a quick start you can use the provided FCB (fcb.bin).
This FCB was generated with the attached tool (fcbgen.c) - note that the bad block handling is disabled.

Then you can "merge" your barebox image with the FCB with something like:
cat fcb.bin barebox-image > barebox-fcb.bin

This works at least on our custom i.MX53 hardware.

~Matthias

Von: barebox-bounces@lists.infradead.org [mailto:barebox-bounces@lists.infradead.org] Im Auftrag von guenter.gebhardt@rafi.de
Gesendet: Montag, 26. März 2012 10:48
An: barebox@lists.infradead.org
Betreff: imx53 internal boot from NAND

Hello, 

I tried to use barebox in order to boot from NAND. 

The ROM loader needs a FCB (Firmware Configuration Block) table at the beginning of the flash (according to chapter 7.5.2.2 of the reference manual). 
I looked at the existing imx53 boards within the barebox sources but I founx that no one used this mode there. 

Has someone done this or can give me some advice? 

-- Gebhardt

[-- Attachment #2: fcbgen.c --]
[-- Type: text/plain, Size: 1875 bytes --]

/*
 * generate firmware control block (FCB) - required to boot iMX53 from NAND
 *
 * only works for 2k page NANDs
 * bad block handling of ROM bootloader is disabled
 *
 * fcb length is 4kB (2 pages)
 * image start at page 2
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

struct fcb_entry
{
  uint32_t addr;
  uint32_t value;
};

struct fcb_entry fcb_entries[] =
{
  { 0x00, 0x00000000 }, // res.
  { 0x04, 0x46434220 }, // fingerprint #2 (ascii FCB)
  { 0x08, 0x01000000 }, // fingerprint #3 (version)
  { 0x68, 0x02000000 }, // primary image start page (page 2)
  { 0x6C, 0x02000000 }, // secondary image start page (page 2)
  { 0x78, 0x00000000 }, // Start page address of DBBT Search Area (0 means no bad blocks)
  { 0x7C, 0x00000000 }, // Bad Block Marker Offset in page data buffer
  { 0xAC, 0x00000000 }, // Bad Block Marker Swapping Enable
  { 0xB0, 0x00000000 }, // Bad Block Marker Offset to Spare Byte
};

int main()
{
  int i, ret;
  char *fname = "fcb.bin";
  FILE *fp;
  uint8_t fcbimage[4 * 1024];

  memset(fcbimage, 0, sizeof(fcbimage));

  for(i = 0; i < (int) (sizeof(fcb_entries) / sizeof(fcb_entries[0])); i++)
  {
    if((fcb_entries[i].addr + 3) >= sizeof(fcbimage))
    {
      printf("Invalid FCB entry (index:%d)\n", i);
      continue;
    }
    fcbimage[fcb_entries[i].addr + 0] = fcb_entries[i].value >> 24;
    fcbimage[fcb_entries[i].addr + 1] = fcb_entries[i].value >> 16;
    fcbimage[fcb_entries[i].addr + 2] = fcb_entries[i].value >> 8;
    fcbimage[fcb_entries[i].addr + 3] = fcb_entries[i].value >> 0;
  }

  if((fp = fopen(fname, "w")) == NULL)
  {
    printf("could not open %s!\n", fname);
    return -1;
  }

  ret = fwrite(fcbimage, 1, sizeof(fcbimage), fp);
  printf("wrote %d bytes.\n", ret);
  if(ret != sizeof(fcbimage))
    printf("error - incomplete file!\n");
  fclose(fp);

  return 0;
}

[-- Attachment #3: fcb.bin --]
[-- Type: application/octet-stream, Size: 4096 bytes --]

[-- Attachment #4: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Antwort: AW: imx53 internal boot from NAND
  2012-03-26  9:09 ` AW: " Matthias Fend
@ 2012-03-26 14:46   ` guenter.gebhardt
  2012-03-27  6:35     ` AW: " Matthias Fend
  0 siblings, 1 reply; 5+ messages in thread
From: guenter.gebhardt @ 2012-03-26 14:46 UTC (permalink / raw)
  To: Matthias Fend; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 1542 bytes --]

Hello,

I have some problems. May you please send me a binary produced with this 
tool?
I want to inspect the flash header.

-- Gebhardt



Von:    Matthias Fend <Matthias.Fend@wolfvision.net>
An:     "guenter.gebhardt@rafi.de" <guenter.gebhardt@rafi.de>, 
"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Datum:  26.03.2012 11:09
Betreff:        AW: imx53 internal boot from NAND



Hi,

For a quick start you can use the provided FCB (fcb.bin).
This FCB was generated with the attached tool (fcbgen.c) - note that the 
bad block handling is disabled.

Then you can "merge" your barebox image with the FCB with something like:
cat fcb.bin barebox-image > barebox-fcb.bin

This works at least on our custom i.MX53 hardware.

~Matthias

Von: barebox-bounces@lists.infradead.org [
mailto:barebox-bounces@lists.infradead.org] Im Auftrag von 
guenter.gebhardt@rafi.de
Gesendet: Montag, 26. März 2012 10:48
An: barebox@lists.infradead.org
Betreff: imx53 internal boot from NAND

Hello, 

I tried to use barebox in order to boot from NAND. 

The ROM loader needs a FCB (Firmware Configuration Block) table at the 
beginning of the flash (according to chapter 7.5.2.2 of the reference 
manual). 
I looked at the existing imx53 boards within the barebox sources but I 
founx that no one used this mode there. 

Has someone done this or can give me some advice? 

-- Gebhardt
[Anhang "fcbgen.c" gelöscht von Guenter Gebhardt/Rafi] [Anhang "fcb.bin" 
gelöscht von Guenter Gebhardt/Rafi] 

[-- Attachment #1.2: Type: text/html, Size: 2549 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: imx53 internal boot from NAND
  2012-03-26  8:47 imx53 internal boot from NAND guenter.gebhardt
  2012-03-26  9:09 ` AW: " Matthias Fend
@ 2012-03-27  5:32 ` Robert Schwebel
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Schwebel @ 2012-03-27  5:32 UTC (permalink / raw)
  To: guenter.gebhardt; +Cc: barebox

On Mon, Mar 26, 2012 at 10:47:36AM +0200, guenter.gebhardt@rafi.de wrote:
> Has someone done this or can give me some advice?

We have the "bcb" command recently, and the functionality should be
integrated there.

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* AW: Antwort: AW: imx53 internal boot from NAND
  2012-03-26 14:46   ` Antwort: " guenter.gebhardt
@ 2012-03-27  6:35     ` Matthias Fend
  0 siblings, 0 replies; 5+ messages in thread
From: Matthias Fend @ 2012-03-27  6:35 UTC (permalink / raw)
  To: guenter.gebhardt; +Cc: barebox

[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]

>Von: guenter.gebhardt@rafi.de [mailto:guenter.gebhardt@rafi.de]
>Gesendet: Montag, 26. März 2012 16:47
>An: Matthias Fend
>Cc: barebox@lists.infradead.org
>Betreff: Antwort: AW: imx53 internal boot from NAND
>
>Hello,
>
>I have some problems. May you please send me a binary produced with this tool?
>I want to inspect the flash header.

fcb.bin contains a FCB and was generated by this tool. It should instantly work with your i.mx53 barebox.
Note that the FCB image must reside within the first blocks of the NAND. The internal ROM loader will always read 4k blocks from NAND - independent of the actual NAND page size. 
The attached FCB must be located at the start of the NAND. The barebox image must be located at page 2.
Assuming a 2k page NAND you should have this:  page 0-1: 4k FCB, page 2-n: barebox.

~Matthias
>
>-- Gebhardt
>
>
>
>Von:        Matthias Fend <Matthias.Fend@wolfvision.net>
>An:        "guenter.gebhardt@rafi.de" <guenter.gebhardt@rafi.de>, "barebox@lists.infradead.org" <barebox@lists.infradead.org>
>Datum:        26.03.2012 11:09
>Betreff:        AW: imx53 internal boot from NAND
>________________________________________
>
>
>
>Hi,
>
>For a quick start you can use the provided FCB (fcb.bin).
>This FCB was generated with the attached tool (fcbgen.c) - note that the bad block handling is disabled.
>
>Then you can "merge" your barebox image with the FCB with something like:
>cat fcb.bin barebox-image > barebox-fcb.bin
>
>This works at least on our custom i.MX53 hardware.
>
>~Matthias
>
>Von: barebox-bounces@lists.infradead.org [mailto:barebox-bounces@lists.infradead.org] Im Auftrag von guenter.gebhardt@rafi.de
>Gesendet: Montag, 26. März 2012 10:48
>An: barebox@lists.infradead.org
>Betreff: imx53 internal boot from NAND
>
>Hello,
>
>I tried to use barebox in order to boot from NAND.
>
>The ROM loader needs a FCB (Firmware Configuration Block) table at the beginning of the flash (according to chapter 7.5.2.2 of the reference manual).
>I looked at the existing imx53 boards within the barebox sources but I founx that no one used this mode there.
>
>Has someone done this or can give me some advice?
>
>-- Gebhardt
>[Anhang "fcbgen.c" gelöscht von Guenter Gebhardt/Rafi] [Anhang "fcb.bin" gelöscht von Guenter Gebhardt/Rafi]

[-- Attachment #2: fcb.bin --]
[-- Type: application/octet-stream, Size: 4096 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-03-27  6:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26  8:47 imx53 internal boot from NAND guenter.gebhardt
2012-03-26  9:09 ` AW: " Matthias Fend
2012-03-26 14:46   ` Antwort: " guenter.gebhardt
2012-03-27  6:35     ` AW: " Matthias Fend
2012-03-27  5:32 ` Robert Schwebel

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