8 using the onboard nand flash, 9 using the spi flash for os, Using the onboard nand flash – Kontron COMe-bP5020 User Manual
Page 61: Using the spi flash for os

www.kontron.com
61
User Guide
COMe-bP5020
6.5.8 Using the Onboard NAND Flash
The onboard NAND Flash is supported with the “ubi” filesystem. The access is read only. Thus, the filesystem and its contents
must be prepared with Linux first.
As a prerequisite, the environment variables “mtdids” and “mtdparts” must be set correctly.
“mtdids” identifies the NAND chip to use while “mtdparts” defines the partitions.
Example:
This defines the first NAND chip (nand0) to be used with the name “chip1”. The chip contains one partition “all” which occupies
the whole chip.
The next command sets the partition “all” to be used with the “ubi” layer:
Now, an “ubi” volume can be mounted; in this example volume “boot”:
After the volume is mounted, its contents can be listed:
or a file loaded, in this case “kernel.bin” to address 0x100000:
6.5.9 Using the SPI Flash for OS
The SPI flash for OS is not used together with a file system, it is used raw. It does not contain any U-Boot components and is
completely free for user usage. It's primary function is to store VxWorks® boot ROMs and images.
Before making any changes to the flashes, ensure that the correct flash is selected. To select the SPI flash for OS, execute the
“sf probe 3” command (SPI flash for OS is routed to the processor’s SPI controller chip select 3).
The SPI flash must be erased before it is programmed. To achieve this, use the “sf erase” command.
To program an image to the SPI flash, it must first be loaded to memory from an arbitrary source. It can then be programmed
with the “sf write” command.
Example: Programming a test file “test.img” from an SD card using the “ext2” file system:
This example assumes that the size of “test.img” is less than 64 kB. The environment variable “filesize” is set automatically
when a file is loaded to memory and can be used for convenience here.
setenv mtdids nand0=chip1
setenv mtdparts mtdparts=chip1:-(all)
ubi part all
ubifsmount boot
ubifsls
ubifsload 100000 kernel.bin
mmc rescan 0
ext2load mmc 0 100000 test.img
sf probe 3
sf erase 0 10000
sf write 100000 0 ${filesize}