-
-
Notifications
You must be signed in to change notification settings - Fork 238
Rebuilding system emulator environment
TODO - see all the repos here https://github.com/EMBA-support-repos/
This documentation is work in progress! Currently it is not recommend to trust the information :)
The following documentation describes the process of building the binaries and kernels used by the system-emulation environment from EMBA.
In order to build any of the binaries used by EMBA, you will need different cross-compilation toolchains. To simplify the process of building these toolchains, we recommend using musl-cross-make project.
There are multiple TARGET configurations possible. The following definitions are some of the used definitions for building the toolchains used by EMBA:
TARGET = i486-linux-musl
TARGET = x86_64-linux-musl
TARGET = arm-linux-musleabi
TARGET = arm-linux-musleabihf
TARGET = mips64-linux-musln32
TARGET = mips64-linux-musl
TARGET = mips64el-linux-musl
TARGET = powerpc-linux-musl
TARGET = powerpc64-linux-musl
TARGET = mips-linux-musl
TARGET = mipsel-linux-musl
I recommend using the mips or mipsel TARGET definition as a starting point.
Another quite important setting is the version of the gcc that should be build. In our case we set this to version 6.5.0
:
GCC_VER = 6.5.0
Finally, we set the OUTPUT definition to a useful directory where we would store the toolchains:
OUTPUT = /opt/cross
Now it should be possible to start building the toolchain with make
. After finishing it a sudo make install
installs the toolchain to the TARGET directory.
https://busybox.net/downloads/busybox-1.29.3.tar.bz2
Currently we are using nearly the original FirmAE kernel. The EMBA fork of it can be found here.
git clone https://github.com/EMBA-support-repos/FirmAE_kernel-v4.1.git
cd FirmAE_kernel-v4.1/
Since MIPS systems can be either big-endian or little-endian, this kernel should be compiled for both endianness. The below instructions produce a little-endian (mipsel) kernel, but should be repeated for a big-endian (mipseb) kernel.
Create the kernel build output directory:
mkdir -p build/mipsel
Copy the configuration file into the build directory:
cp config.mipsel build/mipsel/.config
Assuming that the appropriate cross-compiler is installed in /opt/cross/mipsel-linux-musl
, execute:
make ARCH=mips CROSS_COMPILE=/opt/cross/mipsel-linux-musl/bin/mipsel-linux-musl- O=./build/mipsel -j8
The output kernel image will be generated at the following location:
build/mipsel/vmlinux
Create the kernel build output directory:
mkdir -p build/mipseb
Copy the configuration file into the build directory:
cp config.mipseb build/mipseb/.config
Assuming that the appropriate cross-compiler is installed in /opt/cross/mipseb-linux-musl
, execute:
make ARCH=mips CROSS_COMPILE=/opt/cross/mipseb-linux-musl/bin/mipseb-linux-musl- O=./build/mipseb -j8
The output kernel image will be generated at the following location:
build/mipseb/vmlinux
sf and hf
This documentation is based on the original documentation of the FirmAE and the firmadyne project!
EMBA - firmware security scanning at its best
Sponsor EMBA and EMBArk:
The EMBA environment is free and open source!
We put a lot of time and energy into these tools and related research to make this happen. It's now possible for you to contribute as a sponsor!
If you like EMBA you have the chance to support future development by becoming a Sponsor
Thank You ❤️ Get a Sponsor
You can also buy us some beer here ❤️ Buy me a coffee
To show your love for EMBA with nice shirts or other merch you can check our Spreadshop
EMBA - firmware security scanning at its best