-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_embedded_ctf_tools.sh
More file actions
53 lines (38 loc) · 1.13 KB
/
install_embedded_ctf_tools.sh
File metadata and controls
53 lines (38 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
## Tested on Ubuntu 18.04 LTS
install_qemu_arm() {
## Tested on Debian stretch
## Reference: https://gist.github.com/Liryna/10710751
sudo apt-get install qemu binfmt-support qemu-system-arm qemu-user-static -y
sudo apt-get install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross -y
cat > hello.c << EOF
#include <stdio.h>
int main(void) { return printf("Hello ARM!\n"); }
EOF
# Compile code with arm toolchain
arm-linux-gnueabihf-gcc -static -o hello hello.c
# Check file type of binary
file hello
# Test ARM binary
./hello
}
install_qemu_mips() {
sudo apt install qemu-system-mipsel qemu-system-mips -y
sudo apt install gcc-mipsel-linux-gnu gcc-mips-linux-gnu -y
cat > hello.c << EOF
#include <stdio.h>
int main(void) { return printf("Hello MIPS!\n"); }
EOF
# Cross compile code with mips toolchain
mips-linux-gnu-gcc -static -o hello hello.c
# Check file type of binary
file hello
# Test MIPS binary
./hello
}
install_embedded_ctf_tools() {
sudo apt install gdb-multiarch
install_qemu_arm
install_qemu_mips
}
install_embedded_ctf_tools