Project

General

Profile

Das U-Boot Port (2018 March MDK Release)

https://support.criticallink.com/gitweb/?p=u-boot-mityarm-335x.git;a=summary

Please familiarize yourself with the TI port of u-boot described here as the Critical Link MitySOM-335X port is based on the TI port, and many of the AM335X processor specifics are detailed on the TI wiki.

Branch Description

  • u-boot-2017.01: Latest U-Boot supported by Critical Link for the am335x.

Building U-Boot

Download your own copy of U-Boot:

git clone git://support.criticallink.com/home/git/u-boot-mityarm-335x.git
cd u-boot-mityarm-335x
git checkout -b u-boot-2017.01 2493d32d0457a2d8cf7a84beef2a537ddf278b29

Note: Commit 2493d32d0457a2d8cf7a84beef2a537ddf278b29 is the commit for the March MDK release. Checking out the origin/u-boot-2017.01 branch will check out a newer commit not covered by this page.

These commands will download the repository and check out the March MDK commit from the server. If you intend to make changes you will need to be moderately familiar with Git (See the docs).

Setting up the environment

source /opt/criticallink/mitysom-335x_2018-03-16/environment-setup-cortexa8hf-neon-criticallink-linux-gnueabi

Building U-Boot

The U-Boot build needs to be configured depending on which SOM you're using.

  • mitysom335x_devkit_256MB_defconfig - Config for 256MB NAND SOMs
  • mitysom335x_devkit_512MB_defconfig - Config for 512MB NAND SOMs
  • mitysom335x_devkit_1GB_defconfig - Config for 1GB NAND SOMs
    SOMs with no nand can use any of the above configs
make distclean
make mityarm335x_devkit_<nand size>_defconfig
make

For a faster build, add -j<# threads> to build with multiple threads. Optimally, use as many threads as the building machine has cores.

When built successfully, there are several files created in the source directory.

  • spl/u-boot-spl.bin - The secind-stage bootloader (a stripped down version of u-boot that fits in SRAM)
  • MLO - spl/u-boot-spl.bin with a GP image header prepended to it
  • u-boot.img - The full-fledged U-Boot image.

NAND

This section outlines the configuration of the NAND device in u-boot (which corresponds to the NAND MTD parts in the default Critical Link built Linux kernel).

Note: Offset fields must be aligned with 0x800 (2048) bytes. On writing 3000 (0xbb8) bytes, len field can be aligned to 0x1000 ie 4096 bytes.
Offset field should be aligned to page start address, multiple of 2048 bytes.

NAND Layout

See UBIFS Nand Boot

An additional 2 blocks were taken from the tail end of the userfs partition of the NAND.

256MB NAND

setenv mtdparts "mtdparts=nand:512k@0(mlo),1920k@512k(uboot),128k@2432k(env),5m@2560k(kernel),254208k(userfs),256k(devicetree)" 

512MB NAND

setenv mtdparts "mtdparts=nand:1024k@0(mlo),2048k@1024k(uboot),256k@3072k(env),5m@3328k(kernel),515328k(userfs),512k(devicetree)" 

1GB NAND

setenv mtdparts "mtdparts=nand:2048k@0(mlo),2048k@2048k(uboot),512k@4096k(env),5m@4608k(kernel),1037824k(userfs),1024k(devicetree)" 

Reflashing U-Boot

If you need to reflash the u-boot image to your board, you can follow the instructions below. WARNING: failure to perform this step correctly will "brick" your board. The procedure for recovering a bricked module is dependent on the carrier board setup (or you can return it to Critical Link for servicing).

If you are using the Critical Link dev board, u-boot and the MLO are stored on the SD card, and can simply be updated on the card. Check the TI AM335x U-Boot User's Guide if you are booting from flash or other external boot devices.

Writing to NAND

U-Boot provides a whole set of commands for manipulating the NAND device on the MitySOM-335X SOM. The command

help nand

will detail its usage for you.

See UBIFS Nand Boot for full details on creating a full nand boot scenario on both the 256MB and 512MB Nand parts.

There are a number of different boot modes that the AM3359 part supports that include booting from NAND. The commands illustrated herein have been checked out using the boot mode 0x3E4 (001111100100). If you are using the Critical Link Development Kit baseboard, this corresponds to the BOOTCONFIG jumpers as follows

001001111100 (bit 0 on the left)
JJOJJOOOOOJJ (J = jumper, O = open)

U-Boot# dhcp

For the MLO:
U-Boot# mw.b 0x82000000 0xFF 0x20000
U-Boot# nfs 0x82000000 <host>:<nfs path>/u-boot-mityarm-335x/MLO
U-Boot# nand erase 0x0 0x20000
U-Boot# nand write.i 0x82000000 0x0 $filesize

For u-boot img:
U-Boot# mw.b 0x82000000 0xFF 0x80000
U-Boot# nfs 0x82000000 <host>:<nfs path>/u-boot-mityarm-335x/u-boot.img
U-Boot# nand erase 0x80000 0x80000
U-Boot# nand write.i 0x82000000 0x80000 $filesize

Writing to the SD card

If you are booting from an SD card (as shipped from Critical Link), you can simply replace the MLO and u-boot.img files on the first partition of the SD card. This partition is a FAT partition and can be written to from linux or windows (or many others).

Preparing a new SD card

The TI web site has information on building an SD card that is bootable and contains a linux filesystem (see http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#Setting_Up_Boot_Environment_on_SD_Card)

There are also a couple of scripts in a tar file on the files section to help with this process.

These scripts are also available in the files section under Dev Kit SD Card - 3.2 Kernel. These zips have the full filesystem and boot partition files to create our devkit sd cards. popsd has been renamed to populate_am335x_dev_sd in these zips.

The mksd script will just format an SD card in a suitable fashion (a boot partition, a rootfs partition, and a spare partition).
The popsd script uses mksd to format the SD card and will then install the images on it.

Usage: mksd <MMC device>
        <MMC device> is the path to the /dev device for the SD card

Usage: popsd [opts] <MMC device>
    -h|--help        Print this help
    -b|--bootdir           Directory containing boot files
    -c|--continuous  Continue and make multiple copies
    -f|--force       Don't ask.. just do it
    -v|--verbose     Be more verbose when working
    -m|--mount=<mount point> mount the disk at mount point
    -r|--rootfs=<rootfs tarfile> Use the specified tar file for root fs
    -p|--probe       Find mmccards and exit
    -N|--noformat    skip formatting SD card
        <MMC device> is the path to the /dev device for the SD card

See https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Root_Filesystem_(2018_March_MDK_Release)#SD-Card-based-Root-Filesystem

BE VERY CAREFUL WHICH DEVICE TO TELL THESE SCRIPTS TO WORK ON... You dont want to format your linux machine!!!

Note that you can use loadb, fatload, tftp, nfs, etc to get the images into RAM, and that the particulars of the NFS command are specific to the environment at Critical Link.

Go to top
Add picture from clipboard (Maximum size: 600 MB)