📖BuildRoot交叉编译ARM平台GCC
2021-3-9
| 2024-7-6
字数 217阅读时长≈ 1 分钟
使用buildroot可以在Linux系统上编译出其他平台的GCC,而GCC编译出的可执行文件能够在对应平台上执行。
本文是在ubuntu18.04成功的,按道理其他版本应该没问题

目标平台

Netgear R7000v1/R8000

查看平台信息

cat /proc/cpuinfo
也可以file或者readelf查看路由器固件解包出的可执行文件,例如wget,busybox
uname -a
notion image
notion image

安装依赖

sudo apt-get install vim make gcc build-essential bison flex libncurses5-dev

装buildroot

tar -zxf buildroot-2021.02.tar.gz

设置编译选项

注:配置编译选项 窗口不要太小,不然会报错
注:每次修改完要先save再exit
cd buildroot-2021.02
sudo make menuconfig
notion image
notion image
Target options选择
notion image
notion image
toolchain选择
notion image
notion image

开始编译

make
最后得到
notion image
notion image

GCC编译

./arm-buildroot-linux-uclibcgnueabi-gcc /home/test/Desktop/ttt.c -static -o /home/test/Desktop/ttt
  • static 静态编译
notion image
notion image

问题解决

问:出现问题如何重新编译?
答:make clean
  • 瞎折腾
  • Netgear路由器救砖记录Docker Remote API 未授权访问漏洞复现
    Loading...