diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ae62a695 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,448 @@ +name: build + +on: + pull_request: + types: + - synchronize + - reopened + - opened + push: + branches: + - 'master' + tags: + - 'v*' + workflow_dispatch: + +env: + MAX_KERNEL_SIZE: 0x200000 + MAX_ROOTFS_SIZE: 0x500000 + MAX_KERNEL_SIZE_ULTIMATE: 0x300000 + MAX_ROOTFS_SIZE_ULTIMATE: 0xA00000 + MAX_KERNEL_SIZE_NAND: 0x0800000 + MAX_ROOTFS_SIZE_NAND: 0x1200000 + TAG_NAME: latest + +jobs: + toolchain: + name: Toolchain + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + platform: + - ak3918ev300 + - dm36x + - fh8852v100 + - fh8852v200 + - gk7102 + - gm8136 + - hi3516cv100 + - hi3516cv200 + - hi3516cv300 + - hi3516cv500 + - hi3516ev200 + - hi3519v101 + - hi3536cv100 + - msc313e + - msc316dc + - msc316dm + - nt98562 + - rv1126 + - s3l + - ssc335 + - ssc338q + - t31 + - t40 + - xm510 + - xm530 + + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Determine toolchain + run: | + make BOARD=${{matrix.platform}}_lite prepare + GCC=$(make BOARD=${{matrix.platform}}_lite toolname) + echo GCC=${GCC} >> ${GITHUB_ENV} + URL=https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/${GCC}.tgz + echo ${URL} + if ! wget --spider ${URL} 2> /dev/null; then + echo BUILD=true >> ${GITHUB_ENV} + fi + + - name: Build toolchain + if: env.BUILD + run: | + make BOARD=${{matrix.platform}}_lite br-sdk + SDK=$(find output/images -name *_sdk-buildroot.tar.gz) + mv ${SDK} ${GCC}.tgz + + - name: Upload toolchain + if: env.BUILD && github.event_name != 'pull_request' + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{env.TAG_NAME}} + files: ${{env.GCC}}.tgz + + buildroot: + name: Firmware + needs: toolchain + runs-on: ubuntu-latest + env: + TG_TOKEN: ${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}} + TG_CHANNEL: ${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}} + TG_OPTIONS: -s --connect-timeout 30 --retry 10 --http1.1 -o /dev/null -w %{http_code} + + strategy: + fail-fast: false + matrix: + platform: + - hi3516cv100 + - hi3518cv100 + - hi3518ev100 + - hi3516av100 + - hi3516dv100 + - hi3516cv200 + - hi3518ev200 + - hi3519v101 + - hi3516av200 + - hi3516cv300 + - hi3516ev100 + - hi3516cv500 + - hi3516dv300 + - hi3516av300 + - hi3516ev200 + - hi3516ev300 + - hi3518ev300 + - hi3516dv200 + - hi3536cv100 + - hi3536dv100 + - gk7205v200 + - gk7205v210 + - gk7205v300 + - gk7202v300 + - gk7605v100 + - t31 + - t40 + + release: + - lite + - ultimate + + include: + - platform: hi3518ev200 + release: mini + - platform: hi3516cv300 + release: mini + - platform: hi3516ev200 + release: fpv + - platform: hi3516ev300 + release: fpv + - platform: gk7205v200 + release: fpv + - platform: gk7205v300 + release: fpv + - platform: hi3516ev200 + release: lte + - platform: hi3516ev300 + release: lte + - platform: gk7205v200 + release: lte + - platform: gk7205v300 + release: lte + + # Original SDK test + - platform: gk7205v200 + release: original + custom: onlyci + + # MVP + - platform: fh8852v100 + release: lite + - platform: fh8852v200 + release: lite + - platform: gm8136 + release: lite + - platform: nt98562 + release: lite + - platform: nt98566 + release: lite + - platform: rv1109 + release: lite + - platform: rv1126 + release: lite + - platform: ssc335 + release: lite + - platform: ssc335de + release: lite + - platform: ssc337 + release: lite + - platform: ssc337de + release: lite + - platform: ssc338q + release: lite + - platform: t10 + release: lite + - platform: t20 + release: lite + - platform: t21 + release: lite + - platform: t30 + release: lite + - platform: xm510 + release: lite + - platform: xm530 + release: lite + - platform: xm550 + release: lite + + # TODO + - platform: ak3916ev300 + release: lite + custom: onlyci + - platform: ak3918ev300 + release: lite + custom: onlyci + - platform: dm36x + release: lite + custom: onlyci + - platform: gk7102 + release: lite + - platform: gk7102s + release: lite + - platform: msc313e + release: lite + custom: onlyci + - platform: msc316dc + release: lite + custom: onlyci + - platform: msc316dm + release: lite + custom: onlyci + - platform: s3l + release: lite + custom: onlyci + - platform: ssc325 + release: lite + custom: onlyci + + exclude: + - platform: hi3516cv100 + release: ultimate + - platform: hi3518cv100 + release: ultimate + - platform: hi3518ev100 + release: ultimate + - platform: hi3516cv200 + release: ultimate + - platform: hi3519v101 + release: ultimate + - platform: hi3516ev100 + release: ultimate + - platform: hi3516cv500 + release: ultimate + - platform: hi3516dv300 + release: ultimate + - platform: hi3516av300 + release: ultimate + - platform: hi3516dv200 + release: ultimate + - platform: hi3536cv100 + release: ultimate + - platform: hi3536dv100 + release: ultimate + - platform: gk7605v100 + release: ultimate + - platform: gk7205v210 + release: ultimate + - platform: gk7202v300 + release: ultimate + + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Determine toolchain + run: | + make BOARD=${{matrix.platform}}_lite prepare + GCC=$(make BOARD=${{matrix.platform}}_lite toolname) + echo GCC=${GCC} >> ${GITHUB_ENV} + URL=https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/${GCC}.tgz + echo ${URL} + wget -q -c --retry-on-http-error=503 --timeout=15 ${URL} + + - name: Setup ccache + if: github.event_name != 'pull_request' + uses: actions/cache@v3 + with: + path: /tmp/ccache + key: ${{env.GCC}} + + - name: Restore ccache + if: github.event_name == 'pull_request' + uses: actions/cache/restore@v3 + with: + path: /tmp/ccache + key: ${{env.GCC}} + + - name: Restore download + uses: actions/cache/restore@v3 + with: + path: /tmp/download + key: buildroot-cache + + - name: Build firmware + run: | + FAMILY=${{matrix.platform}} + RELEASE=${{matrix.release}} + CONFIG=$(find br-ext-chip-* -name ${FAMILY}_${RELEASE}_defconfig) + IMAGES=${GITHUB_WORKSPACE}/output/images + + DIR=/tmp/openipc + SDK=/tmp/extsdk + mkdir -p ${DIR} ${SDK} + tar xf ${GCC}.tgz --strip-components=1 -C ${SDK} + + EXT=BR2_TOOLCHAIN_EXTERNAL + echo ${EXT}=y >> ${CONFIG} + echo ${EXT}_CUSTOM=y >> ${CONFIG} + echo ${EXT}_PREINSTALLED=y >> ${CONFIG} + echo ${EXT}_CXX=y >> ${CONFIG} + echo ${EXT}_PATH=\"${SDK}\" >> ${CONFIG} + + PREFIX=$(ls -d ${SDK}/*openipc* | xargs basename) + GCCV=$(echo ${GCC} | cut -d "-" -f 2) + LIBC=$(echo ${GCC} | cut -d "-" -f 3) + KVER=$(echo ${GCC} | cut -d "-" -f 4) + echo ${EXT}_CUSTOM_PREFIX=\"${PREFIX}\" >> ${CONFIG} + echo ${EXT}_CUSTOM_${LIBC^^}=y >> ${CONFIG} + echo ${EXT}_HEADERS_${KVER}=y >> ${CONFIG} + echo ${EXT}_GCC_${GCCV:3:1}=y >> ${CONFIG} + + if [ ${LIBC} = "glibc" ]; then + RPC=${SDK}/${PREFIX}/sysroot/usr/include/rpc/rpc.h + check() { test -f $RPC && echo y || echo n; } + echo ${EXT}_INET_RPC=$(check) >> ${CONFIG} + elif [ ${LIBC} = "uclibc" ]; then + CFG=${SDK}/${PREFIX}/sysroot/usr/include/bits/uClibc_config.h + check() { grep -q "${1} 1" ${CFG} && echo y || echo n; } + echo ${EXT}_LOCALE=$(check __UCLIBC_HAS_LOCALE__) >> ${CONFIG} + echo ${EXT}_HAS_THREADS_DEBUG=$(check __PTHREADS_DEBUG_SUPPORT__) >> ${CONFIG} + echo ${EXT}_HAS_SSP=y >> ${CONFIG} + fi + + echo BR2_CCACHE=y >> ${CONFIG} + echo BR2_CCACHE_DIR=\"/tmp/ccache\" >> ${CONFIG} + export BR2_DL_DIR=/tmp/download + + export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA}) + export GIT_BRANCH=${GITHUB_REF_NAME} + echo GIT_HASH=${GIT_HASH} >> ${GITHUB_ENV} + echo GIT_BRANCH=${GIT_BRANCH} >> ${GITHUB_ENV} + + echo ------------------------------------------------------------ + echo ${CONFIG} + echo ------------------------------------------------------------ + cat ${CONFIG} + echo ------------------------------------------------------------ + make BOARD=${FAMILY}_${RELEASE} all + echo ------------------------------------------------------------ + + check_size() { + FILE=$(basename ${1}) + SIZE1=$(expr $(stat --printf="%s" ${1}) / 1024) + SIZE2=$(expr ${2} / 1024) + echo - ${FILE}: [${SIZE1}KB/${SIZE2}KB] + if [ ${SIZE1} -gt ${SIZE2} ]; then + echo -- Error: ${FILE} size exceeded by $(expr ${SIZE1} - ${SIZE2})KB + exit 1 + fi + } + + if [ ${RELEASE} == "ultimate" ] || grep -q GLIBC=y ${CONFIG}; then + MAX_KERNEL_SIZE=${MAX_KERNEL_SIZE_ULTIMATE} + MAX_ROOTFS_SIZE=${MAX_ROOTFS_SIZE_ULTIMATE} + fi + + if [ -e ${IMAGES}/uImage ]; then + check_size ${IMAGES}/uImage ${MAX_KERNEL_SIZE} + mv ${IMAGES}/uImage ${DIR}/uImage.${FAMILY} + md5sum ${DIR}/uImage.${FAMILY} > ${DIR}/uImage.${FAMILY}.md5sum + fi + + if [ -e ${IMAGES}/zboot.img ]; then + check_size ${IMAGES}/zboot.img ${MAX_KERNEL_SIZE_NAND} + mv ${IMAGES}/zboot.img ${DIR}/boot.img.${FAMILY} + md5sum ${DIR}/boot.img.${FAMILY} > ${DIR}/boot.img.${FAMILY}.md5sum + rm -f ${IMAGES}/rootfs.squashfs + fi + + if [ -e ${IMAGES}/rootfs.squashfs ]; then + check_size ${IMAGES}/rootfs.squashfs ${MAX_ROOTFS_SIZE} + mv ${IMAGES}/rootfs.squashfs ${DIR}/rootfs.squashfs.${FAMILY} + md5sum ${DIR}/rootfs.squashfs.${FAMILY} > ${DIR}/rootfs.squashfs.${FAMILY}.md5sum + + NORFW=${IMAGES}/openipc.${FAMILY}-nor-${RELEASE}.tgz + echo NORFW=${NORFW} >> ${GITHUB_ENV} + tar czf ${NORFW} -C ${DIR} $(ls ${DIR}) + fi + + if [ -e ${IMAGES}/rootfs.ubi ]; then + check_size ${IMAGES}/rootfs.ubi ${MAX_ROOTFS_SIZE_NAND} + mv ${IMAGES}/rootfs.ubi ${DIR}/rootfs.ubi.${FAMILY} + md5sum ${DIR}/rootfs.ubi.${FAMILY} > ${DIR}/rootfs.ubi.${FAMILY}.md5sum + rm -f ${DIR}/rootfs.squashfs* + + NANDFW=${IMAGES}/openipc.${FAMILY}-nand-${RELEASE}.tgz + echo NANDFW=${NANDFW} >> ${GITHUB_ENV} + tar czf ${NANDFW} -C ${DIR} $(ls ${DIR}) + fi + + - name: Upload firmware + if: github.event_name != 'pull_request' && matrix.custom != 'onlyci' + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{env.TAG_NAME}} + files: | + ${{env.NORFW}} + ${{env.NANDFW}} + + - name: Send error + if: github.event_name != 'pull_request' && failure() + run: | + TG_WARN="Error: ${{matrix.platform}}_${{matrix.release}}\n" + TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\n\n" + TG_ICON="\xE2\x9A\xA0 GitHub Actions" + TG_HEADER=$(echo -e ${TG_WARN}${TG_MSG}${TG_ICON}) + HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}") + echo Telegram response: ${HTTP} + exit 2 + + - name: Send binary + if: github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NORFW + run: | + TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\n\n" + TG_ICON="\xE2\x9C\x85 GitHub Actions" + TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON}) + HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${NORFW}) + echo Telegram response: ${HTTP} + + ci-build-check: + if: github.event_name == 'pull_request' && always() + runs-on: ubuntu-latest + name: CI buildcheck + needs: buildroot + steps: + - run: | + result=${{needs.buildroot.result}} + if [[ ${result} = "success" || ${result} = "skipped" ]]; then + exit 0 + else + exit 1 + fi diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml new file mode 100644 index 00000000..4184b6f8 --- /dev/null +++ b/.github/workflows/cache.yml @@ -0,0 +1,37 @@ +name: cache +on: + workflow_dispatch: + +env: + REMOVE: aws* linux* gcc majestic mini + +jobs: + download: + name: Download + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Prepare download + id: cache + uses: actions/cache@v3 + with: + path: /tmp/download + key: buildroot-cache + + - name: Download files + if: steps.cache.outputs.cache-hit != 'true' + run: | + DIR=/tmp/download + export BR2_DL_DIR=${DIR} + LIST=$(find br-ext-chip-*/configs -type f -name *_defconfig) + for CONFIG in ${LIST}; do + echo --- ${CONFIG} + make BOARD=${CONFIG} br-source + done + cd ${DIR} + rm -rf ${REMOVE} diff --git a/.github/workflows/matrix_build.yml b/.github/workflows/matrix_build.yml deleted file mode 100644 index bda05724..00000000 --- a/.github/workflows/matrix_build.yml +++ /dev/null @@ -1,591 +0,0 @@ -name: build - -on: - pull_request: - types: - - synchronize - - reopened - - opened - paths-ignore: - - '**.md' - push: - branches: - - 'master' - tags: - - 'v*' - paths-ignore: - - '**.md' - workflow_dispatch: - -concurrency: - group: ${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -env: - MAX_KERNEL_SIZE: 0x200000 - MAX_ROOTFS_SIZE: 0x500000 - MAX_KERNEL_SIZE_ULTIMATE: 0x300000 - MAX_ROOTFS_SIZE_ULTIMATE: 0xa00000 - TG_OPTIONS: -s --connect-timeout 30 --retry 10 --http1.1 --verbose - -jobs: - toolchain: - name: Toolchain - runs-on: ubuntu-latest - env: - NEED: true - - strategy: - fail-fast: false - matrix: - platform: - - ak3918ev300 - - dm36x - - fh8852v100 - - fh8852v200 - - gk7102 - - gm8136 - - hi3516cv100 - - hi3516cv200 - - hi3516cv300 - - hi3516cv500 - - hi3516ev200 - - hi3519v101 - - hi3536cv100 - - msc313e - - msc316dc - - msc316dm - - nt98562 - - rv1126 - - s3l - - ssc335 - - ssc338q - - t31 - - t40 - - xm510 - - xm530 - - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - - - name: Determine toolchain name and can we skip build - run: | - GIT_HASH=$(git rev-parse --short $GITHUB_SHA) - RELEASE_NAME="Development Build" - TAG_NAME="latest" - PRERELEASE=true - echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV - echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - - BOARD=${{ matrix.platform }}_lite - make BOARD=$BOARD prepare - TOOLNAME=$(make BOARD=$BOARD toolname) - echo "TOOLNAME=$TOOLNAME" >> $GITHUB_ENV - URL=https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/${TOOLNAME}.tgz - echo Checking $URL - - HTTP_CODE=$(curl -o /dev/null --silent -Iw '%{http_code}' $URL) - echo GitHub returned HTTP code: ${HTTP_CODE} - if [ "$HTTP_CODE" == "302" ]; then - echo "NEED=false" >> $GITHUB_ENV - fi - - - name: Install build dependencies - if: env.NEED == 'true' - run: | - sudo make install-deps - if [ ! -z "$ACT" ]; then - echo "FORCE_UNSAFE_CONFIGURE=1" >> $GITHUB_ENV - else - # https://github.com/actions/runner-images/issues/2577 - echo "8.8.8.8 invisible-mirror.net" | sudo tee -a /etc/hosts - fi - - - name: Free disk space - if: ${{ !env.ACT && env.NEED == 'true' }} - run: | - sudo apt clean - docker rmi $(docker image ls -aq) - - - name: Build Buildroot SDK - if: env.NEED == 'true' - run: | - make BOARD=${{ matrix.platform }}_lite br-sdk - SDK_PATH=$(find output/images -name "*_sdk-buildroot.tar.gz") - # Why do we need this crap (only for weird artifact names)? - NEW="$(dirname $SDK_PATH)/${TOOLNAME}.tgz" - mv $SDK_PATH $NEW - SDK_PATH=$NEW - echo "SDK_PATH=$SDK_PATH" >> $GITHUB_ENV - - - uses: actions/upload-artifact@v3 - # uncomment one of the options: - # 1. Build only there is no such toolchain - if: env.NEED == 'true' - with: - name: '${{ env.TOOLNAME }}.tgz' - path: ${{ env.SDK_PATH }} - retention-days: 1 - - - name: Create release - if: ${{ !env.ACT && github.event_name != 'pull_request' && env.NEED == 'true' }} - uses: actions/create-release@v1 - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.TAG_NAME }} - release_name: ${{ env.RELEASE_NAME }} - draft: false - prerelease: ${{ env.PRERELEASE }} - - - name: Upload SDK to release - if: ${{ !env.ACT && github.event_name != 'pull_request' && env.NEED == 'true' }} - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.SDK_PATH }} - asset_name: '${{ env.TOOLNAME }}.tgz' - tag: ${{ env.TAG_NAME }} - overwrite: true - - buildroot: - name: Firmware - needs: toolchain - runs-on: ubuntu-latest - env: - FURRY: ${{ secrets.FURRY }} - - strategy: - fail-fast: false - matrix: - platform: - - hi3516cv100 - - hi3518cv100 - - hi3518ev100 - - hi3516av100 - - hi3516dv100 - - hi3516cv200 - - hi3518ev200 - - hi3519v101 - - hi3516av200 - - hi3516cv300 - - hi3516ev100 - - hi3516cv500 - - hi3516dv300 - - hi3516av300 - - hi3516ev200 - - hi3516ev300 - - hi3518ev300 - - hi3516dv200 - - hi3536cv100 - - hi3536dv100 - - gk7205v200 - - gk7205v210 - - gk7205v300 - - gk7202v300 - - gk7605v100 - - t31 - - t40 - release: - - lite - - ultimate - include: - - platform: hi3518ev200 - release: mini - - platform: hi3516cv300 - release: mini - - platform: hi3516ev200 - release: fpv - - platform: hi3516ev300 - release: fpv - - platform: gk7205v200 - release: fpv - - platform: gk7205v300 - release: fpv - - platform: hi3516ev200 - release: lte - - platform: hi3516ev300 - release: lte - - platform: gk7205v200 - release: lte - - platform: gk7205v300 - release: lte - - # Original SDK test - - platform: gk7205v200 - release: original - custom: onlyci - - # MVP - - platform: fh8852v100 - release: lite - - platform: fh8852v200 - release: lite - - platform: gm8136 - release: lite - - platform: nt98562 - release: lite - - platform: nt98566 - release: lite - - platform: rv1109 - release: lite - - platform: rv1126 - release: lite - - platform: ssc335 - release: lite - - platform: ssc335de - release: lite - - platform: ssc337 - release: lite - - platform: ssc337de - release: lite - - platform: ssc338q - release: lite - - platform: t10 - release: lite - - platform: t20 - release: lite - - platform: t21 - release: lite - - platform: t30 - release: lite - - platform: xm510 - release: lite - - platform: xm530 - release: lite - - platform: xm550 - release: lite - - # TODO - - platform: ak3916ev300 - release: lite - custom: onlyci - - platform: ak3918ev300 - release: lite - custom: onlyci - - platform: dm36x - release: lite - custom: onlyci - - platform: gk7102 - release: lite - - platform: gk7102s - release: lite - - platform: msc313e - release: lite - custom: onlyci - - platform: msc316dc - release: lite - custom: onlyci - - platform: msc316dm - release: lite - custom: onlyci - - platform: s3l - release: lite - custom: onlyci - - platform: ssc325 - release: lite - custom: onlyci - - exclude: - - platform: hi3516cv100 - release: ultimate - - platform: hi3518cv100 - release: ultimate - - platform: hi3518ev100 - release: ultimate - - platform: hi3516cv200 - release: ultimate - - platform: hi3519v101 - release: ultimate - - platform: hi3516ev100 - release: ultimate - - platform: hi3516cv500 - release: ultimate - - platform: hi3516dv300 - release: ultimate - - platform: hi3516av300 - release: ultimate - - platform: hi3516dv200 - release: ultimate - - platform: hi3536cv100 - release: ultimate - - platform: hi3536dv100 - release: ultimate - - platform: gk7605v100 - release: ultimate - - platform: gk7205v210 - release: ultimate - - platform: gk7202v300 - release: ultimate - - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - - - name: Install build dependencies - run: | - sudo make install-deps - if [ ! -z "$ACT" ]; then - echo "FORCE_UNSAFE_CONFIGURE=1" >> $GITHUB_ENV - else - # https://github.com/actions/runner-images/issues/2577 - echo "8.8.8.8 invisible-mirror.net" | sudo tee -a /etc/hosts - fi - - - name: Free disk space - if: ${{ !env.ACT }} - run: | - sudo apt clean - docker rmi $(docker image ls -aq) - - - name: Prepare buildroot - run: | - GIT_HASH=$(git rev-parse --short $GITHUB_SHA) - BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3) - RELEASE_NAME="Development Build" - TAG_NAME="latest" - PRERELEASE=true - echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV - echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV - echo "BRANCH=$BRANCH" >> $GITHUB_ENV - - - name: Determine toolchain name - run: | - BOARD=${{ matrix.platform }}_lite - make BOARD=$BOARD prepare - TOOLNAME=$(make BOARD=$BOARD toolname) - echo "TOOLNAME=$TOOLNAME" >> $GITHUB_ENV - - - name: Setup ccache - if: github.event_name != 'pull_request' - uses: actions/cache@v3 - with: - path: /tmp/ccache - key: ${{ env.TOOLNAME }} - - - name: Restore ccache - if: github.event_name == 'pull_request' - uses: actions/cache/restore@v3 - with: - path: /tmp/ccache - key: ${{ env.TOOLNAME }} - - - uses: actions/download-artifact@v3 - continue-on-error: true - with: - name: '${{ env.TOOLNAME }}.tgz' - - - name: Build firmware - run: | - BOARD=${{ matrix.platform }}_${{ matrix.release }} - CONF_PATH=$(find . -name "${BOARD}_defconfig") - - echo Using $TOOLNAME - if [ ! -f "$TOOLNAME.tgz" ]; then - wget -nv --retry-on-http-error=503 --continue --timeout=15 \ - https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/${TOOLNAME}.tgz - fi - mkdir /tmp/extsdk - tar xvf ${TOOLNAME}.tgz --strip-components=1 -C /tmp/extsdk >/dev/null - set -x - - TLEXT=BR2_TOOLCHAIN_EXTERNAL - echo "${TLEXT}=y" >> $CONF_PATH - echo "${TLEXT}_CUSTOM=y" >> $CONF_PATH - echo "${TLEXT}_PREINSTALLED=y" >> $CONF_PATH - echo "${TLEXT}_CXX=y" >> $CONF_PATH - echo "${TLEXT}_PATH=\"/tmp/extsdk\"" >> $CONF_PATH - - SOC=$(echo $TOOLNAME | cut -d '-' -f 1) - ABI="" - case "$SOC" in - arm*|cortex*) - PREFIX=arm - ABI="eabi" - [[ $SOC =~ _hf$ ]] && ABI="${ABI}hf" - ;; - mips_xburst) - PREFIX=mipsel - ;; - esac - PREFIX="${PREFIX}-openipc-linux-" - - LIBC=$(echo $TOOLNAME | cut -d '-' -f 3) - case "$LIBC" in - uclibc) - PREFIX="${PREFIX}${LIBC}gnu${ABI}" - UCCFG=/tmp/extsdk/${PREFIX}/sysroot/usr/include/bits/uClibc_config.h - check_uclibc_feature() { grep -q "\#define ${1} 1" ${UCCFG} && echo y || echo n; } - echo "${TLEXT}_LOCALE=$(check_uclibc_feature __UCLIBC_HAS_LOCALE__)" >> $CONF_PATH - echo "${TLEXT}_HAS_THREADS_DEBUG=$(check_uclibc_feature __PTHREADS_DEBUG_SUPPORT__)" >> $CONF_PATH - echo "${TLEXT}_HAS_SSP=y" >> $CONF_PATH - ;; - musl) - PREFIX="${PREFIX}${LIBC}${ABI}" - ;; - glibc) - PREFIX="${PREFIX}gnu${ABI}" - RPCH=/tmp/extsdk/${PREFIX}/sysroot/usr/include/rpc/rpc.h - check_glibc_rpc_feature() { test -f $RPCH && echo y || echo n ; } - echo "${TLEXT}_INET_RPC=$(check_glibc_rpc_feature)" >> $CONF_PATH - ;; - esac - echo "${TLEXT}_CUSTOM_PREFIX=\"${PREFIX}\"" >> $CONF_PATH - CAP_LIBC=$(echo $LIBC | tr a-z A-Z) - echo "${TLEXT}_CUSTOM_${CAP_LIBC}=y" >> $CONF_PATH - LXHDRS=$(echo $TOOLNAME | cut -d '-' -f 4) - echo "${TLEXT}_HEADERS_${LXHDRS}=y" >> $CONF_PATH - GCC_VER=$(echo $TOOLNAME | cut -d '-' -f 2) - echo "${TLEXT}_GCC_${GCC_VER:3:1}=y" >> $CONF_PATH - - echo BR2_CCACHE=y >> $CONF_PATH - echo BR2_CCACHE_DIR=\"/tmp/ccache\" >> $CONF_PATH - cat $CONF_PATH - - make BOARD=$BOARD all - - IMAGES_DIR=${GITHUB_WORKSPACE}/output/images - pushd output/images - check_exceeded() { - ACTUAL=$(stat --printf="%s" ${1}) - echo Debug ${1}: ${ACTUAL} vs ${2}... - if [[ ${ACTUAL} -gt ${2} ]]; then - OVERRUN=$((${ACTUAL}-${2})) - echo "TG_NOTIFY=Warning, ${1} size exceeded by ${OVERRUN}... ${{ matrix.platform }} (${{ matrix.release }})" >> $GITHUB_ENV - exit 1 - fi - } - - if [ -f uImage ]; then - # TODO: doesn't fit to lite - case ${{ matrix.platform }} in - hi3516cv500|hi3516dv300|hi3516av300|ssc338q) - MAX_KERNEL_SIZE=${MAX_KERNEL_SIZE_ULTIMATE} - MAX_ROOTFS_SIZE=${MAX_ROOTFS_SIZE_ULTIMATE} - ;; - esac - - case ${{ matrix.release }} in - lite|fpv|lte) - check_exceeded uImage ${MAX_KERNEL_SIZE} - check_exceeded rootfs.squashfs ${MAX_ROOTFS_SIZE} - ;; - ultimate) - check_exceeded uImage ${MAX_KERNEL_SIZE_ULTIMATE} - check_exceeded rootfs.squashfs ${MAX_ROOTFS_SIZE_ULTIMATE} - ;; - esac - - NORFW_PATH="${IMAGES_DIR}/openipc.${{ matrix.platform }}-nor-${{ matrix.release }}.tgz" - echo "NORFW_PATH=$NORFW_PATH" >> $GITHUB_ENV - NORFW_FILE=$(basename $NORFW_PATH) - echo "NORFW_FILE=$NORFW_FILE" >> $GITHUB_ENV - - mv uImage uImage.${{ matrix.platform }} - mv rootfs.squashfs rootfs.squashfs.${{ matrix.platform }} - md5sum rootfs.squashfs.${{ matrix.platform }} > rootfs.squashfs.${{ matrix.platform }}.md5sum - md5sum uImage.${{ matrix.platform }} > uImage.${{ matrix.platform }}.md5sum - tar -cvzf $NORFW_PATH uImage* *rootfs.squashfs.${{ matrix.platform }}* - fi - - if [ -f rootfs.ubifs ] ; then - NANDFW_PATH="${IMAGES_DIR}/openipc.${{ matrix.platform }}-nand-${{ matrix.release }}.tgz" - echo "NANDFW_PATH=$NANDFW_PATH" >> $GITHUB_ENV - NANDFW_FILE=$(basename $NANDFW_PATH) - echo "NANDFW_FILE=$NANDFW_FILE" >> $GITHUB_ENV - - mv rootfs.ubi rootfs.ubi.${{ matrix.platform }} - mv rootfs.ubifs rootfs.ubifs.${{ matrix.platform }} - md5sum rootfs.ubifs.${{ matrix.platform }} > rootfs.ubifs.${{ matrix.platform }}.md5sum - case ${{ matrix.platform }} in - rv*) - mv zboot.img boot.img.${{ matrix.platform }} - md5sum boot.img.${{ matrix.platform }} > boot.img.${{ matrix.platform }}.md5sum - tar -cvzf $NANDFW_PATH boot.img* *rootfs.ubi*.${{ matrix.platform }}* - ;; - *) - tar -cvzf $NANDFW_PATH uImage* *rootfs.ubi*.${{ matrix.platform }}* - ;; - esac - fi - popd - - - name: Send error message to telegram channel - env: - TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }} - TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }} - if: ${{ !env.ACT && failure() && github.event_name != 'pull_request' }} - run: | - TG_NOTIFY="${TG_NOTIFY:=Warning, Buildroot compiling error... ${{ matrix.platform }} (${{ matrix.release }})}" - TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions") - curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendMessage \ - -F chat_id=$TG_CHANNEL -F text="$TG_HEADER" - exit 2 - - - name: Create release - if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' }} - uses: actions/create-release@v1 - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.TAG_NAME }} - release_name: ${{ env.RELEASE_NAME }} - draft: false - prerelease: ${{ env.PRERELEASE }} - - - name: Upload NOR FW to release - if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NORFW_FILE != '' }} - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.NORFW_PATH }} - asset_name: ${{ env.NORFW_FILE }} - tag: ${{ env.TAG_NAME }} - overwrite: true - - - name: Upload NAND FW to release - if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NANDFW_FILE != '' }} - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.NANDFW_PATH }} - asset_name: ${{ env.NANDFW_FILE }} - tag: ${{ env.TAG_NAME }} - overwrite: true - - - name: Send binary file to telegram channel - if: ${{ !env.ACT && github.event_name != 'pull_request' && matrix.custom != 'onlyci' && env.NORFW_FILE != '' }} - env: - TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }} - TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }} - run: | - TG_HEADER=$(echo -e "\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9C\x85 GitHub Actions") - curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendDocument \ - -F chat_id=$TG_CHANNEL -F document="@$NORFW_PATH" -F caption="$TG_HEADER" - - ci-build-check: - if: always() && github.event.pull_request - runs-on: ubuntu-latest - name: CI Build Check - needs: [buildroot] - steps: - - run: | - result="${{ needs.buildroot.result }}" - if [[ $result == "success" || $result == "skipped" ]]; then - exit 0 - else - exit 1 - fi diff --git a/Makefile b/Makefile index 58928750..3d64e028 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,17 @@ +BR_VER = 2021.02.12 BR_DIR = $(PWD)/buildroot-$(BR_VER) BR_MAKE = $(MAKE) -C $(BR_DIR) BR2_EXTERNAL=$(PWD)/general O=$(PWD)/output +CHECK = $(wildcard $(BR_DIR)) ifdef BOARD - CHECK = $(wildcard $(BR_DIR)) CONFIG = $(shell find br-ext-chip-*/configs -type f | grep -m1 $(BOARD)) endif ifeq ($(CONFIG),) - BR_VER = $(error variable BOARD must be defined to initialize build) + CONFIG = $(error variable BOARD must be defined to initialize build) else ifneq ($(shell grep GCC_VERSION_12 $(CONFIG)),) BR_VER = 2023.02 - else - BR_VER = 2021.02.12 endif endif @@ -22,7 +21,6 @@ help: @printf "BR-OpenIPC usage:\n \ - make clean - remove defconfig and target folder\n \ - make distclean - remove buildroot and output folder\n \ - - make install-deps - install system dependencies\n \ - make list-configs - show available board configurations\n \ - make all BOARD= - builds the selected board\n\n" @@ -57,7 +55,3 @@ distclean: list-configs: @ls -1 br-ext-chip-*/configs - -install-deps: - @sudo apt-get install -y build-essential libncurses-dev \ - bc cpio curl file git lzop make rsync unzip wget diff --git a/br-ext-chip-ingenic/board/t40/kernel/patches/00000-arch_mips_boot_Makefile.patch b/br-ext-chip-ingenic/board/t40/kernel/patches/00000-arch_mips_boot_Makefile.patch deleted file mode 100644 index ec8951f5..00000000 --- a/br-ext-chip-ingenic/board/t40/kernel/patches/00000-arch_mips_boot_Makefile.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -drupN a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile ---- a/arch/mips/boot/Makefile 2017-10-21 18:09:07.000000000 +0300 -+++ b/arch/mips/boot/Makefile 2022-06-09 05:02:27.000000000 +0300 -@@ -75,7 +75,7 @@ $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.b - # Compressed u-boot images - # - --targets += uImage -+#targets += uImage - targets += uImage.bin - targets += uImage.bz2 - targets += uImage.gz -@@ -97,6 +97,9 @@ $(obj)/uImage.lzma: $(obj)/vmlinux.bin.l - $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE - $(call if_changed,uimage,lzo) - --$(obj)/uImage: $(obj)/uImage.$(suffix-y) -+ -+ -+targets += uImage -+$(obj)/uImage: $(obj)/uImage.lzma $(obj)/uImage.lzo FORCE - @ln -sf $(notdir $<) $@ - @echo ' Image $@ is ready' diff --git a/general/scripts/executing_commands.sh b/general/scripts/executing_commands.sh index 6e364eff..6e145349 100755 --- a/general/scripts/executing_commands.sh +++ b/general/scripts/executing_commands.sh @@ -5,7 +5,7 @@ D=$(date "+%y.%m.%d") echo "OPENIPC_VERSION=${D:0:1}.${D:1}" >>${TARGET_DIR}/usr/lib/os-release -date "+GITHUB_VERSION=\"${BRANCH}+${GIT_HASH}, %Y-%m-%d\"" >>${TARGET_DIR}/usr/lib/os-release +date "+GITHUB_VERSION=\"${GIT_BRANCH}+${GIT_HASH}, %Y-%m-%d\"" >>${TARGET_DIR}/usr/lib/os-release date "+TIME_STAMP=%s" >>${TARGET_DIR}/usr/lib/os-release if grep -q fpv_defconfig ${BR2_CONFIG}; then echo "BUILD_OPTION=fpv" >>${TARGET_DIR}/usr/lib/os-release