How to network boot MitySOM/ARM

From HyperSecurity Wiki
Jump to: navigation, search

Information and Download Links:

TI AM335x Uboot Page:

http://downloads.ti.com/sitara_linux/esd/AM335xSDK/latest/index_FDS.html

Instructions to build U-boot boot loader for SD Card:

https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Getting_Started_335x

U-Boot AM355x user guide:

http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide

U-Boot Flashing Guide:

http://processors.wiki.ti.com/index.php/AM335x_CCS_Flashing_Tools_Guide

U-Boot Files:

http://downloads.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/AM335x_04_06/04_06_00_07/exports/AM335X-LINUX-PSP-04.06.00.07.tgz?tracked=1

NAND Partition Table:

https://support.criticallink.com/redmine/projects/armc8-platforms/wiki/UBIFS_Nand_Boot

Bootloader Project:

http://omappedia.org/wiki/Bootloader_Project

Settings up Critical Link Tool Chain

As root:

cd /tmp/
wget https://support.criticallink.com/redmine/attachments/download/9537/mitysom-335x-devkit-MDK-2015-11-18.sh
chmod +x mitysom-335x-devkit-MDK-2015-11-18.sh
./mitysom-335x-devkit-MDK-2015-11-18.sh

Install everything with default values.

Downloading U-boot Source:

As a non-root user:

Download u-boot source with git:

git clone git://support.criticallink.com/home/git/u-boot-mityarm-335x.git u-boot-mityarm-335x

Change directory:

cd u-boot-mityarm-335x

Add PXE Options

Edit include/configs/mityarm335x.h:

vi include/configs/mityarm335x.h

Add the following to the include/configs/mityarm335x.h after line 41: [RN - need to specify WHERE to add this. Better still, create a patch file]

/* Add PXE support */
#define CONFIG_CMD_PXE
#define CONFIG_MENU

Once built, check to make sure PXE is included in the u-boot.img:

strings u-boot.img |grep -i pxe

The following should show up:

pxelinux.cfg/
pxelinux.cfg/%s
pxefile_addr_r
pxeuuid
Invalid pxefile address: %s
commands to get and boot from pxe files
get - try to retrieve a pxe file using tftp
pxe boot [pxefile_addr_r] - boot from the pxe file at pxefile_addr_r

Development Board Jumper Settings

  • setup boot jumpers to boot from NAND flash:
BOOTCONFIG [0..11]
::[:][:]::::[:][:][:][:]
  • (to boot from MMC/SD flash)
BOOTCONFIG [0..11]
:::[:]::::::::

Settings U-boot Build Environment Variables:

As a non-root user:

. /opt/criticallink/mitysom-335x_20151118/environment-setup-cortexa8t2hf-vfp-neon-criticallink-linux-gnueabi
unset LDFLAGS
alias makearm='make ARCH=arm CROSS_COMPILE=arm-criticallink-linux-gnueabi-'
makearm mityarm335x_4kpage

SD Card setup:

Source Files

Download and extract MityARM devkit:

cd /tmp
wget https://support.criticallink.com/redmine/attachments/download/4467/MityARM-335X_dev_SD_512MB_Nand.zip
unzip MityARM-335X_dev_SD_512MB_Nand.zip

Insert SD card that will be formatted for MityARM into the PC. Run the following commands as root:

cd MityARM-335X_dev_512MB_Nand
dmesg |grep sd

Assuming that the new SD-Card is sdb, run the following:

./mksd /dev/sdb

As root mount the SD-Card int /mnt/:

mkdir /mnt/sdcard
mount /dev/sdb1 /mnt/sdcard

Copy over the following files from icdeb8 and place them into the SD-Card root:

scp icdeb8:/usr1/local/aux/ARM/u-boot-mityarm-335x/u-boot.img /mnt/sdcard
scp icdeb8:/usr1/local/aux/ARM/u-boot-mityarm-335x/MLO /mnt/sdcard

Check to make sure the SD-Card populated correctly:

ls /mnt/sdcard

