Before stepping into the virtio acceleration, we will build and run a Linux(PetaLinux) in FPGA.

Despite the poor performance of simulation in X86, it’s very convenient to create POC.

We choose MPSoC zcu106(PS) to test ARM, Zynq zc702(PS) to test ARM and Kintex UltraScale kcu705(PL) to test MicroBlaze softcore.

0. Essential tools

OS: Ubuntu 16.04 Desktop

Vivado: 2019.1

Xilinx SDK: 2019.1

PetalLinux SDK:  PetaLinux 2019.1

BSP: Evaluation Board BSP or generated from Vivado/Xilinx SDK

1. Build QEMU

QEMU is in the PetaLinux SDK directory, it’s not necessary to rebuild if you do not wanna modify anything.

git clone git://
cd qemu
apt install libglib2.0-dev libgcrypt20-dev zlib1g-dev autoconf automake libtool bison flex libpixman-1-dev
git submodule update --init dtc
./configure --target-list="aarch64-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --disable-xen
make -j4


2. PetaLinux Project

2.1. Create Project

petalinux-create -t project -n zcu106_arm_a53 --template zynqMP -s ../bsp/xilinx-zcu106-v2019.1-final.bsp
petalinux-config # Decide what to build


After the project created, pre-built images is in directory pre-built. You can test it via petalinux-boot

petalinux-boot --qemu --prebuilt 3 # Start ZCU106 virtual machine with prebuilt kernel


To accelerate the sstate mirror check process, you need download the sstate cache in Ref [5].

If you are using petalinux as root, you need modify sanity.conf like this:

cat /opt/petalinux/v2019.1/components/yocto/source/aarch64/layers/core/meta/conf/sanity.conf

# Sanity checks for common user misconfigurations
# See sanity.bbclass
# Expert users can confirm their sanity with "touch conf/sanity.conf"
BB_MIN_VERSION = "1.39.1"

SANITY_ABIFILE = "${TMPDIR}/abi_version"


#INHERIT += "sanity"

2.2. Build Kernel/Rootfs


3. Boot from QEMU

3.1. Debug

petalinux-boot --qemu --prebuilt 3


3.2. Run with self-compiled-QEMU

/root/Desktop/qemu_zynq_devices/qemu/aarch64-softmmu/qemu-system-aarch64 \
-M arm-generic-fdt-7series -machine linux=on -smp 2 -m 1G \
-serial /dev/null -serial mon:stdio -display none \
-kernel images/linux/uImage -dtb images/linux/system.dtb

Now we’ll add sdcard and try to boot Ubuntu Core OS.

qemu-img create qemu_sd.img 2G
-M arm-generic-fdt-7series -machine linux=on -smp 2 -m 1G \
-serial /dev/null -serial mon:stdio -display none \
-kernel images/linux/uImage -dtb images/linux/system.dtb


4. Co-Sim


5. Boot from Evaluation Board SDCard



[1] Build QEMU:

[2] Zynq UltraScale+ QEMU:

[3] CoSim:

[4] Xilinx Evaluation Board BSP files and Yocto local mirror:

Xilinx FPGA中应用P4网络数据面编程

0. Background

As we all know, P4 is about to be the future of OpenFlow 2.0, and to achieve an totally software defined network with programmable control plane and data plane.

1. Basic Knowledge

Since we’ve got P4 working on X86 server

In SDN controller ONOS.


2. Software/Hardware Plant

2.1. Pureway: P4 bitstream

2.2. Easyway: P4 on PetaLinux

3. Further Exploration



1. Background

Since the MicroBlaze provides the lockstep feature, so finally we can make a POC.

2. MicroBlaze FT Test

3. Server FT Test via MicroBlaze FT controller

4. QEMU with COLO

[1] Triple Modular Redundancy:

[2] Fault Tolerance Technique for Dynamically Reconfigurable Processor:

[3] Xilinx Reduces Risk and Increases Efficiency for IEC61508 and ISO26262 Certified Safety Applications:

[4] Spartan-6 FPGA Dual-Lockstep MicroBlaze Processor with Isolation Design Flow:

[5] MicroBlaze Processor Reference Guide:






0. 环境准备

0.1 硬件

