7 using the spi flash for os, 8 booting an os, 1 booting linux – Kontron AM4150 U-Boot Bootloader User Manual

Page 44: Using the spi flash for os, Booting an os, Booting linux, U-boot usage am4150 u-boot bootloader

Advertising
background image

U-Boot Usage

AM4150 U-Boot Bootloader

Page 44

ID 1052-5678, Rev. 1.0

P R E L I M I N A R Y

6.7

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 pro-
cessor’s SPI controller chip select 3).

The SPI flash must be erased before it is programmed. To achieve this, use the “sf erase” com-
mand.

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 “file-
size” is set automatically when a file is loaded to memory and can be used for convenience here.

6.8

Booting an OS

6.8.1

Booting Linux

To boot Linux, at least a kernel image and a FDT (Flattened Device Tree) must be loaded to
memory. Optionally, an “initrd” can be loaded.

Furthermore, a command line must be prepared in the environment variable “bootargs”.

The boot itself is initiated with the “bootm” command.

To simplify the setup of the board, three predefined scripts are already programmed in the de-
fault environment:

“nfsboot” to boot from a tftp server and mount the root over NFS

“nandboot” to boot from the NAND flash and also mount it as root

“sdboot” to boot from a SD Card and also mount it as root

“multi_img_boot” to boot from the multi-image provided. The multi-image consists of a

FDT, a kernel and a rootfs

For a one-time-only bootup, this can be accomplished with the “run” command, for example:

To make this permanent and have the board execute it automatically, it must be stored in the
“bootcmd” environment variable and the environment must be saved to flash.

mmc rescan 0

ext2load mmc 0 100000 test.img

sf probe 3

sf erase 0 10000

sf write 100000 0 ${filesize}

run nfsboot

Advertising