Build Embedded Linux with Yocto
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.
- Start Visual Studio Code
- Open Terminal. Click View -> Terminal.
-
Browse to folder with Yocto environment.
cd /home/developer/fsimx6-Y2024.04.1/ -
Prepare “build” folder.
./setup-yocto build - When asked for GIT username, press <ENTER>.
- When asked for email, press <ENTER>.
- When asked whether to enable color display, press “y”, then <ENTER>.
-
Update “build” folder.
./setup-yocto build -u -
Browse into “build” folder.
cd build/yocto-fus -
Set environment variables and run setup script.
DISTRO=fus-imx-xwayland MACHINE=fsimx6 ./fus-setup-release.sh -b build-fsimx6-fus-imx-xwayland - When asked to read EULA, press “q” key.
- Accept EULA (press “y”, <ENTER>).
-
Optionally, change maximum running tasks from 4 to 2.
export BB_NUMBER_THREADS="2" -
Optionally, change maximum threads “make” can spawn to 4.
export PARALLEL_MAKE="-j 4" -
Make sure you’re in the “build” folder.
cd /home/developer/fsimx6-Y2024.04.1/build/yocto-fus -
Load additional environment variables.
DISTRO=fus-imx-xwayland MACHINE=fsimx6 source setup-environment build-fsimx6-fus-imx-xwayland -
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.
- Open MATE terminal.
- Browse into folder:
/home/developer/fsimx6-Y2024.04/build/yocto-fus/build-fsimx6-fus-imx-xwayland/tmp/deploy/sdk/[NAME OF THE SCRIPT].sh - There will be a script (a filename, which ends with .sh). Note the name of that script file. Then run it.
- 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. - Now run this command:
source /[SDK DIRECTORY]/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabiIf 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 - Set PATH environment variable to use ARMv7 compiler
settoolchain 1 - You should now be able build C/C++ projects with
makecommand. - If your project is built with
cmake, then do these steps- Make sure your current directory is a directory which contains a buildable
cmakeproject (i.e., it containsCMakeLists.txtfile). - 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
- Make sure your current directory is a directory which contains a buildable
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
Tip:
If you ever need your C/C++ compiler builds to target ARMv8 processor architecture then activate them with this command
settoolchain 2
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.
- 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 - Insert a micro SD card into your computer’s card reader.
- In Oracle VirtualBox Manager window, right-click on your virtual machine -> Settings.
- From the menu on the left, click “Shared Folders”.
- In the upper-right corner, click on a small folder icon with green PLUS sign that says: “Addds new shared folder.”
- Fill out path to your SD card on your host PC. E.g., if you’re running on Windows OS, this may be “F:\”.
- Folder Name will be filled-out automatically.
- 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”
- Check “Auto-mount” checkbox.
- Click OK.
- Click OK.
- 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/fYou should see the content of your SD card.
- 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. - Copy content of SD card also to your host computer.
- Unplug your SD card from your host computer and plug it into your embedded board.
- Connect your embedded board over its serial interface (COM port) to your host PC.
- 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 - If the connection is established, hit <ENTER> key and you should see a login prompt.
- 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
rootas login name, no password should be required) and then userebootcommand. - Immediately after reboot, press and hold ‘s’ key on the keyboard, to keep sending it into DCU Terminal application. A NAND loader should appear.
- Press ‘E’ key to erase flash.
- Press ‘d’ to download a bootloader.
- In DCU Terminal menu, go to File -> Transmit Binary file.
- Browse
uboot.nb0file, which you downloaded from SD Card to your host computer. - When U-Boot is successfully flashed to the board, press ‘x’ key.
- That should execute the
install.scrscript from your SD card and flash the board with the OS. - Once flashed, you should perform these additional commands.
setenv ethaddr 00:05:51:xx:yy:zzwhere
00:05:51:xx:yy:zzrepresents 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. -
Save settings with this command
saveenv -
Reboot
reset -
When the board boots up, log in with
rootusername (no password required). Activate ethernet port by commandifconfig eth0 up -
Enable DHCP with
udhcpc eth0
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.
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.
- Once in UBoot, insert SD card into the board.
- If you have
install.scrinstall 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 - Othwerwise continue with these commands. List files on your SD card:
ls mmc 0 -
There should be a file named
zImage. Load it.load mmc 0 ${updatedev} . zImage nand erase.part Kernel nand write . Kernel ${filesize} -
Load device tree. Instead of
${platform}.dtbuse the name of actual [.dtb] file name.load mmc 0 ${updatedev} . ${platform}.dtb nand erase.part FDT nand write . FDT ${filesize} -
Create UBI with volume rootfs on partition TargetFS.
nand erase.part TargetFS ubi part TargetFS ubi create rootfs -
Load file with root file system. Instead of
rootfs.ubifsuse the name of actual [file.ubifs] file name.load mmc 0 ${updatedev} . rootfs.ubifs ubi write . rootfs ${filesize} -
Execute predefined environment variables.
run .kernel_nand run .fdt_nand run .rootfs_ubifs -
Unset
updatedevenvironment variable and save the current U-Boot environment to persistent storage.setenv updatedev saveenv -
Reboot the board.
reset
Documentation notice
Information may change over time
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.