HackRF One Ettus B200 Ettus B210 BladeRF x40 LimeSDR LimeSDR mini
Frequency Range 1MHz-6GHz 70MHz-6GHz 70MHz-6GHz 300MHz-3.8GHz 100kHz-3.8GHz 100kHz-3.5GHz
RF Bandwidth 20MHz 61.44MHz 61.44MHz 40MHz 61.44MHz 30.72MHz
Sample Depth 8 bits 12 bits 12 bits 12 bits 12 bits 12 bits
Sample Rate 20MSPS 61.44MSPS 61.44MSPS 40MSPS 3.2MSPS 61.44MSPS
Transmitter Channels 1 1 2 1 2 1
Receivers 1 1 2 1 2 1
Duplex Half Full Full Full Full Full
Interface USB 2.0 USB 3.0 USB 3.0 USB 3.0 USB 3.0 USB 3.0
Programmable Logic Gates 64 macrocell CPLD 75k 100k 40k (115k avail) 40k 40k
Chipset MAX5864, MAX2837, RFFC5072 AD9364 AD9361 LMS6002M LMS7002M LMS7002M
Open Source Full Schematic, Firmware Schematic, Firmware Schematic, Firmware Full Full
Oscillator Precision +/-20ppm +/-2ppm +/-2ppm +/-1ppm  +/-1ppm initial

+/-4ppm stable

 +/-1ppm initial

+/-4ppm stable

Transmit Power -10dBm+ (15dBm @ 2.4GHz) 10dBm+ 10dBm+ 6dBm  0 to 10dBm 0 to 10dBm
Price 249€ euros VAT Exc. 991€ euros VAT Exc. 1658€ euros VAT Exc. 625€ euros VAT Exc. 332€ euros VAT Exc. 190€ euros VAT Exc.

0.2 驱动

0.3 软件



1. 接收信号


$ port info gqrx

$ sudo port install gqrx


1.1. 听广播/看电视

1.2. 接收气象云图







1.3. 接收GPS信息

1.4. 方向探测与被动雷达 Direction Finding and Passive Rador

1.5. 接收whatever you want LEGALLY


2. 发送信号

2.1. 发送GPS信号

2.2. 发送文字/音视频


3. 收发信号






Ubuntu Desktop 16.04 & LimeSDR 1.4s with LimeSuite 17.12(If not, OpenUSRP will fail.)

Install build-essential packages

#packages for soapysdr available at myriadrf PPA
sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update

#install core library and build dependencies
sudo apt-get install -y git g++ cmake libsqlite3-dev

#install hardware support dependencies
sudo apt-get install -y libsoapysdr-dev libi2c-dev libusb-1.0-0-dev

#install graphics dependencies
sudo apt-get install -y libwxgtk3.0-dev freeglut3-dev

# Install for building uhd
sudo apt-get install libboost-all-dev libusb-1.0-0-dev python-mako doxygen python-docutils cmake build-essential


Change to UHD driver via uhd

$ cd ~                 # build and install limesuite
$ git clone
$ cd LimeSuite
$ mkdir builddir && cd builddir
$ cmake ../
$ make -j4
$ sudo make install
$ sudo ldconfig

$ cd ~ # build uhd, install, enable lime, rebuild
$ git clone
$ cd uhd/host/
$ mkdir build && cd build
$ cmake ../
$ make -j4
$ sudo make install
$ git clone lib/ursp/OpenUSRP # DO NOT GO OUT
$ echo "INCLUDE_SUBDIRECTORY(OpenUSRP)">>lib/ursp/CMakeLists.txt
$ cmake ../
$ make -j4
$ sudo make install


Or, Change to UHD driver via SoapySDR

$ git clone
$ cd SoapySDR
$ mkdir builddir;cd builddir; cmake ../
$ make -j4
$ sudo make install

$ git clone
$ cd LimeSuite

Build OpenBTS

4. SDR



$ port info gnuradio
$ sudo port install gnuradio+wxgui gr-osmosdr sox
$ port content gnuradio
$ sudo port install hackrf
$ sudo port install rtl-sdr
$ sudo port search gr- # if you wanna more modules in gnuradio, don't be shy

然后打开XQuartz,将/opt/local/bin/gnuradio-companion加入到X自定义应用程序菜单中(建议修改默认的X终端程序内容为xterm -e “source ~/.bash_profile;/bin/bash”)。

使用Xilinx/Intel FPGA加速虚拟化

UPDATE: 老王的笔记中也总结了一些关于devconf的内容。

This article is just a collection of ideas and posts.

Recently I was doing some performance-tunning of QEMU/KVM with kinds of pure-software ways. However, it ended with the existence of QEMU/KVM’s process load.

