Skip to content

Commit

Permalink
Compile using last SDK
Browse files Browse the repository at this point in the history
Refs: #98
  • Loading branch information
orontee committed Nov 13, 2024
1 parent a3d6fe1 commit 753066f
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 78 deletions.
7 changes: 5 additions & 2 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/3rd-parties
/3rd-parties/gsl-2.7.1/
/3rd-parties/gsl-2.7.1.tar.gz
/builddir
/SDK_6.3.0
/SDK_6.8.0
/SDK-B288-6.8.7z
/patchs
20 changes: 8 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,25 @@ jobs:
python3-jinja2 \
wget
- name: Install PocketBook SDK
run: |
./scripts/install_sdk.sh
- name: Generate cross-compilation configuration
run: |
./scripts/generate_cross_compilation_conf.sh
- name: Build dependencies
run: |
mkdir 3rd-parties
source ./SDK_6.8.0/env_set.sh
cd 3rd-parties
wget https://ftp.gnu.org/gnu/gsl/gsl-2.7.1.tar.gz
tar -xzf gsl-2.7.1.tar.gz
cd gsl-2.7.1
CROSS=arm-obreey-linux-gnueabi
./configure --prefix=$PWD/../../SDK_6.3.0/SDK-B288/usr/$CROSS/sysroot \
--host=$CROSS \
./configure --prefix=$PWD/../../SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot \
--host=arm-obreey-linux-gnueabi \
--build=x86_64-pc-linux-gnu \
--target=$CROSS \
CC=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang \
CXX=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang++ \
AR=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ar \
STRIP=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-strip \
RANLIB=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ranlib \
PKGCONFIG=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/pkg-config \
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
--target=arm-obreey-linux-gnueabi \
make -j2
make install
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
python3-jinja2 \
wget
- name: Install PocketBook SDK
run: |
./scripts/install_sdk.sh
- name: Generate cross-compilation configuration
run: |
./scripts/generate_cross_compilation_conf.sh
Expand All @@ -35,29 +39,21 @@ jobs:
id: cached-qa-dependencies
uses: actions/cache@v3
with:
path: SDK_6.3.0
path: SDK_6.8.0
key: qa-${{ runner.os }}-${{ hashFiles('**/meson.build') }}

- name: Optionally build dependencies
if: steps.cached-qa-dependencies.outputs.cache-hit != 'true'
run: |
mkdir 3rd-parties
source ./SDK_6.8.0/env_set.sh
cd 3rd-parties
wget https://ftp.gnu.org/gnu/gsl/gsl-2.7.1.tar.gz
tar -xzf gsl-2.7.1.tar.gz
cd gsl-2.7.1
CROSS=arm-obreey-linux-gnueabi
./configure --prefix=$PWD/../../SDK_6.3.0/SDK-B288/usr/$CROSS/sysroot \
--host=$CROSS \
./configure --prefix=$PWD/../../SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot \
--host=arm-obreey-linux-gnueabi \
--build=x86_64-pc-linux-gnu \
--target=$CROSS \
CC=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang \
CXX=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang++ \
AR=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ar \
STRIP=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-strip \
RANLIB=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ranlib \
PKGCONFIG=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/pkg-config \
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
--target=arm-obreey-linux-gnueabi \
make -j2
make install
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/builddir
/crossfile_arm.ini
/3rd-parties
/data*.json
/SDK_6.8.0
/SDK-B288-6.8.7z
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 2 additions & 0 deletions 3rd-parties/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/gsl-2.7.1.tar.gz
/gsl-2.7.1/
1 change: 1 addition & 0 deletions 3rd-parties/gsl-2.7.1.tar.gz.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b gsl-2.7.1.tar.gz
31 changes: 12 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### PocketBook SDK

