The original goal is to build an ARM coprocessor in an x86 architecture to speed up the performance on data processing.
Our goal is to first simulate the result on emulators such as QEMU, then try out on real hardware.
I am using Arch Linux, so the installation is simple:
$ sudo pacman -S qemu qemu-arch-extra libvirt
Then download kernel image and disk image from Linaro.
Following the instructions on the web page, start the emulator:
$ qemu-system-aarch64 -m 1024 -cpu cortex-a57 -nographic -machine virt \
-kernel Image -append 'root=/dev/vda2 rw rootwait mem=1024M console=ttyAMA0,38400n8' \
-netdev user,id=user0 -device virtio-net-device,netdev=user0 -device virtio-blk-device,drive=disk \
-drive if=none,id=disk,file=vexpress64-openembedded_lamp-armv8-gcc-5.2_20170127-761.img
You can change increase the memory by modifying -m
option and kernel parameters.
Once the VM is up and running, you can access host at 10.0.2.2.
Download the source code of iperf3 and compile it:
$ ./configure
$ make
$ make install
You also need to install it on your host. First start server on host:
$ iperf3 -s
Then test the bandwidth:
$ iperf3 -c 10.0.2.2
Our result the bandwidth is around 150 Mbps.
We use GNU/Linux's socket to do the file transferring. Details see src/server.c
and src/client.c
.
The transfer speed is around 110 Mbps.
The original disk image only has ~400 MB free space left. So the first step is to resize the disk image:
$ qemu-img resize vexpress64-openembedded_lamp-armv8-gcc-5.2_20170127-761.img +10G
This will add 10 GB free space to the disk.
We have to format the new disk space and then mount it:
# fdisk /dev/vda # Make a new partition as /dev/vda3
# mkfs.ext4 /dev/vda3
# mkdir /mnt/extra
# mount /dev/vda3 /mnt/extra
Add the following line to /etc/fstab
:
/dev/vda3 /mnt/extra ext4 defaults 0 2
Reboot the system and the partition will be automatically mounted.
Building libjpeg-turbo requires CMake, so we install CMake first. Download the source code and execute the following command:
$ ./bootstrap
$ make
$ sudo make install
Next, download the source code of libjpeg-turbo then execute:
$ mkdir build && cd build
$ cmake -G"Unix Makefiles" ..
$ make
$ sudo make install