I just remembered that I used to do some co-sim work with National Instruments LabView about ten years ago…(during college life…fk…I’m still young…)

Trial No.1

TBD: Start QEMU instance(s) with passthrough-ed PCI(PCI-SRIOV) devices like ethernet controller or NVMe controller designed in PCI FPGA to offload the emulated works.

Trial No.2

TBD: Start QEMU instance with devices ported to passthrough-ed PCI FPGA as many as possible, i.e. usb controller, ethernet controller and etc..(Like a dock with kinds of devices…)

But I think it will be replaced by Trial No.1.

Trial No.3

TBD: Co-Sim.

Trial No.4

SoC FPGA, as DOM0.

Trial No.5

ASIC offload with slight host management.


[1] Running Xilinx in QEMU,

[2] Building Xen Hypervisor with Petalinux 2019.1,

[3] QEMU SystemC and TLM CoSimulation,

向NVIDIA Jetson Nano中移植QEMU-KVM



什么build rootfs、uboot之类的就不要了,那是后期嵌入式的活,我们在现有环境上build kernel即可。

1. 准备环境




2. 准备kernel

sudo su
sudo apt install nfs-kernel-server
sudo echo "/home/lofyer/Downloads *(rw,no_root_squash,no_subtree_check)" >> /etc/exports
sudo exportfs -avf

Jetson Nano:
sudo su
apt instlal libncurses-dev
mount root@ /mnt
cd /mnt/
cp /proc/config.gz .
gunzip config.gz
mv config .config
make menuconfig # find and enable kvm, tegra hypervisor
make -j4; make -j4 modules_install
make -j4 Image
cp arch/arm64/boot/Image /boot/Image-kvm


# vi /boot/extlinux/extlinux.conf

DEFAULT secondary

MENU TITLE p3450-porg eMMC boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait

LABEL secondary
      MENU LABEL kernel with kvm
      LINUX /boot/Image-kvm
      INITRD /boot/initrd
      APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait

3. 尝试qemu-kvm


apt install qemu-kvm
kvm --help


git clone
cd qemu
./configure --enable-kvm
make -j4


4. 看看FT


Build a robot assistant with nowadays cloud apis


现在随着AI以及计算技术的成熟,尤其Google Assistant已经可以跟人自然语音对话了,所以觉得可以再尝试一下,加之工作需要,所以便又再开启。

现在随着AI以及计算技术的成熟,尤其Google Assistant已经可以跟人自然语音对话了,所以觉得可以再尝试一下,加之工作需要,所以便又再开启。

当然,这里我们首先选取交互平台为微信(Web API),交互形式为语音、文字等不限形式。然后再来看看哪些平台提供的最好用且最像人。

1. Google Assistant

2. 小爱同学(小米)/天猫精灵

3. 图灵/XiaoI

4. 自建



docker using linux bridge

A. Change docker bridge
dockerd -H unix:// -b br_eth0 –fixed-cidr= –default-gateway

B. Create manually, but flexibly
Recreate veth pair if your docker instance was restarted or exited.

[root@172-20-17-247 ~]# docker run –network none -it tianon/network-toolbox /bin/bash
[root@172-20-17-247 ~]# docker inspect –format ‘{{.State.Pid}}’ 3
[root@172-20-17-247 ~]# ip link add centos3-cont type veth peer name centos3-host
[root@172-20-17-247 ~]# brctl addif br_eth0 centos3-host
[root@172-20-17-247 ~]# ifconfig centos3-host up
[root@172-20-17-247 ~]# ip link set netns 74406 dev centos3-cont
[root@172-20-17-247 ~]# nsenter -t 74406 -n ip link set centos3-cont up
[root@172-20-17-247 ~]# nsenter -t 74406 -n ip addr add dev centos3-cont
[root@172-20-17-247 ~]# nsenter -t 74406 -n ip route add default via

[root@172-20-17-247 ~]# docker exec -it 3 bash
root@39eb1da6e842:/# ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=55 time=87.434 ms
^C— ping statistics —
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 87.434/87.434/87.434/0.000 ms

C. With pipework script
[root@172-20-17-247 ~]# pipework br_eth0 -i eth2 CONTAINERID
[root@172-20-17-247 ~]# pipework route CONTAINERID replace default via




Duplicati则是较为轻量级的选择,只要安装agent即可,支持备份目标地址较为丰富,除了传统接口外也支持AWS S3接口;