Build Embedded Linux with Yocto

Step 4 of 5

In this article we will finally build a working Embedded Linux OS image and deploy it to the board. This is where things get real. Let’s start building.

Assuming you successfully booted into your Fedora VM, perform these steps.

  1. Start Visual Studio Code
  2. Open Terminal. Click View -> Terminal.
  3. Browse to folder with Yocto environment.

    cd /home/developer/fsimx6-Y2024.04.1/

  4. Prepare “build” folder.

    ./setup-yocto build

  5. When asked for GIT username, press <ENTER>.
  6. When asked for email, press <ENTER>.
  7. When asked whether to enable color display, press “y”, then <ENTER>.
  8. Update “build” folder.

    ./setup-yocto build -u

  9. Browse into “build” folder.

    cd build/yocto-fus

  10. Set environment variables and run setup script.

    DISTRO=fus-imx-xwayland MACHINE=fsimx6 ./fus-setup-release.sh -b build-fsimx6-fus-imx-xwayland

  11. When asked to read EULA, press “q” key.
  12. Accept EULA (press “y”, <ENTER>).
  13. Optionally, change maximum running tasks from 4 to 2.


    export BB_NUMBER_THREADS="2"

  14. Optionally, change maximum threads “make” can spawn to 4.


    export PARALLEL_MAKE="-j 4"

  15. Make sure you’re in the “build” folder.

    cd /home/developer/fsimx6-Y2024.04.1/build/yocto-fus

  16. Load additional environment variables.

    DISTRO=fus-imx-xwayland MACHINE=fsimx6 source setup-environment build-fsimx6-fus-imx-xwayland

  17. Start OS build process. Take your time. The build process will likely last for several hours.

    bitbake fus-image-std

Note:
The resulting OS image is stored in folder
/home/developer/fsimx6-Y2024.04.1/build/yocto-fus/
and in subfolder:
build-fsimx6-fus-imx-xwayland/tmp/deploy/images/fsimx6
Take a good note of this subfolder.

Warning:
If you ever close and then re-open MATE terminal, then in order to run bitbake again, run this sequence of commands:
cd /home/developer/fsimx6-Y2024.04.1/build/yocto-fus
DISTRO=fus-imx-xwayland MACHINE=fsimx6 source setup-environment build-fsimx6-fus-imx-xwayland

Build Software Development Kit

Should you find yourself in a situation, that you would like to build custom software for your board, you may want to build SDK (Software Development Kit) for it first. The process is essentially the same as described above, however, instead of executing bitbake fus-image-std, execute

bitbake fus-image-std -c populate_sdk

The build may, again, take several hours. However, if you previously built the OS itself, the SDK build will take significantly less, as most of the artifacts will be built by then. Once the SDK is built, perform following steps.

  1. Open MATE terminal.
  2. Browse into folder: /home/developer/fsimx6-Y2024.04/build/yocto-fus/build-fsimx6-fus-imx-xwayland/tmp/deploy/sdk/[NAME OF THE SCRIPT].sh
  3. There will be a script (a filename, which ends with .sh). Note the name of that script file. Then run it.
  4. The script will extract the SDK into directory specified by you. Take good note of the output directory. If you don’t specify any, then default will be used, which is: /opt/fus-imx-xwayland/5.15-kirkstone.
  5. Now run this command:
    source /[SDK DIRECTORY]/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi

    If you extracted SDK into your default folder, the command is:

    source /opt/fus-imx-xwayland/5.15-kirkstone/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi

  6. Note:
    C/C++ compiler, builds of which target ARMv7 processor architecture are located at
    /usr/local/arm/fs-toolchain-11.2-armv7ahf/bin
    C/C++ compiler, builds of which target ARMv8 processor architecture are located at
    /usr/local/arm/fs-toolchain-11.2-armv8ahf/bin

  7. Set PATH environment variable to use ARMv7 compiler
    settoolchain 1

  8. Tip:
    If you ever need your C/C++ compiler builds to target ARMv8 processor architecture then activate them with this command
    settoolchain 2

  9. You should now be able build C/C++ projects with make command.
  10. If your project is built with cmake, then do these steps
    • Make sure your current directory is a directory which contains a buildable cmake project (i.e., it contains CMakeLists.txt file).
    • Then start the build with this command.
      cmake \
        -DCMAKE_FIND_ROOT_PATH=/opt/fus-imx-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux \
        -DCMAKE_TOOLCHAIN_FILE=/opt/fus-imx-xwayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake

OS deployment

