Last active
May 9, 2021 08:48
-
-
Save marcopiovanello/74759dd848d71d33ab23c5f94a6bc05b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Questo script installa una toolchain per sviluppo su ARM | |
# crosscompiler linux-arm-gnueabi-gcc | |
# debugger linux-arm-gnueabi-gdb | |
# gdbgui per linux-arm-gnueabi-gdb | |
# in futuro configurazioni per Vagrant con vm ubuntu 21.04 e provider virtualbox | |
# testato su Ubuntu 20.04 e 21.04 | |
# compatibile con l'installazione WSL di Ubuntu 20.04 (funziona anche con debian ma la sconsiglio) | |
# sotto WSL è completamente integrabile con VSCode | |
# se in WSL si blocca gdb, gdbgui o qemu-arm è sufficiente chiudere l'istanza di WSL e terminare i processi dal task manager | |
# Screenshot https://i.ibb.co/QYVZzjw/Immagine-2021-05-04-134037.png | |
sudo apt update | |
sudo apt install python3 python3-pip ipython3 python3-venv gcc-arm-linux-gnueabi qemu-user build-essential make autoconf texinfo wget | |
pip3 install gdbgui==0.13.2.1 | |
pip3 install pygdbmi==0.9.0.3 | |
pip3 install greenlet==0.4.16 | |
pip3 install Flask-SocketIO==4.3.1 python-engineio==3.13.2 python-socketio==4.6.0 | |
cd $HOME | |
echo "alias arm-gcc=arm-linux-gnueabi-gcc" >> .bashrc | |
sudo touch /usr/local/bin/arm-gdbgui | |
echo '#!/bin/bash | |
ARM_EXEC=$(realpath $1) | |
if ! test -f "$ARM_EXEC"; then | |
echo "Il file $ARM_EXEC non esiste!" | |
exit 1 | |
fi | |
echo "target remote localhost:1234 | |
file quotes$(printf %q "$ARM_EXEC")quotes | |
break main | |
continue" > ~/.gdbinit | |
qemu-arm -g 1234 -L /usr/arm-linux-gnueabi "$ARM_EXEC" & | |
~/.local/bin/gdbgui -g arm-linux-gnueabi-gdb "$ARM_EXEC"' | sudo tee /usr/local/bin/arm-gdbgui | |
sudo sed "s/quotes/'/g" /usr/local/bin/arm-gdbgui | sudo tee /usr/local/bin/arm-gdbgui | |
sudo chmod +x /usr/local/bin/arm-gdbgui | |
wget http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz | |
tar -zvxf gdb-10.2.tar.gz | |
cd gdb-10.2 | |
./configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=arm-linux-gnueabi | |
make -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}') | |
sudo make install | |
echo "" | |
echo "finito!" | |
echo "ora puoi disconnetterti e rifare il login per aggiornare gli alias" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment