From acd9981b4ef750544202df9d9e2d0143a6dfd478 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 24 Jun 2023 19:06:42 +0200 Subject: [PATCH 01/19] odhcpd: bump to latest git HEAD 5211264 odhcpd: add support for dhcpv6_pd_min_len parameter c6bff6f router: Add PREF64 (RFC 8781) support Signed-off-by: Christian Marangi --- package/network/services/odhcpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index c471c7c75d..0eadcc9a5d 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git -PKG_MIRROR_HASH:=c2851b577d1ee632c902eca1864444fa22cad98956bfa852019e6d621c0f8d2a -PKG_SOURCE_DATE:=2023-04-05 -PKG_SOURCE_VERSION:=40ab806bf4c8698ac925d094ce11ce1d57ae2e46 +PKG_MIRROR_HASH:=e2e00e2bb6b7bacda5dcb713e4f9a4b1e316d75b140a4aa77145471bf6fe5c17 +PKG_SOURCE_DATE:=2023-06-24 +PKG_SOURCE_VERSION:=52112643308bb02a3b4fa2894dd7d4340ba4a237 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 From 38cc09165fd11caa9599d960280bd91dbaba7a62 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 19 Jun 2023 13:55:32 +0200 Subject: [PATCH 02/19] CI: migrate each workflow to use reusable workflow from dedicated repo Migrate each workflow to use reusable workflow from dedicated repo to skip pushing CI related commits to openwrt and better track versioning of CI workflow. Signed-off-by: Christian Marangi --- .github/workflows/coverity.yml | 51 +------ .github/workflows/kernel.yml | 121 +--------------- .github/workflows/label-kernel.yml | 119 +-------------- .github/workflows/label-target.yml | 32 +---- .github/workflows/packages.yml | 46 +----- .github/workflows/push-containers.yml | 199 +------------------------- .github/workflows/toolchain.yml | 50 +------ .github/workflows/tools.yml | 74 +--------- 8 files changed, 22 insertions(+), 670 deletions(-) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 72f39a729b..f54695986d 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -16,53 +16,4 @@ jobs: contents: read packages: read actions: write - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: x86 - subtarget: 64 - build_full: true - include_feeds: true - use_ccache_cache: false - coverity_compiler_template_list: >- - x86_64-openwrt-linux-gcc - x86_64-openwrt-linux-musl-gcc - # qosify fails to build with cov-build - coverity_check_packages: >- - cgi-io - dnsmasq - dropbear - firewall - fstools - fwtool - iwinfo - jsonfilter - libnl-tiny - libubox - mtd - netifd - odhcp6c - odhcpd - opkg - procd - relayd - rpcd - swconfig - ubox - ubus - ucert - uci - uclient - ucode - ugps - uhttpd - umbim - umdns - unetd - uqmi - urngd - usbmode - usign - usteer - ustp - ustream-ssl + uses: openwrt/actions-shared-workflows/.github/workflows/coverity.yml@main diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 3aa46f5cd7..87b8a14293 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -28,128 +28,13 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }} - targets: ${{ steps.find_targets.outputs.targets }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - - - name: Set targets - id: find_targets - run: | - ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)" - CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')" - - TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')" - TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')" - - # On testing non-specific target, skip testing each subtarget if we are testing pr - if [ ${{ github.event_name }} != 'push' ]; then - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic; then - TARGETS_SUBTARGETS=$TARGETS - fi - fi - - JSON_TARGETS_SUBTARGETS='[' - FIRST=1 - for TARGET in $TARGETS_SUBTARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' - - JSON_TARGETS='[' - FIRST=1 - for TARGET in $TARGETS; do - if echo "$CHANGED_FILES" | grep -v -q target/linux || - echo "$CHANGED_FILES" | grep -q target/linux/generic || - echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS""$TUPLE" - FIRST=0 - fi - done - JSON_TARGETS="$JSON_TARGETS"']' - - echo -e "\n---- targets to build ----\n" - echo "$JSON_TARGETS_SUBTARGETS" - echo -e "\n---- targets to build ----\n" - - echo -e "\n---- targets to check patch ----\n" - echo "$JSON_TARGETS" - echo -e "\n---- targets to check patch ----\n" - - echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT - echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT - - build: - name: Build Kernel with external toolchain - needs: determine_targets + build-kernels: + name: Build all affected Kernels permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} - - check-kernel-patches: - name: Check Kernel patches - needs: determine_targets - permissions: - contents: read - packages: read - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets)}} - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - - upload-ccache-cache-in-s3: - if: github.event_name == 'push' && github.repository_owner == 'openwrt' - name: Upload ccache cache to s3 - needs: [determine_targets, build] - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}} secrets: s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} - uses: ./.github/workflows/upload-file-s3.yml - with: - endpoint: https://storage.googleapis.com - bucket: openwrt-ci-cache - download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache - filename: ccache-kernel-${{ matrix.target }}-${{ matrix.subtarget }}.tar + uses: openwrt/actions-shared-workflows/.github/workflows/kernel.yml@main diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml index eab79cf0c0..655d7d6ff3 100644 --- a/.github/workflows/label-kernel.yml +++ b/.github/workflows/label-kernel.yml @@ -7,123 +7,10 @@ on: - labeled jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:kernel:') - name: Set target - runs-on: ubuntu-latest - outputs: - targets_subtargets: ${{ steps.set_target.outputs.targets_subtargets }} - targets: ${{ steps.set_target.outputs.targets }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Parse label - id: parse_label - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT - - - name: Set targets - id: set_target - run: | - ALL_TARGETS="$(perl ./scripts/dump-target-info.pl kernels 2>/dev/null)" - - TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1)" - TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1)" - - [ "${{ steps.parse_label.outputs.subtarget }}" = "first" ] && TARGETS_SUBTARGETS=$TARGETS - - JSON_TARGETS_SUBTARGETS='[' - FIRST=1 - while IFS= read -r line; do - TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) - TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) - SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) - - [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != "$TARGET" ] && continue - [ "${{ steps.parse_label.outputs.subtarget }}" != "all" ] && [ "${{ steps.parse_label.outputs.subtarget }}" != "first" ] && - [ "${{ steps.parse_label.outputs.subtarget }}" != $SUBTARGET ] && continue - if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then - TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) - [ -z "$TESTING_KERNEL_VER" ] && continue - fi - - TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"',' - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE" - FIRST=0 - done <<< "$TARGETS_SUBTARGETS" - JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']' - - JSON_TARGETS='[' - FIRST=1 - while IFS= read -r line; do - TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1) - TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1) - SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2) - - [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != $TARGET ] && continue - if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then - TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3) - [ -z "$TESTING_KERNEL_VER" ] && continue - fi - - TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}' - [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"',' - JSON_TARGETS="$JSON_TARGETS""$TUPLE" - FIRST=0 - done <<< "$TARGETS" - JSON_TARGETS="$JSON_TARGETS"']' - - echo -e "\n---- targets to build ----\n" - echo "$JSON_TARGETS_SUBTARGETS" - echo -e "\n---- targets to build ----\n" - - echo -e "\n---- targets to check patch ----\n" - echo "$JSON_TARGETS" - echo -e "\n---- targets to check patch ----\n" - - echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT - echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT - - build_kernel: - name: Build Kernel with external toolchain - needs: set_target + build-kernels-label: + name: Build all affected Kernels from defined label permissions: contents: read packages: read actions: write - uses: ./.github/workflows/build.yml - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.set_target.outputs.targets_subtargets)}} - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - testing: ${{ matrix.testing != '' && true }} - build_kernel: true - build_all_kmods: true - - check-kernel-patches: - name: Check Kernel patches - needs: set_target - permissions: - contents: read - packages: read - actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.set_target.outputs.targets)}} - uses: ./.github/workflows/check-kernel-patches.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - testing: ${{ matrix.testing != '' && true }} + uses: openwrt/actions-shared-workflows/.github/workflows/label-kernel.yml@main diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml index 610aab026a..989ee9fcb4 100644 --- a/.github/workflows/label-target.yml +++ b/.github/workflows/label-target.yml @@ -7,36 +7,10 @@ on: - labeled jobs: - set_target: - if: startsWith(github.event.label.name, 'ci:target:') - name: Set target - runs-on: ubuntu-latest - outputs: - target: ${{ steps.set_target.outputs.target }} - subtarget: ${{ steps.set_target.outputs.subtarget }} - - steps: - - name: Set target - id: set_target - env: - CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} - run: | - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT - echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT - - build_target: - name: Build target - needs: set_target + build-target-label: + name: Build target from defined label permissions: contents: read packages: read actions: write - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ needs.set_target.outputs.target }} - subtarget: ${{ needs.set_target.outputs.subtarget }} - build_full: true - build_all_kmods: true - build_all_boards: true - build_all_modules: true + uses: openwrt/actions-shared-workflows/.github/workflows/label-target.yml@main diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index fe2898cacd..07621dcb4a 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -3,7 +3,6 @@ name: Build all core packages on: pull_request: paths: - - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -12,7 +11,6 @@ on: - 'toolchain/**' push: paths: - - '.github/workflows/build.yml' - '.github/workflows/packages.yml' - 'config/**' - 'include/**' @@ -30,51 +28,13 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - build: - name: Build Packages with external toolchain + build-packages: + name: Build all core packages for selected target permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: - - target: malta - subtarget: be - - target: x86 - subtarget: 64 - uses: ./.github/workflows/build.yml - with: - container_name: toolchain - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_kernel: true - build_all_kmods: true - build_all_modules: true - build_full: true - ccache_type: packages - upload_ccache_cache: ${{ github.repository_owner == 'openwrt' }} - - upload-ccache-cache-in-s3: - if: github.event_name == 'push' && github.repository_owner == 'openwrt' - name: Upload ccache cache to s3 - needs: build - strategy: - fail-fast: False - matrix: - include: - - target: malta - subtarget: be - - target: x86 - subtarget: 64 secrets: s3_access_key: ${{ secrets.GCS_S3_ACCESS_KEY }} s3_secret_key: ${{ secrets.GCS_S3_SECRET_KEY }} - uses: ./.github/workflows/upload-file-s3.yml - with: - endpoint: https://storage.googleapis.com - bucket: openwrt-ci-cache - download_id: ${{ matrix.target }}-${{ matrix.subtarget }}-ccache-cache - filename: ccache-packages-${{ matrix.target }}-${{ matrix.subtarget }}.tar - + uses: openwrt/actions-shared-workflows/.github/workflows/packages.yml@main diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 1678c5ad4f..5b5140961c 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -5,13 +5,8 @@ on: paths: - 'include/version.mk' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/push-containers.yml' - - '.github/workflows/Dockerfile.tools' - 'toolchain/**' - - '.github/workflows/build.yml' - - '.github/workflows/toolchain.yml' - - '.github/workflows/Dockerfile.toolchain' branches-ignore: - master @@ -23,198 +18,10 @@ concurrency: cancel-in-progress: true jobs: - determine-container-info: - name: Determine needed info to push containers - if: ${{ github.repository_owner == 'openwrt' }} - runs-on: ubuntu-latest - outputs: - owner-lc: ${{ steps.generate-owner-lc.outputs.owner-lc }} - container-tag: ${{ steps.determine-container-tag.outputs.container-tag }} - - steps: - - name: Set lower case owner name - id: generate-owner-lc - env: - OWNER: ${{ github.repository_owner }} - run: | - echo "owner-lc=${OWNER,,}" >> "$GITHUB_OUTPUT" - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] - # will refresh the tools container with the matching tag. - # (example branch openwrt-22.03 -> tools:openwrt-22.03) - # (example branch openwrt-22.03-test -> tools:openwrt-22.03) - - name: Determine tools container tag - id: determine-container-tag - run: | - CONTAINER_TAG=latest - - if [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - echo "Container tag to push for tools and toolchain is $CONTAINER_TAG" - echo "container-tag=$CONTAINER_TAG" >> "$GITHUB_OUTPUT" - - build-linux-buildbot: - name: Build tools with buildbot container - if: ${{ github.repository_owner == 'openwrt' }} - uses: ./.github/workflows/build-tools.yml - with: - generate_prebuilt_artifacts: true - - push-tools-container: - needs: [ determine-container-info, build-linux-buildbot ] - if: ${{ github.repository_owner == 'openwrt' }} - name: Push prebuilt tools container - runs-on: ubuntu-latest - + build-push-containers: + name: Build and Push all prebuilt containers permissions: contents: read packages: write - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: 'openwrt' - - - name: Download prebuilt tools from build job - uses: actions/download-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt - - - name: Extract prebuild tools - working-directory: openwrt - run: tar -xf tools.tar - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: openwrt - push: true - tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/tools:${{ needs.determine-container-info.outputs.container-tag }} - file: openwrt/.github/workflows/Dockerfile.tools - - determine-targets: - name: Set targets - if: ${{ github.repository_owner == 'openwrt' }} - runs-on: ubuntu-latest - outputs: - target: ${{ steps.find_targets.outputs.target }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set targets - id: find_targets - run: | - export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ - | awk '{ print $1 }')" - - JSON='[' - FIRST=1 - for TARGET in $TARGETS; do - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON="$JSON"',' - JSON="$JSON""$TUPLE" - FIRST=0 - done - JSON="$JSON"']' - - echo -e "\n---- targets ----\n" - echo "$JSON" - echo -e "\n---- targets ----\n" - - echo "target=$JSON" >> $GITHUB_OUTPUT - - build: - name: Build Target Toolchain - if: ${{ github.repository_owner == 'openwrt' }} - needs: [ determine-targets, push-tools-container ] - permissions: - contents: read - packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine-targets.outputs.target)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_toolchain: true - build_external_toolchain: true - upload_external_toolchain: true - - push-toolchain-container: - name: Push Target Toolchain container - if: ${{ github.repository_owner == 'openwrt' }} - needs: [ determine-container-info, determine-targets, build ] - runs-on: ubuntu-latest - - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine-targets.outputs.target)}} - - permissions: - contents: read - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: 'openwrt' - - - name: Download external toolchain from build job - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.target }}-${{ matrix.subtarget }}-external-toolchain - path: openwrt - - - name: Find external toolchain name - id: get-toolchain-name - working-directory: openwrt - run: | - TOOLCHAIN_NAME=$(ls | grep toolchain-${{ matrix.target }}-${{ matrix.subtarget }}) - echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: openwrt - push: true - tags: ghcr.io/${{ needs.determine-container-info.outputs.owner-lc }}/toolchain:${{ matrix.target }}-${{ matrix.subtarget }}-${{ needs.determine-container-info.outputs.container-tag }} - file: openwrt/.github/workflows/Dockerfile.toolchain - build-args: | - OWNER_LC=${{ needs.determine-container-info.outputs.owner-lc }} - CONTAINER_TAG=${{ needs.determine-container-info.outputs.container-tag }} - TOOLCHAIN_NAME=${{ steps.get-toolchain-name.outputs.toolchain-name }} + uses: openwrt/actions-shared-workflows/.github/workflows/push-containers.yml@main diff --git a/.github/workflows/toolchain.yml b/.github/workflows/toolchain.yml index 4f4d78f4f8..0bc9fec179 100644 --- a/.github/workflows/toolchain.yml +++ b/.github/workflows/toolchain.yml @@ -3,12 +3,10 @@ name: Build Toolchains on: pull_request: paths: - - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - 'toolchain/**' push: paths: - - '.github/workflows/build.yml' - '.github/workflows/toolchain.yml' - 'toolchain/**' branches-ignore: @@ -22,52 +20,10 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - determine_targets: - name: Set targets - runs-on: ubuntu-latest - outputs: - target: ${{ steps.find_targets.outputs.target }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set targets - id: find_targets - run: | - export TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null \ - | sort -u -t '/' -k1,1 \ - | awk '{ print $1 }')" - - JSON='[' - FIRST=1 - for TARGET in $TARGETS; do - TUPLE='{"target":"'"$(echo $TARGET | cut -d "/" -f 1)"'","subtarget":"'"$(echo $TARGET | cut -d "/" -f 2)"'"}' - [[ $FIRST -ne 1 ]] && JSON="$JSON"',' - JSON="$JSON""$TUPLE" - FIRST=0 - done - JSON="$JSON"']' - - echo -e "\n---- targets ----\n" - echo "$JSON" - echo -e "\n---- targets ----\n" - - echo "target=$JSON" >> $GITHUB_OUTPUT - - build: - name: Build Target Toolchain - needs: determine_targets + build-toolchains: + name: Build Toolchains for each target permissions: contents: read packages: read actions: write - strategy: - fail-fast: False - matrix: - include: ${{fromJson(needs.determine_targets.outputs.target)}} - uses: ./.github/workflows/build.yml - with: - target: ${{ matrix.target }} - subtarget: ${{ matrix.subtarget }} - build_toolchain: true + uses: openwrt/actions-shared-workflows/.github/workflows/toolchain.yml@main diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 83bf5e98f5..35904a5e56 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -5,13 +5,11 @@ on: paths: - 'include/**' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' push: paths: - 'include/**' - 'tools/**' - - '.github/workflows/build-tools.yml' - '.github/workflows/tools.yml' branches-ignore: - master @@ -24,72 +22,6 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - build-macos-latest: - name: Build tools with macos latest - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Setup MacOS - run: | - echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV" - hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage - hdiutil attach OpenWrt.sparseimage - mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/ - - - name: Install required prereq on MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: | - brew install \ - automake \ - coreutils \ - diffutils \ - findutils \ - gawk \ - git-extras \ - gnu-getopt \ - gnu-sed \ - grep \ - make - - echo "/bin" >> "$GITHUB_PATH" - echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH" - echo "/usr/bin" >> "$GITHUB_PATH" - echo "/usr/local/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH" - echo "/usr/sbin" >> "$GITHUB_PATH" - - - name: Make prereq - working-directory: ${{ env.WORKPATH }}/openwrt - run: make defconfig - - - name: Build tools MacOS - working-directory: ${{ env.WORKPATH }}/openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-logs - path: ${{ env.WORKPATH }}/openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: macos-latest-config - path: ${{ env.WORKPATH }}/openwrt/.config - - build-linux-buildbot: - name: Build tools with buildbot container - uses: ./.github/workflows/build-tools.yml + build-tools: + name: Build host tools for linux and macos based systems + uses: openwrt/actions-shared-workflows/.github/workflows/tools.yml@main From 14293dd901e5fdb0fd242945b5916ccbb33ab328 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 19 Jun 2023 13:39:42 +0200 Subject: [PATCH 03/19] CI: drop unused reusable workflow and dockerfiles Drop unused reusable workflow and dockerfiles now that we moved them to a dedicated repository. Signed-off-by: Christian Marangi --- .github/workflows/Dockerfile.toolchain | 8 - .github/workflows/Dockerfile.tools | 4 - .github/workflows/build-tools.yml | 73 --- .github/workflows/build.yml | 575 --------------------- .github/workflows/check-kernel-patches.yml | 155 ------ .github/workflows/upload-file-s3.yml | 46 -- 6 files changed, 861 deletions(-) delete mode 100644 .github/workflows/Dockerfile.toolchain delete mode 100644 .github/workflows/Dockerfile.tools delete mode 100644 .github/workflows/build-tools.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/check-kernel-patches.yml delete mode 100644 .github/workflows/upload-file-s3.yml diff --git a/.github/workflows/Dockerfile.toolchain b/.github/workflows/Dockerfile.toolchain deleted file mode 100644 index 949bc2bb5c..0000000000 --- a/.github/workflows/Dockerfile.toolchain +++ /dev/null @@ -1,8 +0,0 @@ -ARG OWNER_LC -ARG CONTAINER_TAG - -FROM ghcr.io/$OWNER_LC/tools:$CONTAINER_TAG - -ARG TOOLCHAIN_NAME - -ADD $TOOLCHAIN_NAME /external-toolchain/ diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools deleted file mode 100644 index 5d365fc56d..0000000000 --- a/.github/workflows/Dockerfile.tools +++ /dev/null @@ -1,4 +0,0 @@ -FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 - -COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host -COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml deleted file mode 100644 index 0212925c50..0000000000 --- a/.github/workflows/build-tools.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Build host tools - -on: - workflow_call: - inputs: - generate_prebuilt_artifacts: - type: boolean - -permissions: - contents: read - -jobs: - build: - name: Build tools - runs-on: ubuntu-latest - container: ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v6 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: chown -R buildbot:buildbot openwrt - - - name: Set configs for tools container - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - touch .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - echo CONFIG_BUILD_ALL_HOST_TOOLS=y >> .config - - - name: Make prereq - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-logs - path: openwrt/logs - - - name: Upload config - if: always() - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-config - path: openwrt/.config - - - name: Archive prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: tar -cf tools.tar staging_dir/host build_dir/host - - - name: Upload prebuilt tools - if: inputs.generate_prebuilt_artifacts == true - uses: actions/upload-artifact@v3 - with: - name: linux-buildbot-prebuilt-tools - path: openwrt/tools.tar - retention-days: 1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 367a43383b..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,575 +0,0 @@ -name: Build sub target - -on: - workflow_call: - secrets: - coverity_api_token: - inputs: - container_name: - type: string - default: tools - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - build_toolchain: - type: boolean - include_feeds: - type: boolean - build_full: - type: boolean - build_kernel: - type: boolean - build_all_modules: - type: boolean - build_all_kmods: - type: boolean - build_all_boards: - type: boolean - use_openwrt_container: - type: boolean - default: true - coverity_project_name: - type: string - default: OpenWrt - coverity_check_packages: - type: string - coverity_compiler_template_list: - type: string - default: >- - arm-openwrt-linux-gcc - coverity_force_compile_packages: - type: string - default: >- - curl - libnl - mbedtls - wolfssl - openssl - build_external_toolchain: - type: boolean - upload_external_toolchain: - type: boolean - use_ccache_cache: - type: boolean - default: true - ccache_type: - type: string - default: kernel - upload_ccache_cache: - type: boolean - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }} - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - container_name: ${{ steps.determine_tools_container.outputs.container_name }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_NAME=${{ inputs.container_name }} - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - if [ "$CONTAINER_NAME" = "toolchain" ]; then - GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - GHCR_HEADER="Authorization: Bearer ${GHCR_TOKEN}" - GHCR_MANIFEST_LINK=https://ghcr.io/v2/${{ steps.lower_owner.outputs.owner_lc }}/${{ inputs.container_name }}/manifests/${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" - # Check if container exist - if [ $(curl -s -o /dev/null -w "%{http_code}" -H "$GHCR_HEADER" -I "$GHCR_MANIFEST_LINK") = 200 ]; then - CONTAINER_TAG=${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG" - else - CONTAINER_NAME=tools - fi - fi - - echo "Tools container to use $CONTAINER_NAME:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT - - build: - name: Build ${{ inputs.target }}/${{ inputs.subtarget }} - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ needs.setup_build.outputs.container_name }}:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - actions: write - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Checkout packages feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/packages - path: openwrt/feeds/packages - - - name: Checkout luci feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/luci - path: openwrt/feeds/luci - - - name: Checkout routing feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/routing - path: openwrt/feeds/routing - - - name: Checkout telephony feed - if: inputs.include_feeds == true - uses: actions/checkout@v3 - with: - repository: openwrt/telephony - path: openwrt/feeds/telephony - - - name: Parse toolchain file - if: inputs.build_toolchain == false - id: parse-toolchain - working-directory: openwrt - run: | - if [ -d /external-toolchain/ ]; then - echo "toolchain-type=external_container" >> $GITHUB_OUTPUT - exit 0 - fi - - TOOLCHAIN_PATH=snapshots - - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')" - fi - elif [ "${{ github.ref_type }}" = "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')" - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')" - fi - elif [ "${{ github.ref_type }}" = "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - - if [ -n "$major_ver" ]; then - git fetch --tags -f - latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" - if [ -n "$latest_tag" ]; then - TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') - fi - fi - - SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums" - if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') - - echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT - elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then - TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")" - TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p') - - echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT - else - echo "toolchain-type=internal" >> $GITHUB_OUTPUT - fi - - echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" - echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV" - - - name: Download and extract ccache cache from s3 - id: restore-ccache-cache-s3 - if: inputs.use_ccache_cache == true - working-directory: openwrt - run: | - ENDPOINT=https://storage.googleapis.com - BUCKET=openwrt-ci-cache - CCACHE_TAR=ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar - - if curl -o /dev/null -s --head --fail $ENDPOINT/$BUCKET/$CCACHE_TAR; then - wget -O - $ENDPOINT/$BUCKET/$CCACHE_TAR | tar -xf - - echo "cache-hit=true" >> $GITHUB_OUTPUT - fi - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - mkdir -p staging_dir build_dir - ln -s /prebuilt_tools/staging_dir/host staging_dir/host - ln -s /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Update & Install feeds - if: inputs.include_feeds == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - ./scripts/feeds update -a - ./scripts/feeds install -a - - - name: Restore ccache cache - id: restore-ccache-cache - if: inputs.use_ccache_cache == true && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: actions/cache/restore@v3 - with: - path: openwrt/.ccache - key: ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }} - restore-keys: | - ccache-${{ inputs.ccache_type }}-${{ inputs.target }}/${{ inputs.subtarget }}- - - - name: Import GPG keys - shell: su buildbot -c "sh -e {0}" - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' - run: gpg --receive-keys 0xCD84BCED626471F1 0x1D53D1877742E911 0xCD54E82DADB3684D - - - name: Download external toolchain/sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums.asc - wget https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums - gpg --with-fingerprint --verify sha256sums.asc - sha256sum --check --ignore-missing sha256sums - tar --xz -xf ${{ env.TOOLCHAIN_FILE }}.tar.xz - rm ${{ env.TOOLCHAIN_FILE }}.tar.xz sha256sums - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure all kernel modules - if: inputs.build_all_kmods == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - - - name: Configure all modules - if: inputs.build_all_modules == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL=y >> .config - - - name: Configure all boards - if: inputs.build_all_boards == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TARGET_MULTI_PROFILE=y >> .config - echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config - echo CONFIG_TARGET_ALL_PROFILES=y >> .config - - # ccache for some reason have problem detecting compiler type - # with external toolchain. This cause the complete malfunction - # of ccache with the result of tons of unsupported compiler - # option error. - # To fix this force compiler type to gcc. - - name: Configure ccache and apply fixes - if: inputs.use_ccache_cache == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - env: - SYSTEM_CCACHE_CONF: staging_dir/host/etc/ccache.conf - run: | - touch $SYSTEM_CCACHE_CONF - - echo compiler_type=gcc >> $SYSTEM_CCACHE_CONF - - echo CONFIG_CCACHE=y >> .config - - - name: Configure external toolchain in container - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Configure external toolchain - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) - TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin - OPENWRT_DIR=$(pwd) - - # Find target name from toolchain info.mk - GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') - - cd $TOOLCHAIN_BIN - - # Revert sdk wrapper scripts applied to all the bins - for app in $(find . -name "*.bin"); do - TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') - rm $TARGET_APP - mv .$TARGET_APP.bin $TARGET_APP - done - - # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build - cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh - for app in cc gcc g++ c++ cpp ld as ; do - [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin - ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app - done - - - name: Configure external toolchain with sdk - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - ./scripts/ext-toolchain.sh \ - --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \ - --overwrite-config \ - --config ${{ inputs.target }}/${{ inputs.subtarget }} - - - name: Configure internal toolchain - if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Show configuration - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/diffconfig.sh - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build toolchain - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build Kernel Kmods - if: inputs.build_kernel == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build everything - if: inputs.build_full == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Build external toolchain - if: inputs.build_external_toolchain == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Coverity prepare toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz - wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5 - echo ' coverity.tar.gz' >> coverity.tar.gz.md5 - md5sum -c coverity.tar.gz.md5 - - mkdir cov-analysis-linux64 - tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64 - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - - for template in ${{ inputs.coverity_compiler_template_list }}; do - cov-configure --template --comptype gcc --compiler "$template" - done - - - name: Clean and recompile packages with Coverity toolchain - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "bash {0}" - working-directory: openwrt - run: | - set -o pipefail -o errexit - - coverity_check_packages=(${{ inputs.coverity_check_packages }}) - printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }}) - printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}" - make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}" - export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH - cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Upload build to Coverity for analysis - if: inputs.coverity_check_packages != '' - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - tar czf cov-int.tar.gz ./cov-int - curl \ - --form token="${{ secrets.coverity_api_token }}" \ - --form email="contact@openwrt.org" \ - --form file=@cov-int.tar.gz \ - --form version="${{ github.ref_name }}-${{ github.sha }}" \ - --form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \ - "https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}" - - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs - path: "openwrt/logs" - - - name: Delete already present ccache cache - if: steps.restore-ccache-cache.outputs.cache-hit == 'true' && inputs.use_ccache_cache == true && - github.event_name == 'push' && steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: octokit/request-action@v2.x - with: - route: DELETE /repos/{repository}/actions/caches?key={key} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - INPUT_REPOSITORY: ${{ github.repository }} - INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - - - name: Save ccache cache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - steps.restore-ccache-cache-s3.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - path: openwrt/.ccache - key: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }} - - - name: Archive ccache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - inputs.upload_ccache_cache == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: tar -cf ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar .ccache - - - name: Upload ccache cache - if: inputs.use_ccache_cache == true && github.event_name == 'push' && - inputs.upload_ccache_cache == true - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-ccache-cache - path: openwrt/ccache-${{ inputs.ccache_type }}-${{ inputs.target }}-${{ inputs.subtarget }}.tar - retention-days: 1 - - - name: Find external toolchain name - id: get-toolchain-name - if: inputs.upload_external_toolchain == true - working-directory: openwrt - run: | - TOOLCHAIN_NAME=$(ls bin/targets/${{inputs.target }}/${{ inputs.subtarget }} | grep toolchain) - echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT - - - name: Upload prebuilt toolchain - if: inputs.upload_external_toolchain == true - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain - path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }} - retention-days: 1 diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml deleted file mode 100644 index 1ab4a361f5..0000000000 --- a/.github/workflows/check-kernel-patches.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Refresh kernel for target - -on: - workflow_call: - inputs: - target: - required: true - type: string - subtarget: - required: true - type: string - testing: - type: boolean - use_openwrt_container: - type: boolean - default: true - -permissions: - contents: read - -jobs: - setup_build: - name: Setup build - runs-on: ubuntu-latest - outputs: - owner_lc: ${{ steps.lower_owner.outputs.owner_lc }} - container_tag: ${{ steps.determine_tools_container.outputs.container_tag }} - - steps: - - name: Set lower case owner name - id: lower_owner - run: | - OWNER_LC=$(echo "${{ github.repository_owner }}" \ - | tr '[:upper:]' '[:lower:]') - - if [ ${{ inputs.use_openwrt_container }} == "true" ]; then - OWNER_LC=openwrt - fi - - echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - - # Per branch tools container tag - # By default stick to latest - # For official test targetting openwrt stable branch - # Get the branch or parse the tag and push dedicated tools containers - # For local test to use the correct container for stable release testing - # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]- - - name: Determine tools container tag - id: determine_tools_container - run: | - CONTAINER_TAG=latest - if [ -n "${{ github.base_ref }}" ]; then - if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG="${{ github.base_ref }}" - fi - elif [ ${{ github.ref_type }} == "branch" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then - CONTAINER_TAG=${{ github.ref_name }} - elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then - CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')" - fi - elif [ ${{ github.ref_type }} == "tag" ]; then - if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then - CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')" - fi - fi - echo "Tools container to use tools:$CONTAINER_TAG" - echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT - - check-patch: - name: Check Kernel patches - needs: setup_build - runs-on: ubuntu-latest - - container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }} - - permissions: - contents: read - packages: read - - steps: - - name: Checkout master directory - uses: actions/checkout@v3 - with: - path: openwrt - - - name: Fix permission - run: | - chown -R buildbot:buildbot openwrt - - - name: Prepare prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - mkdir -p staging_dir build_dir - ln -sf /prebuilt_tools/staging_dir/host staging_dir/host - ln -sf /prebuilt_tools/build_dir/host build_dir/host - - ./scripts/ext-tools.sh --refresh - - - name: Configure testing kernel - if: inputs.testing == true - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_TESTING_KERNEL=y >> .config - - - name: Configure system - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - echo CONFIG_ALL_KMODS=y >> .config - echo CONFIG_DEVEL=y >> .config - echo CONFIG_AUTOREMOVE=y >> .config - echo CONFIG_CCACHE=y >> .config - - echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config - echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config - - make defconfig - - - name: Build tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh - - - name: Refresh Kernel patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: make target/linux/refresh V=s - - - name: Validate Refreshed Kernel Patches - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: | - . .github/workflows/scripts/ci_helpers.sh - - if git diff --name-only --exit-code; then - success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok" - else - err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)" - err "You can also check the provided artifacts with the refreshed patch from this CI run." - mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - for f in $(git diff --name-only); do - cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/ - done - exit 1 - fi - - - name: Upload Refreshed Patches - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed - path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed diff --git a/.github/workflows/upload-file-s3.yml b/.github/workflows/upload-file-s3.yml deleted file mode 100644 index 6bcb172468..0000000000 --- a/.github/workflows/upload-file-s3.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Upload File to S3 - -on: - workflow_call: - secrets: - s3_access_key: - s3_secret_key: - inputs: - endpoint: - required: true - type: string - bucket: - required: true - type: string - download_id: - required: true - type: string - filename: - required: true - type: string - -jobs: - upload-file-in-s3: - name: Upload file in S3 - runs-on: ubuntu-latest - - steps: - - name: Install minio - run: | - curl https://dl.min.io/client/mc/release/linux-amd64/mc \ - --create-dirs \ - -o $GITHUB_WORKSPACE/minio-binaries/mc - - chmod +x $GITHUB_WORKSPACE/minio-binaries/mc - echo $GITHUB_WORKSPACE/minio-binaries/ >> $GITHUB_PATH - - - name: Setup minio - run: mc alias set s3 ${{ inputs.endpoint }} ${{ secrets.s3_access_key }} ${{ secrets.s3_secret_key }} - - - name: Download file - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.download_id }} - - - name: Upload file to s3 - run: mc cp ${{ inputs.filename }} s3/${{ inputs.bucket }}/ From c71dada92654a53c63bbc5bebcc40fe924750ed7 Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Wed, 21 Jun 2023 21:53:07 +0200 Subject: [PATCH 04/19] ramips: fix lan leds for Wavlink WL-WN535K1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously both lan1 and lan2 leds were wrongly labelled as lan2. Moreover they were connected to the wrong lan port. Fixes 8fde82095ba0 ("ramips: add support for Wavlink WL-WN535K1") Reported-by: Nicolò Maria Semprini Signed-off-by: Davide Fioravanti --- target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts | 4 ++-- target/linux/ramips/mt7620/base-files/etc/board.d/01_leds | 4 ++-- target/linux/ramips/mt7620/base-files/etc/board.d/02_network | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts index 67a7d8d488..bbb3e01add 100644 --- a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn535k1.dts @@ -48,12 +48,12 @@ lan1 { label = "green:lan1"; - gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; }; lan2 { label = "green:lan2"; - gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; }; wan { diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 2deda0861a..6a097ab8e3 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -219,8 +219,8 @@ tplink,re200-v1) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; wavlink,wl-wn535k1) - ucidef_set_led_switch "lan1" "lan2" "green:lan1" "switch0" "0x04" - ucidef_set_led_switch "lan2" "lan2" "green:lan2" "switch0" "0x20" + ucidef_set_led_switch "lan1" "lan1" "green:lan1" "switch0" "0x20" + ucidef_set_led_switch "lan2" "lan2" "green:lan2" "switch0" "0x04" ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" ;; wavlink,wl-wn579x3) diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 787e123e31..e571dc1f6f 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -235,7 +235,7 @@ ramips_setup_interfaces() ;; wavlink,wl-wn535k1) ucidef_add_switch "switch0" \ - "2:lan" "5:lan" "4:wan" "6@eth0" + "2:lan:2" "5:lan:1" "4:wan" "6@eth0" ;; wavlink,wl-wn579x3) ucidef_add_switch "switch0" \ From f1136fe1fd3e7539c4efb035efeffe77500dd9c0 Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Thu, 22 Jun 2023 00:33:16 +0200 Subject: [PATCH 05/19] bcm53xx: add Wavlink Quantum DAX/WL-WN538A8 as alt name As already documented in the wiki (https://openwrt.org/toh/wavlink/quantum_dax_wn538a8), this router is based on the Phicomm K3. Just the flashing method is different Signed-off-by: Davide Fioravanti --- target/linux/bcm53xx/image/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index defa68e59f..b1eb4277b7 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -461,6 +461,10 @@ TARGET_DEVICES += smartrg_sr400ac define Device/phicomm_k3 DEVICE_VENDOR := PHICOMM DEVICE_MODEL := K3 + DEVICE_ALT0_VENDOR := Wavlink + DEVICE_ALT0_MODEL := QUANTUM DAX + DEVICE_ALT1_VENDOR := Wavlink + DEVICE_ALT1_MODEL := WL-WN538A8 DEVICE_PACKAGES := $(BRCMFMAC_4366C0) $(USB3_PACKAGES) IMAGES := trx endef From b308bd50efaadd2fdfa58123b0e25896478c882b Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Mon, 19 Jun 2023 08:24:31 +0200 Subject: [PATCH 06/19] kernel: migrate FORCE_MAX_ZONEORDER to ARCH_FORCE_MAX_ORDER for 6.1 The flag FORCE_MAX_ZONEORDER was renamed to ARCH_FORCE_MAX_ORDER in Kernel 6.1 [1]. Rename the flag in generic Kconfig and remove it from target configs. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0192445cb2f7ed1cd7a95a0fc8c7645480baba25 Signed-off-by: Stefan Kalscheuer --- target/linux/apm821xx/config-6.1 | 1 - target/linux/armsr/config-6.1 | 1 - target/linux/bcm27xx/bcm2708/config-6.1 | 1 - target/linux/bcm27xx/bcm2709/config-6.1 | 1 - target/linux/bcm27xx/bcm2710/config-6.1 | 1 - target/linux/bcm27xx/bcm2711/config-6.1 | 1 - target/linux/bmips/bcm6318/config-6.1 | 1 - target/linux/bmips/bcm63268/config-6.1 | 1 - target/linux/bmips/bcm6328/config-6.1 | 1 - target/linux/bmips/bcm6358/config-6.1 | 1 - target/linux/bmips/bcm6362/config-6.1 | 1 - target/linux/bmips/bcm6368/config-6.1 | 1 - target/linux/gemini/config-6.1 | 1 - target/linux/generic/config-6.1 | 2 +- target/linux/ipq806x/config-6.1 | 1 - target/linux/malta/config-6.1 | 1 - target/linux/qualcommax/config-6.1 | 1 - target/linux/rockchip/armv8/config-6.1 | 1 - 18 files changed, 1 insertion(+), 18 deletions(-) diff --git a/target/linux/apm821xx/config-6.1 b/target/linux/apm821xx/config-6.1 index 9e51e94a2f..2979312101 100644 --- a/target/linux/apm821xx/config-6.1 +++ b/target/linux/apm821xx/config-6.1 @@ -10,7 +10,6 @@ CONFIG_APM821xx=y # CONFIG_ARCHES is not set CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y diff --git a/target/linux/armsr/config-6.1 b/target/linux/armsr/config-6.1 index a48af89b87..46483152d0 100644 --- a/target/linux/armsr/config-6.1 +++ b/target/linux/armsr/config-6.1 @@ -39,7 +39,6 @@ CONFIG_ACPI_THERMAL=y # CONFIG_ACPI_TINY_POWER_BUTTON is not set # CONFIG_ALIBABA_UNCORE_DRW_PMU is not set CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y diff --git a/target/linux/bcm27xx/bcm2708/config-6.1 b/target/linux/bcm27xx/bcm2708/config-6.1 index edf74c4fad..e1942be1f9 100644 --- a/target/linux/bcm27xx/bcm2708/config-6.1 +++ b/target/linux/bcm27xx/bcm2708/config-6.1 @@ -4,7 +4,6 @@ CONFIG_APERTURE_HELPERS=y CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM2835=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y diff --git a/target/linux/bcm27xx/bcm2709/config-6.1 b/target/linux/bcm27xx/bcm2709/config-6.1 index 4f9be6d371..0e5824011c 100644 --- a/target/linux/bcm27xx/bcm2709/config-6.1 +++ b/target/linux/bcm27xx/bcm2709/config-6.1 @@ -5,7 +5,6 @@ CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_BCM=y CONFIG_ARCH_BCM2835=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y diff --git a/target/linux/bcm27xx/bcm2710/config-6.1 b/target/linux/bcm27xx/bcm2710/config-6.1 index 295b665589..0782618e7c 100644 --- a/target/linux/bcm27xx/bcm2710/config-6.1 +++ b/target/linux/bcm27xx/bcm2710/config-6.1 @@ -6,7 +6,6 @@ CONFIG_ARCH_BCM2835=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y diff --git a/target/linux/bcm27xx/bcm2711/config-6.1 b/target/linux/bcm27xx/bcm2711/config-6.1 index 6642a88142..eea6beac3d 100644 --- a/target/linux/bcm27xx/bcm2711/config-6.1 +++ b/target/linux/bcm27xx/bcm2711/config-6.1 @@ -6,7 +6,6 @@ CONFIG_ARCH_BCM2835=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y diff --git a/target/linux/bmips/bcm6318/config-6.1 b/target/linux/bmips/bcm6318/config-6.1 index 4f54ce5533..526319da33 100644 --- a/target/linux/bmips/bcm6318/config-6.1 +++ b/target/linux/bmips/bcm6318/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/bmips/bcm63268/config-6.1 b/target/linux/bmips/bcm63268/config-6.1 index 2ed4eba2f6..624c00556d 100644 --- a/target/linux/bmips/bcm63268/config-6.1 +++ b/target/linux/bmips/bcm63268/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/bmips/bcm6328/config-6.1 b/target/linux/bmips/bcm6328/config-6.1 index 85d5578b8e..5b33e93236 100644 --- a/target/linux/bmips/bcm6328/config-6.1 +++ b/target/linux/bmips/bcm6328/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/bmips/bcm6358/config-6.1 b/target/linux/bmips/bcm6358/config-6.1 index 1d95a92cbc..8ca1ca3af5 100644 --- a/target/linux/bmips/bcm6358/config-6.1 +++ b/target/linux/bmips/bcm6358/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/bmips/bcm6362/config-6.1 b/target/linux/bmips/bcm6362/config-6.1 index b51f7e4166..dba808dfb2 100644 --- a/target/linux/bmips/bcm6362/config-6.1 +++ b/target/linux/bmips/bcm6362/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/bmips/bcm6368/config-6.1 b/target/linux/bmips/bcm6368/config-6.1 index 6fd4fe03bb..13915425d8 100644 --- a/target/linux/bmips/bcm6368/config-6.1 +++ b/target/linux/bmips/bcm6368/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 diff --git a/target/linux/gemini/config-6.1 b/target/linux/gemini/config-6.1 index 41f7093c1c..a4f2cba851 100644 --- a/target/linux/gemini/config-6.1 +++ b/target/linux/gemini/config-6.1 @@ -1,7 +1,6 @@ CONFIG_ALIGNMENT_TRAP=y CONFIG_AMBA_PL08X=y CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_GEMINI=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y diff --git a/target/linux/generic/config-6.1 b/target/linux/generic/config-6.1 index 6252e66896..956738afe8 100644 --- a/target/linux/generic/config-6.1 +++ b/target/linux/generic/config-6.1 @@ -239,6 +239,7 @@ CONFIG_ARCH_BINFMT_ELF_STATE=y # CONFIG_ARCH_EXYNOS is not set CONFIG_ARCH_FLATMEM_ENABLE=y # CONFIG_ARCH_FOOTBRIDGE is not set +CONFIG_ARCH_FORCE_MAX_ORDER=11 # CONFIG_ARCH_GEMINI is not set # CONFIG_ARCH_HI3xxx is not set # CONFIG_ARCH_HIGHBANK is not set @@ -2160,7 +2161,6 @@ CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_FONT_6x8 is not set # CONFIG_FONT_TER16x32 is not set # CONFIG_FORCEDETH is not set -CONFIG_FORCE_MAX_ZONEORDER=11 # CONFIG_FORCE_NR_CPUS is not set CONFIG_FORTIFY_SOURCE=y # CONFIG_FPGA is not set diff --git a/target/linux/ipq806x/config-6.1 b/target/linux/ipq806x/config-6.1 index 559de1cf48..b30a635396 100644 --- a/target/linux/ipq806x/config-6.1 +++ b/target/linux/ipq806x/config-6.1 @@ -3,7 +3,6 @@ CONFIG_ALIGNMENT_TRAP=y # CONFIG_APQ_MMCC_8084 is not set CONFIG_AR8216_PHY=y CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y # CONFIG_ARCH_IPQ40XX is not set CONFIG_ARCH_IPQ806X=y diff --git a/target/linux/malta/config-6.1 b/target/linux/malta/config-6.1 index 9411879835..8ab648069d 100644 --- a/target/linux/malta/config-6.1 +++ b/target/linux/malta/config-6.1 @@ -1,5 +1,4 @@ CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y diff --git a/target/linux/qualcommax/config-6.1 b/target/linux/qualcommax/config-6.1 index 2fa4aa30bb..ec44e936b4 100644 --- a/target/linux/qualcommax/config-6.1 +++ b/target/linux/qualcommax/config-6.1 @@ -4,7 +4,6 @@ CONFIG_64BIT=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y diff --git a/target/linux/rockchip/armv8/config-6.1 b/target/linux/rockchip/armv8/config-6.1 index 4d747537e2..e21de9a348 100644 --- a/target/linux/rockchip/armv8/config-6.1 +++ b/target/linux/rockchip/armv8/config-6.1 @@ -2,7 +2,6 @@ CONFIG_64BIT=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y From 9d64cc068fbb15d9e6498c1eba79851823b2f4f5 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Wed, 21 Jun 2023 02:30:20 +0200 Subject: [PATCH 07/19] ipq40xx: meraki-mr33, meraki-mr74: disable image generation After migrating to kernel 5.15, upgrading causes the units to become soft-bricked, hanging forever at the kernel startup. Kernel size limitation of 4000000 bytes is suspected here, but this is not fully confirmed. Disable the images to protect users from inadvertent bricking of units, because recovery of those is painful with Cisco's U-boot, until the root cause is found and fixed. Signed-off-by: Lech Perczak --- target/linux/ipq40xx/image/generic.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 59d4f082ff..671fca1682 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -764,6 +764,7 @@ define Device/meraki_mr33 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct + DEFAULT := n endef TARGET_DEVICES += meraki_mr33 @@ -776,6 +777,7 @@ define Device/meraki_mr74 PAGESIZE := 2048 DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct DEVICE_DTS_CONFIG := config@3 + DEFAULT := n endef TARGET_DEVICES += meraki_mr74 From e4fe3097ef6a961874b66932a0ac4be18070630a Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Sat, 13 May 2023 13:51:45 +0000 Subject: [PATCH 08/19] mediatek: add support for Mercusys MR90X v1 This commit adds support for Mercusys MR90X(EU) v1 router. Device specification -------------------- SoC Type: MediaTek MT7986BLA, Cortex-A53, 64-bit RAM: MediaTek MT7986BLA (512MB) Flash: SPI NAND GigaDevice GD5F1GQ5UEYIGY (128 MB) Ethernet: MediaTek MT7531AE + 2.5GbE MaxLinear GPY211C0VC (SLNW8) Ethernet: 1x2.5Gbe (WAN/LAN 2.5Gbps), 3xGbE (WAN/LAN 1Gbps, LAN1, LAN2) WLAN 2g: MediaTek MT7975N, b/g/n/ax, MIMO 4x4 WLAN 5g: MediaTek MT7975P(N), a/n/ac/ax, MIMO 4x4 LEDs: 1 orange and 1 green status LEDs, 4 green gpio-controlled LEDs on ethernet ports Button: 1 (Reset) USB ports: No Power: 12 VDC, 2 A Connector: Barrel Bootloader: Main U-Boot - U-Boot 2022.01-rc4. Additionally, both UBI slots contain "seconduboot" (also U-Boot 2022.01-rc4) Serial console (UART) --------------------- V +-------+-------+-------+-------+ | +3.3V | GND | TX | RX | +---+---+-------+-------+-------+ | +--- Don't connect The R3 (TX line) and R6 (RX line) are absent on the PCB. You should solder them or solder the jumpers. Installation (UART) ------------------- 1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2 2. Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C' 3. Load and run OpenWrt initramfs image: tftpboot initramfs-kernel.bin bootm 4. Once inside OpenWrt, set / update env variables: fw_setenv baudrate 115200 fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit" fw_setenv fdtcontroladdr 5ffc0e70 fw_setenv ipaddr 192.168.1.1 fw_setenv loadaddr 0x46000000 fw_setenv mtdids "spi-nand0=spi-nand0" fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)" fw_setenv netmask 255.255.255.0 fw_setenv serverip 192.168.1.2 fw_setenv stderr serial@11002000 fw_setenv stdin serial@11002000 fw_setenv stdout serial@11002000 fw_setenv tp_boot_idx 0 5. Run 'sysupgrade -n' with the sysupgrade OpenWrt image Installation (without UART) --------------------------- 1. Login as root via SSH (router IP, port 20001, password - your web interface password) 2. Open for editing /etc/hotplug.d/iface/65-iptv (e.g., using WinSCP and SSH settings from the p.1) 3. Add a newline after "#!/bin/sh": telnetd -l /bin/login.sh 4. Save "65-iptv" file 5. Toggle "IPTV/VLAN Enable" checkbox in the router web interface and save 6. Make sure that telnetd is running: netstat -ltunp | grep 23 7. Login via telnet to router IP, port 23 (no username and password are required) 8 Upload OpenWrt "initramfs-kernel.bin" to the "/tmp" folder of the router (e.g., using WinSCP and SSH settings from the p.1) 9. Stock busybox doesn't contain ubiupdatevol command. Hence, we need to download and upload the full version of busybox to the router. For example, from here: https://github.com/xerta555/Busybox-Binaries/raw/master/busybox-arm64 Upload busybox-arm64 to the /tmp dir of the router and run: in the telnet shell: cd /tmp chmod a+x busybox-arm64 10. Check "initramfs-kernel.bin" size: du -h initramfs-kernel.bin 11. Delete old and create new "kernel" volume with appropriate size (greater than "initramfs-kernel.bin" size): ubirmvol /dev/ubi0 -N kernel ubimkvol /dev/ubi0 -n 1 -N kernel -s 9MiB 12. Write OpenWrt "initramfs-kernel.bin" to the flash: ./busybox-arm64 ubiupdatevol /dev/ubi0_1 /tmp/initramfs-kernel.bin 13. u-boot-env can be empty so lets create it (or overwrite it if it already exists) with the necessary values: fw_setenv baudrate 115200 fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit" fw_setenv fdtcontroladdr 5ffc0e70 fw_setenv ipaddr 192.168.1.1 fw_setenv loadaddr 0x46000000 fw_setenv mtdids "spi-nand0=spi-nand0" fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)" fw_setenv netmask 255.255.255.0 fw_setenv serverip 192.168.1.2 fw_setenv stderr serial@11002000 fw_setenv stdin serial@11002000 fw_setenv stdout serial@11002000 fw_setenv tp_boot_idx 0 14. Reboot to OpenWrt initramfs: reboot 15. Login as root via SSH (IP 192.168.1.1, port 22) 16. Upload OpenWrt sysupgrade.bin image to the /tmp dir of the router 17. Run sysupgrade: sysupgrade -n /tmp/sysupgrade.bin Recovery -------- 1. Press Reset button and power on the router 2. Navigate to U-Boot recovery web server (http://192.168.1.1/) and upload the OEM firmware Recovery (UART) --------------- 1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2 2. Attach UART, switch on the router and interrupt the boot process by pressing 'Ctrl-C' 3. Load and run OpenWrt initramfs image: tftpboot initramfs-kernel.bin bootm 4. Do what you need (restore partitions from a backup, install OpenWrt etc.) Stock layout ------------ 0x000000000000-0x000000200000 : "boot" 0x000000200000-0x000000300000 : "u-boot-env" 0x000000300000-0x000003500000 : "ubi0" 0x000003500000-0x000006700000 : "ubi1" 0x000006700000-0x000006f00000 : "userconfig" 0x000006f00000-0x000007300000 : "tp_data" ubi0/ubi1 format ---------------- U-Boot at boot checks that all volumes are in place: +-------------------------------+ | Volume Name: uboot Vol ID: 0| | Volume Name: kernel Vol ID: 1| | Volume Name: rootfs Vol ID: 2| +-------------------------------+ MAC addresses ------------- +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | label | 00:eb:xx:xx:xx:be | label | | LAN | 00:eb:xx:xx:xx:be | label | | WAN | 00:eb:xx:xx:xx:bf | label+1 | | WLAN 2g | 00:eb:xx:xx:xx:be | label | | WLAN 5g | 00:eb:xx:xx:xx:bd | label-1 | +---------+-------------------+-----------+ label MAC address was found in UBI partition "tp_data", file "default-mac". OEM wireless eeprom is also there (file "MT7986_EEPROM.bin"). Signed-off-by: Mikhail Zhilkin --- .../uboot-envtools/files/mediatek_filogic | 4 + .../dts/mt7986b-mercusys-mr90x-v1.dts | 276 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 6 + .../filogic/base-files/etc/board.d/02_network | 7 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 5 + .../base-files/lib/preinit/09_mount_cfg_part | 23 ++ .../base-files/lib/preinit/10_fix_eth_mac.sh | 6 + .../base-files/lib/preinit/81_fix_eeprom | 16 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 14 + 10 files changed, 361 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part create mode 100644 target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 881d0c4501..7918bdacfc 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -40,6 +40,10 @@ bananapi,bpi-r3) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; +mercusys,mr90x-v1) + local envdev=/dev/mtd$(find_mtd_index "u-boot-env") + ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" + ;; netgear,wax220) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x20000" "0x20000" ;; diff --git a/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts new file mode 100644 index 0000000000..8b8858ccef --- /dev/null +++ b/target/linux/mediatek/dts/mt7986b-mercusys-mr90x-v1.dts @@ -0,0 +1,276 @@ +// SPDX-License-Identifier: (GL-2.0 OR MIT) + +/dts-v1/; +#include +#include + +#include "mt7986b.dtsi" + +/ { + compatible = "mercusys,mr90x-v1", "mediatek,mt7986b"; + model = "Mercusys MR90X v1"; + + aliases { + serial0 = &uart0; + + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x20000000>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + label = "green:lan2"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "green:lan1"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led-2 { + label = "green:lan0"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-3 { + label = "green:wan"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led-4 { + label = "orange:status"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: led-5 { + label = "green:status"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-handle = <&phy6>; + phy-mode = "2500base-x"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + #address-cells = <1>; + #size-cells = <0>; + + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-delay-us = <1500000>; + reset-post-delay-us = <1000000>; + + /* WAN/LAN 2.5Gbps phy + MaxLinear GPY211C0VC (SLNW8) */ + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + }; + + switch: switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* WAN/LAN 1Gbps port */ + port@0 { + reg = <0>; + label = "lan0"; + }; + + /* LAN1 port */ + port@1 { + reg = <1>; + label = "lan1"; + }; + + /* LAN2 port */ + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <20000000>; + spi-tx-buswidth = <4>; + spi-rx-buswidth = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "boot"; + reg = <0x0 0x200000>; + read-only; + }; + + partition@200000 { + label = "u-boot-env"; + reg = <0x200000 0x100000>; + }; + + partition@300000 { + label = "ubi0"; + reg = <0x300000 0x3200000>; + }; + + partition@3500000 { + label = "ubi1"; + reg = <0x3500000 0x3200000>; + read-only; + }; + + partition@6700000 { + label = "userconfig"; + reg = <0x6700000 0x800000>; + read-only; + }; + + partition@6f00000 { + label = "tp_data"; + reg = <0x6f00000 0x400000>; + read-only; + }; + }; + }; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 0ba825fd2b..c81bd2cd97 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -9,6 +9,12 @@ case $board in cudy,wr3000-v1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; +mercusys,mr90x-v1) + ucidef_set_led_netdev "lan0" "lan0" "green:lan0" "lan0" "link tx rx" + ucidef_set_led_netdev "lan1" "lan2" "green:lan1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "lan2" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "green:wan" "eth1" "link tx rx" + ;; netgear,wax220) ucidef_set_led_netdev "eth0" "LAN" "green:lan" "eth0" ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy0-ap0" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 8803326b27..c05c5d25e4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -32,6 +32,9 @@ mediatek_setup_interfaces() mediatek,mt7988a-dsa-10g-spim-snand) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "eth1 eth2" ;; + mercusys,mr90x-v1) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 + ;; qihoo,360t7) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ;; @@ -69,6 +72,10 @@ mediatek_setup_macs() bananapi,bpi-r3) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + mercusys,mr90x-v1) + label_mac=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + lan_mac=$label_mac + ;; netgear,wax220) lan_mac=$(mtd_get_mac_ascii u-boot-env mac) label_mac=$lan_mac diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3969a7bfe4..4b7047eec5 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -32,6 +32,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress ;; + mercusys,mr90x-v1) + addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr -1 > /sys${DEVPATH}/macaddress + ;; netgear,wax220) hw_mac_addr=$(mtd_get_mac_ascii u-boot-env mac) [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part new file mode 100644 index 0000000000..819df40d08 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part @@ -0,0 +1,23 @@ +. /lib/functions/system.sh + +mount_ubi_part() { + local part_name="$1" + local mtd_num=$(grep $part_name /proc/mtd | cut -c4) + local ubi_num=$(ubiattach -m $mtd_num | \ + awk -F',' '/UBI device number [0-9]{1,}/{print $1}' | \ + awk '{print $4}') + mkdir /tmp/$part_name + mount -r -t ubifs ubi$ubi_num:$part_name /tmp/$part_name +} + +preinit_mount_cfg_part() { + case $(board_name) in + mercusys,mr90x-v1) + mount_ubi_part "tp_data" + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main preinit_mount_cfg_part diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index ec078741c9..cfddd9cedc 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -8,6 +8,12 @@ preinit_set_mac_address() { ip link set dev eth0 address "$addr" ip link set dev eth1 address "$addr" ;; + mercusys,mr90x-v1) + addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) + ip link set dev eth1 address "$(macaddr_add $addr 1)" + ;; + *) + ;; esac } diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom b/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom new file mode 100644 index 0000000000..0a842facca --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/81_fix_eeprom @@ -0,0 +1,16 @@ +. /lib/functions/system.sh + +preinit_fix_eeprom() { + case $(board_name) in + mercusys,mr90x-v1) + eeprom="/lib/firmware/mediatek/mt7986_eeprom_mt7975_dual.bin" + oem="/tmp/tp_data/MT7986_EEPROM.bin" + [ ! -L $eeprom -a -e $oem ] && \ + mv -f $eeprom $eeprom.bak && ln -s $oem $eeprom + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main preinit_fix_eeprom diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 5b624bc551..11c2c5c664 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -70,6 +70,10 @@ platform_do_upgrade() { cudy,wr3000-v1) default_do_upgrade "$1" ;; + mercusys,mr90x-v1) + CI_UBIPART="ubi0" + nand_do_upgrade "$1" + ;; qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ae25aee2ed..fd83b9d441 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -250,6 +250,20 @@ define Device/mediatek_mt7988a-rfb-nand endef TARGET_DEVICES += mediatek_mt7988a-rfb-nand +define Device/mercusys_mr90x-v1 + DEVICE_VENDOR := Mercusys + DEVICE_MODEL := MR90X v1 + DEVICE_DTS := mt7986b-mercusys-mr90x-v1 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 51200k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += mercusys_mr90x-v1 + define Device/qihoo_360t7 DEVICE_VENDOR := Qihoo DEVICE_MODEL := 360T7 From 906e2a1b994ed0d965ed582f188ab94eca988b87 Mon Sep 17 00:00:00 2001 From: Maximilian Martin Date: Tue, 13 Jun 2023 12:55:59 +0200 Subject: [PATCH 09/19] ath79: Add support for MOXA AWK-1137C Device specifications: ====================== * Qualcomm/Atheros AR9344 * 128 MB of RAM * 16 MB of SPI NOR flash * 2x 10/100 Mbps Ethernet * 2T2R 2.4/5 GHz Wi-Fi * 4x GPIO-LEDs (1x wifi, 2x ethernet, 1x power) * 1x GPIO-button (reset) * 2x fast ethernet - lan1 + builtin switch port 1 + used as WAN interface - lan2 + builtin switch port 2 + used as LAN interface * 9-30V DC * external antennas Flashing instructions: ====================== Log in to https://192.168.127.253/ Username: admin Password: moxa Open Maintenance > Firmware Upgrade and install the factory image. Serial console access: ====================== Connect a RS232-USB converter to the maintenance port. Pinout: (reset button left) [GND] [NC] [RX] [TX] Firmware Recovery: ================== When the WLAN and SYS LEDs are flashing, the device is in recovery mode. Serial console access is required to proceed with recovery. Download the original image from MOXA and rename it to 'awk-1137c.rom'. Set up a TFTP server at 192.168.127.1 and connect to a lan port. Follow the instructions on the serial console to start the recovery. Signed-off-by: Maximilian Martin --- include/image-commands.mk | 9 + package/boot/uboot-envtools/files/ath79 | 1 + scripts/moxa-encode-fw.py | 109 +++++++++++ .../linux/ath79/dts/ar9344_moxa_awk-1137c.dts | 184 ++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 4 + .../generic/base-files/etc/board.d/02_network | 8 +- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 + .../generic/base-files/etc/init.d/bootcount | 3 + .../base-files/lib/preinit/10_fix_eth_mac.sh | 3 + target/linux/ath79/image/generic.mk | 14 ++ 10 files changed, 338 insertions(+), 1 deletion(-) create mode 100755 scripts/moxa-encode-fw.py create mode 100644 target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts diff --git a/include/image-commands.mk b/include/image-commands.mk index 1d69485019..9220b8dec0 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -399,6 +399,15 @@ define Build/lzma-no-dict @mv $@.new $@ endef +define Build/moxa-encode-fw + $(TOPDIR)/scripts/moxa-encode-fw.py \ + --input $@ \ + --output $@ \ + --magic $(MOXA_MAGIC) \ + --hwid $(MOXA_HWID) \ + --buildid 00000000 +endef + define Build/netgear-chk $(STAGING_DIR_HOST)/bin/mkchkimg \ -o $@.new \ diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 5201b8b27a..e83703b035 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -47,6 +47,7 @@ etactica,eg200|\ glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ librerouter,librerouter-v1|\ +moxa,awk-1137c|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndr4300-v2|\ diff --git a/scripts/moxa-encode-fw.py b/scripts/moxa-encode-fw.py new file mode 100755 index 0000000000..48d139b839 --- /dev/null +++ b/scripts/moxa-encode-fw.py @@ -0,0 +1,109 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later + +import argparse +import struct + +from binascii import crc32 +from dataclasses import dataclass +from itertools import cycle +from typing import List + + +def xor(data: bytes) -> bytes: + passphrase = "Seek AGREEMENT for the date of completion.\0" + pw = cycle(bytearray(passphrase.encode('ascii'))) + return bytearray(b ^ next(pw) for b in data) + + +def add_fw_header(data: bytes, magic: int, hwid: int, build_id: int, + offsets: List[int]) -> bytes: + unknown_1 = 0x01 + unknown_2 = 0x0000 + unknown_3 = 0x00000000 + unknown_4 = 0x01000000 + file_crc = crc(data, 0) + + header_struct = struct.Struct('>QIBBHIIIIII' + 'I' * len(offsets)) + header_size = header_struct.size + file_size = header_size + len(data) + + header_offsets = map(lambda x: x + header_size, offsets) + + header_data = header_struct.pack(magic, file_size, unknown_1, len(offsets), + unknown_2, hwid, build_id, unknown_3, + build_id, unknown_4, *header_offsets, + file_crc) + return header_data + data + + +def add_file_header(data: bytes, filename: str, build_id: int) -> bytes: + unknown1 = 0x01000000 + unknown2 = 0x00000000 + file_crc = crc(data, 0) + + header_struct = struct.Struct(">16sIIIII") + file_size = header_struct.size + len(data) + + header_data = header_struct.pack(filename.encode('ascii'), file_size, + unknown1, build_id, unknown2, file_crc) + return header_data + data + + +def crc(data: bytes, init_val: int) -> int: + return 0xffffffff ^ (crc32(data, 0xffffffff ^ init_val)) + + +@dataclass +class Partition: + name: str + size: int + + +def main(): + partitions = [ + Partition(name='kernel', size=2048 * 1024), + Partition(name='root', size=9216 * 1024), + Partition(name='userdisk', size=3076 * 1024), + ] + + parser = argparse.ArgumentParser(prog='moxa-encode-fw', + description='MOXA IW firmware encoder') + parser.add_argument('-i', '--input', required=True, type=str, help='Firmware file') + parser.add_argument('-o', '--output', required=True, type=str, help="Output path for encoded firmware file") + parser.add_argument('-m', '--magic', required=True, type=lambda x: int(x,0), help="Magic for firmware header") + parser.add_argument('-d', '--hwid', required=True, type=lambda x: int(x,0), help="Hardware id of device") + parser.add_argument('-b', '--buildid', required=True, type=lambda x: int(x,0), help="Build id of firmware") + args = parser.parse_args() + + with open(args.input, 'rb') as input_file: + firmware = bytearray(input_file.read()) + + offsets = [] + pos_input = 0 + pos_output = 0 + firmware_seg = bytearray() + + for partition in partitions: + part_data = firmware[pos_input:pos_input + partition.size] + + # just to make sure that no partition is empty + if len(part_data) == 0: + part_data = bytearray([0x00]) + + header = add_file_header(part_data, partition.name, args.buildid) + firmware_seg += header + + offsets.append(pos_output) + pos_input += partition.size + pos_output += len(header) + + moxa_firmware = add_fw_header(firmware_seg, args.magic, args.hwid, args.buildid, offsets) + + encrypted = xor(moxa_firmware) + with open(args.output, 'wb') as output_file: + output_file.write(encrypted) + + +if __name__ == '__main__': + main() diff --git a/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts b/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts new file mode 100644 index 0000000000..d2c5171402 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_moxa_awk-1137c.dts @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include +#include + +/ { + compatible = "moxa,awk-1137c", "qca,ar9344"; + model = "MOXA AWK-1137C"; + + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + label-mac-device = ð1; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-names = "default"; + + led_status_green: led-0 { + label = "green:status"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <0>; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + + led_status_red: led-1 { + label = "red:status"; + color = ; + function = LED_FUNCTION_STATUS; + function-enumerator = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + led-2 { + label = "green:wifi"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-3 { + label = "green:lan1"; + color = ; + function = LED_FUNCTION_WAN; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led-4 { + label = "green:lan2"; + color = ; + function = LED_FUNCTION_LAN; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led-5 { + label = "yellow:wifi"; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0assoc"; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + label = "firmware"; + reg = <0x050000 0xe00000>; + compatible = "denx,uimage"; + }; + + partition@e50000 { + label = "log1"; + reg = <0xe50000 0x020000>; + read-only; + }; + + partition@e70000 { + label = "log2"; + reg = <0xe70000 0x020000>; + read-only; + }; + + partition@e90000 { + label = "version"; + reg = <0xe90000 0x020000>; + read-only; + }; + + partition@eb0000 { + label = "config1"; + reg = <0xeb0000 0x020000>; + read-only; + }; + + partition@ed0000 { + label = "config2"; + reg = <0xed0000 0x020000>; + read-only; + }; + + partition@ef0000 { + label = "config-data"; + reg = <0xef0000 0x0c0000>; + read-only; + }; + + partition@fb0000 { + label = "mib0"; + reg = <0xfb0000 0x030000>; + read-only; + }; + + art: partition@fe0000 { + label = "art"; + reg = <0xfe0000 0x010000>; + read-only; + }; + + partition@ff0000 { + label = "fis"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; + +ð1 { + status = "okay"; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 10c67991fd..65cf7b3292 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -302,6 +302,10 @@ tplink,cpe210-v3) meraki,mr16) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" ;; +moxa,awk-1137c) + ucidef_set_led_switch "wan" "LAN1" "green:lan1" "switch0" "0x02" + ucidef_set_led_switch "lan" "LAN2" "green:lan2" "switch0" "0x04" + ;; netgear,wnr2200-8m|\ netgear,wnr2200-16m) ucidef_set_led_netdev "wan-amber" "WAN (amber)" "amber:wan" "eth0" diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index d18eddf5b7..64869701c6 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -240,7 +240,8 @@ ath79_setup_interfaces() ubnt,routerstation) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; - comfast,cf-e375ac) + comfast,cf-e375ac|\ + moxa,awk-1137c) ucidef_add_switch "switch0" \ "0@eth0" "1:wan" "2:lan" ;; @@ -731,6 +732,11 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) label_mac=$lan_mac ;; + moxa,awk-1137c) + lan_mac=$(mtd_get_mac_ascii u-boot-env mac_addr) + wan_mac=$(mtd_get_mac_ascii u-boot-env mac_addr) + label_mac=$lan_mac + ;; nec,wf1200cr|\ nec,wg1200cr) lan_mac=$(mtd_get_mac_ascii devdata "lanmac") diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index c46573ece5..3b089885b3 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -62,6 +62,10 @@ case "$FIRMWARE" in caldata_extract "art" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr) ;; + moxa,awk-1137c) + caldata_extract "art" 0x1000 0x440 + ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env mac_addr) + ;; nec,wg800hp) caldata_extract "art" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_text board_data 0x680) diff --git a/target/linux/ath79/generic/base-files/etc/init.d/bootcount b/target/linux/ath79/generic/base-files/etc/init.d/bootcount index 7807559d81..01c446b1bb 100755 --- a/target/linux/ath79/generic/base-files/etc/init.d/bootcount +++ b/target/linux/ath79/generic/base-files/etc/init.d/bootcount @@ -8,6 +8,9 @@ boot() { adtran,bsap1840) fconfig -s -w -d $(find_mtd_part "RedBoot config") -n boot_cntb -x 0 ;; + moxa,awk-1137c) + fw_setenv fwr_verify 0 + ;; qihoo,c301) local n=$(fw_printenv activeregion | cut -d = -f 2) fw_setenv "image${n}trynum" 0 diff --git a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh index 5fa23e8eb6..8b39a17eb0 100644 --- a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -28,6 +28,9 @@ preinit_set_mac_address() { fortinet,fap-221-b) ip link set dev eth0 address $(mtd_get_mac_text u-boot 0x3ff80 12) ;; + moxa,awk-1137c) + ip link set dev eth0 address $(mtd_get_mac_ascii u-boot-env mac_addr) + ;; tplink,deco-s4-v2) base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) ip link set dev eth0 address $base_mac diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 1a558c30a0..6a2131f5ae 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -9,6 +9,7 @@ DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL +DEVICE_VARS += MOXA_MAGIC MOXA_HWID DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES @@ -1819,6 +1820,19 @@ define Device/mercury_mw4530r-v1 endef TARGET_DEVICES += mercury_mw4530r-v1 +define Device/moxa_awk-1137c + SOC := ar9344 + DEVICE_MODEL := AWK-1137C + DEVICE_VENDOR := MOXA + MOXA_MAGIC := 0x8919123028877702 + MOXA_HWID := 0x01080000 + IMAGE_SIZE := 14336k + DEVICE_PACKAGES := uboot-envtools + IMAGES += factory.rom + IMAGE/factory.rom := $$(IMAGE/sysupgrade.bin) | moxa-encode-fw +endef +TARGET_DEVICES += moxa_awk-1137c + define Device/nec_wx1200cr DEVICE_VENDOR := NEC IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs From 5d1cb52da062f75d34b77b7d02e5101ab13397ac Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 20 Jun 2023 14:29:57 +0800 Subject: [PATCH 10/19] arm-trusted-firmware-rockchip: Update to 2.9 Switch to standard TF-A build. Signed-off-by: Tianling Shen --- .../arm-trusted-firmware-rockchip/Makefile | 46 +++++++++---------- package/boot/uboot-rockchip/Makefile | 4 +- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/package/boot/arm-trusted-firmware-rockchip/Makefile b/package/boot/arm-trusted-firmware-rockchip/Makefile index b712a3530a..f5b9d6b16d 100644 --- a/package/boot/arm-trusted-firmware-rockchip/Makefile +++ b/package/boot/arm-trusted-firmware-rockchip/Makefile @@ -7,43 +7,39 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=arm-trusted-firmware-rockchip -PKG_VERSION:=2.3 +PKG_VERSION:=2.9 PKG_RELEASE:=1 -PKG_SOURCE:=atf-v$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/atf-builds/atf/releases/download/v$(PKG_VERSION)/atf-v$(PKG_VERSION).tar.gz? -PKG_HASH:=bf352298743aed594cf2958dd588e06ab6713fc514bb6f809bf55a85a87134c1 - -PKG_LICENSE:=BSD-3-Clause -PKG_LICENSE_FILES:=license.md +PKG_HASH:=76a66a1de0c01aeb83dfc7b72b51173fe62c6e51d6fca17cc562393117bed08b PKG_MAINTAINER:=Tobias Maedel -MAKE_PATH:=$(PKG_NAME) - +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/trusted-firmware-a.mk include $(INCLUDE_DIR)/package.mk -define Package/arm-trusted-firmware-rockchip - SECTION:=boot - CATEGORY:=Boot Loaders - TITLE:=ARM Trusted Firmware for Rockchip - DEPENDS:=@TARGET_rockchip_armv8 +define Trusted-Firmware-A/Default + NAME:=Rockchip $(1) SoCs + BUILD_TARGET:=rockchip endef -define Build/Prepare - $(TAR) -C $(PKG_BUILD_DIR) -xf $(DL_DIR)/$(PKG_SOURCE) +define Trusted-Firmware-A/rk3328 + BUILD_SUBTARGET:=armv8 + PLAT=rk3328 endef -define Build/Compile +define Trusted-Firmware-A/rk3399 + BUILD_SUBTARGET:=armv8 + PLAT:=rk3399 endef -define Build/InstallDev - $(INSTALL_DIR) -p $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/rk*.elf $(STAGING_DIR_IMAGE)/ +TFA_TARGETS:= \ + rk3328 \ + rk3399 + +define Package/trusted-firmware-a/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31/bl31.elf $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)_bl31.elf endef -define Package/arm-trusted-firmware-rockchip/install -endef - -$(eval $(call BuildPackage,arm-trusted-firmware-rockchip)) +$(eval $(call BuildPackage/Trusted-Firmware-A)) diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 59b8be84cf..983edcb240 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -26,7 +26,7 @@ endef define U-Boot/rk3328/Default BUILD_SUBTARGET:=armv8 - DEPENDS:=+PACKAGE_u-boot-$(1):arm-trusted-firmware-rockchip + DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3328 ATF:=rk3328_bl31.elf OF_PLATDATA:=$(1) endef @@ -70,7 +70,7 @@ endef define U-Boot/rk3399/Default BUILD_SUBTARGET:=armv8 - DEPENDS:=+PACKAGE_u-boot-$(1):arm-trusted-firmware-rockchip + DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3399 ATF:=rk3399_bl31.elf endef From e95c772894fbc69ea4574c047a22f57388465ccf Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Fri, 9 Jun 2023 08:52:32 -0300 Subject: [PATCH 11/19] ath79: 5.15: fix not exported sym ath79_pll_base ath79_pll_base was declared as extern but no code exported it. Anyone including arch/mips/include/asm/mach-ath79/ath79.h and compiled as a module would break with: ERROR: modpost: "ath79_pll_base" [drivers/net/ethernet/atheros/ag71xx/ag71xx.ko] undefined! Signed-off-by: Luiz Angelo Daros de Luca --- .../0041-MIPS-ath79-common-exports.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch diff --git a/target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch b/target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch new file mode 100644 index 0000000000..befcf2d50f --- /dev/null +++ b/target/linux/ath79/patches-5.15/0041-MIPS-ath79-common-exports.patch @@ -0,0 +1,26 @@ +From: Luiz Angelo Daros de Luca +Subject: [PATCH] ath79: export ath79_pll_base + +This symbol is declared as extern but nobody exported it. +Any module including arch/mips/include/asm/mach-ath79/ath79.h +will not build. Without this export, ag71xx.ko will not build +as a module and the build will fail like this: + +ERROR: modpost: "ath79_pll_base" [drivers/net/ethernet/atheros/ag71xx/ag71xx.ko] undefined! + +The ath79_pll_base symbol is accessed in the ath79_pll_wr() inline function. + +--- + arch/mips/ath79/common.c | 1 + + 1 file changed, 1 insertions(+) + +--- a/arch/mips/ath79/common.c ++++ b/arch/mips/ath79/common.c +@@ -34,6 +34,7 @@ unsigned int ath79_soc_rev; + EXPORT_SYMBOL_GPL(ath79_soc_rev); + + void __iomem *ath79_pll_base; ++EXPORT_SYMBOL_GPL(ath79_pll_base); + void __iomem *ath79_reset_base; + EXPORT_SYMBOL_GPL(ath79_reset_base); + void __iomem *ath79_ddr_base; From c6ef4170945c6ab5432382110389f31fea92a76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Thu, 15 Jun 2023 15:59:44 +0200 Subject: [PATCH 12/19] ath79: mikrotik: extract common bits for RB951x-2HnD devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mikrotik RouterBOARD 951Ui-2HnD and Mikrotik RouterBOARD RB951G-2HnD are very similar devices. Extract the DTS bits that are identical for these two boards to a separate DTSI file. Signed-off-by: Michał Kępień --- ...ar9344_mikrotik_routerboard-951ui-2hnd.dts | 81 +----------------- ...ar9344_mikrotik_routerboard-951x-2hnd.dtsi | 82 +++++++++++++++++++ 2 files changed, 83 insertions(+), 80 deletions(-) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts index 3d59a30f11..65003cb9a1 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951ui-2hnd.dts @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9344_mikrotik_routerboard.dtsi" +#include "ar9344_mikrotik_routerboard-951x-2hnd.dtsi" / { compatible = "mikrotik,routerboard-951ui-2hnd", "qca,ar9344"; @@ -59,77 +59,6 @@ }; }; -&gpio { - nand_power { - gpio-hog; - gpios = <14 GPIO_ACTIVE_LOW>; - output-high; - }; -}; - -&nand { - status = "okay"; - - nand-ecc-mode = "soft"; - qca,nand-swap-dma; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "booter"; - reg = <0x0000000 0x0040000>; - read-only; - }; - - partition@40000 { - label = "kernel"; - reg = <0x0040000 0x03c0000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x0400000 0x7c00000>; - }; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "mikrotik,routerboot-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "routerboot"; - reg = <0x0 0x0>; - read-only; - }; - - hard_config: hard_config { - read-only; - }; - - bios { - size = <0x1000>; - read-only; - }; - - soft_config { - }; - }; - }; -}; - ð0 { phy-handle = <&swphy4>; @@ -143,11 +72,3 @@ &wmac { qca,led-pin = /bits/ 8 <11>; }; - -&usb { - status = "okay"; -}; - -&usb_phy { - status = "okay"; -}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi new file mode 100644 index 0000000000..5d135f1ca6 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951x-2hnd.dtsi @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard.dtsi" + +&gpio { + nand_power { + gpio-hog; + gpios = <14 GPIO_ACTIVE_LOW>; + output-high; + }; +}; + +&nand { + status = "okay"; + + nand-ecc-mode = "soft"; + qca,nand-swap-dma; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0000000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + }; + }; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; From db02cecd6ad2e5962e6e9d8307da34855a083ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Sat, 17 Jun 2023 19:12:21 +0200 Subject: [PATCH 13/19] ath79: add support for MikroTik RB951G-2HnD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MikroTik RB951G-2HnD is a wireless SOHO router that was previously supported by the ar71xx target, see commit 7a709573d7 ("ar71xx: add kernel support for the Mikrotik RB951G board"). Specifications -------------- - SoC: Atheros AR9344 (600 MHz) - RAM: 128 MB (2x 64 MB) - Storage: 128 MB NAND flash (various manufacturers) - Ethernet: Atheros AR8327 switch, 5x 10/100/1000 Mbit/s - 1x PoE in (port 1, 8-30 V input) - Wireless: Atheros AR9340 (802.11b/g/n) - USB: 2.0 (1A) - 8x LED: - 1x power (green, not configurable) - 1x user (green, not configurable) - 5x GE ports (green, not configurable) - 1x wireless (green, not configurable) - 1x button (restart) Unlike on the RB951Ui-2HnD, none of the LEDs on this device seem to be GPIO-controllable, which was also the case for older OpenWRT versions that supported this board via a mach file. The Ethernet port LEDs are controlled by the switch chip. See https://mikrotik.com/product/RB951G-2HnD for more details. Flashing -------- TFTP boot initramfs image and then perform sysupgrade. Follow common MikroTik procedures at https://openwrt.org/toh/mikrotik/common. Signed-off-by: Michał Kępień --- .../ar9344_mikrotik_routerboard-951g-2hnd.dts | 58 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 +++ .../base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + .../base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 70 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts new file mode 100644 index 0000000000..16da7a3c95 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-951g-2hnd.dts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard-951x-2hnd.dtsi" + +/ { + compatible = "mikrotik,routerboard-951g-2hnd", "qca,ar9344"; + model = "Mikrotik RouterBOARD 951G-2HnD"; + + /delete-node/ aliases; + /delete-node/ leds; + + gpio-export { + compatible = "gpio-export"; + + gpio_usb_power { + gpio-export,name = "rb951g-2hnd:power:usb"; + gpio-export,output = <1>; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ref { + clock-frequency = <25000000>; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PAD0_MODE */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x6f000000 0x00000101 0x00001616>; + + phy-mode = "rgmii"; + phy-handle = <&phy0>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rxd-delay = <1>; + switch-only-mode = <1>; + }; +}; + +ð1 { + status = "disabled"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 3f65b35c8c..683e9a3330 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -48,6 +48,15 @@ define Device/mikrotik_routerboard-922uags-5hpacd endef TARGET_DEVICES += mikrotik_routerboard-922uags-5hpacd +define Device/mikrotik_routerboard-951g-2hnd + $(Device/mikrotik_nand) + SOC := ar9344 + DEVICE_MODEL := RouterBOARD 951G-2HnD + DEVICE_PACKAGES += kmod-usb-ohci kmod-usb2 + SUPPORTED_DEVICES += rb-951g-2hnd +endef +TARGET_DEVICES += mikrotik_routerboard-951g-2hnd + define Device/mikrotik_routerboard-951ui-2hnd $(Device/mikrotik_nand) SOC := ar9344 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index aba811fb2d..68c8cfb96e 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -35,6 +35,7 @@ ath79_setup_interfaces() mikrotik,routerboard-map-2nd) ucidef_set_interface_lan "eth0 eth1" ;; + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-962uigs-5hact2hnt) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index b23bd05bcd..cc05ba080b 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -46,6 +46,7 @@ case "$FIRMWARE" in mikrotik,routerboard-962uigs-5hact2hnt) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 7) ;; + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-951ui-2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" +11) ;; diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index cefbc5d334..e3887bfc50 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -33,6 +33,7 @@ platform_do_upgrade() { mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ + mikrotik,routerboard-951g-2hnd|\ mikrotik,routerboard-951ui-2hnd|\ mikrotik,routerboard-sxt-5nd-r2) platform_do_upgrade_mikrotik_nand "$1" From 8d06bc175154db42a0550212a4b8474008939b34 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 2 Mar 2023 21:45:50 +0100 Subject: [PATCH 14/19] ramips: add Edimax BR-6208AC V2 support Specifications: - Device: Edimax BR-6208AC V2 - SoC: MT7620A - Flash: 16 MiB - RAM: 64 MiB - Switch: 1 WAN, 3 LAN (10/100 Mbps) - WiFi: MT7620 2.4 GHz + MT7610E 5 GHz - LEDs: 1x POWER (green, not configurable) 1x Firmware (green, configurable) 1x Internet (green, configurable) 1x VPN (green, configurable) 1x 2.4G (green, not configurable) 1x 5G (green, not configurable) Normal installation: - Upload the sysupgrade image via the default web interface Installation with U-Boot and TFTP: - Requires a TFTP server which provides the sysupgrade image - Requires a connection to the serial port of the device, rate 57600 Signed-off-by: Stefan Weil --- .../dts/mt7620a_edimax_br-6208ac-v2.dts | 217 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 16 ++ .../mt7620/base-files/etc/board.d/01_leds | 7 + .../mt7620/base-files/etc/board.d/02_network | 5 + 4 files changed, 245 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_edimax_br-6208ac-v2.dts diff --git a/target/linux/ramips/dts/mt7620a_edimax_br-6208ac-v2.dts b/target/linux/ramips/dts/mt7620a_edimax_br-6208ac-v2.dts new file mode 100644 index 0000000000..5f1c01b35e --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_edimax_br-6208ac-v2.dts @@ -0,0 +1,217 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 Stefan Weil + */ + +#include "mt7620a.dtsi" + +#include +#include +#include +#include + +/ { + compatible = "edimax,br-6208ac-v2", "ralink,mt7620a-soc"; + model = "Edimax BR-6208AC v2"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_firmware; + }; + + keys { + compatible = "gpio-keys"; + + // Vendor firmware: /proc/RESET_BUTTON + reset_wps { + label = "reset_wps"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + // Vendor firmware: /proc/driver/led + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + // RALINK_REG_PIO3924DATA 39-24 + led_internet: internet { + label = "green:internet"; + color = ; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + // RALINK_REG_PIO7140DATA 44-40 + led_wlan_2_4ghz: wlan_2_4ghz { + label = "green:wlan2g"; + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + // RALINK_REG_PIO7140DATA 43-40 + led_wlan_5ghz: wlan_5ghz { + label = "green:wlan5g"; + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + // RALINK_REG_PIO7140DATA 42-40 + led_firmware: firmware { + label = "green:firmware"; + color = ; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + // default-state = "keep"; + }; + + // RALINK_REG_PIO7140DATA 41-40 + led_vpn: vpn { + label = "green:vpn"; + color = ; + gpios = <&gpio2 1 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gdma { + status = "okay"; +}; + +// Vendor firmware: RALINK_REG_PIO7140 - gpio0: gpio@600 +// Vendor firmware: RALINK_REG_PIO3924 - gpio1: gpio@638 +// Vendor firmware: RALINK_REG_PIO7140 - gpio2: gpio@660 +// Vendor firmware: RALINK_REG_PIO72 - gpio3: gpio@688 + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + // Vendor partitions: + // 0x000000000000-0x000000030000 : "Bootloader" + // 0x000000030000-0x000000040000 : "Config" + // 0x000000040000-0x000000050000 : "Factory" + // 0x000000050000-0x000000070000 : "Cimage" + // 0x000000070000-0x000000fe0000 : "Uimage" + // 0x000000070000-0x000000190000 : "Kernel" + // 0x000000190000-0x000000fe0000 : "RootFS" + // 0x000000fe0000-0x000001000000 : "FreeSpace" + + // Bootloader + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + // Config + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + // Factory + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + // Cimage + partition@50000 { + label = "cimage"; + reg = <0x50000 0x20000>; + read-only; + }; + + partition@70000 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,offset = ; + openwrt,partition-magic = ; + label = "firmware"; + reg = <0x00070000 0x00f70000>; + }; + + // FreeSpace + partition@fe0000 { + label = "freespace"; + reg = <0xfe0000 0x20000>; + read-only; + }; + }; + }; +}; + +&state_default { + gpio { + // TODO: "spi refclk"? + groups = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd"; + function = "gpio"; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_2e>; + nvmem-cell-names = "mac-address"; + + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_2e: macaddr@2e { + reg = <0x2e 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index bb06e0d6c8..cd7aea7388 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -380,6 +380,22 @@ define Device/dovado_tiny-ac endef TARGET_DEVICES += dovado_tiny-ac +define Device/edimax_br-6208ac-v2 + SOC := mt7620a + DEVICE_VENDOR := Edimax + DEVICE_MODEL := BR-6208AC + DEVICE_VARIANT := V2 + BLOCKSIZE := 64k + IMAGE_SIZE := 7744k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ + edimax-header -s CSYS -m RN71 -f 0x70000 -S 0x01100000 | pad-rootfs | \ + check-size | append-metadata + DEVICE_PACKAGES := kmod-mt76x2 kmod-mt76x0e kmod-phy-realtek \ + kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport \ + uboot-envtools +endef +TARGET_DEVICES += edimax_br-6208ac-v2 + define Device/edimax_br-6478ac-v2 SOC := mt7620a DEVICE_VENDOR := Edimax diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index 6a097ab8e3..af2f574aef 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -98,6 +98,13 @@ domywifi,dw22d) dovado,tiny-ac) ucidef_set_led_netdev "wifi_led" "wifi" "orange:wifi" "wlan0" ;; +edimax,br-6208ac-v2) + ucidef_set_led_netdev "wan" "Internet" "green:internet" "eth0.2" "tx rx" + ucidef_set_led_netdev "wifi_led" "WLAN 2.4 GHz" "green:wlan2g" "wlan1" + ucidef_set_led_netdev "wifi_led" "WLAN 5 GHz" "green:wlan5g" "wlan1" + ucidef_set_led_netdev "wifi_led" "Firmware" "green:firmware" "wlan1" + ucidef_set_led_netdev "lan" "VPN" "green:vpn" "switch0" "0x20" + ;; edimax,br-6478ac-v2|\ edimax,ew-7478apc) ucidef_set_led_netdev "wifi_led" "wifi" "blue:wlan" "wlan0" diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index e571dc1f6f..005b7212cb 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -142,6 +142,10 @@ ramips_setup_interfaces() "5:lan" "6@eth0" ucidef_add_switch_attr "switch1" "enable" "false" ;; + edimax,br-6208ac-v2) + ucidef_add_switch "switch0" \ + "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0" + ;; edimax,br-6478ac-v2|\ lb-link,bl-w1200|\ tplink,archer-c2-v1) @@ -273,6 +277,7 @@ ramips_setup_macs() asus,rt-n12p|\ asus,rt-n14u|\ bdcom,wap2100-sk|\ + edimax,br-6208ac-v2|\ edimax,ew-7478apc|\ fon,fon2601|\ head-weblink,hdrm200|\ From 9ffdaa7fa1478146b5d8c77d4b3a5d4d4007a487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Sun, 14 May 2023 16:39:15 +0200 Subject: [PATCH 15/19] ipq40xx: Enable gpio-restart in kernel configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some ZTE devices require the gpio-restart driver to support restarting the LTE modem along with OpenWrt Signed-off-by: Andreas Böhler --- target/linux/ipq40xx/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index d5bde55178..0acc013a81 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -376,6 +376,7 @@ CONFIG_PINCTRL_MSM=y # CONFIG_PINCTRL_SM8250 is not set CONFIG_PM_OPP=y CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_MSM=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y From f70ee53b08466f612546f699c556cbdaa39e1466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=B6hler?= Date: Wed, 7 Jun 2023 21:24:18 +0200 Subject: [PATCH 16/19] ipq4019: add support for ZTE MF287+ aka DreiNeo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ZTE MF287+ is a LTE router used (exclusively?) by the network operator "3". The MF287 (i.e. non-plus aka 3Neo) is also supported (the only difference is the LTE modem) Specifications ============== SoC: IPQ4018 RAM: 256MiB Flash: 8MiB SPI-NOR + 128MiB SPI-NAND LAN: 4x GBit LAN LTE: ZTE Cat12 (MF287+) / ZTE Cat6 (MF287) WiFi: 802.11a/b/g/n/ac SoC-integrated MAC addresses ============= LAN: from config + 2 WiFi 1: from config WiFi 2: from config + 1 Installation ============ Option 1 - TFTP --------------- TFTP installation using UART is preferred. Disassemble the device and connect serial. Put the initramfs image as openwrt.bin to your TFTP server and configure a static IP of 192.168.1.100. Load the initramfs image by typing: setenv serverip 192.168.1.100 setenv ipaddr 192.168.1.1 tftpboot 0x82000000 openwrt.bin bootm 0x82000000 From this intiramfs boot you can take a backup of the currently installed partitions as no vendor firmware is available for download: ubiattach -m14 cat /dev/ubi0_0 > /tmp/ubi0_0 cat /dev/ubi0_1 > /tmp/ubi0_1 Copy the files /tmp/ubi0_0 and /tmp/ubi0_1 somewhere save. Once booted, transfer the sysupgrade image and run sysupgrade. You might have to delete the stock volumes first: ubirmvol /dev/ubi0 -N ubi_rootfs ubirmvol /dev/ubi0 -N kernel Option 2 - From stock firmware ------------------------------ The installation from stock requires an exploit first. The exploit consists of a backup file that forces the firmware to download telnetd via TFTP from 192.168.0.22 and run it. Once exploited, you can connect via telnet and login as admin:admin. The exploit will be available at the device wiki page. Once inside the stock firmware, you can transfer the -factory.bin file to /tmp by using "scp" from the stock frmware or "tftp". ZTE has blocked writing to the NAND. Fortunately, it's easy to allow write access - you need to read from one file in /proc. Once done, you need to erase the UBI partition and flash OpenWrt. Before performing the operation, make sure that mtd13 is the partition labelled "rootfs" by calling "cat /proc/mtd". Complete commands: cd /tmp tftp -g -r factory.bin 192.168.0.22 cat /proc/driver/sensor_id flash_erase /dev/mtd13 0 0 dd if=/tmp/factory.bin of=/dev/mtdblock13 bs=131072 Afterwards, reboot your device and you should have a working OpenWrt installation. Restore Stock ============= Option 1 - via UART ------------------- Boot an OpenWrt initramfs image via TFTP as for the initial installation. Transfer the two backed-up files to your box to /tmp. Then, run the following commands - replace $kernel_length and $rootfs_size by the size of ubi0_0 and ubi0_1 in bytes. ubiattach -m 14 ubirmvol /dev/ubi0 -N kernel ubirmvol /dev/ubi0 -N rootfs ubirmvol /dev/ubi0 -N rootfs_data ubimkvol /dev/ubi0 -N kernel -s $kernel_length ubimkvol /dev/ubi0 -N ubi_rootfs -s $rootfs_size ubiupdatevol /dev/ubi0_0 /tmp/ubi0_0 ubiupdatevol /dev/ubi0_1 /tmp/ubi0_1 Option 2 - from within OpenWrt ------------------------------ This option requires to flash an initramfs version first so that access to the flash is possible. This can be achieved by sysupgrading to the recovery.bin version and rebooting. Once rebooted, you are again in a default OpenWrt installation, but no partition is mounted. Follow the commands from Option 1 to flash back to stock. LTE Modem ========= The LTE modem is similar to other ZTE devices and controls some more LEDs and battery management. Configuring the connection using uqmi works properly, the modem provides three serial ports and a QMI CDC ethernet interface. Signed-off-by: Andreas Böhler --- package/firmware/ipq-wifi/Makefile | 2 + .../ipq40xx/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 2 + .../arm/boot/dts/qcom-ipq4018-mf287plus.dts | 384 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 18 + 5 files changed, 410 insertions(+) create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 2bffd2a1b7..9b0d4c5c9f 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -40,6 +40,7 @@ ALLWIFIBOARDS:= \ wallys_dr40x9 \ xiaomi_ax3600 \ xiaomi_ax9000 \ + zte_mf287plus \ zyxel_nbg7815 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -126,6 +127,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) +$(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index b131d0d618..1a74fb792c 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -107,6 +107,10 @@ ipq40xx_setup_interfaces() zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; + zte,mf287plus) + ucidef_set_interface_lan "lan1 lan2 lan3 lan4" + ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" + ;; *) echo "Unsupported hardware. Network interfaces not initialized" ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 988921fa8c..e6e99b9d21 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -27,6 +27,7 @@ EOF ;; zte,mf18a |\ zte,mf286d |\ + zte,mf287plus |\ zte,mf289f) CI_UBIPART="rootfs" local mtdnum="$( find_mtd_index $CI_UBIPART )" @@ -208,6 +209,7 @@ platform_do_upgrade() { teltonika,rutx10 |\ zte,mf18a |\ zte,mf286d |\ + zte,mf287plus |\ zte,mf289f) CI_UBIPART="rootfs" nand_do_upgrade "$1" diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts new file mode 100644 index 0000000000..6c285f4b8a --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-mf287plus.dts @@ -0,0 +1,384 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022, Pawel Dembicki . +// Copyright (c) 2022, Giammarco Marzano . +// Copyright (c) 2023, Andreas Böhler + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + model = "ZTE MF287Plus"; + compatible = "zte,mf287plus"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + /* + * bootargs forced by u-boot bootipq command: + * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + /* + * This node is used to restart modem module to avoid anomalous + * behaviours on initial communication. + */ + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-0 { + label = "blue:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + }; + + key-wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + }; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + }; +}; + +&mdio { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, + <&tlmm 59 GPIO_ACTIVE_HIGH>, + <&tlmm 1 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; + + spi-nand@1 { /* flash@1 ? */ + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0x140000>; + read-only; + }; + + partition@140000 { + label = "ART"; + reg = <0x140000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@280000 { + label = "mac"; + reg = <0x280000 0x140000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@3c0000 { + label = "cfg-param"; + reg = <0x3c0000 0x600000>; + read-only; + }; + + partition@9c0000 { + label = "oops"; + reg = <0x9c0000 0x140000>; + }; + + partition@b00000 { + label = "web"; + reg = <0xb00000 0x800000>; + }; + + partition@1300000 { + label = "rootfs"; + reg = <0x1300000 0x2200000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; + + zigbee@2 { + #address-cells = <1>; + #size-cells = <0>; + + compatible = "silabs,em3581"; + reg = <2>; + spi-max-frequency = <12000000>; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&gmac { + status = "okay"; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; + mac-address-increment = <2>; +}; + +&switch { + status = "okay"; +}; + +&swport2 { + status = "okay"; + + label = "lan1"; +}; + +&swport3 { + status = "okay"; + + label = "lan2"; +}; + +&swport4 { + status = "okay"; + + label = "lan3"; +}; + +&swport5 { + status = "okay"; + + label = "lan4"; +}; + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio54", "gpio59", "gpio1"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; + +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; + mac-address-increment = <1>; + qcom,ath10k-calibration-variant = "zte,mf287plus"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 671fca1682..b9e9e478d9 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1148,6 +1148,24 @@ define Device/zte_mf286d endef TARGET_DEVICES += zte_mf286d +define Device/zte_mf287plus + $(call Device/zte_mf28x_common) + DEVICE_DTS_CONFIG := config@ap.dk01.1-c2 + DEVICE_MODEL := MF287Plus + DEVICE_ALT0_VENDOR := ZTE + DEVICE_ALT0_MODEL := MF287 + DEVICE_PACKAGES += ipq-wifi-zte_mf287plus + SOC := qcom-ipq4018 +# The recovery image is used to return back to stock (an initramfs-based image +# that can be flashed to the device via sysupgrade +# The factory image is used to install from the stock firmware by using an +# exploit for the web interface + IMAGES += factory.bin recovery.bin + IMAGE/factory.bin := append-ubi + IMAGE/recovery.bin := append-squashfs4-fakeroot | sysupgrade-tar kernel=$$$$(BIN_DIR)/openwrt-$$(BOARD)$$(if $$(SUBTARGET),-$$(SUBTARGET))-$$(DEVICE_NAME)-initramfs-zImage.itb rootfs=$$$$@ | append-metadata +endef +TARGET_DEVICES += zte_mf287plus + define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F From af0546da3440dba24217949527e503820350ff05 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 06:24:11 +0000 Subject: [PATCH 17/19] layerscape: armv8_64b: add Traverse Ten64 NAND variant The Ten64 board[1] is based around NXP's Layerscape LS1088A SoC. It is capable of booting both standard Linux distributions from disk devices, using EFI, and booting OpenWrt from NAND. See the online manual for more information, including the flash layout[2]. This patchset adds support for generating Ten64 images for NAND boot. For disk boot, one can use the EFI support that was recently added to the armvirt target. We previously supported NAND users by building inside our armvirt/EFI target[3], but this approach is not suitable for OpenWrt upstream. Users who used our supplied NAND images will be able to upgrade to this via sysupgrade. Signed-off-by: Mathew McBride [1] - https://www.traverse.com.au/hardware/ten64 [2] - https://ten64doc.traverse.com.au/hardware/flash/ [3] - Example: https://gitlab.com/traversetech/ls1088firmware/openwrt/-/commit/285e4360e1604eb466880d245d48efd9962143a5 --- package/boot/uboot-envtools/files/layerscape | 3 ++ target/linux/layerscape/armv8_64b/config-5.15 | 3 +- .../layerscape/base-files/etc/board.d/01_led | 4 +++ .../base-files/etc/board.d/02_network | 4 +++ .../base-files/etc/board.d/03_gpio_switches | 8 +++++ .../base-files/lib/upgrade/platform.sh | 27 ++++++++++++++++ target/linux/layerscape/image/Makefile | 13 ++++++++ target/linux/layerscape/image/armv8_64b.mk | 32 +++++++++++++++++++ 8 files changed, 93 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape index b11587d876..bc7dcf24f9 100644 --- a/package/boot/uboot-envtools/files/layerscape +++ b/package/boot/uboot-envtools/files/layerscape @@ -16,6 +16,9 @@ case "$board" in traverse,ls1043s) ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000" ;; + traverse,ten64) + ubootenv_add_uci_config "/dev/mtd3" "0x0000" "0x80000" "0x80000" + ;; esac config_load ubootenv diff --git a/target/linux/layerscape/armv8_64b/config-5.15 b/target/linux/layerscape/armv8_64b/config-5.15 index 69edc7a3f0..0e8ab0c253 100644 --- a/target/linux/layerscape/armv8_64b/config-5.15 +++ b/target/linux/layerscape/armv8_64b/config-5.15 @@ -508,6 +508,7 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_NAND_FSL_IFC=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_MTD_SPLIT_FIRMWARE=y @@ -515,7 +516,7 @@ CONFIG_MTD_SPLIT_FIT_FW=y CONFIG_MTD_SST25L=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MULTIPLEXER=y CONFIG_MUTEX_SPIN_ON_OWNER=y diff --git a/target/linux/layerscape/base-files/etc/board.d/01_led b/target/linux/layerscape/base-files/etc/board.d/01_led index 7fddfa0824..a21c21980a 100644 --- a/target/linux/layerscape/base-files/etc/board.d/01_led +++ b/target/linux/layerscape/base-files/etc/board.d/01_led @@ -17,6 +17,10 @@ traverse,ls1043s) ucidef_set_led_netdev "xgact" "10G Activity" "ls1043s:yellow:10gact" "eth6" ucidef_set_led_netdev "xglink" "10G Link" "ls1043s:green:10glink" "eth6" ;; +traverse,ten64) + ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" + ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/etc/board.d/02_network b/target/linux/layerscape/base-files/etc/board.d/02_network index 172172c12c..7bc5f9b502 100644 --- a/target/linux/layerscape/base-files/etc/board.d/02_network +++ b/target/linux/layerscape/base-files/etc/board.d/02_network @@ -17,6 +17,10 @@ case "$(board_name)" in ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth6" ucidef_set_interface_wan "eth4" ;; + traverse,ten64) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3" + ucidef_set_interface_wan "eth6" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches index df3b759916..5e0e24ef28 100644 --- a/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/layerscape/base-files/etc/board.d/03_gpio_switches @@ -20,6 +20,14 @@ traverse,ls1043s) ucidef_add_gpio_switch "lte_disable" "LTE Airplane Mode" "394" ucidef_add_gpio_switch "lte_power" "LTE Power" "395" ;; +traverse,ten64) + ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" + ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" + ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378" + ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379" + ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369" + ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373" + ;; esac board_config_flush diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index e88dfdf145..c63cf05e5c 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -49,6 +49,26 @@ platform_do_upgrade_traverse_nandubi() { nand_do_upgrade "$1" || (echo "Upgrade failed, setting bootsys ${bootsys}" && fw_setenv bootsys $bootsys) } + +platform_do_upgrade_traverse_slotubi() { + part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" + echo "Active boot slot: ${part}" + new_active_sys="b" + + if [ ! -z "${part}" ]; then + if [ "${part}" = "ubia" ]; then + CI_UBIPART="ubib" + else + CI_UBIPART="ubia" + new_active_sys="a" + fi + fi + echo "Updating UBI part ${CI_UBIPART}" + fw_setenv "openwrt_active_sys" "${new_active_sys}" + nand_do_upgrade "$1" + return $? +} + platform_copy_config_sdboot() { local diskdev partdev parttype=ext4 @@ -90,6 +110,10 @@ platform_check_image() { nand_do_platform_check "traverse-ls1043" $1 return $? ;; + traverse,ten64) + nand_do_platform_check "ten64-mtd" $1 + return $? + ;; fsl,ls1012a-frdm | \ fsl,ls1012a-frwy-sdboot | \ fsl,ls1012a-rdb | \ @@ -130,6 +154,9 @@ platform_do_upgrade() { traverse,ls1043s) platform_do_upgrade_traverse_nandubi "$1" ;; + traverse,ten64) + platform_do_upgrade_traverse_slotubi "${1}" + ;; fsl,ls1012a-frdm | \ fsl,ls1012a-rdb | \ fsl,ls1021a-twr | \ diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile index 52dc532c34..1463a3eaea 100644 --- a/target/linux/layerscape/image/Makefile +++ b/target/linux/layerscape/image/Makefile @@ -64,6 +64,19 @@ define Build/traverse-fit @mv -f $@.new $@ endef +define Build/traverse-fit-ls1088 + ./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \ + -v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \ + -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -C gzip -c 1 -c 2 \ + -d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \ + -D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \ + -d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \ + -D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2 + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + @mv -f $@.new $@ +endef + define Device/fix-sysupgrade DEVICE_COMPAT_VERSION := 2.0 DEVICE_COMPAT_MESSAGE := DTB was added to sysupgrade. Image format is different. \ diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index f5a6a055fb..0016e3bde8 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -451,3 +451,35 @@ define Device/traverse_ls1043 SUPPORTED_DEVICES := traverse,ls1043s traverse,ls1043v endef TARGET_DEVICES += traverse_ls1043 + +define Device/traverse_ten64_mtd + DEVICE_VENDOR := Traverse + DEVICE_MODEL := Ten64 (NAND boot) + DEVICE_NAME := ten64-mtd + DEVICE_PACKAGES += \ + uboot-envtools \ + kmod-rtc-rx8025 \ + kmod-sfp \ + kmod-i2c-mux-pca954x \ + restool + DEVICE_DESCRIPTION = \ + Generate images for booting from NAND/ubifs on Traverse Ten64 (LS1088A) \ + family boards. For disk (NVMe/USB/SD) boot, use the armvirt target instead. + FILESYSTEMS := squashfs + KERNEL_LOADADDR := 0x80000000 + KERNEL_ENTRY_POINT := 0x80000000 + FDT_LOADADDR := 0x90000000 + KERNEL_SUFFIX := -kernel.itb + DEVICE_DTS := freescale/fsl-ls1088a-ten64 + IMAGES := nand.ubi sysupgrade.bin + KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/nand.ubi := append-ubi + KERNEL_IN_UBI := 1 + BLOCKSIZE := 128KiB + PAGESIZE := 2048 + MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 600 + SUPPORTED_DEVICES = traverse,ten64 +endef +TARGET_DEVICES += traverse_ten64_mtd + From a7bd96c98f8f6901f7c163719847611af22d5471 Mon Sep 17 00:00:00 2001 From: Mathew McBride Date: Tue, 6 Jun 2023 07:39:14 +0000 Subject: [PATCH 18/19] layerscape: add patches for SFP support on DPAA2 platforms This is required for managed operation of the SFP ports on the Ten64 (LS1088A) and other boards. The two issues resolved are: - Validation of 10G SFP link modes fail as Linux did not consider the equivalence of modes like XFI, 10GBase-R - Fix a locking issue that prevented the system rebooting when SFP ports were controlled by the SFP driver. Please note, these patches are replaced by upstream ones in 6.x, see: commit 61ec9a8154a5 ("armvirt: add SFP support patches for NXP Layerscape DPAA2 platforms") in OpenWrt for the relevant patches. Signed-off-by: Mathew McBride --- ...2-mac-add-support-for-more-10G-modes.patch | 34 +++++++++ .../704-dpaa2-eth-do-not-hold-rtnl_lock.patch | 74 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 target/linux/layerscape/patches-5.15/703-net-dpaa2-mac-add-support-for-more-10G-modes.patch create mode 100644 target/linux/layerscape/patches-5.15/704-dpaa2-eth-do-not-hold-rtnl_lock.patch diff --git a/target/linux/layerscape/patches-5.15/703-net-dpaa2-mac-add-support-for-more-10G-modes.patch b/target/linux/layerscape/patches-5.15/703-net-dpaa2-mac-add-support-for-more-10G-modes.patch new file mode 100644 index 0000000000..0bd96f1f4f --- /dev/null +++ b/target/linux/layerscape/patches-5.15/703-net-dpaa2-mac-add-support-for-more-10G-modes.patch @@ -0,0 +1,34 @@ +From c314138bd045e050432158ab021160de3ba51c5e Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Thu, 30 Jan 2020 22:42:38 +0000 +Subject: [PATCH 2/4] net: dpaa2-mac: add support for more 10G modes + +Phylink documentation says: + * Note that the PHY may be able to transform from one connection + * technology to another, so, eg, don't clear 1000BaseX just + * because the MAC is unable to BaseX mode. This is more about + * clearing unsupported speeds and duplex settings. The port modes + * should not be cleared; phylink_set_port_modes() will help with this. + +So add the missing 10G modes. + +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -140,6 +140,12 @@ static void dpaa2_mac_validate(struct ph + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_USXGMII: + phylink_set(mask, 10000baseT_Full); ++ phylink_set(mask, 10000baseKR_Full); ++ phylink_set(mask, 10000baseCR_Full); ++ phylink_set(mask, 10000baseSR_Full); ++ phylink_set(mask, 10000baseLR_Full); ++ phylink_set(mask, 10000baseLRM_Full); ++ phylink_set(mask, 10000baseER_Full); + if (state->interface == PHY_INTERFACE_MODE_10GBASER) + break; + phylink_set(mask, 5000baseT_Full); diff --git a/target/linux/layerscape/patches-5.15/704-dpaa2-eth-do-not-hold-rtnl_lock.patch b/target/linux/layerscape/patches-5.15/704-dpaa2-eth-do-not-hold-rtnl_lock.patch new file mode 100644 index 0000000000..c7d16e5c4c --- /dev/null +++ b/target/linux/layerscape/patches-5.15/704-dpaa2-eth-do-not-hold-rtnl_lock.patch @@ -0,0 +1,74 @@ +From d5af37ae22f0364be9ded773d737dd6e5b207b10 Mon Sep 17 00:00:00 2001 +From: Ioana Ciornei +Date: Thu, 21 Nov 2019 21:15:25 +0200 +Subject: [PATCH 3/4] dpaa2-eth: do not hold rtnl_lock on phylink_create() or + _destroy() + +The rtnl_lock should not be held when calling phylink_create() or +phylink_destroy() since it leads to the deadlock listed below: + +[ 18.656576] rtnl_lock+0x18/0x20 +[ 18.659798] sfp_bus_add_upstream+0x28/0x90 +[ 18.663974] phylink_create+0x2cc/0x828 +[ 18.667803] dpaa2_mac_connect+0x14c/0x2a8 +[ 18.671890] dpaa2_eth_connect_mac+0x94/0xd8 + +Fix this by moving the _lock() and _unlock() calls just outside of +phylink_of_phy_connect() and phylink_disconnect_phy(). + +Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") +Reported-by: Russell King +Signed-off-by: Ioana Ciornei +Signed-off-by: Russell King +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 4 ++++ + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4217,12 +4217,10 @@ static irqreturn_t dpni_irq0_handler_thr + dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); + dpaa2_eth_update_tx_fqids(priv); + +- rtnl_lock(); + if (dpaa2_eth_has_mac(priv)) + dpaa2_eth_disconnect_mac(priv); + else + dpaa2_eth_connect_mac(priv); +- rtnl_unlock(); + } + + return IRQ_HANDLED; +@@ -4516,9 +4514,7 @@ static int dpaa2_eth_remove(struct fsl_m + #endif + + unregister_netdev(net_dev); +- rtnl_lock(); + dpaa2_eth_disconnect_mac(priv); +- rtnl_unlock(); + + dpaa2_eth_dl_port_del(priv); + dpaa2_eth_dl_traps_unregister(priv); +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -357,7 +357,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * + if (mac->pcs) + phylink_set_pcs(mac->phylink, &mac->pcs->pcs); + ++ rtnl_lock(); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); ++ rtnl_unlock(); + if (err) { + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); + goto err_phylink_destroy; +@@ -378,7 +380,9 @@ void dpaa2_mac_disconnect(struct dpaa2_m + if (!mac->phylink) + return; + ++ rtnl_lock(); + phylink_disconnect_phy(mac->phylink); ++ rtnl_unlock(); + phylink_destroy(mac->phylink); + dpaa2_pcs_destroy(mac); + } From ce998cb6e161db9c9e868fd570da9189f05fde3e Mon Sep 17 00:00:00 2001 From: Alexey Bartenev <41exey@proton.me> Date: Wed, 31 May 2023 10:50:23 -0400 Subject: [PATCH 19/19] ramips: add support for D-Link DIR-806A B1 router MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit General specification: SoC Type: MediaTek MT7620A (580MHz) ROM: 8 MB SPI-NOR (MX25L6406E) RAM: 64 MB DDR (W9751G6KB-25) Switch: MediaTek MT7530 Ethernet: 5 ports - 5×100MbE (WAN, LAN1-4) Wireless: 2.4 GHz (MediaTek RT5390): b/g/n Wireless: 5 GHz (MediaTek MT7610EN): ac/n Buttons: 2 button (POWER, WPS/RESET) Bootloader: U-Boot 1.1.3 Power: 12 VDC, 0.5 A MACs: | LAN | [Factory + 0x04] - 2 | | WLAN 2.4g | [Factory + 0x04] - 1 | | WLAN 5g | [Factory + 0x8004] - 3 | | WAN | [Factory + 0x04] - 2 | OEM easy installation: 1. Use a PC to browse to http://192.168.0.1. 2. Go to the System section and open the Firmware Update section. 3. Under the Local Update at the right, click on the CHOOSE FILE... 4. When a modal window appears, choose the firmware file and click on the Open. 5. Next click on the UPDATE FIRMWARE button and upload the firmware image. Wait for the router to flash and reboot. OEM installation using the TFTP method (need level converter): 1. Download the latest firmware image. 2. Set up a Tftp server on a PC (e.g. Tftpd32) and place the firmware image to the root directory of the server. 3. Power off the router and use a twisted pair cable to connect the PC to any of the router's LAN ports. 4. Configure the network adapter of the PC to use IP address 192.168.0.180 and subnet mask 255.255.255.0. 5. Connect serial port (57600 8N1) and turn on the router. 6. Then interrupt "U-Boot Boot Menu" by hitting 2 key (select "2: Load system code then write to Flash via TFTP."). 7. Press Y key when show "Warning!! Erase Linux in Flash then burn new one. Are you sure? (Y/N)" Input device IP (192.168.0.1) ==:192.168.0.1 Input server IP (192.168.0.180) ==:192.168.0.180 Input Linux Kernel filename () ==:firmware_name The router should download the firmware via TFTP and complete flashing in a few minutes. After flashing is complete, use the PC to browse to http://192.168.1.1 or ssh to proceed with the configuration. Signed-off-by: Alexey Bartenev <41exey@proton.me> --- package/boot/uboot-envtools/files/ramips | 3 +- .../ramips/dts/mt7620a_dlink_dir-806a-b1.dts | 165 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 13 ++ .../mt7620/base-files/etc/board.d/01_leds | 3 + .../mt7620/base-files/etc/board.d/02_network | 1 + 5 files changed, 184 insertions(+), 1 deletion(-) create mode 100755 target/linux/ramips/dts/mt7620a_dlink_dir-806a-b1.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index b3f37c7c3e..85a819be31 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -24,7 +24,8 @@ sitecom,wlr-4100-v1-002|\ zyxel,keenetic-lite-iii-a) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; -arcadyan,we420223-99) +arcadyan,we420223-99|\ +dlink,dir-806a-b1) ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x1000" "0x1000" ;; allnet,all0256n-4m|\ diff --git a/target/linux/ramips/dts/mt7620a_dlink_dir-806a-b1.dts b/target/linux/ramips/dts/mt7620a_dlink_dir-806a-b1.dts new file mode 100755 index 0000000000..b7fc063b7f --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_dlink_dir-806a-b1.dts @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7620a.dtsi" + +#include +#include +#include + +/ { + compatible = "dlink,dir-806a-b1", "ralink,mt7620a-soc"; + model = "D-Link DIR-806A B1"; + + aliases { + led-boot = &wps_led; + led-failsafe = &wps_led; + led-running = &wps_led; + led-upgrade = &wps_led; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; // #12 + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wifi_led: 2.4g { + label = "green:wlan"; + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; // #72 + }; + + wps_led: wps { + label = "green:wps"; + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; // #39 + }; + + }; + +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <48000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ALL"; + reg = <0x0 0x800000>; + read-only; + }; + + partition@0_1 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "Factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uartf", "ephy"; + function = "gpio"; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-2)>; +}; + +&wmac { + pinctrl-names = "default", "pa_gpio"; + pinctrl-0 = <&pa_pins>; + pinctrl-1 = <&pa_gpio_pins>; + + ralink,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-1)>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + + nvmem-cells = <&macaddr_factory_8004>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-3)>; + + led { + led-active-low; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index cd7aea7388..f3f4873d76 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -223,6 +223,19 @@ define Device/dlink_dir-510l endef TARGET_DEVICES += dlink_dir-510l +define Device/dlink_dir-806a-b1 + SOC := mt7620a + IMAGE_SIZE := 7872k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DIR-806A + DEVICE_VARIANT := B1 + DEVICE_PACKAGES += kmod-mt76x0e + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size | \ + sign-dlink-ru cef285a2e29e40b2baab31277d44298b +endef +TARGET_DEVICES += dlink_dir-806a-b1 + define Device/dlink_dir-810l SOC := mt7620a DEVICE_PACKAGES := kmod-mt76x0e diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index af2f574aef..22e79ca755 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -44,6 +44,9 @@ comfast,cf-wr800n) ucidef_set_led_netdev "lan" "lan" "white:ethernet" eth0.1 ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0" ;; +dlink,dir-806a-b1) + ucidef_set_led_netdev "wifi_led" "2.4g" "green:wlan" "phy1-ap0" + ;; dlink,dir-810l|\ trendnet,tew-810dr) ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 005b7212cb..a0174d2d1c 100644 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -79,6 +79,7 @@ ramips_setup_interfaces() asus,rt-ac54u|\ asus,rt-n14u|\ bdcom,wap2100-sk|\ + dlink,dir-806a-b1|\ domywifi,dm202|\ domywifi,dm203|\ domywifi,dw22d|\