Flash the NAND using tftp For Rugged Board i.MX6UL

Objective:

This guide describes a method of flashing the NAND using tftp for the Rugged Board i.MX6UL .

Materials:

Hardware:

Software:

  • Ubuntu 16.04

Booting the Board from Network :-

Booting from network means loading the kernel and device-tree over TFTP. The bootloader itself must already be loaded from any other boot device available.

Procedure:

Development Host Preparations :-

On the development host, a TFTP server must be installed and configured. The following tools will be needed to boot the Kernel from Ethernet:

  1. A TFTP server and

  2. An optional tool for starting/stopping a service (xinetd).

  • Following packages need to be install in the host PC.Before installing the below packages, please check your internet(Ethernet Cable) connection.

Ubuntu and Debian:

$ sudo apt-get update

$ sudo apt-get install tftpd-hpa xinetd

After the installation, there are two ways to configure the TFTP server :

  1. As a standalone daemon

  2. Controlled and handled by xinetd

  • First, create a directory to store the TFTP files :

host$ sudo mkdir /tftpboot
host$ sudo chmod -R 777 /tftpboot
host$ sudo chown -R nobody /tftpboot 
## This command is changing the ownership of the "/tftpboot" directory and everything underneath it to the user or group specified as "nobody."
Then copy your BSP image files to this directory.You also need to configure a static IP address for the appropriate interface. The default IP address of the PHYTEC evaluation boards is 192.168.3.11. So setting 192.168.3.10 with netmask 255.255.255.0 as a host address is a good choice.

Configure TFTP as a stand alone daemon

  • Create or edit /etc/default/tftpd-hpa :

host$ sudo nano /etc/default/tftpd-hpa

 # /etc/default/tftpd-hpa
   TFTP_USERNAME="nobody"
   TFTP_DIRECTORY="/tftpboot"
   TFTP_ADDRESS="192.168.3.10:69"
   TFTP_OPTIONS="-s -c"

for save the changes press ctrl+o then press enter button then press  crtl+x 
Then connect the ethernet cable from your pc to board and check it as below:-

Check the (inet 192.168.3.10) is showing or not.
Set TFTP_DIRECTORY to your TFTP server root directory

Set TFTP_ADDRESS to the host address the server is listening to (set to 192.168.3.10:69 )

Set TFTP_OPTIONS, following command shows the available options:

Restart the services to pick-up the configuration changes :

host$ sudo service tftpd-hpa restart
NOTE:- If any error will popup then check the ip adress proporly changed or not.
The TFTP server is automatically mounted to /mnt/tftp

If “tftp” file is not present inside the /mnt/ as below : 
Then copy the tftp file manually : 
  • NOTE:- You can download the “tftp” file from below link :

( https://drive.google.com/drive/folders/11QuBQWwWUerL_r057QBlQ_IuxvF7FDRz?usp=sharing )

NAND UPDATING STEPS :-

  • Then open the board terminal by :

$ sudo minicom -s 
  • Stop it in bootloader level then type the bellow commands :

Update barebox :

bootloader$ ifup eth0

bootloader$ barebox_update -t nand /mnt/tftp/barebox.bin

We also recommend erasing the environment of the old barebox. Otherwise, the new barebox will use the old environment.

bootloader$ erase /dev/nand0.barebox-environment.bb
After erasing the environment, you have to reset your board. Otherwise, the barebox will still use the old environment.

bootloader$ reset  

 #Again stop it in bootloader level
#Again 

bootloader$ ifup eth0

Update the Kernel and devicetree :

  • Create UBI volumes for Linux kernel, oftree, and root filesystem in NAND :

bootloader$ ubiformat /dev/nand0.root
bootloader$ ubiattach /dev/nand0.root
bootloader$ ubimkvol -t static /dev/nand0.root.ubi kernel 16M
bootloader$ ubimkvol -t static /dev/nand0.root.ubi oftree 1M
bootloader$ ubimkvol -t dynamic /dev/nand0.root.ubi root 0
  • Now get the Linus kernel and oftree from your TFTP server and store it into the NAND Flash :

bootloader$ ubiupdatevol /dev/nand0.root.ubi.kernel /mnt/tftp/zImage
bootloader$ ubiupdatevol /dev/nand0.root.ubi.oftree /mnt/tftp/oftree

Update the root file system :

  • For flashing Linux's root filesystem into NAND, please wait :

bootloader$ cp -v /mnt/tftp/root.ubifs /dev/nand0.root.ubi.root 

 ## change the name of root.ubifs as per your “.ubifs” name.

Follow the below logs :-

barebox 2019.01.0-bsp-yocto-i.mx6ul-pd19.1.0 #1 Tue Feb 7 05:12:29 UTC 2023


Board: Phytec phyCORE-i.MX6 Ultra Lite SOM with NAND
detected i.MX6 UltraLite revision 1.2
i.MX reset reason POR (SRSR: 0x00000001)
i.MX6 UltraLite unique ID: d1e090b62c2fb9d4
mdio_bus: miibus0: probed
eth0: got preset MAC address: 50:2d:f4:24:6f:5b
nand: ONFI flash detected
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABADAH4), 512MiB, page size: 2048, OOB size: 64
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
imx-usb 2184200.usb@2184200.of: USB EHCI 1.00
imx-esdhc 2190000.usdhc@2190000.of: registered as mmc0
state: New state registered 'state'
state: Using bucket 0@0x00000000
netconsole: registered as netconsole-1
phySOM-i.MX6: Using environment in NAND flash
malloc space: 0x8fe7cec0 -> 0x9fcf9d7f (size 254.5 MiB)
envfs: no envfs (magic mismatch) - envfs never written?
running /env/bin/init...
barebox 2019.01.0-bsp-yocto-i.mx6ul-pd19.1.0 #1 Tue Feb 7 05:12:29 UTC 2023


Board: Phytec phyCORE-i.MX6 Ultra Lite SOM with NAND
detected i.MX6 UltraLite revision 1.2
i.MX reset reason WDG (SRSR: 0x00000010)
i.MX6 UltraLite unique ID: d1e090b62c2fb9d4
mdio_bus: miibus0: probed
eth0: got preset MAC address: 50:2d:f4:24:6f:5b
nand: ONFI flash detected
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABADAH4), 512MiB, page size: 2048, OOB size: 64
Bad block table found at page 262080, version 0x01
Bad block table found at page 262016, version 0x01
imx-usb 2184200.usb@2184200.of: USB EHCI 1.00
imx-esdhc 2190000.usdhc@2190000.of: registered as mmc0
state: New state registered 'state'
state: Using bucket 0@0x00000000
netconsole: registered as netconsole-1
phySOM-i.MX6: Using environment in NAND flash
malloc space: 0x8fe7cec0 -> 0x9fcf9d7f (size 254.5 MiB)
envfs: no envfs (magic mismatch) - envfs never written?
running /env/bin/init...

NOTE:- IF any case the zimage and oftree are not updating or showing the log like bellow :-

  • Then you have to check the images are proporly copied into the /tftpboot/ folder or not , if not copied 1st copy the images proporly :

host$ sudo service tftpd-hpa restart
  • Then again follow the NAND updating stapes (from barebox to .Ubifs)

Last updated