The following should be found:

  • u-boot.img
  • MLO

Then unmount the SD-Card:

umount /mnt/sdcard

Flashing images to NAND in U-Boot with SD Card for 512M Modules:

Format a SD card to vfat32 with boot flags

Download and extract AM335X-LINUX-PSP-04.06.00.07:

wget https://support.criticallink.com/redmine/attachments/download/4467/MityARM-335X_dev_SD_512MB_Nand.zip
unzip MityARM-335X_dev_SD_512MB_Nand.zip
cd AM335X-LINUX-PSP-04.06.00.07/src/kernel
cp MLO and u-boot.img to SD card

After the 2nd stage prompt U-Boot# comes up, the images for the 1st stage and 2nd stage can be flashed to NAND for persistent storage. Flashing SPL to NAND in SD boot Flash SPL (MLO) to NAND by executing the following commands:

Erase all nand

nand erase.chip

Flash MLO to Nand

mw.b $kloadaddr ff 40000
fatload mmc 0 $kloadaddr MLO
nand write.i $kloadaddr 0 $filesize
nand write.i $kloadaddr 40000 $filesize
nand write.i $kloadaddr 80000 $filesize
nand write.i $kloadaddr c0000 $filesize

Flash U-boot to Nand

mw.b $kloadaddr ff 200000
fatload mmc 0 $kloadaddr u-boot.img
nand write.i $kloadaddr 100000 $filesize

Flashing images to NAND in U-Boot with SD Card for 256M Modules:

Format a SD card to vfat32 with boot flags

Download and extract AM335X-LINUX-PSP-04.06.00.07:

wget http://downloads.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/AM335x_04_06/04_06_00_07/exports/AM335X-LINUX-PSP-04.06.00.07.tgz?tracked=1
tar zxvf AM335X-LINUX-PSP-04.06.00.07.tgz
cd AM335X-LINUX-PSP-04.06.00.07/images/u-boot/am335x
cp MLP and u-boot.img to SD card

After the 2nd stage prompt U-Boot# comes up, the images for the 1st stage and 2nd stage can be flashed to NAND for persistent storage. Flashing SPL to NAND in SD boot Flash SPL (MLO) to NAND by executing the following commands:

mmc rescan
fatload mmc 0 0x82000000 MLO
nand erase 0x0 0x20000
nand write 0x82000000 0x0 0x20000

If no error messages are displayed the SPL of NAND boot has been successfully transferred to NAND. Flashing U-Boot to NAND in SD boot Flash the 2nd stage U-Boot (u-boot.img) to NAND by executing the following commands:

mmc rescan
fatload mmc 0 0x82000000 u-boot.img
nand erase 0x80000 0x40000
nand write 0x82000000 0x80000 0x40000

Change U-boot Environment for PXE booting:

setenv bootcmd_orig \'${bootcmd}\'
setenv bootcmd 'run net_boot'
setenv rootpath
saveenv

Changing U-Boot to boot from SD Card:

Power up MityARM and press "space bar" to get into the U-boot command prompt. Then run the following commands:

mmc rescan
fatload mmc 0 0x81000000 uEnv.txt
env import -t 0x81000000 $filesize
saveenv
boot

PXE booting using U-boot

setenv pxefile_addr_r 0x80000100
setenv kernel_addr_r  0x80008000
setenv ramdisk_addr_r 0x82000000
pxe get
pxe boot

Notes

Reset all environment variables to default:

env default -f -a

Save environment variables:

saveenv

See environment variables:

printenv

MAC address is defined in environment variables:

eth1addr=

If receiving error about eth1addr not set, run the following:

setenv eth1addr {macaddress}

Restart/reboot u-boot:

reset

Manual booting via tftp:

setenv bootargs 'mem=512M console=ttyO0,115200n8 root=/dev/ram0 initrd=0x82000000,40M ramdisk_size=60000 ip=dhcp panic=10'
tftp 0x80007fc0 mityarm/uImage
tftp 0x82000000 mityarm/ramdisk.gz
bootm 0x80007fc0