Project

General

Profile

Root Filesystem (2020 August MDK Release)

SD Card based Root Filesystem

Installing the filesystem

The MDK comes packaged with a prebuilt root filesystem. This can be found in the MDK's install directory under deploy.

First, backup the filesystem currently on the SD card (you will need to modify the paths based on your specific Linux distribution):

sudo cd /path/to/media/rootfs/
sudo tar czvf ~/rootfs-backup.tar.gz .

Then, you can install the new root filesystem with

rm -rf /path/to/media/rootfs/*
tar xvf <MDK path>/deploy/mitysom-335x-devkit-rootfs.tar.bz2 -C /path/to/media/rootfs/
sync

NOTE: It's recommended that you flush any buffered data to the root filesystem media with sync to avoid corruption. This command will not print any status output and can take a long time to run depending on the write speed of the media.

Please note that when you update the root filesystem to the latest MDK, you will also want to replace your kernel image with the latest MDK's kernel image.

Installing U-Boot and Linux

cp <MDK path>/deploy/<SOM NAND size>/MLO /path/to/media/boot/
cp <MDK path>/deploy/<SOM NAND size>/u-boot.img /path/to/media/boot/
cp <MDK path>/deploy/fitImage /path/to/media/boot/fitImage
sync

Note: This device tree only works with U-Boot from the 2020 August MDK.

Booting the Root Filesystem

U-Boot can boot using the SD card root filesystem with

U-Boot# mmcinfo; setenv fdtaddr 0x88000000; setenv fdt_high 0xFFFFFFFF; setenv kloadaddr 0x80007FC0;
U-Boot# fatload mmc 0 $kloadaddr zImage
U-Boot# fatload mmc 0 $fdtaddr am335x-mitysom.dtb
U-Boot# setenv console "ttyS0,115200n8" 
U-Boot# run mmc_args
U-Boot# bootz $kloadaddr - $fdtaddr

These commands can be saved as the default boot command

U-Boot# setenv console "ttyS0,115200n8" 
U-Boot# setenv fdtaddr 0x88000000; setenv fdt_high 0xFFFFFFFF; setenv kloadaddr 0x80007FC0;
U-Boot# setenv bootcmd "mmcinfo; fatload mmc 0 0x80007FC0 zImage; fatload mmc 0 0x88000000 am335x-mitysom.dtb; run mmc_args; bootz 0x80007FC0 - 0x88000000" 
U-Boot# saveenv

NAND based Root Filesystem

See UBIFS Nand Boot.

Before building the UBIFS image, unpack the prebuilt root filesystem that ships with the MDK. This may be found in the MDK's install directory under deploy.

cd <your working directory>
mkdir filesystem
tar xf <MDK path>/deploy/mitysom-335x-devkit-rootfs.tar.bz2 -C ./filesystem

When flashing the kernel image, use the new FIT image instead of zImage or uImage. This FIT image contains the kernel and devkit device tree.
The image can be found at

<MDK path>/deploy/fitImage

Network Boot

TFTP

U-Boot loads the zImage and device-tree over the network using TFTP.

Install the TFTP server

sudo apt-get install tftpd-hpa

Configure the server
Add/Update the following line in /etc/conf.d/tftpd:

TFTPD_DIRECTORY="/srv/tftp" 

Create the TFTP folder

mkdir -p /srv/tftp

Reload the TFTP server

sudo service tftpd-hpa restart

Add the kernel image and device tree from the MDK

mkdir /srv/tftp/mitysom/
cp <MDK path>/deploy/zImage-zImage_devkit.bin /srv/tftp/mitysom/zImage
cp <MDK path>/deploy/zImage-zImage_devkit.dtb /srv/tftp/mitysom/am335x-mitysom.dtb

NFS

After U-Boot loads the kernel, the kernel may use an NFS drive as it's root filesystem.

Install an NFS server

sudo apt-get install nfs-kernel-server

Make the NFS rootfs folder

mkdir -p /srv/nfs/mitysom

Export the rootfs folder
Add the following entry to /etc/exports:

/srv/nfs/mitysom *(rw,async,nohide,insecure,no_root_squash,no_subtree_check)

Update the NFS server's exports

sudo exportfs -arv

Make the NFS server serve over UDP
Add the following to /etc/nfs.conf

[nfsd]
 udp=y
 vers2=y

Restart the NFS server

systemctl restart nfs-server.service

Uncompress the MDK rootfs

tar xf <MDK path>/deploy/mitysom-335x-devkit-rootfs.tar.bz2 -C /srv/nfs/mitysom

In order to sucessfully boot, DHCP needs to be disabled in systemd for the network adapter connecting to the NFS server.

mkdir -p /srv/nfs/mitysom/etc/connman
vi /srv/nfs/mitysom/etc/connman/main.conf

Then add the following lines to /srv/nfs/mitysom/etc/connman/main.conf:
[General]
NetworkInterfaceBlacklist=eth

Booting

Configure and boot U-Boot:

U-Boot# set kloadaddr 0x80007FC0
U-Boot# set fdtaddr 0x88000000
U-Boot# set serverip <host machine IP>
U-Boot# set rootpath "/srv/nfs/mitysom" 
U-Boot# set autoload no
U-Boot# set bootcmd "dhcp; tftp $kloadaddr /mitysom/zImage; tftp $fdtaddr /mitysom/am335x-mitysom.dtb; run net_args; bootz $kloadaddr - $fdtaddr;" 
U-Boot# saveenv
U-Boot# boot

Go to top
Add picture from clipboard (Maximum size: 1 GB)