设置 | 登录 | 注册

作者共发了1篇帖子。

交叉编译bluez蓝牙协议栈(安装到板子上的/usr/local目录)

1楼 巨大八爪鱼 2025-6-24 19:58

交叉编译器:arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-linux-gnueabihf

export PATH=$PATH:/home/oct1158/Downloads/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-linux-gnueabihf/bin


【交叉编译libffi-3.5.1】

wget https://github.com/libffi/libffi/releases/download/v3.5.1/libffi-3.5.1.tar.gz

tar xf libffi-3.5.1.tar.gz

cd libffi-3.5.1

./configure --host=arm-none-linux-gnueabihf

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf libffi-3.5.1-binary.tar.gz usr

cd ../..


【交叉编译zlib-1.3.1】

wget https://www.zlib.net/zlib-1.3.1.tar.gz

tar xf zlib-1.3.1.tar.gz

cd zlib-1.3.1

CC=arm-none-linux-gnueabihf-gcc AR=arm-none-linux-gnueabihf-ar LD=arm-none-linux-gnueabihf-ld ./configure

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf zlib-1.3.1-binary.tar.gz usr

cd ../..


【交叉编译glib-2.57.1】

glib-2.57.1是最后一个压缩包里面有configure脚本的版本。

glib-2.59.0是最后一个压缩包里面有configure.ac文件的版本。

从glib-2.59.1版本开始就只支持meson了,不再支持configure了。

wget https://download.gnome.org/sources/glib/2.57/glib-2.57.1.tar.xz

tar xf glib-2.57.1.tar.xz

cd glib-2.57.1

echo glib_cv_stack_grows=no > arm-linux.cache

echo glib_cv_uscore=no >> arm-linux.cache

./configure --host=arm-none-linux-gnueabihf --cache-file=arm-linux.cache --disable-libelf --disable-libmount --with-pcre=internal LIBFFI_CFLAGS=-I$(pwd)/../libffi-3.5.1/_install/usr/local/include LIBFFI_LIBS="-L$(pwd)/../libffi-3.5.1/_install/usr/local/lib -lffi" CFLAGS=-I$(pwd)/../zlib-1.3.1/_install/usr/local/include LDFLAGS=-L$(pwd)/../zlib-1.3.1/_install/usr/local/lib

make

make install DESTDIR=$(pwd)/_install


ModuleNotFoundError: No module named 'imp'解决方案:

修改py-compile文件,第119行和第140行的import sys, os, py_compile, imp,imp改成importlib,并在下一行赋值imp=importlib。


cd _install

sudo chown -R root:root usr

tar czf glib-2.57.1-binary.tar.gz usr

cd ../..


【交叉编译expat-2.7.1】

wget https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.gz

tar xf expat-2.7.1.tar.gz

cd expat-2.7.1

./configure --host=arm-none-linux-gnueabihf

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf expat-2.7.1-binary.tar.gz usr

cd ../..


【交叉编译dbus-1.15.6】

dbus-1.15.6是最后一个压缩包里面有configure脚本的版本。

dbus-1.15.10是最后一个压缩包里面有configure.ac文件的版本。

从dbus-1.15.12版本开始就只支持meson了,不再支持configure了。

wget https://dbus.freedesktop.org/releases/dbus/dbus-1.15.6.tar.xz

tar xf dbus-1.15.6.tar.xz

cd dbus-1.15.6

./configure --host=arm-none-linux-gnueabihf EXPAT_CFLAGS=-I$(pwd)/../expat-2.7.1/_install/usr/local/include EXPAT_LIBS="-L$(pwd)/../expat-2.7.1/_install/usr/local/lib -lexpat"

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf dbus-1.15.6-binary.tar.gz usr

cd ../..


【交叉编译libical-3.0.20】

wget https://github.com/libical/libical/releases/download/v3.0.20/libical-3.0.20.tar.gz

tar xf libical-3.0.20.tar.gz

cd libical-3.0.20

CC=arm-none-linux-gnueabihf-gcc CXX=arm-none-linux-gnueabihf-g++ cmake . -DICAL_GLIB=False

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf libical-3.0.20-binary.tar.gz usr

cd ../..


【交叉编译readline-8.2.13】

wget https://ftp.gnu.org/gnu/readline/readline-8.2.13.tar.gz

tar xf readline-8.2.13.tar.gz

cd readline-8.2.13

./configure --host=arm-none-linux-gnueabihf

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf readline-8.2.13-binary.tar.gz usr

cd ../..


【交叉编译ncurses-6.5】

wget https://ftp.gnu.org/gnu/ncurses/ncurses-6.5.tar.gz

tar xf ncurses-6.5.tar.gz

cd ncurses-6.5

./configure --host=arm-none-linux-gnueabihf --with-shared

make

修改progs/Makefile文件里面第82行的INSTALL_PROG变量,在变量值的末尾添加

--strip-program=arm-none-linux-gnueabihf-strip

然后make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root usr

tar czf ncurses-6.5-binary.tar.gz usr

cd ../..


【交叉编译bluez-5.66】

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.66.tar.xz

tar xf bluez-5.66.tar.xz

cd bluez-5.66

sudo dnf install python-docutils

./configure --host=arm-none-linux-gnueabihf --disable-udev --with-dbusconfdir=/root/bluetooth --with-dbussystembusdir=/root/bluetooth --with-dbussessionbusdir=/root/bluetooth DBUS_CFLAGS="-I$(pwd)/../dbus-1.15.6/_install/usr/local/include/dbus-1.0 -I$(pwd)/../dbus-1.15.6/_install/usr/local/lib/dbus-1.0/include" DBUS_LIBS="-L$(pwd)/../dbus-1.15.6/_install/usr/local/lib -ldbus-1" GLIB_CFLAGS="-I$(pwd)/../glib-2.57.1/_install/usr/local/include/glib-2.0 -I$(pwd)/../glib-2.57.1/_install/usr/local/lib/glib-2.0/include" GLIB_LIBS="-L$(pwd)/../glib-2.57.1/_install/usr/local/lib -lglib-2.0" ICAL_CFLAGS=-I$(pwd)/../libical-3.0.20/_install/usr/local/include ICAL_LIBS="-L$(pwd)/../libical-3.0.20/_install/usr/local/lib -lical -licalvcal" CFLAGS=-I$(pwd)/../readline-8.2.13/_install/usr/local/include LDFLAGS="-L$(pwd)/../readline-8.2.13/_install/usr/local/lib -L$(pwd)/../ncurses-6.5/_install/usr/lib -lncursesw"

make

make install DESTDIR=$(pwd)/_install

cd _install

sudo chown -R root:root *

tar czf bluez-5.66-binary.tar.gz *

cd ../..

内容转换:

回复帖子
内容:
用户名: 您目前是匿名发表。
验证码:
看不清?换一张
©2010-2025 Purasbar Ver3.0 [手机版] [桌面版]
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。