Cross Compiling DPDK for ARM64

First: why you would want to do this in the first place. Maybe your boss told you to or maybe you just enjoy making life harder for yourself than it needs to be. Either way, here we are!
So what exactly is cross compiling? It’s when you compile code on one machine (your laptop) and then run that compiled code on a different machine (the ARM64 server). This can come in handy if your target platform doesn’t have the resources to do the compilation itself, or if you want to avoid having to install all of those ***** dependencies.
Now DPDK. It stands for Data Plane Development Kit and it’s a set of libraries that help accelerate network packet processing on bare-metal servers. This can be really useful in data centers or other high-performance environments where you need to process large amounts of traffic quickly and efficiently.
So how do we cross compile DPDK for ARM64? Well, first things first: make sure your laptop has all the necessary tools installed. You’ll need a compiler (gcc), some build tools (make), and a few other goodies like ccache and pkg-config. If you don’t have these already, go ahead and install them now.
Next, download the DPDK source code from their website: https://dpdk.org/downloads/. Make sure to get the version that matches your target platform (in this case, ARM64). Once it’s finished downloading, extract the tarball and navigate into the directory.
Now comes the fun part! Let’s start compiling. First, we need to configure our build environment:

# Set the target platform to x86_64-none-linux-gnueabihf
# and specify the availability of the ARM Ethernet library
# while excluding other libraries that are not needed for this build
$ ./configure --target=x86_64-none-linux-gnueabihf --with-librte-eal-avail=rte_eth_arm --without-librte_mempool --without-librte_mbuf --without-librte_ring --without-librte_hash --without-librte_ip4 --without-librte_ipv6 --without-librte_tcp --without-librte_udp --without-librte_sck --without-librte_mbuf_ext --without-librte_ring_ext --without-librte_mempool_ext --without-librte_hash_ext --without-librte_ip4_ext --without-librte_ipv6_ext --without-librte_tcp_ext --without-librte_udp_ext --without-librte_sck_ext

This may look intimidating at first, but it’s just telling DPDK to compile for ARM64 and exclude some of the optional features that we don’t need. If you want to include any of these features later on, simply remove the `–without-librte_` flags from this command.
Once configure is finished running (which can take a while), it will generate a bunch of makefiles and other build artifacts that we can use to compile our code. Now let’s actually do some compiling:

bash
# This line runs the make command with the -j flag, which specifies the number of jobs to run simultaneously. 
# The $(nproc) command returns the number of processing units available, allowing for efficient use of resources.
make -j$(nproc)

# This line ensures that the script is executed using the bash shell.
#!/bin/bash

This tells DPDK to run `make` with the number of CPU cores on your laptop, which should help speed up the compilation process (assuming you have more than one core). If not, just replace `$(nproc)` with a specific value.
After this finishes running, we’ll end up with a bunch of compiled libraries and binaries in our build directory. Now let’s copy them over to our target platform:

# This script is used to copy compiled libraries and binaries from a build directory to a target platform.
# The script uses the `scp` command to securely transfer files over SSH.

# The `-r` flag is used to recursively copy the entire build directory and its contents.
# The `<build_directory>` is the source directory containing the compiled files.
# The `user` is the username of the target platform.
# The `<target_ip>` is the IP address of the target platform.
# The `~/dpdk-crosscompiled` is the destination directory on the target platform.
scp -r <build_directory> user@<target_ip>:~/dpdk-crosscompiled

This will transfer all the files from your local `build_directory` to a directory called `dpdk-crosscompiled` on your target server. Make sure you replace `user`, ``, and `` with appropriate values for your environment.
And that’s it! You should now have DPDK compiled and ready to go on your ARM64 server. Just copy over the necessary files, set up your network interfaces, and you’re good to go.

SICORPS