6.1.3. How to setup a board

This document describes how to setup an environment to run library generated by DLK on a DE10-Nano board. We need the host system which has microSD card reader. All example commands are in case you use Linux or MacOS. If you use other system, commands will have some differences.

6.1.3.1. Create Linux system on microSD card (On host)

At first we need to get the Linux image. The image is available from the Terasic web site and please follow the link as below:

  1. Go to Terasic’s official web site

  2. Select “Products”

  3. Select “DE10-Nano Kit”

  4. Select “Resources”

  5. Select “Linux BSP (Board Support Package): MicroSD Card Image”

  6. Select “Linux LXDE Desktop (kernel 4.5)”

Note: A user registration is required to download the image.

Downloaded file contains the “DE10_Nano_LXDE.img”. Please set the empty microSD card into your system and write the downloaded image to microSD card as below.

$ sudo dd if=DE10_Nano_LXDE.img of=/dev/mmcblk0 bs=128M && sync

Caution & Note:

  • In Linux

    • /dev/xxx might have different name and please make sure the device name of target microSD

  • In MacOS

    • /dev/xxx has different name and please make sure the device name of target microSD

    • bs option of dd command should be changed to bs=128m

Please unset the microSD from your host system after dd && sync operation has been finished. And please set the microSD again for further operations.

6.1.3.2. Update some files for DLK (On host)

We need to update some files of microSD. To update it, we need to perform some copy operations.

Required files are shown in the following list. These files are necessary in later step.

{Blueoil directory}/dlk/hw/intel/de10_nano/
 ├── linux_kernel/zImage
 ├── linux_kernel/kernel_modules.tar.gz
 └── dma/terasic_ubuntu_arm32/udmabuf.ko

{Blueoil directory}/output_files/fpga/
 ├── preloader-mkpimage.bin
 ├── soc_system.rbf
 └── soc_system.dtb

Note: u-boot.scr is no need to update.

And the actual copy operations should be executed as below. It’s assumed that all required files are put on the REQUIRED_FILES directory.

$ cd REQUIRED_FILES
$ mkdir /media
$ mount -t vfat /dev/mmcblk0p1 /media
$ cp zImage /media
$ cp kernel_modules.tar.gz /media
$ cp soc_system.dtb /media
$ cp soc_system.rbf /media
$ dd if=preloader-mkpimage.bin of=/dev/mmcblk0p3 && sync
$ cp udmabuf.ko /media

Caution & Note:

  • In Linux

    • /dev/xxx might have different name and please make sure the device name of target microSD

  • In MacOS

    • /dev/xxx has different name and please make sure the device name of target microSD

6.1.3.3. Load a kernel module automatically (On DE10-Nano)

This section is to make linux load udmabuf.ko automatically in boot.

First, we will delete old kernel modules and replace it with the old ones:

$ rm -rf /lib/modules/*
$ tar xvzf /media/kernel_modules.tar.gz -C /lib/modules

Second, we need to put udmabuf.ko into specified directory.

$ cp /media/udmabuf.ko /lib/modules/4.5.0/kernel/drivers/misc/

Third, update kernel modules with:

$ echo "udmabuf" >> /etc/modules
$ depmod
$ reboot

6.1.3.4. Other Information

  • Network is initially set up as DHCP network.

  • If you want to run the demo program, OpenCV2 and xmltodict package is also required. Please execute sudo apt-get install python-opencv and sudo apt-get install python-xmltodict.