How to Setup Development Environment at Home
1. Virtualize if not on Linux (Ubuntu 22.04)
The course work assumes you are using Ubuntu Linux operating system. If you are running another operating system, you have the following options for virtualization.
- Winduws Subsystem for Linux (WSL) a lightwight Linux virtualization well integrated with Windows (recommended for Windows users)
- Docker
- Virtual Machine (e.g. VM Player)
- Dual Boot
- Don’t virtualize, just use COE Linux Environment
macOS: While macOS is based on freeBSD it is only similar to the Linux OS. The differences between macOS and Linux make installing the toolchain much harder. Trying it is an opportunity to spend countless hours in learning about the macOS/Linux differences. More efficient (for the purpose of this class) is to run Linux inside docker or a virtual machine.
1.1. Windows Subystem for Linux (WSL)
- Install Ubuntu 22.04 LTS in Windows Subsystem for Linux (WSL) (detailed instructions) by entering the following command on Windows Command Line with Administrator Rights enter:
wsl --install -d Ubuntu-22.04
- Start a new WSL terminal by clicking on Windows Start -> Ubuntu 22.04
- After logging into WSL for the first time, follow the instructions for generic Linux below.
Note to benefit from the speed advantage of WSL 2, use your /home/
Windows applications can be started from the WSL side as well (and will open on Windows). Applications that take file arguments as input magically can even open files that are stored within WSL (/home/…).
Should you need a graphical output from WSL applications please check the WSLDisplay Instructions.
2. Installing Development Tools on Linux
-
Install base development tools and git:
sudo apt install build-essential gdb-multiarch git libyaml-dev
- The tools for cross compilation and simulation environment are packaged as an SDK. Download the SDK installer binary. Install the SDK by executing the downloaded file. Accept the default installation path or enter a new one (but avoid spaces in the path). For the next steps we’ll assume it is installed under
~/eece4534sdk
.SDK_INST=esl-glibc-x86_64-esl-eece4534-image-cortexa9t2hf-neon-zedboard-esl-v3-toolchain-2023.1.sh wget --no-check-certificate https://www1.coe.neu.edu/~esl/EECE4534/$SDK_INST bash ./$SDK_INST -d ~/eece4534sdk
The SDK refernced above is for
x86_64
architecture. For running on anaarch64
system, such as an ARM-based MAC (with Ubuntu 22.04 VM), or RPI4/5 (with Debian, i.e. RaspberryPiOS), replacex86_64
withaarch64
in the SDK filename assigned to SDK_INST. -
In order to use the SDK, the build environment needs to be activated each time a new shell is started. Note however, that the SDK since it is self-contained comes with an own set of many system binaries which it puts in the front of the PATH (so that they are found first). Hence, when the SDK is activated, you may see differend binary versions than your original Linux. Depending on your usage, do one of the following:
To simplify activating the SDK environment, create alias (thanks to Connor, Spring 22). Update
~/.bashrc
:echo "alias setup-xarm='source ~/eece4534sdk/environment-setup-cortexa9t2hf-neon-esl-linux-gnueabi && PS1=\"(xarm) \$PS1\"'" >> ~/.bashrc
Then, in any new terminal you can activate the SDK by:
setup-xarm
Download ZedBoard root image for QEMU to execute.
wget --no-check-certificate -P $OECORE_TARGET_SYSROOT https://www1.coe.neu.edu/~esl/EECE4534/esl-image-zedboard-esl.wic
- For kernel module compilation (only needed starting from lab 3): Activate the SDK environment and prebuild the necessary libraries for module compilation:
setup-xarm cd $OECORE_TARGET_SYSROOT/lib/modules/5.10.0-esl/build/ make scripts && make prepare
The compilation will show some warnings in the end. The warnings below are normal and can be ignored 1.
scripts/Makefile.build:414: warning: overriding recipe for target 'modules.order' Makefile:1405: warning: ignoring old recipe for target 'modules.order'
-
Later when using the ZedBoard simulator (QEMU), the simulated guest ssh server is reachable (through port forwaring on the host) on localhost port 10022. You could login through
ssh root@localhost -p 10022
. For easier access, use the following commands to add a profile into your local SSH client configuration:printf "\nHost qemu\n\tHostName localhost\n\tUser root\n\tPort 10022" >> ~/.ssh/config
With this setting connecting to the simulator becomes simpler (once ARM Linux on QEMU is booted ARMXCompSim):
ssh qemu
To uninstall the SDK, just remove the SDK folder with rm -rf <SDK folder>
, remove any modifications in ~/.bashrc
, remove non-needed packages.
-
Avoiding those warnings requires debugging the Linux kernel build system which is out of scope for our class. ↩