mirror of
				https://github.com/portapack-mayhem/mayhem-firmware.git
				synced 2025-10-30 22:50:28 +00:00 
			
		
		
		
	Add Kali Linux compiling how-to
| @@ -221,4 +221,71 @@ If you want to have all these commands in one go, go to https://github.com/GullC | ||||
| # Other Toolsets | ||||
| - [Linux Aarch64 gcc-arm-none-eabi-9-2020-q2-update-aarch64-linux.tar.bz2](https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-aarch64-linux.tar.bz2?revision=7166404a-b4f5-4598-ac75-e5f8b90abb09&rev=7166404ab4f54598ac75e5f8b90abb09&hash=07EE5CACCCE77E97A1A8C049179D77EACA5AD4E5) | ||||
| - [Toolsets archive](https://developer.arm.com/downloads/-/gnu-rm) | ||||
| - [Compilation error after changing toolsets](https://github.com/portapack-mayhem/mayhem-firmware/issues/420) | ||||
| - [Compilation error after changing toolsets](https://github.com/portapack-mayhem/mayhem-firmware/issues/420) | ||||
|  | ||||
|  | ||||
| # Compiling Mayhem Firmware on Kali Linux | ||||
| Tested at 21. Sept. 2024 on Kali 2024.3 kali-rolling | ||||
| Should work for any Debian based Distribution, see comments. | ||||
|  | ||||
| ## Download and install dependencies | ||||
| ``` | ||||
| sudo apt update | ||||
| sudo apt install git tar bzip2 lz4 wget curl cmake python3 python3-setuptools python3-distutils-extra python3-yaml dfu-util hackrf | ||||
| ``` | ||||
|  | ||||
| In many distributions the tool `hackrf` is provided, but outdated because of the release policy. Kali is rolling release, so does not follow this restrictions. | ||||
| If you have a R9 or newer HackRF and need a newer version, I recommended to download and compile it by yourself. Source: https://github.com/greatscottgadgets/hackrf | ||||
|  | ||||
| ## Download and install the ARM toolchain | ||||
| If you use another Version as 9.2.1, the mayham cmake warns you: | ||||
| > WARNING: Compiler version mismatch, please use the official compiler version 9.2.1 when sharing builds! Current compiler version: 13.2.1 | ||||
|  | ||||
| It might compile. From other projects, as Proxmark3 or Chameleon Ultra, we know the gcc-arm-none-eabi in version 13 (provided by various distributions) creates a bigger firmware image, which won't fit into the memory. Even if it compiles without error, the firmware file is useless. | ||||
|  | ||||
| ``` | ||||
| sudo mkdir /opt/build | ||||
| sudo chmod $USER:$(id -gn $USER) /opt/build | ||||
| cd /opt/build | ||||
| wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 | ||||
| mkdir armbin | ||||
| tar --strip=1 -xjvf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 -C armbin | ||||
| ``` | ||||
|  | ||||
| I recommend to adjust the user rights at the first possible moment. Work as root as less as possible. | ||||
| If more than one person works in the system, feel free to set the group to something more generic. For example `src` or `staff`. | ||||
|  | ||||
| Source for the newest toolcain: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads | ||||
| Source for deprecated toolchain: https://developer.arm.com/downloads/-/gnu-rm | ||||
|  | ||||
|  | ||||
| ### Set toolchain as default | ||||
| ``` | ||||
| echo 'PATH=/opt/build/armbin/bin:/opt/build/armbin/lib:$PATH' >> ~/.zshrc | ||||
| source ~/.zshrc | ||||
| ``` | ||||
|  | ||||
| Kali Linux uses [ZSH](https://en.wikipedia.org/wiki/Z_shell) as default shell. On [Debian](https://wiki.debian.org/Shell) is Bash the default shell, so if you are using Debian or changed the default shell, you need to pipe the echo into ~/.bashrc (or the related [rc file](https://en.wikipedia.org/wiki/Configuration_file)) | ||||
|  | ||||
| ## Get the Firmware from Github | ||||
| ``` | ||||
| cd ~ | ||||
| mkdir git | ||||
| cd git | ||||
| git clone https://github.com/portapack-mayhem/mayhem-firmware/ --recurse-submodules | ||||
| ``` | ||||
|  | ||||
| Personal Note: | ||||
| > You could work at any place, for example `/opt`. The [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) says `/usr/src` wold be the right place for source codes. But this would be in `/` and most systems I know got roundabout 20 to 50 GB for `/` and several 100 GB for `/home`, so I decide to work with git in /home. | ||||
|  | ||||
|  | ||||
| ## Build the firmware | ||||
| ``` | ||||
| cd ~/git/mayhem-firmware | ||||
| mkdir build | ||||
| cd build | ||||
| cmake .. | ||||
| make clean && make | ||||
| ``` | ||||
|  | ||||
| For the first compile `make clean &&` is not necessary. But if the compilation stops of any reason, you need to use clean. If nothing is there, it won't hurt. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Benjamin Møller
					Benjamin Møller