Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Get FFS partition configuration

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

This section assumes that you are using the default partitions specified in the TI kernel drivers. If you are using command line partitions then the address will that of the partition you are creating for your file system. For more information on creating Flash partitions using the command line please see the Kernel Command Line Partition configuration page

NOR Flash Partitions

To determine the file system start address in NOR flash you can either look at the MTD partitions defined in the driver or the content of /proc/mtd from a running Linux kernel.

Using the Linux Driver

The NOR partitions for the EVM are defined in the file arch/arm/mach-davinci/board-evm.c. This path is based from the root of the kernel tree. For example if the TI kernel was copied to /home/user/workdir/ti-davinci the NOR partitions would be defined in

/home/user/workdir/ti-davinci/arch/arm/mach-davinci/board-evm.c

NOTE: For some systems there may be a board-<board number>-evm.c file. If that file exists then it should be used instead of the board-evm.c file. For example on the DM355 the Flash partitions are defined in board-dm355-evm.c.

The partitions are defined in the nor_partitions structure. For example the partition definition may look like:

   static struct mtd_partition nor_partitions[] = {
       /* bootloader (U-Boot, etc) in first sector */
       {
             .name             = "bootloader",
             .offset           = 0,
             .size             = SZ_128K,
             .mask_flags       = 0
       },
       /* bootloader params in the next sector */
       {
             .name             = "params",
             .offset           = MTDPART_OFS_APPEND,
             .size             = SZ_128K,
             .mask_flags       = MTD_WRITEABLE, /* force read-only */
       },
       /* kernel */
       {
             .name             = "kernel",
             .offset           = MTDPART_OFS_APPEND,
             .size             = SZ_4M,
             .mask_flags       = 0
       },
       /* file system */
       {
             .name             = "filesystem",
             .offset           = MTDPART_OFS_APPEND,
             .size             = MTDPART_SIZ_FULL,
             .mask_flags       = 0
       }
   };

The size of each partition is set in the .size member of each mtd_partition structure. So in this example we have the following partitions:

  1. bootloader - size 128K
  2. params - size 128K
  3. kernel - size 4M
  4. filesystem - size set to remainder of flash

To determine the start address of the file system partition in flash we will add the sizes of the partitions before it. In this case that is 128K + 128K + 4M = 4352K or 0x440000 bytes. So our file system partition starts at offset 0x440000 bytes.

Using a Linux Booted System

In this case we will use a Linux system which is booted to a kernel with Flash support enabled and check the contents of /proc/mtd to determine the offset of the file system partition. For more information on enabling Flash support please see the Flash configuration in the Kernel page.

From the command line issue the command

   target$ cat /proc/mtd

You should see output similar to the following:

   dev:    size   erasesize  name
   mtd0: 00020000 00010000 "bootloader"
   mtd1: 00020000 00010000 "params"
   mtd2: 00400000 00010000 "kernel"
   mtd3: 00bc0000 00010000 "filesystem"

The size of each flash partition is the second element in each row of the table. In this example there are 4 partitions with the following sizes:

  1. bootloader - size 0x20000
  2. params - size 0x20000
  3. kernels - size 0x400000
  4. filesystem - size 0xbc0000

To determine the start address of the file system partition in flash we will add the sizes of the partitions before it. In this case that is 0x20000 + 0x20000 + 0x400000 = 0x440000 bytes. So our file system partition starts at offset 0x440000 bytes.

NAND Flash Paritions

To determine the file system start address in NAND flash you can either look at the MTD partitions defined in the driver or the content of /proc/mtd from a running Linux kernel.

Using the Linux Driver

The NAND partitions for the EVM are defined in the file arch/arm/mach-davinci/board-evm.c. This path is based from the root of the kernel tree. For example if the TI kernel was copied to /home/user/workdir/ti-davinci the NAND partitions would be defined in

/home/user/workdir/ti-davinci/arch/arm/mach-davinci/board-evm.c

NOTE: For some systems there may be a board-<board number>-evm.c file. If that file exists then it should be used instead of the board-evm.c file. For example on the DM355 the Flash partitions are defined in board-dm355-evm.c.

The partitions are defined in the nand_partitions structure. For example the partition definition may look like:

   static struct mtd_partition nand_partitions[] = {
       /* bootloader (U-Boot, etc) in first sector */
       {
             .name             = "bootloader",
             .offset           = 0,
             .size             = SZ_256K,
             .mask_flags       = MTD_WRITEABLE, /* force read-only */
       },
       /* bootloader params in the next sector */
       {               .name             = "params",
             .offset           = MTDPART_OFS_APPEND,
             .size             = SZ_128K,
             .mask_flags       = MTD_WRITEABLE, /* force read-only */
       },
       /* kernel */
       {
             .name             = "kernel",
             .offset           = MTDPART_OFS_APPEND,
             .size             = SZ_4M,
             .mask_flags       = 0
       },
       /* file system */
       {
             .name             = "filesystem",
             .offset           = MTDPART_OFS_APPEND,
             .size             = MTDPART_SIZ_FULL,
             .mask_flags       = 0
       }
   };

The size of each partition is set in the .size member of each mtd_partition structure. So in this example we have the following partitions:

  1. bootloader - size 256K
  2. params - size 128K
  3. kernel - size 4M
  4. filesystem - size set to remainder of flash

To determine the start address of the file system partition in flash we will add the sizes of the partitions before it. In this case that is 256K + 128K + 4M = 4480K or 0x460000 bytes. So our file system partition starts at offset 0x460000 bytes.

Using a Linux Booted System

In this case we will use a Linux system which is booted to a kernel with Flash support enabled and check the contents of /proc/mtd to determine the offset of the file system partition. For more information on enabling Flash support please see Flash configuration in the Kernel page.

From the command line issue the command

   target$ cat /proc/mtd

You should see output similar to the following:

   dev:    size   erasesize  name
   mtd0: 00040000 00004000 "bootloader"
   mtd1: 00020000 00004000 "params"
   mtd2: 00400000 00004000 "kernel"
   mtd3: 03ba0000 00004000 "filesystem"

The size of each flash partition is the second element in each row of the table. In this example there are 4 partitions with the following sizes:

  1. bootloader - size 0x40000
  2. params - size 0x20000
  3. kernels - size 0x400000
  4. filesystem - size 0x3ba0000

To determine the start address of the file system partition in flash we will add the sizes of the partitions before it. In this case that is 0x40000 + 0x20000 + 0x400000 = 0x460000 bytes. So our file system partition starts at offset 0x460000 bytes.