If you managed to successfully build the OS, it is now time to deploy it to your board and let the OS boot up. From your favourite terminal (beit MATE terminal or Visual Studio Code) perform these commands.

  1. Browse to OS build output folder.
    cd /home/developer/fsimx6-Y2024.04.1/build/yocto-fus/
    cd build-fsimx6-fus-imx-xwayland/tmp/deploy/images/fsimx6

  2. Insert a micro SD card into your computer’s card reader.
  3. In Oracle VirtualBox Manager window, right-click on your virtual machine -> Settings.
  4. From the menu on the left, click “Shared Folders”.
  5. In the upper-right corner, click on a small folder icon with green PLUS sign that says: “Addds new shared folder.”
  6. Fill out path to your SD card on your host PC. E.g., if you’re running on Windows OS, this may be “F:\”.
  7. Folder Name will be filled-out automatically.
  8. Fill out mount point. This will be the folder within virtualized OS, where the content of your SD card will be mounted. E.g., “/mnt/f”
  9. Check “Auto-mount” checkbox.
  10. Click OK.
  11. Click OK.
  12. Assuming you used “/mnt/f” as folder for your SD card within virtualized OS, try this command in terminal, to see, if SD card was properly mounted.
    ls -laF /mnt/f

    You should see the content of your SD card.

  13. Now we are going to copy files from your OS build folder onto the SD card. Here’s the list of files we need to copy.
    Filename Description
    install.scr Board installation script. Without, we would need to perform OS deployment by typing U-boot commands into the board, which is quite clumsy.
    fus-image-std-fsimx6.manifest This file contains list of packages that are built into the OS. This file is not required, but copying it to the SD card is a good way to mark your deployed OS with information on what kind of OS you created.
    uboot.nb0 Contains the U-Boot loader.
    zImage Contains OS kernel.
    fus-image-std-fsimx6.ubifs Contains root file system (basically all files of the OS).
    armstonea9r2q-fsimx6.dtb Contains device tree for board hardware. Whether or not this is the correct file for your particular board is not 100% sure. Explore all. Explore other .dtb files in the OS build output folder. If your OS stops during boot, or is stuck in a continuous reboot cycle or if some of your hardware peripherals do not work as expected (e.g., display does not light up), it might be, that you loaded a .dtb file, which is not compatible with your board. You may need to contact F&S support directly in such case. You may also try to experiment with other .dtb files, until you load the correct one. You may also need to read F&S hardware documentation to figure out, which device tree file is the right one for your board.
  14. Based on the file list above, you may want to run this command to copy the necessary files to your SD card:

    cp -L armstonea9q-fsimx6.dtb /mnt/f/armstonea9q.dtb
    cp -L install.scr /mnt/f
    cp -L fus-image-std-fsimx6.manifest /mnt/f
    cp -L fus-image-std-fsimx6.ubifs /mnt/f/rootfs-fsimx6.ubifs
    cp -L uboot.nb0 /mnt/f
    cp -L zImage /mnt/f/zImage-fsimx6

    Notice, that some of the copy commands rename the target file. This is intentional, because the install.scr script is expecting the files to have a precise specific name.

  15. Copy content of SD card also to your host computer.
  16. Unplug your SD card from your host computer and plug it into your embedded board.
  17. Connect your embedded board over its serial interface (COM port) to your host PC.
  18. Use DCUTerm to establish serial connection with your board. Proper COM settings should be:
    Data bits: 8
    Stop bits: 1
    Parity: None
    Flow Control: None
  19. If the connection is established, hit <ENTER> key and you should see a login prompt.
  20. The next step is to reboot the board. You can either unplug it and then plug it back in, or you can log in (use root as login name, no password should be required) and then use reboot command.
  21. Immediately after reboot, press and hold ‘s’ key on the keyboard, to keep sending it into DCU Terminal application. A NAND loader should appear.
  22. Press ‘E’ key to erase flash.
  23. Press ‘d’ to download a bootloader.
  24. In DCU Terminal menu, go to File -> Transmit Binary file.
  25. Browse uboot.nb0 file, which you downloaded from SD Card to your host computer.
  26. When U-Boot is successfully flashed to the board, press ‘x’ key.
  27. That should execute the install.scr script from your SD card and flash the board with the OS.
  28. Once flashed, you should perform these additional commands.
    setenv ethaddr 00:05:51:xx:yy:zz

    where 00:05:51:xx:yy:zz represents Ethernet hardware address of your choice. You may want to adjust your DHCP server to assign the same IP address to your embedded board each time it boots up. This will turn out to be very useful later.

  29. Save settings with this command

    saveenv

  30. Reboot

    reset

  31. When the board boots up, log in with root username (no password required). Activate ethernet port by command

    ifconfig eth0 up

  32. Enable DHCP with

    udhcpc eth0

Deploying built OS to the board manually.

If, for whatever reason, your automatic deploy script fails, there is a sequence of commands that you can type once you are in U-Boot, to copy the OS from SD Card to the flash memory of your board, save it and let it boot. Here’s how. Type this exact sequence of commands into DCU Terminal.

  1. Once in UBoot, insert SD card into the board.
  2. If you have install.scr install script on the SD card, then you can run this sequence of commands to run it, save the OS and reboot the board.
    update.install
    saveenv
    reset

  3. Othwerwise continue with these commands. List files on your SD card:
    ls mmc 0

  4. There should be a file named zImage. Load it.

    load mmc 0 ${updatedev} . zImage
    nand erase.part Kernel
    nand write . Kernel ${filesize}

  5. Load device tree. Instead of ${platform}.dtb use the name of actual [.dtb] file name.

    load mmc 0 ${updatedev} . ${platform}.dtb
    nand erase.part FDT
    nand write . FDT ${filesize}

  6. Create UBI with volume rootfs on partition TargetFS.

    nand erase.part TargetFS
    ubi part TargetFS
    ubi create rootfs

  7. Load file with root file system. Instead of rootfs.ubifs use the name of actual [file.ubifs] file name.

    load mmc 0 ${updatedev} . rootfs.ubifs 
    ubi write . rootfs ${filesize}

  8. Execute predefined environment variables.

    run .kernel_nand
    run .fdt_nand
    run .rootfs_ubifs

  9. Unset updatedev environment variable and save the current U-Boot environment to persistent storage.

    setenv updatedev
    saveenv

  10. Reboot the board.

    reset

Documentation notice

Information may change over time

Created
Last technically reviewed

Technical details on this page may change as vendor tools, board support packages, operating system images, and runtime versions evolve.

This page was last technically reviewed on May 4, 2026. If your setup differs from the one described here, please contact us for help.