first commit
This commit is contained in:
33
toolchain/build.sh
Executable file
33
toolchain/build.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
SYSROOT="$(pwd)/sysroot"
|
||||
CLANG_PATH=/usr/local/opt/llvm@16/bin
|
||||
|
||||
export PATH="$CLANG_PATH:$PATH"
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
export LD="ld.lld"
|
||||
|
||||
export PKG_CONFIG_PATH=$SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig
|
||||
export CFLAGS="--target=armv7-linux-gnueabihf -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard --sysroot=$SYSROOT"
|
||||
export CXXFLAGS="--target=armv7-linux-gnueabihf -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard --sysroot=$SYSROOT"
|
||||
export LDFLAGS="--target=armv7-linux-gnueabihf -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -fuse-ld=lld --sysroot=$SYSROOT"
|
||||
|
||||
BUILD_DIR="./build"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
rm -rf "$BUILD_DIR"/*
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
cmake -GNinja \
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_SYSROOT="$SYSROOT" \
|
||||
-DUSE_ALSA_ADAPTER=ON \
|
||||
../../
|
||||
# -DCMAKE_BUILD_TYPE=Debug \
|
||||
# -DCMAKE_C_FLAGS="$CFLAGS -g" \
|
||||
# -DCMAKE_CXX_FLAGS="$CXXFLAGS -g" \
|
||||
# -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS -g" \
|
||||
# ../../
|
||||
|
||||
ninja
|
||||
38
toolchain/copy_sysroot.sh
Executable file
38
toolchain/copy_sysroot.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
#apt install clang llvm libasound2-dev libssl-dev
|
||||
#apt-get install usb-modeswitch usb-modeswitch-data
|
||||
#apt-get install modemmanager
|
||||
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/clang 100
|
||||
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/clang++ 100
|
||||
#alsamixer -> F4, turn on mic1 with space
|
||||
|
||||
|
||||
read -p "Input ip: " NANOPI_IP
|
||||
read -sp "Input ssh password: " SSH_PASSWORD
|
||||
echo
|
||||
|
||||
DEST_DIR="./sysroot"
|
||||
|
||||
copy_files() {
|
||||
sshpass -p "$SSH_PASSWORD" rsync -avLW --no-p --no-o --no-g --delete root@$NANOPI_IP:$1 $2
|
||||
}
|
||||
|
||||
if ! command -v sshpass &> /dev/null; then
|
||||
echo "sshpass not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $DEST_DIR/usr
|
||||
|
||||
echo "Copying..."
|
||||
|
||||
copy_files "/lib" "$DEST_DIR/"
|
||||
copy_files "/usr/lib" "$DEST_DIR/usr/"
|
||||
copy_files "/usr/include" "$DEST_DIR/usr/"
|
||||
|
||||
#ln -sf $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlicommon.so.1.0.9 $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlicommon.so
|
||||
#ln -sf $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlidec.so.1.0.9 $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlidec.so
|
||||
#ln -sf $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlienc.so.1.0.9 $DEST_DIR/usr/lib/arm-linux-gnueabihf/libbrotlienc.so
|
||||
|
||||
echo "Success"
|
||||
Reference in New Issue
Block a user