diff --git a/.containerignore b/.containerignore index 6a403fb..cefa683 100644 --- a/.containerignore +++ b/.containerignore @@ -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 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fed399d..f31b561 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -32,29 +32,26 @@ 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: | + ./SDK_6.8.0/env_set.sh mkdir 3rd-parties 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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 25beb83..eeb8441 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -35,29 +39,22 @@ 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: | + ./SDK_6.8.0/env_set.sh mkdir 3rd-parties 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 diff --git a/.gitignore b/.gitignore index 7a0f2f9..696199e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /builddir /crossfile_arm.ini -/3rd-parties /data*.json +/SDK_6.8.0 +/SDK-B288-6.8.7z diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 988dfca..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "SDK_6.3.0"] - path = SDK_6.3.0 - url = https://github.com/pocketbook/SDK_6.3.0.git diff --git a/3rd-parties/.gitignore b/3rd-parties/.gitignore new file mode 100644 index 0000000..ff67983 --- /dev/null +++ b/3rd-parties/.gitignore @@ -0,0 +1,2 @@ +/gsl-2.7.1.tar.gz +/gsl-2.7.1/ diff --git a/3rd-parties/gsl-2.7.1.tar.gz.sha256 b/3rd-parties/gsl-2.7.1.tar.gz.sha256 new file mode 100644 index 0000000..5f85213 --- /dev/null +++ b/3rd-parties/gsl-2.7.1.tar.gz.sha256 @@ -0,0 +1 @@ +dcb0fbd43048832b757ff9942691a8dd70026d5da0ff85601e52687f6deeb34b gsl-2.7.1.tar.gz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4a184c..cbaeced 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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): @@ -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 + ./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 @@ -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 @@ -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 diff --git a/Containerfile b/Containerfile index 30bf327..f1e321f 100644 --- a/Containerfile +++ b/Containerfile @@ -27,25 +27,20 @@ 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 ./SDK_6.8.0/env_set.sh && \ + mkdir 3rd-parties && \ 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 diff --git a/SDK-B288-6.8.7z.sha256 b/SDK-B288-6.8.7z.sha256 new file mode 100644 index 0000000..1779d8f --- /dev/null +++ b/SDK-B288-6.8.7z.sha256 @@ -0,0 +1 @@ +b924fbeba90e9258854e910c2c29a3105e6fb9c6e0e6de4cb13a015be3fc23e2 SDK-B288-6.8.7z diff --git a/SDK_6.3.0 b/SDK_6.3.0 deleted file mode 160000 index dd8de46..0000000 --- a/SDK_6.3.0 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dd8de463733a2bc0d53d1214b64734586fac427e diff --git a/crossfile_arm.ini.in b/crossfile_arm.ini.in index 2f3fba1..65e5195 100644 --- a/crossfile_arm.ini.in +++ b/crossfile_arm.ini.in @@ -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', @@ -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: diff --git a/patchs/extend-env_set.sh.patch b/patchs/extend-env_set.sh.patch new file mode 100644 index 0000000..ccf16eb --- /dev/null +++ b/patchs/extend-env_set.sh.patch @@ -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 diff --git a/scripts/generate_cross_compilation_conf.sh b/scripts/generate_cross_compilation_conf.sh index e749a73..2f035df 100755 --- a/scripts/generate_cross_compilation_conf.sh +++ b/scripts/generate_cross_compilation_conf.sh @@ -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 diff --git a/scripts/install_sdk.sh b/scripts/install_sdk.sh new file mode 100755 index 0000000..8c0240b --- /dev/null +++ b/scripts/install_sdk.sh @@ -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 diff --git a/src/compile_flags.txt b/src/compile_flags.txt index 4a6de89..2544193 100644 --- a/src/compile_flags.txt +++ b/src/compile_flags.txt @@ -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 diff --git a/src/meson.build b/src/meson.build index 24933f3..b849abb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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 )