.. include:: /keyword.rst ========= TFTP Boot ========= .. contents:: Sections :local: :depth: 1 .. toctree:: :hidden: :maxdepth: 1 -------------------------------- ``tftpboot`` is a boot command in U-boot for booting devices over a network using the Trivial File Transfer Protocol (TFTP). |G1200-EVK| supports the Ethernet driver in U-Boot since |IOT-YOCTO| v24.0. |G510-G700-EVK| supports the Ethernet driver in U-Boot since |IOT-YOCTO| v24.1. It also provides support for booting via ``tftpboot`` natively in U-Boot. There are many tutorials and how-to guides for `tftpboot` with U-Boot available on the Internet and on YouTube. Here, we provide a very simple example of network setup for ``tftpboot`` on U-Boot. Prepare TFTP Server on PC Host ------------------------------ There are many TFTP server software options for Windows or Linux PC hosts. Developers will need a TFTP server on the PC host and prepare the image for the target EVK. For example, we suggest `tftpd64 `_ for Windows PC hosts, and `tftpd `_ for Linux PC hosts. Please refer to the documentation of these software for server settings and how to place the ``test.image`` in the folder accessible by the TFTP server. Configuration Example --------------------- After user install the TFTP server, please ensure that the Ethernet of |G1200-EVK| and the PC host are in the same LAN network with the same IPv4 subnet. In the following example, the IP address of the PC host is ``192.168.0.111``, and the IP address of |G1200-EVK| is ``192.168.0.100``. Prepare the ``test.image`` in the folder controlled by the TFTP server. 1. Enter the U-Boot shell on |G1200-EVK|. 2. Input the following commands for network settings and check the network connection: .. prompt:: bash => setenv serverip 192.168.0.111 setenv ipaddr 192.168.0.100 setenv gatewayip 192.168.0.255 setenv netmask 255.255.255.0 setenv ethaddr 08:00:00:00:22:01 ping 192.168.0.111 Developers should see the following output: .. prompt:: bash => ping 192.168.0.111 Using ethernet@11021000 device host 192.168.0.111 is alive Transfer Test Image to Genio EVK -------------------------------- 3. Transfer `test.image` from the PC host to |G1200-EVK|: .. prompt:: bash => tftpboot test.image Using ethernet@11021000 device TFTP from server 192.168.0.111: our IP address is 192.168.0.100 Filename 'test.image'. Load address: 0x4c000000 Loading: ################################################################## ################################################################## ########################################################## 11.4 MiB/s done Bytes transferred = 104857600 (6400000 hex) Now, the user have transferred `test.image` to the address `0x4c000000`. If this is a fitImage, you can use the command ``bootm`` to boot the Linux kernel from this fitImage. However, user need to take care of many other settings, such as loading the device tree blob (DTB), etc. Please read the U-Boot script carefully and modify it as needed to ensure a successful boot. Build and Deploy `rity-bringup-image` via TFTP Boot on Genio EVK ---------------------------------------------------------------- Developer could build the ``rity-demo-image`` and then boot the kernel and mount the file system via ramdisk on Genio EVK. However, The transmission time when deploying via tftpboot will be very long due to the size of the ``rity-demo-image``. Instead, we recommend using the ``rity-bringup-image`` to try this feature, which is more suitable given the memory limitations and reduce the network transmission time. .. note:: The |G510-EVK| has only 4GB of RAM, which is insufficient to handle the size of the ``rity-demo-image`` Kernel Configuration ^^^^^^^^^^^^^^^^^^^^ Enabling ``CONFIG_BLK_DEV_RAM=y`` is vital for supporting ramdisk block devices, as it simplifies the TFTP boot process by facilitating quick and flexible access to a temporary root filesystem. |IOT-YOCTO| has already enabled this configuration since version 24.1. If you want to use alternative approaches such as ``initramfs``, please ensure that you configure them properly according to your design specifications. .. prompt:: CONFIG_BLK_DEV_RAM=y Instructions to Build `rity-bringup-image` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Edit your conf/local.conf to include necessary settings for using ramdisk rootfs with ``rity-bringup-image``. .. prompt:: IMAGE_FSTYPES:append = " cpio.gz.u-boot " Build the rity-bringup-image: .. prompt:: bash $ MACHINE=genio-1200-evk bitbake rity-bringup-image Instructions to Delopy and Use TFTP Boot with Ramdisk of rity-bringup-image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Once the build is complete, locate the output files, which are typically found in the ``tmp/deploy/images/`` directory within the corresponding ``MACHINE`` folder. For exampel, if user wants to boot |G1200-EVK| via TFTP Boot. Then, deploy the two required files ``fitImage`` and root filesystem ``rity-bringup-image-genio-1200-evk.cpio.gz.u-boot`` to the TFTP server. .. important:: Please aware the EVK should have a well function boot chain on the main storage (EMMC or UFS) to support TFTP boot. If user is unsure whether the firmware supports TFTP boot, please flash the new build ``rity-bringup-image`` on the EVK. 1. Run the following command to reboot the system: .. prompt:: bash $ reboot 2.Hit any key when you see the message "Hit any key to stop autoboot" 3.Run the following commands in u-boot mode: .. prompt:: bash => setenv ethaddr 08:00:00:00:22:01 setenv bootfile fitImage setenv serverip XXX.XXX.XXX.XXX # The IP address of your TFTP server setenv bootargs "root=/dev/ram0 rootwait ramdisk_size=1207185408 ramdisk_start=0x68000000" saveenv 4.Hit any key when you see the message "Hit any key to stop autoboot" 5.Run the following commands in u-boot mode: .. prompt:: bash => dhcp tftpboot 0x68000000 rity-bringup-image-genio-1200-evk.cpio.gz.u-boot It will take several minutes, depends on the image size and network transmission. Then we could boot the kernel using fitImage. .. prompt:: bash => bootm 0x4c000000 0x68000000