AW: imx53 internal boot from NAND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx [mailto:barebox-bounces@xxxxxxxxxxxxxxxxxxx] Im Auftrag von guenter.gebhardt@xxxxxxx
Gesendet: Montag, 26. März 2012 10:48
An: barebox@xxxxxxxxxxxxxxxxxxx
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
/*
 * 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: fcb.bin
Description: fcb.bin

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

[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux