SoCrates Linaro Linux Desktop
Demo with Linaro Linux Desktop on SoCrates board with Keyboard/Mouse/Screen/Camera

21 Feb 2017 - 23:54 | Version 25 | | | , , ,



This project utilizes EBV SoCrates board to demonstrate the Linux Linaro OS running on the Altera Cyclone V SoC device. This project allows you to boot linux and use mjpeg streamer with USB camera. This project can be built using the features of the 13.0 release.

The purpose of this project was to test some of the capabilities of the SoC hardware. The video pipeline is implemented in the FPGA portion of the SoC using Altera's Video IP (VIP) suite and some of the manualy made parts written with VHDL to enable streaming to LVDS DLC0700DDG -T-1 screen . A frame buffer DMA component in the FPGA reads the video buffer information from DDR in the HPS and writes it into the video pipeline.

This project is based on the Detlev Zundel's kernel tree and using Chris Rauter's driver for Altera VIP frame buffer.


  1. EBV SoCrates 1.12 board or later
  2. SD card adapter
  3. 8 GB microSD card
  4. USB HUB
  5. Female to Female USB adapter

Building the demo


  1. Quartus 13.0sp1
  2. Build toolchain - only if you wish to build the kernel source and the device tree. Not necessary if you are using the provided uImage and dtb files.
  3. SOC EDS 13.0
    • Needed to compile linux kernel
  4. Custom kernel
  5. Linaro Linux Root filesystem

Build the Quartus project

  1. Download archived project file (.qar)
  2. Open project file and extract it
  3. Start Qsys and generate system.
  4. Full compile whole project

Linux Kernel Configuration and Drivers

Driver summary / Kernel changes summary

  1. Frame buffer driver
  2. Update kernel build configuration
  3. Update kernel device tree
    • Altera VIP frame buffer has to be added to device tree

How to get the kernel source and compile (optional : uImage and dtb files attached to this project)

  1. Get archieved kernel source files
  2. Run patch from attached files
  3. Compile the kernel
#setup build environment
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export LOADADDR=0x8000

#import default config(patch will enable new drivers in this config)
make socfpga_defconfig

#make a new uImage
make uImage

#build the device tree
#You need this device tree to get the drivers to work!
make socfpga_cyclone5.dtb

NOTE: You can use allready compiled uImage and device tree which is attached

U-BOOT arguments

You will have to add few commands to u-boot since SoCrates is not automatically allowing FPGA part to use HPS DDRAM memory. Also you will have to increase size of DMA to enable video streaming and parallel use of keyboard and mouse with camera.

There are two ways for changing enviorment variables for u-boot and both of them will be demonstrated here.

Changing variables with setenv command 
setenv axibridge ffd0501c
setenv axibridge_handoff 0x0
setenv l3remap ff800000
setenv l3remap_handoff 0x00000019
setenv bridge_enable mw $axibridge ${axibridge_handoff}; mw $l3remap ${l3remap_handoff}
setenv bootcmd 'run bridge_enable_handoff; run mmcload; run mmcboot'
setenv mmcboot 'setenv bootargs console=ttyS0,57600 root=${mmcroot} rw rootwait coherent_pool=2M;bootm ${loadaddr} - ${fdtaddr}'
setenv bootdelay 10

Those commands will allow FPGA to use DDRAM from HPS side, and will increase DMA on 2 Mbyte

Changing variables with mkenvimage

Mkenvimage tool can be found in folder Project/software/spl_bsp/uboot-socfpga/tools/mkenvimage
  1. Insert microSD card image to PC
  2. From directory Project/software/spl_bsp run commands
    1. uboot-socfpga/tools/mkenvimage -s 4096 -o ubootenv.bin uBootInitRAMFsEnv.txt</span>
    2. sudo dd if=ubootenv.bin of=/dev/sdX bs=512 seek=1</span>
NOTE: File uBootinitRAMFsEnv.txt can be found in attachments

Create the SD Card Image

Partition SD Card Image

  1. Determine the device associated with the SD card on the host by running the following command before and after inserting the card in the reader:$ cat /proc/partitions Let's assume it is /dev/sdx
  2. Repartition the card, with the sudo fdisk/dev/sdx command
    $ Use p to print current partitioning
    $ Use d to delete all partitions one by one
  3. Create partition using these options, pressing enter after each one: n p 2 4096 +4496384 t 83
    Create partition using these options, pressing enter after each one: n p 1 9000000 +20480K t 1 b
    Create partition using these options, pressing enter after each one: n p 3 2048 +1024K t 3 a2
  4. Press w to write partitions to card, then exit
  5. Verify the card was partitioned correctly, it should look like this (use fdisk and p to see it): 
    Device Boot Start End Blocks Id System
    /dev/sdx1 9000000 9020480 20480 b W95 FAT32
    /dev/sdx2 4096 8996863 4496384 83 Linux
    /dev/sdx3 2048 4095 1024 a2 Unknown
  6. Make partition one a DOS partition
    $ sudo mkdosfs /dev/sdx1

Place the preloader and u-boot in the binary partition

  1. dd if=preloader_with_header.img of=/dev/sdx3 bs=64k seek=0
  2. sudo dd if=u-boot.img of=/dev/sdx3 bs=64K seek=4

Copy the Linux kernel and Device Tree file to the Fat 32 partition

  1. mkdir /sdcard
  2. mount /dev/sdx1 /sdcard
  3. cp uImage.bin /sdcard/uImage
  4. cp socfpga.dtb /sdcard/socfpga.dtb
  5. umount /sdcard
  6. sync

Copy the Linaro Root Filesystem to the Linux partition

The linaro rootfs can be found in attachments.
  1. mount /dev/sdx2 /sdcard
  2. cp /binary /sdcard
  3. umount /sdcard
  4. sync

Booting the system

Please refer to Figure 2 in the SoCrates datasheet for the layout of SoCrates board.
  1. Install the microSD card in the SoCrates
  2. Set the Dip Switch P18 mode to OFF OFF ON ON OFF ON OFF ON
  3. P4 jumper should connect pins 1 and 2 and pins 5 and 6
  4. Use USB HUB to connect a keyboard, mouse and camera
    • You can use USB to mini USB B cable, because drivers are set so the board always works as a host device.
  5. Connect LVDS TFT Display to P2 FPGA connector
  6. Connect a terminal cable to UART connector
  7. Connect Ethernet cable
  8. Connect USB blaster cable
  9. Power the board
  10. Programthe FPGA part while bootdelay is loading
  11. Wait for Linux to start
  12. Login with: account root, pasword root or with startx

Root filesystem

It is necessary to Download Linaro Linux Root file system from official site. You can easily install mjpeg-streamer and stream USB camera to ethernet or take a pictures with it.

We used Linaro 13.0, but that release is not available anymore, so you can try with the new one.

Give us your feedback

© 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Privacy.