Skip to content

Building from source

z4ziggy edited this page Jun 4, 2020 · 17 revisions

Required:


For Arch Linux : Install the package gcc-arm-none-eabi-bin from the AUR.

Then, install the other requirements if needed:

sudo pacman -S dfu-util
sudo pacman -S cmake
sudo pacman -S git
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2.7 get-pip.py

sudo pip install pyyaml


For Ubuntu x86 or x86_64:

This process is for cross compiling on an x86 platform and does not work on an Arm platform such as raspberry pi.

NOTE: The PPA version of gcc-arm-embedded is no longer supported or available on Launchpad. The project has been migrated to Arm's website. The PPA install section has been replaced with the manual install version below.

It is necessary to use the latest version of GCC-ARM (version 6.3.1 20170620 and version 9 2019q4 are known to work).

To install the arm.com version:

cd /opt
sudo wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
  • Unpack the tarball to the same directory
sudo tar xjf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
  • Do one of the following: Temporarily add compiler to path, Permanently add compiler to path, or edit the porta-pack toolchain-arm-cortex-m.cmake file

Temporarily add compiler to path (needs to be done every time you open a new terminal)

export PATH=$PATH:/opt/gcc-arm-none-eabi-9-2019-q4-major/bin

Permanently add compiler to path (only need to do once but may make path variable too long or slow down the system a little)

sudo nano /etc/environment

...
PATH="{existing path string}:/opt/gcc-arm-none-eabi-9-2019-q4-major/bin"
...

Edit the {porta-pack_source_folder}/firmware/toolchain-arm-cortex-m.cmake file (needs to be done each time you download the portapack source). You must wait to run this command until after you clone the git repository later in the install steps.

sed -i -e 's:arm-none-eabi-g:/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g:g' firmware/toolchain-arm-cortex-m.cmake

Replace "arm-none-eabi-gcc" in the CMAKE_FORCE_C_COMPILER and CMAKE_C_COMPILER lines by the full path to the up-to-date version of gcc installed in the previous step. Do the same for "arm-none-eabi-g++" in the CMAKE_FORCE_CXX_COMPILER and CMAKE_CXX_COMPILER lines.

The beginning of the file should look like this:

if(CMAKE_VERSION VERSION_LESS 3.6)
  include(CMakeForceCompiler)
  CMAKE_FORCE_C_COMPILER(/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc GNU)
  CMAKE_FORCE_CXX_COMPILER(/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++ GNU)
else()
  set(CMAKE_C_COMPILER /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc)
  set(CMAKE_CXX_COMPILER /opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g++)
  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif()
  • Then, install the other requirements if needed:
sudo apt install python
sudo apt install python2.7
sudo apt install dfu-util
sudo apt install cmake
sudo apt install git
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2.7 get-pip.py

sudo pip install pyyaml
sudo pip install image  (for building world map with adsb_map.py later)






NOTE: the command 'python' should point to python2.7. You can check with

python --version

Clone the repository and let gcc do the work:

git clone https://github.com/z4ziggy/portapack-havoc.git
cd portapack-havoc
git submodule update --init --recursive

If you didn't add gcc-arm-embedded compiler to the path (outlined above), then edit toolchain-arm-cortex-m.cmake file now to use the complete path to the compiler.

sed -i -e 's:arm-none-eabi-g:/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-g:g' firmware/toolchain-arm-cortex-m.cmake
mkdir build
cd build
cmake ..
make firmware

Give it some time and you should end up with a fresh /firmware/portapack-h1-havoc.bin file. You can now flash it.