The [PocketBook SDK](https://github.com/pocketbook/SDK_6.3.0) is
The [PocketBook SDK](https://github.com/pocketbook/SDK_6.8.0) is
hosted on Github and managed as a Git submodule.

### GNU Scientific Library
Expand Down Expand Up @@ -35,14 +35,13 @@ podman run --rm -v ${PWD}:/opt/taranis \
Read the [Containerfile](./Containerfile) to fix potential missing
dependencies.

1. First, clone the source repository and populate Git submodules:
1. First, clone the source repository and populate the `SDK_6.8.0`
directory with the PocketBook SDK:
```sh
git submodule init
git submodule update
./scripts/install_sdk.sh
```

This will populate the `SDK_6.3.0` directory with the PocketBook
SDK.
This will

2. Update SDK paths and generate cross compilation configuration (It
will generate the file `crossfile_arm.ini` used to build):
Expand All @@ -53,23 +52,17 @@ dependencies.
3. Download, build and install source code of the [GNU Scientific
Library dependency](https://www.gnu.org/software/gsl/):
```sh
source ./SDK_6.8.0/env_set.sh
mkdir 3rd-parties
pushd 3rd-parties
wget https://ftp.gnu.org/gnu/gsl/gsl-2.7.1.tar.gz
sha256sum -c gsl-2.7.1.tar.gz.sha256
tar -xzf gsl-2.7.1.tar.gz
pushd gsl-2.7.1
CROSS=arm-obreey-linux-gnueabi
CC=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang \
CXX=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang++ \
AR=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ar \
STRIP=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-strip \
RANLIB=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ranlib \
PKGCONFIG=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/pkg-config \
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" \
./configure --prefix=$PWD/../../SDK_6.3.0/SDK-B288/usr/$CROSS/sysroot \
--host=$CROSS \
./configure --prefix=$PWD/../../SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot \
--host=arm-obreey-linux-gnueabi \
--build=x86_64-pc-linux-gnu \
--target=$CROSS
--target=arm-obreey-linux-gnueabi
make -j4
make install
popd
Expand Down Expand Up @@ -105,7 +98,7 @@ ninja -C builddir clang-format

Static analysis:
```sh
SCANBUILD=./SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/bin/scan-build ninja -C builddir
SCANBUILD=./SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/bin/scan-build ninja -C builddir
```

## Screenshots
Expand Down Expand Up @@ -206,7 +199,7 @@ automatic poweroff.
On the host computer, start a shell with current working directory the
root directory of a Git clone of `taranis` repository. Then start GDB:
```shell
./SDK_6.3.0/SDK-B288/usr/bin/arm-linux-gdb -q taranis.app
./SDK_6.8.0/SDK-B288/usr/bin/arm-linux-gdb -q taranis.app
```

Under GDB, run `target remote 192.168.1.34:10002` where the IP address
Expand Down
18 changes: 6 additions & 12 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,19 @@ RUN git checkout ${VERSION} && \
git submodule init && \
git submodule update

RUN ./scripts/install_sdk.sh
RUN ./scripts/generate_cross_compilation_conf.sh

RUN mkdir 3rd-parties && \
RUN source ./SDK_6.8.0/env_set.sh && \
cd 3rd-parties && \
wget https://ftp.gnu.org/gnu/gsl/gsl-2.7.1.tar.gz && \
sha256sum -c gsl-2.7.1.tar.gz.sha256 && \
tar -xzf gsl-2.7.1.tar.gz && \
cd gsl-2.7.1 && \
export CROSS=arm-obreey-linux-gnueabi && \
CC=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang \
CXX=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-clang++ \
AR=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ar \
STRIP=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-strip \
RANLIB=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/$CROSS-ranlib \
PKGCONFIG=$PWD/../../SDK_6.3.0/SDK-B288/usr/bin/pkg-config \
CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" \
./configure --prefix=$PWD/../../SDK_6.3.0/SDK-B288/usr/$CROSS/sysroot \
--host=$CROSS \
./configure --prefix=$PWD/../../SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot \
--host=arm-obreey-linux-gnueabi \
--build=x86_64-pc-linux-gnu \
--target=$CROSS && \
--target=arm-obreey-linux-gnueabi && \
make -j$(nproc) && \
make install

Expand Down
1 change: 1 addition & 0 deletions SDK-B288-6.8.7z.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b924fbeba90e9258854e910c2c29a3105e6fb9c6e0e6de4cb13a015be3fc23e2 SDK-B288-6.8.7z
1 change: 0 additions & 1 deletion SDK_6.3.0
Submodule SDK_6.3.0 deleted from dd8de4
16 changes: 8 additions & 8 deletions crossfile_arm.ini.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
; -*- mode: ini-generic; -*-

[binaries]
c = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-clang'
cpp = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-clang++'
ar = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-ar'
strip = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-strip'
pkgconfig = '@pwd@/SDK_6.3.0/SDK-B288/usr/bin/pkg-config'
c = '@pwd@/SDK_6.8.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-clang'
cpp = '@pwd@/SDK_6.8.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-clang++'
ar = '@pwd@/SDK_6.8.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-ar'
strip = '@pwd@/SDK_6.8.0/SDK-B288/usr/bin/arm-obreey-linux-gnueabi-strip'
pkgconfig = '@pwd@/SDK_6.8.0/SDK-B288/usr/bin/pkg-config'

[built-in options]
cpp_args = ['-fsigned-char',
Expand All @@ -24,9 +24,9 @@ cpu = 'armv7'
endian = 'little'

[properties]
sys_root = '@pwd@/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot'
pkg_config_libdir = ['@pwd@/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/lib/pkgconfig',
'@pwd@/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/lib/pkgconfig']
sys_root = '@pwd@/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot'
pkg_config_libdir = ['@pwd@/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/lib/pkgconfig',
'@pwd@/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/lib/pkgconfig']
needs_exe_wrapper = true

; Local Variables:
Expand Down
31 changes: 31 additions & 0 deletions patchs/extend-env_set.sh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*** env_set.sh.orig 2023-06-29 10:29:36.000000000 +0200
--- env_set.sh 2024-07-14 12:07:25.667451149 +0200
***************
*** 116,119 ****
--- 116,129 ----
TOOLCHAIN_PREFIX=arm-obreey-linux-gnueabi
WORKSPACE=/srv/Jenkins/workspace/fwbuilder-ng-2
+
+ # Required to cross-compile projects not using CMake
+ CC=${CMAKE_C_COMPILER}
+ CXX=${CMAKE_CXX_COMPILER}
+ AR=${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ar
+ STRIP=${PB_STRIP}
+ RANLIB=${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-ranlib
+ PKGCONFIG=${TOOLCHAIN_PATH}/bin/pkg-config
+ CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
+
export BUILD_CFG
export PB_CMAKE_FLAGS
***************
*** 238,239 ****
--- 248,256 ----
export PB_LCP_DRM
export PB_USE_DROPBOX
+ export CC
+ export CXX
+ export AR
+ export STRIP
+ export RANLIB
+ export PKGCONFIG
+ export CFLAGS
22 changes: 21 additions & 1 deletion scripts/generate_cross_compilation_conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,30 @@
PROJECT_ROOT=${PWD}
# Script is expected to be called from project root

SDK_ROOT=${PROJECT_ROOT}/SDK_6.3.0/SDK-B288
SDK_PARENT_DIR=${PROJECT_ROOT}/SDK_6.8.0
SDK_ROOT=${SDK_PARENT_DIR}/SDK-B288

cd ${SDK_ROOT}
./bin/update_path.sh

cd ${PROJECT_ROOT}
patch ${SDK_PARENT_DIR}/env_set.sh ${PROJECT_ROOT}/patchs/extend-env_set.sh.patch
${SDK_PARENT_DIR}/env_set.sh
# Will have to source that script later to set environment

PWDESC=$(echo ${SDK_PARENT_DIR} | sed 's_/_\\/_g')
sed "s/@pwd@/$PWDESC/g" crossfile_arm.ini.in > crossfile_arm.ini

find ${SDK_ROOT} -type f \
\( -name "qt.conf" -or -name "Qt5*.cmake" \) \
-execdir sed -i "s@/BUILD/@${PWDESC}/@g" {} \;

find ${SDK_ROOT}/usr/arm-obreey-linux-gnueabi/sysroot/usr/lib/pkgconfig \
-type f -name "*.pc" \
-execdir sed -i "s@/srv/Jenkins/workspace/SDK-GEN/output-b288/host@@g" {} \;

sed -i "s@Cflags:@#Cflags:@g" \
${SDK_ROOT}/usr/arm-obreey-linux-gnueabi/sysroot/usr/lib/pkgconfig/fontconfig.pc

PWDESC=$(echo ${PROJECT_ROOT} | sed 's_/_\\/_g')
sed "s/@pwd@/$PWDESC/g" crossfile_arm.ini.in > crossfile_arm.ini
24 changes: 24 additions & 0 deletions scripts/install_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

set -e

SDK_PATH=SDK_6.8.0
SDK_ARCHIVE=SDK-B288-6.8.7z

function download_archive() {
echo Downloading ${SDK_ARCHIVE}
wget -nv -O ${SDK_ARCHIVE} https://github.com/pocketbook/SDK_6.3.0/releases/download/6.8/${SDK_ARCHIVE} > /dev/null
}

function unpack() {
sha256sum -c ${SDK_ARCHIVE}.sha256

7z x -o${SDK_PATH} ${SDK_ARCHIVE}
}

if [ ! -d ${SDK_PATH} ]; then
if [ ! -e ${SDK_ARCHIVE} ]; then
download_archive
fi
unpack
fi
10 changes: 5 additions & 5 deletions src/compile_flags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--std=c++17
--language=c++
-I/home/matthias/Projets/taranis/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/lib/clang/7.0.0/include
-I/home/matthias/Projets/taranis/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/include/c++/6.3.0
-I/home/matthias/Projets/taranis/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/include
-I/home/matthias/Projets/taranis/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/include
-I/home/matthias/Projets/taranis/SDK_6.3.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/local/include
-I/home/matthias/Projets/taranis/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/lib/clang/7.0.0/include
-I/home/matthias/Projets/taranis/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/include/c++/6.3.0
-I/home/matthias/Projets/taranis/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/include
-I/home/matthias/Projets/taranis/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/include
-I/home/matthias/Projets/taranis/SDK_6.8.0/SDK-B288/usr/arm-obreey-linux-gnueabi/sysroot/usr/local/include
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ about_cc = configure_file(

# Generate source with icons
pbres_command = find_program(
'../SDK_6.3.0/SDK-B288/usr/bin/pbres',
'../SDK_6.8.0/SDK-B288/usr/bin/pbres',
required: true
)

Expand Down

0 comments on commit 753066f

Please sign in to comment.