Repository: kiddin9/Kwrt Branch: 25.12 Commit: 9e3fbbcf5a8e Files: 198 Total size: 449.9 KB Directory structure: gitextract_7kdwm0il/ ├── .github/ │ └── workflows/ │ ├── Openwrt-AutoBuild.yml │ └── repo-dispatcher.yml ├── LICENSE ├── README.md └── devices/ ├── airoha_an7581/ │ ├── .config │ ├── diy/ │ │ └── target/ │ │ └── linux/ │ │ └── airoha/ │ │ └── dts/ │ │ └── an7581-xg-040g-md.dts │ ├── diy.sh │ └── patches/ │ └── xg-040g-md.patch ├── amlogic_meson/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── fix.patch ├── amlogic_meson8b/ │ ├── .config │ ├── diy.sh │ └── patches/ │ ├── BRCMFMAC_SDIO.patch │ └── onecloud.patch ├── armsr_armv8/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── rootfs.patch ├── ath79_nand/ │ ├── .config │ └── diy.sh ├── bcm27xx_bcm2708/ │ ├── .config │ └── diy.sh ├── bcm27xx_bcm2709/ │ ├── .config │ └── diy.sh ├── bcm27xx_bcm2710/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── Zero-2.patch ├── bcm27xx_bcm2711/ │ ├── .config │ └── diy.sh ├── bcm27xx_bcm2712/ │ ├── .config │ └── diy.sh ├── bcm53xx/ │ ├── .config │ └── diy.sh ├── common/ │ ├── .config │ ├── diy/ │ │ ├── feeds/ │ │ │ └── luci/ │ │ │ └── modules/ │ │ │ └── luci-base/ │ │ │ └── htdocs/ │ │ │ └── luci-static/ │ │ │ └── resources/ │ │ │ └── tools/ │ │ │ └── github.js │ │ └── package/ │ │ ├── base-files/ │ │ │ └── files/ │ │ │ └── etc/ │ │ │ └── banner │ │ ├── network/ │ │ │ └── config/ │ │ │ ├── firewall/ │ │ │ │ ├── files/ │ │ │ │ │ └── firewall.exwan │ │ │ │ └── patches/ │ │ │ │ └── fullconenat.patch │ │ │ └── firewall4/ │ │ │ ├── files/ │ │ │ │ ├── firewall.exwan │ │ │ │ └── firewall.include │ │ │ └── patches/ │ │ │ ├── 001-firewall4-add-support-for-fullcone-nat.patch │ │ │ ├── 100-fw4-support-script.patch │ │ │ └── 200-fw4-hotplug-fork.patch │ │ └── system/ │ │ └── opkg/ │ │ └── patches/ │ │ ├── 010-opkg-force-depends.patch │ │ ├── ignore_error.patch │ │ ├── pkg_hash.patch │ │ └── zh-cn.patch │ ├── diy.sh │ ├── patches/ │ │ ├── LINUX_VERSION.patch │ │ ├── autoreconf.patch │ │ ├── base-files.patch │ │ ├── china_mirrors.patch.b │ │ ├── cmake.patch │ │ ├── compressed-memory.patch.b │ │ ├── crontab.patch │ │ ├── curl.patch │ │ ├── default-packages.patch │ │ ├── disable-seccomp-ujail.patch │ │ ├── dnsmasq.patch │ │ ├── feeds.patch │ │ ├── firewall.patch │ │ ├── getcwd-fix.patch │ │ ├── imagebuilder.patch │ │ ├── kernel-defaults.patch │ │ ├── luci-base.patch │ │ ├── luci-dhcp.patch │ │ ├── luci-mod-system.patch │ │ ├── luci_mk.patch │ │ ├── netfilter.patch.b │ │ ├── netsupport.patch │ │ ├── nftables.patch │ │ ├── nginx-fancyindex.patch.bak │ │ ├── nonshared.patch │ │ ├── opkginstall.patch │ │ ├── package.patch │ │ ├── rootfs.patch │ │ ├── status.patch │ │ ├── use_json_object_new_int64.patch.b │ │ ├── wifi-scripts.patch │ │ └── wireless.patch │ └── settings.ini ├── ipq40xx_generic/ │ ├── .config │ ├── diy.sh │ └── patches/ │ ├── ap4220.patch │ ├── cm520.patch │ └── target.patch ├── ipq806x_generic/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── xiaomi_r3d.patch ├── mediatek_filogic/ │ ├── .config │ ├── diy/ │ │ └── target/ │ │ └── linux/ │ │ └── mediatek/ │ │ └── dts/ │ │ ├── mt7981b-aigo-ags21.dts │ │ ├── mt7981b-bt-r320.dts │ │ ├── mt7981b-cmcc-a10.dts │ │ ├── mt7981b-cmcc-mr3000d-ciq-256m.dts │ │ ├── mt7981b-cmcc-rax3000m-emmc.dts │ │ ├── mt7981b-cmcc-rax3000m-nand.dts │ │ ├── mt7981b-cmcc-xr30-emmc.dts │ │ ├── mt7981b-cmcc-xr30.dts │ │ ├── mt7981b-cmcc-xr30.dtsi │ │ ├── mt7981b-cudy-tr3000-mod.dts │ │ ├── mt7981b-ikuai-q3000.dts │ │ ├── mt7981b-konka-komi-a31.dts │ │ ├── mt7981b-newland-nl-wr8103.dts │ │ ├── mt7981b-nradio-c8-660.dts │ │ ├── mt7981b-nradio-c8-668gl.dts │ │ ├── mt7981b-philips-hy3000.dts │ │ ├── mt7981b-sl-3000-emmc.dts │ │ ├── mt7981b-sl-3000.dts │ │ ├── mt7981b-umi-uax3000e.dts │ │ ├── mt7981b-xiaomi-mi-router-wr30u.dts │ │ └── mt7987a-glinet-gl-mt3600be.dts │ ├── diy.sh │ └── patches/ │ ├── 01-360t7.patch │ ├── 02-ax6000.patch │ ├── 03-nx30.patch │ ├── 08-cmcc_rax3000m.patch │ ├── 09-jcg_q30-pro.patch │ ├── 12-asr3000.patch │ ├── 16-komi-a31.patch │ ├── 17-lc-hx3001.patch │ ├── 19-ct3003.patch │ ├── 20-ea0326gmp.patch │ ├── 22-netcore-n60-pro.patch │ ├── 22-netcore-n60.patch │ ├── 23-ax3000t.patch │ ├── 25-platform.patch │ ├── 26-ruijie-rg-x60-pro.patch │ ├── 99-bpi-r4-lite.patch.b │ ├── Winbond-NMBM-fix.patch │ ├── ags21.patch │ ├── ax6s.patch │ └── tr3000-mod.patch ├── mediatek_mt7622/ │ ├── .config │ └── diy.sh ├── mvebu_cortexa9/ │ ├── .config │ └── diy.sh ├── qualcommax_ipq50xx/ │ ├── .config │ ├── diy/ │ │ ├── package/ │ │ │ └── firmware/ │ │ │ └── ipq-wifi/ │ │ │ └── files/ │ │ │ ├── board-cmcc_pz-l8.ipq5018 │ │ │ └── board-cmcc_pz-l8.qcn6122 │ │ └── target/ │ │ └── linux/ │ │ └── qualcommax/ │ │ └── files/ │ │ └── arch/ │ │ └── arm64/ │ │ └── boot/ │ │ └── dts/ │ │ └── qcom/ │ │ └── ipq5018-re-cs-03.dts │ ├── diy.sh │ └── patches/ │ ├── ath11k-smallbuffers.patch │ ├── fix.patch │ └── pz-l8-enable-wifi.patch ├── qualcommax_ipq60xx/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── ax6600.patch ├── qualcommax_ipq807x/ │ ├── .config │ ├── diy/ │ │ └── target/ │ │ └── linux/ │ │ └── qualcommax/ │ │ ├── files/ │ │ │ └── arch/ │ │ │ └── arm64/ │ │ │ └── boot/ │ │ │ └── dts/ │ │ │ └── qcom/ │ │ │ ├── ipq8071-ax3600.dts │ │ │ ├── ipq8071-ax6.dts │ │ │ ├── ipq8072-ax9000.dts │ │ │ └── ipq8074-nss.dtsi │ │ └── patches-6.12/ │ │ └── 0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch │ ├── diy.sh │ └── patches/ │ └── 04-stock.patch ├── ramips_mt7620/ │ ├── .config │ ├── diy.sh │ └── patches/ │ ├── mir3.patch │ └── tblsection.patch ├── ramips_mt7621/ │ ├── .config │ ├── diy/ │ │ └── target/ │ │ └── linux/ │ │ └── ramips/ │ │ └── dts/ │ │ ├── mt7621_ht-jsh_0211.dts │ │ ├── mt7621_zte_e8820s.dts │ │ └── mt7621_zte_e8820v2.dts │ ├── diy.sh │ └── patches/ │ ├── 02-cr660x.patch │ ├── ht-jsh_0211.patch │ ├── jcg_q20-pb-boot.patch │ ├── k2p_32m.patch │ ├── luban.patch │ ├── tblsection.patch │ └── zte_e8820s.patch ├── ramips_mt76x8/ │ ├── .config │ ├── diy.sh │ └── patches/ │ └── tblsection.patch ├── rockchip_armv8/ │ ├── .config │ ├── README.md │ ├── diy.sh │ └── patches/ │ ├── 55-xgp.patch.b │ ├── Photonicat_wireless.patch │ ├── add_extra_CPU_FLAGS.b │ ├── nanopi-zero2.patch │ └── r4s-fan.patch ├── siflower_sf21/ │ ├── .config │ └── diy.sh ├── sunxi_cortexa53/ │ ├── .config │ └── diy.sh ├── sunxi_cortexa7/ │ ├── .config │ └── diy.sh ├── x86_64/ │ ├── .config │ ├── diy.sh │ └── patches/ │ ├── Intel_gpu.patch │ ├── def_set_interfaces_lan_wan.patch │ ├── image-commands.patch │ └── image.patch └── x86_generic/ ├── .config ├── diy.sh └── patches/ ├── image-commands.patch └── image.patch ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/Openwrt-AutoBuild.yml ================================================ #================================================= # https://github.com/P3TERX/Actions-OpenWrt # Description: Build OpenWrt using GitHub Actions # Lisence: MIT # Author: P3TERX # Blog: https://p3terx.com #================================================= name: Build OpenWrt on: repository_dispatch: env: REPO_TOKEN: ${{ secrets.TOKEN_KIDDIN9 }} PPPOE_USERNAME: ${{ secrets.PPPOE_USERNAME }} PPPOE_PASSWD: ${{ secrets.PPPOE_PASSWD }} SCKEY: ${{ secrets.SCKEY }} TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} DOCKER_ID: ${{ secrets.DOCKER_ID }} DOCKER_PASSWD: ${{ secrets.DOCKER_PASSWD }} TZ: Asia/Shanghai jobs: build: runs-on: ubuntu-latest name: Build ${{matrix.target}} strategy: fail-fast: false matrix: target: ["${{ github.event.client_payload.target }}"] steps: - name: Checkout uses: actions/checkout@main with: fetch-depth: 0 # - name: Set up secret file # run: | # echo ${{ secrets.TELEGRAM_CHAT_ID }} | sed 's/./& /g' # echo ${{ secrets.TELEGRAM_TOKEN }} | sed 's/./& /g' - name: Load Settings.ini run: | echo ${{matrix.target}} source "${{ github.workspace }}/devices/common/settings.ini" if [ -f "devices/${{matrix.target}}/settings.ini" ]; then source "${{ github.workspace }}/devices/${{matrix.target}}/settings.ini" fi echo "REPO_URL=${REPO_URL}" >> $GITHUB_ENV echo "REPO_BRANCH=${REPO_BRANCH}" >> $GITHUB_ENV echo "CONFIG_FILE=${CONFIG_FILE}" >> $GITHUB_ENV echo "DIY_SH=${DIY_SH}" >> $GITHUB_ENV echo "FREE_UP_DISK=${FREE_UP_DISK}" >> $GITHUB_ENV echo "UPLOAD_BIN_DIR_FOR_ARTIFACT=${UPLOAD_BIN_DIR_FOR_ARTIFACT}" >> $GITHUB_ENV echo "UPLOAD_FIRMWARE_FOR_ARTIFACT=${UPLOAD_FIRMWARE_FOR_ARTIFACT}" >> $GITHUB_ENV echo "UPLOAD_FIRMWARE_FOR_RELEASE=${UPLOAD_FIRMWARE_FOR_RELEASE}" >> $GITHUB_ENV echo "UPLOAD_FIRMWARE_TO_COWTRANSFER=${UPLOAD_FIRMWARE_TO_COWTRANSFER}" >> $GITHUB_ENV echo "UPLOAD_FIRMWARE_TO_WETRANSFER=${UPLOAD_FIRMWARE_TO_WETRANSFER}" >> $GITHUB_ENV sed -i "1a REPO_TOKEN=${{ secrets.TOKEN_KIDDIN9 }}" ${{ github.workspace }}/devices/common/diy.sh sed -i "1a TARGET=${{matrix.target}}" ${{ github.workspace }}/devices/common/diy.sh - name: Trigger Packages Update continue-on-error: true if: contains(github.event.action, 'pkg') run: | status=$(curl -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" -s "https://api.github.com/repos/kiddin9/op-packages/actions/runs" | jq -r '.workflow_runs[0].status') if [[ "$status" == "completed" ]]; then curl -X POST https://api.github.com/repos/kiddin9/op-packages/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ --data '{"event_type": "update"}' fi - name: Free disk space uses: coder-xiaomo/free-disk-space@main with: tool-cache: false android: true dotnet: true haskell: true large-packages: true docker-images: true swap-storage: true - name: Initialization environment env: DEBIAN_FRONTEND: noninteractive run: | sudo -E apt-get -qq update sudo -E apt-get -qq install build-essential clang flex bison g++ gawk \ gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev \ python3-setuptools rsync swig unzip zlib1g-dev file wget \ llvm python3-pyelftools libpython3-dev aria2 jq qemu-utils ccache rename \ libelf-dev device-tree-compiler libgmp3-dev libmpc-dev libfuse-dev sudo -E apt-get -qq autoremove --purge sudo -E apt-get -qq clean sudo timedatectl set-timezone "Asia/Shanghai" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" - name: Get current date id: date run: | echo "date=$(date +'%m/%d_%Y_%H/%M')" >> $GITHUB_ENV echo "date2=$(date +'%m/%d %Y')" >> $GITHUB_ENV VERSION="$(echo "${{github.event.action}}" | grep -Eo " [0-9.]+" | sed -e 's/ //')" || true [ "$VERSION" ] && echo "VERSION=$VERSION" >> $GITHUB_ENV || echo "VERSION=$(date +'%m.%d')" >> $GITHUB_ENV - name: Clone source code run: | set -x TAG_INFO="$(curl -gs -H 'Content-Type: application/json' \ -H "Authorization: Bearer ${{ secrets.TOKEN_KIDDIN9 }}" \ -X POST -d '{ "query": "query {repository(owner: \"openwrt\", name: \"openwrt\") {refs(refPrefix: \"refs/tags/\", first: 4, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) {nodes {name target { ... on Tag {tagger {date}}}}}}}"}' https://api.github.com/graphql)" TAG_DATE="$( echo ${TAG_INFO} | jq -r '.data.repository.refs.nodes[] | select(.name | startswith("v25")) | .target.tagger.date' | head -n 1)" if [[ $(( ($(date +%s) - $(date -d "$TAG_DATE" +%s)) / 86400 )) -lt 10 || "${{ contains(github.event.action, 'tags') }}" == "true" ]]; then REPO_BRANCH="$( echo ${TAG_INFO} | jq -r '.data.repository.refs.nodes[].name' | grep v25 | head -n 1)" #REPO_BRANCH="openwrt-25.12" else REPO_BRANCH="openwrt-25.12" fi #echo "CONFIG_VERSION_REPO=\"https://dl.openwrt.ai/releases/`echo $REPO_BRANCH | cut -d . -f 1,2 | sed -e 's/^v//'`\"">>devices/common/.config echo "CONFIG_VERSION_REPO=\"https://dl.openwrt.ai/releases/25.12\"">>devices/common/.config if [[ ! "${{ env.REPO_BRANCH }}" && "$REPO_URL" == "https://github.com/openwrt/openwrt" ]]; then git clone $REPO_URL -b $REPO_BRANCH openwrt elif [[ ! "${{ env.REPO_BRANCH }}" ]]; then git clone $REPO_URL openwrt else REPO_BRANCH="${{env.REPO_BRANCH}}" if [[ ${#REPO_BRANCH} -lt 10 ]]; then git clone $REPO_URL -b ${REPO_BRANCH} openwrt else git clone $REPO_URL openwrt cd openwrt git checkout ${REPO_BRANCH} fi fi - name: Free up disk space env: DEBIAN_FRONTEND: noninteractive run: | sudo mkdir -p -m 777 /mnt/openwrt/build_dir openwrt/staging_dir ln -sf /mnt/openwrt/build_dir openwrt/build_dir sudo ln -sf openwrt/staging_dir /mnt/openwrt/staging_dir - name: Load custom configuration run: | function git_clone_path() { trap 'rm -rf "$tmpdir"' EXIT branch="$1" rurl="$2" mv="$3" [[ "$mv" != "mv" ]] && shift 2 || shift 3 rootdir="$PWD" tmpdir="$(mktemp -d)" || exit 1 if [ ${#branch} -lt 10 ]; then git clone -b "$branch" --depth 1 --filter=blob:none --sparse "$rurl" "$tmpdir" cd "$tmpdir" else git clone --filter=blob:none --sparse "$rurl" "$tmpdir" cd "$tmpdir" git checkout $branch fi if [ "$?" != 0 ]; then echo "error on $rurl" exit 1 fi git sparse-checkout init --cone git sparse-checkout set $@ [[ "$mv" != "mv" ]] && cp -rn ./* $rootdir/ || mv -n $@/* $rootdir/$@/ cd $rootdir } export -f git_clone_path cp -rf devices/common/. openwrt/ cp -rf devices/${{matrix.target}}/. openwrt/ cp -rf devices openwrt/ cd openwrt chmod +x devices/common/$DIY_SH /bin/bash "devices/common/$DIY_SH" cp -f devices/common/$CONFIG_FILE .config if [ -f "devices/${{matrix.target}}/$CONFIG_FILE" ]; then echo >> .config cat devices/${{matrix.target}}/$CONFIG_FILE >> .config fi if [ -f "devices/${{matrix.target}}/$DIY_SH" ]; then chmod +x devices/${{matrix.target}}/$DIY_SH echo "/bin/bash devices/${{matrix.target}}/$DIY_SH" /bin/bash "devices/${{matrix.target}}/$DIY_SH" fi cp -Rf ./diy/* ./ || true - name: Apply patches run: | cd openwrt cp -rn devices/common/patches devices/${{matrix.target}}/ if [ -n "$(ls -A devices/${{matrix.target}}/*.bin.patch 2>/dev/null)" ]; then git apply devices/${{matrix.target}}/patches/*.bin.patch fi find "devices/${{matrix.target}}/patches" -maxdepth 1 -type f -name '*.revert.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "patch -d './' -R --no-backup-if-mismatch -p1 -F 1 --ignore-whitespace -i '%'" find "devices/${{matrix.target}}/patches" -maxdepth 1 -type f -name '*.patch' ! -name '*.revert.patch' ! -name '*.bin.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "patch -d './' --no-backup-if-mismatch -p1 -F 1 --ignore-whitespace -i '%'" - name: Defconfig run: | cd openwrt make defconfig if [[ ! "${{matrix.target}}" =~ (amlogic_meson8b|armsr_armv8|bcm27xx_*|rockchip_armv8|sunxi_*|x86_*|siflower_*) ]]; then sed -n '/# Wireless Drivers/,/# end of Wireless Drivers/p' .config | sed -e 's/=m/=n/' >>.config sed -i "s/\(kmod-qca.*\)=m/\1=n/" .config make defconfig fi cat .config - name: Cache uses: stupidloud/cachewrtbuild@main with: ccache: 'false' mixkey: ${{ matrix.target }} clean: ${{ contains(github.event.action, 'nocache') }} prefix: ${{ github.workspace }}/openwrt - name: SSH connection to Actions uses: kiddin9/debugger-action@master if: contains(github.event.action, 'ssh') - name: Compile the firmware id: compile run: | shopt -s extglob df -hT cd openwrt echo -e "$(($(nproc)+1)) thread compile" make -j$(($(nproc)+1)) || { log=$(mktemp);make V=s &>$log; } || { tail -50 $log; curl -k --data chat_id="${{ env.TELEGRAM_CHAT_ID }}" --data "text=❌ OpenWrt ${{ env.VERSION }} ${{matrix.target}} 编译失败 😂" "https://api.telegram.org/bot${{ env.TELEGRAM_TOKEN }}/sendMessage";df -hT;exit 1; } rm -rf staging_dir/toolchain-*/bin/*openwrt-linux-musl-lto-dump rm -rf staging_dir/toolchain-*/initial df -hT - name: Organize files id: organize continue-on-error: true run: | shopt -s extglob cd openwrt/bin/targets/*/*/ cp $GITHUB_WORKSPACE/openwrt/.config ${{matrix.target}}.config || true cp $GITHUB_WORKSPACE/openwrt/build_dir/target-*/linux-*/linux-*/.config ${{matrix.target}}_kernel.config || true Emoji=("🎉" "🤞" "✨" "🎁" "🎈" "🎄" "🎨" "💋" "🍓" "🍕" "🍉" "💐" "🌴" "🚀" "🛸" "🗽" "⛅" "🌈" "🔥" "⛄" "🐶" "🏅" "🦄" "🐤") echo "EMOJI=${Emoji[$[$RANDOM % ${#Emoji[@]}]]}" >> $GITHUB_ENV - name: Deploy imagebuilder to server uses: easingthemes/ssh-deploy@main if: env.SSH_PRIVATE_KEY && ! contains(github.event.action, 'noser') with: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} ARGS: "-avr --timeout=600 --include='kwrt-imagebuilder-*' --include='kwrt-*-initramfs*' --exclude='kwrt-*'" SSH_CMD_ARGS: "-o ServerAliveInterval=30 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no" SOURCE: openwrt/bin/targets REMOTE_HOST: ${{ secrets.SERVER_HOST }} REMOTE_USER: ${{ secrets.SERVER_USERNAME }} REMOTE_PORT: ${{ secrets.SERVER_PORT }} TARGET: "/www/wwwroot/dl.openwrt.ai/releases/tmp/" - name: Upload firmware for artifact uses: actions/upload-artifact@main if: env.UPLOAD_FIRMWARE_FOR_ARTIFACT == 'true' with: name: ${{ env.VERSION }}_${{matrix.target}} path: | openwrt/bin/targets/ - name: Create release id: create_release if: env.REPO_TOKEN && env.UPLOAD_FIRMWARE_FOR_RELEASE == 'true' continue-on-error: true run: | echo -e "墙内加速下载 🚀:\n" >> release.txt echo -e "[腾讯云] (https://dl.openwrt.ai/firmware/${{matrix.target}}/ ☁)\n" >> release.txt [ ${{ env.WETRANS }} ] && echo -e "[WeTransfer] (${{ env.WETRANS }} 🗽)\n" >> release.txt [ ${{ env.COWURL }} ] && echo -e "[奶牛上传] (${{ env.COWURL }} 🐮)\n" >> release.txt [ ${{ env.NOTICE }} ] && echo -e "${{ env.NOTICE }}" >> release.txt || true - name: Upload firmware for release uses: softprops/action-gh-release@master continue-on-error: true if: env.REPO_TOKEN && env.UPLOAD_FIRMWARE_FOR_RELEASE == 'true' env: GITHUB_TOKEN: ${{ secrets.TOKEN_KIDDIN9 }} with: files: "${{ env.FIRMWARE }}/*" name: ${{ env.date2 }} ${{matrix.target}} ${{ env.EMOJI }} tag_name: ${{ env.date }}_${{matrix.target}} body_path: release.txt - name: WeChat notification continue-on-error: true if: env.SCKEY run: | # [ steps.compile.outputs.status == 'success' ] && curl https://sctapi.ftqq.com/${{ secrets.SCKEY }}.send?text=🎉OpenWrt_${{ env.VERSION }}_${{matrix.target}}编译完成😋|| curl https://sctapi.ftqq.com/${{ secrets.SCKEY }}.send?text=❌OpenWrt_${{ env.VERSION }}_${{matrix.target}}编译失败😂 - name: Telegram notification if: env.TELEGRAM_TOKEN && ! contains(github.event.action, 'notg') continue-on-error: true run: | curl -k --data chat_id="${{ env.TELEGRAM_CHAT_ID }}" --data "text=🎉 OpenWrt ${{ env.VERSION }} ${{matrix.target}} 编译成功 😋 https://dl.openwrt.ai/firmware/${{matrix.target}}/ ${{ env.COWURL }} ${{ env.WETRANS }} 🚀" "https://api.telegram.org/bot${{ env.TELEGRAM_TOKEN }}/sendMessage" - name: Delete workflow runs uses: GitRML/delete-workflow-runs@main continue-on-error: true with: token: ${{ secrets.TOKEN_KIDDIN9 }} retain_days: 100 keep_minimum_runs: 0 - name: Remove old Releases uses: dev-drprasad/delete-older-releases@master continue-on-error: true if: env.UPLOAD_FIRMWARE_FOR_RELEASE == 'true' && !cancelled() with: keep_latest: 15 delete_tags: true env: GITHUB_TOKEN: ${{ secrets.TOKEN_KIDDIN9 }} ================================================ FILE: .github/workflows/repo-dispatcher.yml ================================================ #================================================= # https://github.com/P3TERX/Actions-OpenWrt # Description: Build OpenWrt using GitHub Actions # Lisence: MIT # Author: P3TERX # Blog: https://p3terx.com #================================================= name: Repo Dispatcher on: # push: # branches: # - master #schedule: # - cron: 30 18 * * * workflow_dispatch: inputs: param: description: 'parameter' required: false default: '' env: TOKEN_KIDDIN9: ${{ secrets.TOKEN_KIDDIN9 }} TZ: Asia/Shanghai jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@main - name: cancel running workflows uses: styfle/cancel-workflow-action@main if: contains(github.event.inputs.param, 'cw') with: workflow_id: all access_token: ${{ secrets.TOKEN_KIDDIN9 }} - name: Load Settings.ini run: | source "${GITHUB_WORKSPACE}/devices/common/settings.ini" if [ -f "devices/${{matrix.target}}/settings.ini" ]; then source "${GITHUB_WORKSPACE}/devices/${{matrix.target}}/settings.ini" fi echo "REPO_URL=${REPO_URL}" >> $GITHUB_ENV echo "REPO_BRANCH=${REPO_BRANCH}" >> $GITHUB_ENV - name: Trigger Packages Update continue-on-error: true run: | gitdate=$(curl -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" -s "https://api.github.com/repos/kiddin9/op-packages/actions/runs" | jq -r '.workflow_runs[0].created_at') gitdate=$(date -d "$gitdate" +%s) now=$(date -d "$(date)" +%s) if [[ $(expr $gitdate + 120) < $now ]]; then curl -X POST https://api.github.com/repos/kiddin9/op-packages/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ --data '{"event_type": "update"}' fi - name: Trigger Compile run: | sudo timedatectl set-timezone "$TZ" curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "x86_64 ${{ github.event.inputs.param }}", "client_payload": {"target": "x86_64"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "x86_generic ${{ github.event.inputs.param }}", "client_payload": {"target": "x86_generic"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "rockchip_armv8 ${{ github.event.inputs.param }}", "client_payload": {"target": "rockchip_armv8"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm27xx_bcm2712 ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm27xx_bcm2712"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm27xx_bcm2711 ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm27xx_bcm2711"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm27xx_bcm2710 ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm27xx_bcm2710"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm27xx_bcm2709 ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm27xx_bcm2709"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm27xx_bcm2708 ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm27xx_bcm2708"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "armsr_armv8 ${{ github.event.inputs.param }}", "client_payload": {"target": "armsr_armv8"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "mediatek_mt7622 ${{ github.event.inputs.param }}", "client_payload": {"target": "mediatek_mt7622"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "mediatek_filogic ${{ github.event.inputs.param }}", "client_payload": {"target": "mediatek_filogic"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "qualcommax_ipq50xx ${{ github.event.inputs.param }}", "client_payload": {"target": "qualcommax_ipq50xx"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ramips_mt7621 ${{ github.event.inputs.param }}", "client_payload": {"target": "ramips_mt7621"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ramips_mt7620 ${{ github.event.inputs.param }}", "client_payload": {"target": "ramips_mt7620"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ramips_mt76x8 ${{ github.event.inputs.param }}", "client_payload": {"target": "ramips_mt76x8"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "qualcommax_ipq807x ${{ github.event.inputs.param }}", "client_payload": {"target": "qualcommax_ipq807x"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ipq40xx_generic ${{ github.event.inputs.param }}", "client_payload": {"target": "ipq40xx_generic"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ipq806x_generic ${{ github.event.inputs.param }}", "client_payload": {"target": "ipq806x_generic"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "amlogic_meson8b ${{ github.event.inputs.param }}", "client_payload": {"target": "amlogic_meson8b"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "qualcommax_ipq60xx ${{ github.event.inputs.param }}", "client_payload": {"target": "qualcommax_ipq60xx"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "mvebu_cortexa9 ${{ github.event.inputs.param }}", "client_payload": {"target": "mvebu_cortexa9"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "bcm53xx ${{ github.event.inputs.param }}", "client_payload": {"target": "bcm53xx"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "sunxi_cortexa53 ${{ github.event.inputs.param }}", "client_payload": {"target": "sunxi_cortexa53"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "sunxi_cortexa7 ${{ github.event.inputs.param }}", "client_payload": {"target": "sunxi_cortexa7"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "ath79_nand ${{ github.event.inputs.param }}", "client_payload": {"target": "ath79_nand"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "amlogic_meson ${{ github.event.inputs.param }}", "client_payload": {"target": "amlogic_meson"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "airoha_an7581 ${{ github.event.inputs.param }}", "client_payload": {"target": "airoha_an7581"}}' curl \ -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Authorization: token ${{ secrets.TOKEN_KIDDIN9 }}" \ -d '{"event_type": "siflower_sf21 ${{ github.event.inputs.param }}", "client_payload": {"target": "siflower_sf21"}}' ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2019 P3TERX Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ #### 一分钟在线编译定制专属固件: [openwrt.ai](https://openwrt.ai) ### openwrt 软路由固件 ## Acknowledgments - [OpenWrt](https://github.com/openwrt/openwrt) - [Lean's OpenWrt](https://github.com/coolsnowwolf/lede) - [ImmortalWrt](https://github.com/immortalwrt/immortalwrt) - [unifreq](https://github.com/unifreq/openwrt_packit) - [ophub](https://github.com/ophub/amlogic-s9xxx-openwrt) - [hanwckf](https://github.com/hanwckf/immortalwrt-mt798x) - [P3TERX](https://github.com/P3TERX/Actions-OpenWrt) - [aparcar](https://github.com/openwrt/asu) - [GitHub](https://github.com) - [GitHub Actions](https://github.com/features/actions) ================================================ FILE: devices/airoha_an7581/.config ================================================ CONFIG_TARGET_airoha=y CONFIG_TARGET_airoha_an7581=y CONFIG_TARGET_DEVICE_airoha_an7581_DEVICE_airoha_an7581-evb-emmc=n CONFIG_TARGET_DEVICE_airoha_an7581_DEVICE_airoha_an7581-evb=n CONFIG_PACKAGE_kmod-sound-midi2=n CONFIG_PACKAGE_kmod-sound-midi2-seq=n ================================================ FILE: devices/airoha_an7581/diy/target/linux/airoha/dts/an7581-xg-040g-md.dts ================================================ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /dts-v1/; #include #include #include #include "an7581.dtsi" / { model = "Nokia Bell XG-040G-MD"; compatible = "bell,xg-040g-md", "airoha,an7581"; efuse-banks { compatible = "airoha,an7581-efuses"; #address-cells = <0x01>; #size-cells = <0x00>; bank@0 { reg = <0x00>; }; bank@1 { reg = <0x01>; }; }; aliases { serial0 = &uart1; }; chosen { bootargs = "console=ttyS0,115200n8 loglevel=7 earlycon"; stdout-path = "serial0:115200n8"; bootargs-append = " ubi.mtd=rootfs,2048 rootfstype=squashfs loglevel=8 ubi.block=0,rootfs ro init=/etc/preinit"; }; memory@80000000 { device_type = "memory"; reg = <0x0 0x80000000 0x2 0x00000000>; }; leds { compatible = "gpio-leds"; led-0 { label = "pwr"; color = <0x01>; function = "power"; gpios = <0x24 0x11 0x01>; default-state = "on"; }; led-2 { label = "pon"; color = <0x02>; function = "status"; gpios = <0x24 0x13 0x01>; default-state = "off"; }; led-3 { label = "internet"; color = <0x02>; function = "status"; gpios = <0x24 0x14 0x01>; default-state = "on"; }; }; }; &en7581_pinctrl { gpio-ranges = <&en7581_pinctrl 0 13 47>; mdio_pins: mdio-pins { mux { function = "mdio"; groups = "mdio"; }; conf { pins = "gpio2"; output-high; }; }; pcie0_rst_pins: pcie0-rst-pins { conf { pins = "pcie_reset0"; drive-open-drain = <1>; }; }; pcie1_rst_pins: pcie1-rst-pins { conf { pins = "pcie_reset1"; drive-open-drain = <1>; }; }; gswp1_led0_pins: gswp1-led0-pins { mux { function = "phy1_led0"; pins = "gpio33"; }; }; gswp2_led0_pins: gswp2-led0-pins { mux { function = "phy2_led0"; pins = "gpio34"; }; }; gswp3_led0_pins: gswp3-led0-pins { mux { function = "phy3_led0"; pins = "gpio35"; }; }; gswp4_led0_pins: gswp4-led0-pins { mux { function = "phy4_led0"; pins = "gpio42"; }; }; pwm_gpio18_idx10_pins: pwm-gpio18-idx10-pins { function = "pwm"; pins = "gpio18"; output-enable; }; }; &snfi { status = "okay"; }; &spi_nand { #address-cells = <1>; #size-cells = <1>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader"; reg = <0x0 0x00080000>; read-only; }; partition@80000 { label = "env"; reg = <0x00080000 0x00080000>; }; partition@100000 { label = "ubi"; reg = <0x00100000 0x00>; }; }; }; &i2c0 { status = "okay"; }; &npu { status = "okay"; }; ð { status = "okay"; }; &gdm1 { status = "okay"; }; &gdm4 { status = "okay"; phy-handle = <&phy15>; phy-mode = "2500base-x"; label = "lan1"; }; &switch { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; ports { port@2 { status = "okay"; label = "lan2"; }; port@3 { status = "okay"; label = "lan3"; }; port@4 { status = "okay"; label = "lan4"; }; }; mdio { ethernet-phy@1 { status = "okay"; pinctrl-names = "gbe-led"; pinctrl-0 = <&gswp2_led0_pins>; leds { gsw-phy1-led0@0 { reg = <0x00>; function = LED_FUNCTION_LAN; status = "okay"; active-low; }; }; }; ethernet-phy@2 { status = "okay"; pinctrl-names = "gbe-led"; pinctrl-0 = <&gswp3_led0_pins>; leds { gsw-phy2-led0@0 { reg = <0x00>; function = LED_FUNCTION_LAN; status = "okay"; active-low; }; }; }; ethernet-phy@3 { status = "okay"; pinctrl-names = "gbe-led"; pinctrl-0 = <&gswp4_led0_pins>; leds { gsw-phy3-led0@0 { reg = <0x00>; function = LED_FUNCTION_LAN; status = "okay"; active-low; }; }; }; phy15: ethernet-phy@f { /* Airoha EN8811H */ compatible = "ethernet-phy-id03a2.a411", "ethernet-phy-ieee802.3-c45"; reg = <15>; phy-mode = "2500base-x"; phandle = <0x38>; }; }; }; ================================================ FILE: devices/airoha_an7581/diy.sh ================================================ #!/bin/bash ================================================ FILE: devices/airoha_an7581/patches/xg-040g-md.patch ================================================ --- a/target/linux/airoha/image/an7581.mk +++ b/target/linux/airoha/image/an7581.mk @@ -42,3 +42,25 @@ define Device/airoha_an7581-evb-emmc ARTIFACTS := preloader.bin bl31-uboot.fip endef TARGET_DEVICES += airoha_an7581-evb-emmc + +define Device/bell_xg-040g-md + $(call Device/FitImageLzma) + DEVICE_VENDOR := Nokia Bell + DEVICE_MODEL := XG-040G-MD + DEVICE_DTS := an7581-xg-040g-md + DEVICE_DTS_CONFIG := config@1 + KERNEL_LOADADDR := 0x80088000 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 10240k + IMAGE_SIZE := 261120k + KERNEL_IN_UBI := 1 + UBINIZE_OPTS := -m 2048 -p 128KiB -s 2048 + DEVICE_PACKAGES := airoha-en7581-npu-firmware kmod-phy-airoha-en8811h kmod-i2c-an7581 kmod-input-gpio-keys-polled + IMAGES += factory.bin sysupgrade.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SOC := an7581 +endef +TARGET_DEVICES += bell_xg-040g-md --- a/target/linux/airoha/an7581/base-files/etc/board.d/02_network +++ b/target/linux/airoha/an7581/base-files/etc/board.d/02_network @@ -14,6 +14,9 @@ an7581_setup_interfaces() airoha,an7581-evb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth1" ;; + bell,xg-040g-md) + ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "eth1" + ;; *) echo "Unsupported hardware. Network interfaces not initialized" ;; new file mode 100644 index 00000000000000..556caa19fe6d14 --- /dev/null +++ b/target/linux/airoha/an7581/base-files/lib/upgrade/platform.sh @@ -0,0 +1,15 @@ +REQUIRE_IMAGE_METADATA=1 + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + *) + nand_do_upgrade "$1" + ;; + esac +} + +platform_check_image() { + return 0 +} ================================================ FILE: devices/amlogic_meson/.config ================================================ CONFIG_TARGET_amlogic=y CONFIG_TARGET_amlogic_meson=y CONFIG_TARGET_MULTI_PROFILE=y CONFIG_TARGET_ALL_PROFILES=y CONFIG_PACKAGE_kmod-pcie_mhi=n ================================================ FILE: devices/amlogic_meson/diy.sh ================================================ #!/bin/bash shopt -s extglob git_clone_path istoreos-24.10 https://github.com/istoreos/istoreos target/linux/amlogic package/boot/uboot-amlogic-prebuilt mv -f target/linux/amlogic/patches-6.6 target/linux/amlogic/patches-6.12 mv -f target/linux/amlogic/meson/config-6.6 target/linux/amlogic/meson/config-6.12 sed -i "s/KERNEL_PATCHVER:=6.6/KERNEL_PATCHVER:=6.12/" target/linux/amlogic/Makefile rm -rf package/kernel/r81* ================================================ FILE: devices/amlogic_meson/patches/fix.patch ================================================ --- a/package/kernel/mac80211/broadcom.mk +++ b/package/kernel/mac80211/broadcom.mk @@ -432,6 +432,7 @@ define KernelPackage/brcmfmac/config config BRCMFMAC_SDIO bool "Enable SDIO bus interface support" + default y if TARGET_amlogic default y if TARGET_bcm27xx default y if TARGET_imx_cortexa7 default y if TARGET_starfive ================================================ FILE: devices/amlogic_meson8b/.config ================================================ CONFIG_TARGET_amlogic=y CONFIG_TARGET_amlogic_meson8b=y CONFIG_TARGET_amlogic_meson8b_DEVICE_thunder-onecloud=y CONFIG_TARGET_ROOTFS_SQUASHFS=n CONFIG_TARGET_ROOTFS_EXT4FS=y ================================================ FILE: devices/amlogic_meson8b/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh #rm -rf package/kernel/mac80211 #git_clone_path c640f7b93736621b4d56627e4f6ab824093f9c3d https://github.com/openwrt/openwrt package/kernel/mac80211 git_clone_path main https://github.com/lxiaya/openwrt-onecloud target/linux/amlogic mv -f target/linux/amlogic/patches-6.6 target/linux/amlogic/patches-6.12 mv -f target/linux/amlogic/meson8b/config-6.6 target/linux/amlogic/meson8b/config-6.12 sed -i "s/KERNEL_PATCHVER:=6.6/KERNEL_PATCHVER:=6.12/" target/linux/amlogic/Makefile sed -i "s/wpad-openssl/wpad-basic-mbedtls/" target/linux/amlogic/image/Makefile sed -i "s/neon-vfpv4/vfpv4/" target/linux/amlogic/meson8b/target.mk ================================================ FILE: devices/amlogic_meson8b/patches/BRCMFMAC_SDIO.patch ================================================ --- a/package/kernel/mac80211/broadcom.mk +++ b/package/kernel/mac80211/broadcom.mk @@ -432,6 +432,7 @@ define KernelPackage/brcmfmac/config config BRCMFMAC_SDIO bool "Enable SDIO bus interface support" + default y if TARGET_amlogic default y if TARGET_bcm27xx default y if TARGET_imx_cortexa7 default y if TARGET_starfive ================================================ FILE: devices/amlogic_meson8b/patches/onecloud.patch ================================================ --- a/target/linux/amlogic/image/Makefile +++ b/target/linux/amlogic/image/Makefile @@ -36,7 +36,7 @@ endef ### Devices ### define Device/Default FILESYSTEMS := ext4 - IMAGES := emmc.img + IMAGES := emmc_burn.img KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) KERNEL_LOADADDR := 0x01080000 KERNEL_NAME := Image @@ -46,12 +46,19 @@ endef define Device/thunder-onecloud DEVICE_DTS := amlogic/meson8b-onecloud - DEVICE_TITLE := Thunder OneCloud + DEVICE_TITLE := OneCloud 玩客云 + DEVICE_PACKAGES += kmod-usb-net-rtl8152 KERNEL_LOADADDR := 0x00208000 - IMAGE/emmc.img := boot-script onecloud | emmc-common $$(DEVICE_NAME) + IMAGE/emmc_burn.img := boot-script onecloud | emmc-common $$(DEVICE_NAME) endef ifeq ($(SUBTARGET),meson8b) TARGET_DEVICES += thunder-onecloud endif +define Image/Build + export BIN_DIR=$(BIN_DIR); \ + cd /data/packit/openwrt-onecloud; \ + . ~/packit/packit_onecloud1.sh +endef + $(eval $(call BuildImage)) ================================================ FILE: devices/armsr_armv8/.config ================================================ CONFIG_TARGET_armsr=y CONFIG_TARGET_armsr_armv8=y CCONFIG_TARGET_DEVICE_armsr_armv8_DEVICE_generic=y CONFIG_TARGET_DEVICE_armsr_armv8_DEVICE_box=y CONFIG_PACKAGE_kmod-brcmfmac=y CONFIG_BRCMFMAC_SDIO=y CONFIG_TARGET_ROOTFS_TARGZ=y CONFIG_TARGET_ROOTFS_EXT4FS=y CONFIG_TARGET_ROOTFS_SQUASHFS=n CONFIG_PACKAGE_kmod-switch-ar8xxx=n ================================================ FILE: devices/armsr_armv8/diy.sh ================================================ SHELL_FOLDER=$(dirname $(readlink -f "$0")) rm -rf package/feeds/kiddin9/rtl8188eu package/feeds/kiddin9/rtl8192eu package/feeds/kiddin9/rtl8812au-ac ================================================ FILE: devices/armsr_armv8/patches/rootfs.patch ================================================ --- a/target/linux/armsr/image/Makefile +++ b/target/linux/armsr/image/Makefile @@ -81,10 +81,8 @@ define Device/efi-default IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata IMAGE/combined-efi.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) - IMAGES-y := rootfs.img.gz IMAGES-y += combined-efi.img.gz else - IMAGES-y := rootfs.img IMAGES-y += combined-efi.img endif ifeq ($(CONFIG_VMDK_IMAGES),y) @@ -116,4 +114,24 @@ define Device/generic endef TARGET_DEVICES += generic +define Device/box + DEVICE_TITLE := N1/电视盒子全系列 + DEVICE_PACKAGES := perlbase-base perlbase-utf8 perlbase-time perlbase-xsloader perlbase-file btrfs-progs luci-app-amlogic kmod-brcmfmac wpad-basic-mbedtls iw fdisk lsblk automount + IMAGE/rootfs.tar.gz := append-rootfs | gzip + IMAGES := rootfs.tar.gz + KERNEL := kernel-bin +endef +TARGET_DEVICES += box + +define Image/Build + if [ "$(PROFILE_SANITIZED)" == "box" ]; then \ + export BIN_DIR=$(BIN_DIR); \ + export DATE=$(DATE); \ + export MORE="$(MORE)"; \ + export ROOTFS_PARTSIZE=$(shell echo $$(($(ROOTFS_PARTSIZE)/1024/1024))); \ + cd /data/packit/amlogic-s9xxx-openwrt; \ + . ~/packit/packit_amlogic.sh; \ + fi +endef + $(eval $(call BuildImage)) ================================================ FILE: devices/ath79_nand/.config ================================================ CONFIG_TARGET_ath79=y CONFIG_TARGET_ath79_nand=y CONFIG_TARGET_DEVICE_ath79_nand_DEVICE_meraki_mr18=n ================================================ FILE: devices/ath79_nand/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) sed -i '/# start dockerd/,/# end dockerd/d' .config rm -rf feeds/kiddin9/xtables-wgobfs ================================================ FILE: devices/bcm27xx_bcm2708/.config ================================================ CONFIG_TARGET_bcm27xx=y CONFIG_TARGET_bcm27xx_bcm2708=y CONFIG_TARGET_DEVICE_bcm27xx_bcm2708_DEVICE_rpi=y CONFIG_PACKAGE_kmod-codec-bcm2835=n CONFIG_PACKAGE_kmod-isp-bcm2835=n ================================================ FILE: devices/bcm27xx_bcm2708/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile ================================================ FILE: devices/bcm27xx_bcm2709/.config ================================================ CONFIG_TARGET_bcm27xx=y CONFIG_TARGET_bcm27xx_bcm2709=y CONFIG_TARGET_bcm27xx_bcm2709_DEVICE_rpi-2=y CONFIG_PACKAGE_kmod-codec-bcm2835=n CONFIG_PACKAGE_kmod-isp-bcm2835=n ================================================ FILE: devices/bcm27xx_bcm2709/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile sed -i 's/ factory.img.gz / /' target/linux/bcm27xx/image/Makefile ================================================ FILE: devices/bcm27xx_bcm2710/.config ================================================ CONFIG_TARGET_bcm27xx=y CONFIG_TARGET_bcm27xx_bcm2710=y CONFIG_TARGET_bcm27xx_bcm2710_DEVICE_rpi-3=y CONFIG_PACKAGE_kmod-codec-bcm2835=n CONFIG_PACKAGE_kmod-isp-bcm2835=n ================================================ FILE: devices/bcm27xx_bcm2710/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile wget -N https://github.com/RPi-Distro/firmware-nonfree/raw/bullseye/debian/config/brcm80211/brcm/brcmfmac43436-sdio.bin -P files/lib/firmware/brcm/ wget -N https://github.com/RPi-Distro/firmware-nonfree/raw/bullseye/debian/config/brcm80211/brcm/brcmfmac43436-sdio.txt -P files/lib/firmware/brcm/ wget -N https://github.com/RPi-Distro/firmware-nonfree/raw/bullseye/debian/config/brcm80211/brcm/brcmfmac43436s-sdio.bin -P files/lib/firmware/brcm/ wget -N https://github.com/RPi-Distro/firmware-nonfree/raw/bullseye/debian/config/brcm80211/brcm/brcmfmac43436s-sdio.txt -P files/lib/firmware/brcm/ ================================================ FILE: devices/bcm27xx_bcm2710/patches/Zero-2.patch ================================================ --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -122,7 +122,7 @@ define Device/rpi-3 DEVICE_MODEL := 3B/3B+/CM3 DEVICE_VARIANT := (64bit) DEVICE_ALT0_VENDOR := Raspberry Pi - DEVICE_ALT0_MODEL := 2B-1.2 + DEVICE_ALT0_MODEL := 2B-1.2/Zero 2/Zero 2W DEVICE_ALT0_VARIANT := (64bit) KERNEL_IMG := kernel8.img DEVICE_DTS := \ ================================================ FILE: devices/bcm27xx_bcm2711/.config ================================================ CONFIG_TARGET_bcm27xx=y CONFIG_TARGET_bcm27xx_bcm2711=y CONFIG_TARGET_bcm27xx_bcm2711_DEVICE_rpi-4=y CONFIG_PACKAGE_kmod-codec-bcm2835=n CONFIG_PACKAGE_kmod-isp-bcm2835=n ================================================ FILE: devices/bcm27xx_bcm2711/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile ================================================ FILE: devices/bcm27xx_bcm2712/.config ================================================ CONFIG_TARGET_bcm27xx=y CONFIG_TARGET_bcm27xx_bcm2712=y CONFIG_TARGET_bcm27xx_bcm2712_DEVICE_rpi-5=y CONFIG_PACKAGE_kmod-of-mdio=n CONFIG_PACKAGE_kmod-codec-bcm2835=n CONFIG_PACKAGE_kmod-isp-bcm2835=n ================================================ FILE: devices/bcm27xx_bcm2712/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152/' target/linux/bcm27xx/Makefile ================================================ FILE: devices/bcm53xx/.config ================================================ CONFIG_TARGET_bcm53xx=y CONFIG_TARGET_bcm53xx_generic=y CONFIG_TARGET_DEVICE_bcm53xx_generic_DEVICE_phicomm_k3=y CONFIG_TARGET_DEVICE_bcm53xx_generic_DEVICE_asus_rt-ac88u=y CONFIG_TARGET_DEVICE_bcm53xx_generic_DEVICE_dlink_dir-885l=y CONFIG_KERNEL_DEVMEM=y CONFIG_BUSYBOX_CONFIG_ARPING=y CONFIG_PACKAGE_kmod-pcie_mhi=n ================================================ FILE: devices/bcm53xx/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) sed -i "s/^TARGET_DEVICES /# TARGET_DEVICES /" target/linux/bcm53xx/image/Makefile sed -i "s/# TARGET_DEVICES += phicomm_k3/TARGET_DEVICES += phicomm_k3/" target/linux/bcm53xx/image/Makefile sed -i "s/# TARGET_DEVICES += asus_rt-ac88u/TARGET_DEVICES += asus_rt-ac88u/" target/linux/bcm53xx/image/Makefile sed -i "s/# TARGET_DEVICES += dlink_dir-885l/TARGET_DEVICES += dlink_dir-885l/" target/linux/bcm53xx/image/Makefile sed -i "s/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES)/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES) -brcmfmac-firmware-4366c0-pcie k3wifi luci-app-k3screenctrl/" target/linux/bcm53xx/image/Makefile ================================================ FILE: devices/common/.config ================================================ CONFIG_GRUB_TIMEOUT="0" CONFIG_GRUB_CONSOLE=n CONFIG_TARGET_ROOTFS_EXT4FS=n CONFIG_TARGET_ROOTFS_CPIOGZ=n CONFIG_LUCI_CSSTIDY=n CONFIG_SIGNED_PACKAGES=n CONFIG_SIGNATURE_CHECK=n CONFIG_TARGET_MULTI_PROFILE=y CONFIG_TARGET_ALL_PROFILES=y # 设置固件大小: CONFIG_TARGET_ROOTFS_PARTSIZE=1004 CONFIG_ALL_NONSHARED=y CONFIG_USE_APK=n CONFIG_BUILD_PATENTED=y CONFIG_IB=y CONFIG_IB_STANDALONE=y CONFIG_JSON_OVERVIEW_IMAGE_INFO=y CONFIG_FEED_telephony=n CONFIG_KERNEL_WERROR=n # IPv6支持: CONFIG_IPV6=y # Applications # Themes CONFIG_PACKAGE_luci-theme-bootstrap=y # 其他需要安装的软件包: CONFIG_PACKAGE_dnsmasq=n CONFIG_PACKAGE_dnsmasq-full=y CONFIG_PACKAGE_dnsmasq_full_dhcp=y CONFIG_PACKAGE_dnsmasq_full_ipset=y CONFIG_PACKAGE_firewall=m CONFIG_PACKAGE_miniupnpd-iptables=m CONFIG_NGINX_DAV=y CONFIG_PACKAGE_luci-base=y CONFIG_PACKAGE_luci-compat=y CONFIG_PACKAGE_luci-lib-ipkg=y CONFIG_LUCI_LANG_zh_Hans=y CONFIG_LUCI_LANG_en=y CONFIG_PACKAGE_coremark=y CONFIG_DEVEL=y CONFIG_CCACHE=y CONFIG_TOOLCHAINOPTS=y CONFIG_COREMARK_OPTIMIZE_O3=y CONFIG_COREMARK_ENABLE_MULTITHREADING=y CONFIG_COREMARK_NUMBER_OF_THREADS=16 CONFIG_PACKAGE_zoneinfo-asia=y CONFIG_PACKAGE_my-default-settings=y CONFIG_PACKAGE_wget-ssl=y CONFIG_PACKAGE_curl=y CONFIG_PACKAGE_htop=y CONFIG_PACKAGE_nano=y CONFIG_XRAY_PROVIDE_V2RAY=y CONFIG_V2RAY_CORE_COMPRESS_UPX=n CONFIG_XRAY_CORE_COMPRESS_UPX=n CONFIG_PACKAGE_zram-swap=y CONFIG_PACKAGE_kmod-lib-lz4=y CONFIG_PACKAGE_kmod-lib-zstd=y CONFIG_NODEJS_14=y CONFIG_BUSYBOX_CUSTOM=y CONFIG_BUSYBOX_CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y CONFIG_BUSYBOX_CONFIG_FEATURE_CROND_SPECIAL_TIMES=y CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG_INFO=y CONFIG_PACKAGE_luci-ssl=y # uhttpd服务 CONFIG_PACKAGE_bash=y CONFIG_PACKAGE_ca-bundle=y CONFIG_PACKAGE_wifi-scripts=m # CONFIG_PACKAGE_netdata=m CONFIG_IMAGEOPT=y CONFIG_VERSIONOPT=y CONFIG_VERSION_MANUFACTURER="Kiddin'" CONFIG_VERSION_FILENAMES=n CONFIG_VERSION_CODE_FILENAMES=n CONFIG_VERSION_HOME_URL="https://openwrt.ai/" CONFIG_KERNEL_XDP_SOCKETS=y CONFIG_ZLIB_OPTIMIZE_SPEED=y CONFIG_ZSTD_OPTIMIZE_O3=y CONFIG_BUILD_PATENTED=y # start dockerd CONFIG_KERNEL_CGROUP_DEVICE=y CONFIG_KERNEL_CGROUP_FREEZER=y CONFIG_KERNEL_NET_CLS_CGROUP=y CONFIG_KERNEL_CGROUP_NET_PRIO=y CONFIG_KERNEL_MEMCG_SWAP_ENABLED=y CONFIG_KERNEL_CFQ_GROUP_IOSCHED=y CONFIG_KERNEL_CGROUP_PERF=y CONFIG_KERNEL_CGROUP_HUGETLB=y CONFIG_KERNEL_EXT4_FS_POSIX_ACL=y CONFIG_KERNEL_EXT4_FS_SECURITY=y CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y # end dockerd ================================================ FILE: devices/common/diy/feeds/luci/modules/luci-base/htdocs/luci-static/resources/tools/github.js ================================================ 'use strict'; return L.Class.extend({ desc: function(description, username, project) { var luci_project = 'luci-app-' + project; var title = _('if you have any problem, please click to view the project on GitHub : ') + project; var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + luci_project; var package_label = 'package-' + project.replace(/-/g, '_') + '-default'; var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default'; return "" + "" + "" + "" + "" + "
" + _(description) + "" + "" + "" + "" + "" + "
" + "" + "" + project + "" + "" + project + "" + "" + "" + "" + luci_project + "" + "" + luci_project + "" + "" + "
" + "
"; }, luci_desc: function(description, username, project) { var luci_label = 'luci-' + project.replace(/-/g, '_') + '-default'; project = 'luci-app-' + project; var luci_title = _('if you have any problem, please click to view the luci ui project on GitHub : ') + project; return "" + "" + "" + "" + "" + "
" + _(description) + "" + "" + "" + project + "" + "" + project + "" + "" + "
"; } }); ================================================ FILE: devices/common/diy/package/base-files/files/etc/banner ================================================ |\__/,| (`\ _.|o o |_ ) ) -------------(((---(((------------------- %D %C by Kiddin' ----------------------------------------- ================================================ FILE: devices/common/diy/package/network/config/firewall/files/firewall.exwan ================================================ #!/bin/sh # UCI 配置操作函数 config_get() { uci -q get "$1"; } config_set() { uci set "$1=$2"; } config_add_list() { uci add_list "$1=$2"; } config_delete() { uci -q delete "$1"; } config_commit() { uci commit "$1"; } # 检查列表是否包含元素 list_contains() { local value="$1"; shift echo "$@" | grep -q -w "$value" } # 从列表中移除元素 list_remove() { local value="$1" local list="$2" echo "$list" | sed "s/\<$value\>//g" | xargs } # 更新 SSH 和 TTYD 配置 update_ssh_ttyd() { if [ "$(config_get "firewall.@defaults[0].ex_ssh")" = "1" ]; then if [ -n "$(config_get "dropbear.@dropbear[0].GatewayPorts")" ]; then config_set "dropbear.@dropbear[0].GatewayPorts" "on" config_commit "dropbear" service dropbear reload & fi if command -v ttyd >/dev/null 2>&1; then [ "$(config_get "ttyd.@ttyd[0].interface")" != "@lan" ] && config_set "ttyd.@ttyd[0].interface" "@lan" if [ "$(config_get "firewall.@defaults[0].family")" = "ipv4" ]; then config_set "ttyd.@ttyd[0].ipv6" "0" else config_set "ttyd.@ttyd[0].ipv6" "1" fi config_commit "ttyd" service ttyd reload & fi fi } # 更新防火墙规则 update_firewall_rule() { local port="$1" local is_backend_port="$2" local rule="firewall.ex_$port" local family=$(config_get "firewall.@defaults[0].family") local proto=$(config_get "firewall.@defaults[0].proto") config_set "$rule" "rule" config_set "$rule.name" "ex_$port" config_set "$rule.src" "wan" config_set "$rule.dest_port" "$port" config_set "$rule.target" "ACCEPT" [ "$family" = "ipv4" ] && config_set "$rule.family" "ipv4" || config_set "$rule.family" "ipv6" if [ "$is_backend_port" = "1" ]; then config_add_list "$rule.proto" "tcp" else case "$proto" in udp) config_add_list "$rule.proto" "udp" ;; tudp) config_add_list "$rule.proto" "tcp" config_add_list "$rule.proto" "udp" ;; *) config_add_list "$rule.proto" "tcp" ;; esac fi } # 删除所有以前生成的 config rule remove_all_ex_rules() { local rules=$(uci show firewall | grep "\.name='ex_" | cut -d. -f2) for rule in $rules; do config_delete "firewall.$rule" done } # 更新 export 配置 update_export() { local export=$(config_get "firewall.@defaults[0].export") local ex_ssh=$(config_get "firewall.@defaults[0].ex_ssh") local sshport=$(config_get "dropbear.@dropbear[0].Port") # 处理 SSH 端口 if [ "$ex_ssh" = "1" ]; then if ! list_contains "$sshport" $export; then export="$export $sshport" fi else export=$(list_remove "$sshport" "$export") fi config_set "firewall.@defaults[0].export" "$export" remove_all_ex_rules # 添加新的规则 for port in $export; do update_firewall_rule "$port" "0" done } # 更新 uhttpd 配置 update_uhttpd() { local backend_port="$1" local old_backend_port="$2" local use_https=$(config_get "uhttpd.main.redirect_https") uci -q del_list uhttpd.main.listen_http="0.0.0.0:$old_backend_port" uci -q del_list uhttpd.main.listen_http="[::]:$old_backend_port" uci -q del_list uhttpd.main.listen_https="0.0.0.0:$old_backend_port" uci -q del_list uhttpd.main.listen_https="[::]:$old_backend_port" if [ -n "$backend_port" ]; then if [ "$use_https" = "1" ]; then config_add_list "uhttpd.main.listen_https" "0.0.0.0:$backend_port" config_add_list "uhttpd.main.listen_https" "[::]:$backend_port" else config_add_list "uhttpd.main.listen_http" "0.0.0.0:$backend_port" config_add_list "uhttpd.main.listen_http" "[::]:$backend_port" fi fi config_commit "uhttpd" } # 更新 nginx 配置 update_nginx() { local backend_port="$1" local old_backend_port="$2" local use_https=$(uci show nginx | grep -q "_redirect2ssl" && echo "1" || echo "0") config_delete "nginx.ex_$old_backend_port" if [ -n "$backend_port" ]; then config_set "nginx.ex_$backend_port" "server" config_set "nginx.ex_$backend_port.server_name" "ex_$backend_port" config_add_list "nginx.ex_$backend_port.include" "conf.d/*.locations" config_set "nginx.ex_$backend_port.access_log" "off" if [ "$use_https" = "1" ]; then config_add_list "nginx.ex_$backend_port.listen" "$backend_port ssl" config_add_list "nginx.ex_$backend_port.listen" "[::]:$backend_port ssl" if [ ! "$(config_get "nginx.ex_$backend_port.ssl_certificate")" ]; then config_set "nginx.ex_$backend_port.ssl_certificate" "/etc/nginx/conf.d/_lan.crt" config_set "nginx.ex_$backend_port.ssl_certificate_key" "/etc/nginx/conf.d/_lan.key" fi else config_add_list "nginx.ex_$backend_port.listen" "$backend_port" config_add_list "nginx.ex_$backend_port.listen" "[::]:$backend_port" fi fi config_commit "nginx" } # 主逻辑 main() { local backend_port=$(config_get "firewall.@defaults[0].backend_port") local old_backend_port=$(config_get "firewall.@defaults[0].old_backend_port") update_ssh_ttyd update_export if [ "$backend_port" != "$old_backend_port" ]; then if pgrep nginx >/dev/null; then update_nginx "$backend_port" "$old_backend_port" /etc/init.d/nginx reload & elif pgrep uhttpd >/dev/null; then update_uhttpd "$backend_port" "$old_backend_port" /etc/init.d/uhttpd reload & fi config_set "firewall.@defaults[0].old_backend_port" "$backend_port" fi [ -n "$backend_port" ] && update_firewall_rule "$backend_port" "1" config_commit "firewall" } main ================================================ FILE: devices/common/diy/package/network/config/firewall/patches/fullconenat.patch ================================================ index 85a3750..9fac9b1 100644 --- a/defaults.c +++ b/defaults.c @@ -46,7 +46,9 @@ const struct fw3_option fw3_flag_opts[] = { FW3_OPT("synflood_protect", bool, defaults, syn_flood), FW3_OPT("synflood_rate", limit, defaults, syn_flood_rate), FW3_OPT("synflood_burst", int, defaults, syn_flood_rate.burst), - + + FW3_OPT("fullcone", bool, defaults, fullcone), + FW3_OPT("tcp_syncookies", bool, defaults, tcp_syncookies), FW3_OPT("tcp_ecn", int, defaults, tcp_ecn), FW3_OPT("tcp_window_scaling", bool, defaults, tcp_window_scaling), diff --git a/options.h b/options.h index 6edd174..c02eb97 100644 --- a/options.h +++ b/options.h @@ -267,6 +267,7 @@ struct fw3_defaults bool drop_invalid; bool syn_flood; + bool fullcone; struct fw3_limit syn_flood_rate; bool tcp_syncookies; diff --git a/zones.c b/zones.c index 2aa7473..57eead0 100644 --- a/zones.c +++ b/zones.c @@ -627,6 +627,7 @@ print_zone_rule(struct fw3_ipt_handle *h struct fw3_address *msrc; struct fw3_address *mdest; struct fw3_ipt_rule *r; + struct fw3_defaults *defs = &state->defaults; if (!fw3_is_family(zone, handle->family)) return; @@ -712,8 +713,22 @@ print_zone_rule(struct fw3_ipt_handle *h { r = fw3_ipt_rule_new(handle); fw3_ipt_rule_src_dest(r, msrc, mdest); - fw3_ipt_rule_target(r, "MASQUERADE"); - fw3_ipt_rule_append(r, "zone_%s_postrouting", zone->name); + /*FIXME: Workaround for FULLCONE-NAT*/ + if(defs->fullcone) + { + warn("%s will enable FULLCONE-NAT", zone->name); + fw3_ipt_rule_target(r, "FULLCONENAT"); + fw3_ipt_rule_append(r, "zone_%s_postrouting", zone->name); + r = fw3_ipt_rule_new(handle); + fw3_ipt_rule_src_dest(r, msrc, mdest); + fw3_ipt_rule_target(r, "FULLCONENAT"); + fw3_ipt_rule_append(r, "zone_%s_prerouting", zone->name); + } + else + { + fw3_ipt_rule_target(r, "MASQUERADE"); + fw3_ipt_rule_append(r, "zone_%s_postrouting", zone->name); + } } } } ================================================ FILE: devices/common/diy/package/network/config/firewall4/files/firewall.exwan ================================================ #!/bin/sh # UCI 配置操作函数 config_get() { uci -q get "$1"; } config_set() { uci set "$1=$2"; } config_add_list() { uci add_list "$1=$2"; } config_delete() { uci -q delete "$1"; } config_commit() { uci commit "$1"; } # 检查列表是否包含元素 list_contains() { local value="$1"; shift echo "$@" | grep -q -w "$value" } # 从列表中移除元素 list_remove() { local value="$1" local list="$2" echo "$list" | sed "s/\<$value\>//g" | xargs } # 更新 SSH 和 TTYD 配置 update_ssh_ttyd() { if [ "$(config_get "firewall.@defaults[0].ex_ssh")" = "1" ]; then if [ -n "$(config_get "dropbear.@dropbear[0].GatewayPorts")" ]; then config_set "dropbear.@dropbear[0].GatewayPorts" "on" config_commit "dropbear" service dropbear reload & fi if command -v ttyd >/dev/null 2>&1; then [ "$(config_get "ttyd.@ttyd[0].interface")" != "@lan" ] && config_set "ttyd.@ttyd[0].interface" "@lan" if [ "$(config_get "firewall.@defaults[0].family")" = "ipv4" ]; then config_set "ttyd.@ttyd[0].ipv6" "0" else config_set "ttyd.@ttyd[0].ipv6" "1" fi config_commit "ttyd" service ttyd reload & fi fi } # 更新防火墙规则 update_firewall_rule() { local port="$1" local is_backend_port="$2" local rule="firewall.ex_$port" local family=$(config_get "firewall.@defaults[0].family") local proto=$(config_get "firewall.@defaults[0].proto") config_set "$rule" "rule" config_set "$rule.name" "ex_$port" config_set "$rule.src" "wan" config_set "$rule.dest_port" "$port" config_set "$rule.target" "ACCEPT" [ "$family" = "ipv4" ] && config_set "$rule.family" "ipv4" || config_set "$rule.family" "ipv6" if [ "$is_backend_port" = "1" ]; then config_add_list "$rule.proto" "tcp" else case "$proto" in udp) config_add_list "$rule.proto" "udp" ;; tudp) config_add_list "$rule.proto" "tcp" config_add_list "$rule.proto" "udp" ;; *) config_add_list "$rule.proto" "tcp" ;; esac fi } # 删除所有以前生成的 config rule remove_all_ex_rules() { local rules=$(uci show firewall | grep "\.name='ex_" | cut -d. -f2) for rule in $rules; do config_delete "firewall.$rule" done } # 更新 export 配置 update_export() { local export=$(config_get "firewall.@defaults[0].export") local ex_ssh=$(config_get "firewall.@defaults[0].ex_ssh") local sshport=$(config_get "dropbear.@dropbear[0].Port") # 处理 SSH 端口 if [ "$ex_ssh" = "1" ]; then if ! list_contains "$sshport" $export; then export="$export $sshport" fi else export=$(list_remove "$sshport" "$export") fi config_set "firewall.@defaults[0].export" "$export" remove_all_ex_rules # 添加新的规则 for port in $export; do update_firewall_rule "$port" "0" done } # 更新 uhttpd 配置 update_uhttpd() { local backend_port="$1" local old_backend_port="$2" local use_https=$(config_get "uhttpd.main.redirect_https") uci -q del_list uhttpd.main.listen_http="0.0.0.0:$old_backend_port" uci -q del_list uhttpd.main.listen_http="[::]:$old_backend_port" uci -q del_list uhttpd.main.listen_https="0.0.0.0:$old_backend_port" uci -q del_list uhttpd.main.listen_https="[::]:$old_backend_port" if [ -n "$backend_port" ]; then if [ "$use_https" = "1" ]; then config_add_list "uhttpd.main.listen_https" "0.0.0.0:$backend_port" config_add_list "uhttpd.main.listen_https" "[::]:$backend_port" else config_add_list "uhttpd.main.listen_http" "0.0.0.0:$backend_port" config_add_list "uhttpd.main.listen_http" "[::]:$backend_port" fi fi config_commit "uhttpd" } # 更新 nginx 配置 update_nginx() { local backend_port="$1" local old_backend_port="$2" local use_https=$(uci show nginx | grep -q "_redirect2ssl" && echo "1" || echo "0") config_delete "nginx.ex_$old_backend_port" if [ -n "$backend_port" ]; then config_set "nginx.ex_$backend_port" "server" config_set "nginx.ex_$backend_port.server_name" "ex_$backend_port" config_add_list "nginx.ex_$backend_port.include" "conf.d/*.locations" config_set "nginx.ex_$backend_port.access_log" "off" if [ "$use_https" = "1" ]; then config_add_list "nginx.ex_$backend_port.listen" "$backend_port ssl" config_add_list "nginx.ex_$backend_port.listen" "[::]:$backend_port ssl" if [ ! "$(config_get "nginx.ex_$backend_port.ssl_certificate")" ]; then config_set "nginx.ex_$backend_port.ssl_certificate" "/etc/nginx/conf.d/_lan.crt" config_set "nginx.ex_$backend_port.ssl_certificate_key" "/etc/nginx/conf.d/_lan.key" fi else config_add_list "nginx.ex_$backend_port.listen" "$backend_port" config_add_list "nginx.ex_$backend_port.listen" "[::]:$backend_port" fi fi config_commit "nginx" } # 主逻辑 main() { local backend_port=$(config_get "firewall.@defaults[0].backend_port") local old_backend_port=$(config_get "firewall.@defaults[0].old_backend_port") update_ssh_ttyd update_export if [ "$backend_port" != "$old_backend_port" ]; then if pgrep nginx >/dev/null; then update_nginx "$backend_port" "$old_backend_port" /etc/init.d/nginx reload & elif pgrep uhttpd >/dev/null; then update_uhttpd "$backend_port" "$old_backend_port" /etc/init.d/uhttpd reload & fi config_set "firewall.@defaults[0].old_backend_port" "$backend_port" fi [ -n "$backend_port" ] && update_firewall_rule "$backend_port" "1" config_commit "firewall" } main ================================================ FILE: devices/common/diy/package/network/config/firewall4/files/firewall.include ================================================ ================================================ FILE: devices/common/diy/package/network/config/firewall4/patches/001-firewall4-add-support-for-fullcone-nat.patch ================================================ From aa3b56e289fba7425e649a608c333622ffd9c367 Mon Sep 17 00:00:00 2001 From: Syrone Wong Date: Sat, 9 Apr 2022 13:24:19 +0800 Subject: [PATCH] firewall4: add fullcone support fullcone is drop-in replacement of masq for non-udp traffic add runtime fullcone rule check, disable it globally if fullcone expr is invalid defaults.fullcone and defaults.fullcone6 are switches for IPv4 and IPv6 respectively, most IPv6 traffic do NOT need this FullCone NAT functionality. Renew: ZiMing Mo --- root/etc/config/firewall | 2 ++ root/usr/share/firewall4/templates/ruleset.uc | 16 ++++++++++++++-- .../firewall4/templates/zone-fullcone.uc | 4 ++++ root/usr/share/ucode/fw4.uc | 69 ++++++++++++++++++- 4 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 root/usr/share/firewall4/templates/zone-fullcone.uc --- a/root/etc/config/firewall +++ b/root/etc/config/firewall @@ -5,6 +5,10 @@ config defaults option forward REJECT # Uncomment this line to disable ipv6 rules # option disable_ipv6 1 + option flow_offloading 1 + option flow_offloading_hw 1 + option fullcone 1 + option fullcone6 0 config zone option name lan --- a/root/usr/share/firewall4/templates/ruleset.uc +++ b/root/usr/share/firewall4/templates/ruleset.uc @@ -327,6 +327,12 @@ table inet fw4 { {% for (let redirect in fw4.redirects(`dstnat_${zone.name}`)): %} {%+ include("redirect.uc", { fw4, zone, redirect }) %} {% endfor %} +{% if (zone.masq && fw4.default_option("fullcone")): %} + {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "dstnat" }) %} +{% endif %} +{% if (zone.masq6 && fw4.default_option("fullcone6")): %} + {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "dstnat" }) %} +{% endif %} {% fw4.includes('chain-append', `dstnat_${zone.name}`) %} } @@ -337,20 +343,26 @@ table inet fw4 { {% for (let redirect in fw4.redirects(`srcnat_${zone.name}`)): %} {%+ include("redirect.uc", { fw4, zone, redirect }) %} {% endfor %} -{% if (zone.masq): %} +{% if (zone.masq && !fw4.default_option("fullcone")): %} {% for (let saddrs in zone.masq4_src_subnets): %} {% for (let daddrs in zone.masq4_dest_subnets): %} {%+ include("zone-masq.uc", { fw4, zone, family: 4, saddrs, daddrs }) %} {% endfor %} {% endfor %} {% endif %} -{% if (zone.masq6): %} +{% if (zone.masq6 && !fw4.default_option("fullcone6")): %} {% for (let saddrs in zone.masq6_src_subnets): %} {% for (let daddrs in zone.masq6_dest_subnets): %} {%+ include("zone-masq.uc", { fw4, zone, family: 6, saddrs, daddrs }) %} {% endfor %} {% endfor %} {% endif %} +{% if (zone.masq && fw4.default_option("fullcone")): %} + {%+ include("zone-fullcone.uc", { fw4, zone, family: 4, direction: "srcnat" }) %} +{% endif %} +{% if (zone.masq6 && fw4.default_option("fullcone6")): %} + {%+ include("zone-fullcone.uc", { fw4, zone, family: 6, direction: "srcnat" }) %} +{% endif %} {% fw4.includes('chain-append', `srcnat_${zone.name}`) %} } --- /dev/null +++ b/root/usr/share/firewall4/templates/zone-fullcone.uc @@ -0,0 +1,4 @@ +{# /usr/share/firewall4/templates/zone-fullcone.uc #} + meta nfproto {{ fw4.nfproto(family) }} fullcone comment "!fw4: Handle {{ + zone.name +}} {{ fw4.nfproto(family, true) }} fullcone NAT {{ direction }} traffic" --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -1,3 +1,5 @@ +// /usr/share/ucode/fw4.uc + const fs = require("fs"); const uci = require("uci"); const ubus = require("ubus"); @@ -489,6 +491,25 @@ function nft_try_hw_offload(devices) { return (rc == 0); } +function nft_try_fullcone() { + let nft_test = + 'add table inet fw4-fullcone-test; ' + + 'add chain inet fw4-fullcone-test dstnat { ' + + 'type nat hook prerouting priority -100; policy accept; ' + + 'fullcone; ' + + '}; ' + + 'add chain inet fw4-fullcone-test srcnat { ' + + 'type nat hook postrouting priority -100; policy accept; ' + + 'fullcone; ' + + '}; '; + let cmd = sprintf("/usr/sbin/nft -c '%s' 2>/dev/null", replace(nft_test, "'", "'\\''")); + let ok = system(cmd) == 0; + if (!ok) { + warn("nft_try_fullcone: cmd "+ cmd + "\n"); + } + return ok; +} + return { read_kernel_version: function() { @@ -855,6 +876,18 @@ return { warn(`[!] ${msg}\n`); }, + myinfo: function(fmt, ...args) { + if (getenv("QUIET")) + return; + + let msg = sprintf(fmt, ...args); + + if (getenv("TTY")) + warn(`\033[32m${msg}\033[m\n`); + else + warn(`[I] ${msg}\n`); + }, + get: function(sid, opt) { return this.cursor.get("firewall", sid, opt); }, @@ -1036,6 +1069,21 @@ return { } }, + myinfo_section: function(s, msg) { + if (s[".name"]) { + if (s.name) + this.myinfo("Section %s (%s) %s", this.section_id(s[".name"]), s.name, msg); + else + this.myinfo("Section %s %s", this.section_id(s[".name"]), msg); + } + else { + if (s.name) + this.myinfo("ubus %s (%s) %s", s.type || "rule", s.name, msg); + else + this.myinfo("ubus %s %s", s.type || "rule", msg); + } + }, + parse_policy: function(val) { return this.parse_enum(val, [ "accept", @@ -1475,6 +1523,7 @@ return { "dnat", "snat", "masquerade", + "fullcone", "accept", "reject", "drop" @@ -1946,6 +1995,8 @@ return { } let defs = this.parse_options(data, { + fullcone: [ "bool", "0" ], + fullcone6: [ "bool", "0" ], input: [ "policy", "drop" ], output: [ "policy", "drop" ], forward: [ "policy", "drop" ], @@ -1980,6 +2031,11 @@ return { delete defs.syn_flood; + if (!nft_try_fullcone()) { + delete defs.fullcone; + warn("nft_try_fullcone failed, disable fullcone globally\n"); + } + this.state.defaults = defs; }, @@ -2205,10 +2261,23 @@ return { zone.related_subnets = related_subnets; zone.related_physdevs = related_physdevs; - if (zone.masq || zone.masq6) + if (zone.masq) { zone.dflags.snat = true; + if (this.state.defaults.fullcone) { + zone.dflags.dnat = true; + this.myinfo_section(data, "IPv4 fullcone enabled for zone '" + zone.name + "'"); + } + } + + if (zone.masq6) { + zone.dflags.snat = true; + if (this.state.defaults.fullcone6) { + zone.dflags.dnat = true; + this.myinfo_section(data, "IPv6 fullcone enabled for zone '" + zone.name + "'"); + } + } - if ((zone.auto_helper && !(zone.masq || zone.masq6)) || length(zone.helper)) { + if ((zone.auto_helper && !(zone.masq || zone.masq6 || this.state.defaults.fullcone || this.state.defaults.fullcone6)) || length(zone.helper)) { zone.dflags.helper = true; for (let helper in (length(zone.helper) ? zone.helper : this.state.helpers)) { ================================================ FILE: devices/common/diy/package/network/config/firewall4/patches/100-fw4-support-script.patch ================================================ diff --git a/root/sbin/fw4 b/root/sbin/fw4 index c3e95c2..8fa6c6e 100755 --- a/root/sbin/fw4 +++ b/root/sbin/fw4 @@ -20,6 +20,7 @@ start() { { flock -x 1000 + test -f /etc/firewall.exwan && sh /etc/firewall.exwan case "$1" in start) [ -f $STATE ] && die "The fw4 firewall appears to be already loaded." @@ -38,6 +39,7 @@ start() { ACTION=includes \ utpl -S $MAIN } 1000>$LOCK + test -f /etc/firewall.include && sh /etc/firewall.include } print() { ================================================ FILE: devices/common/diy/package/network/config/firewall4/patches/200-fw4-hotplug-fork.patch ================================================ diff --git a/root/etc/hotplug.d/iface/20-firewall b/root/etc/hotplug.d/iface/20-firewall index d0f030b..9a8132c 100644 --- a/root/etc/hotplug.d/iface/20-firewall +++ b/root/etc/hotplug.d/iface/20-firewall @@ -14,4 +14,4 @@ has_zone() { has_zone || exit 0 logger -t firewall "Reloading firewall due to $ACTION of $INTERFACE ($DEVICE)" -fw4 -q reload +fw4 -q reload & ================================================ FILE: devices/common/diy/package/system/opkg/patches/010-opkg-force-depends.patch ================================================ --- a/src/opkg-cl.c +++ b/src/opkg-cl.c @@ -255,6 +255,10 @@ static int args_parse(int argc, char *argv[]) } } + conf->force_depends = 1; + conf->force_checksum = 1; + conf->force_overwrite = 1; + if (!conf->conf_file && !conf->offline_root) conf->conf_file = xstrdup("/etc/opkg.conf"); ================================================ FILE: devices/common/diy/package/system/opkg/patches/ignore_error.patch ================================================ --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -1422,5 +1422,4 @@ "package \"%s\" %s script returned status %d.\n", pkg->name, script, err); - return err; } ================================================ FILE: devices/common/diy/package/system/opkg/patches/pkg_hash.patch ================================================ --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -263,5 +263,5 @@ if (unresolved) { - res = 1; + // res = 1; tmp = unresolved; while (*tmp) { ================================================ FILE: devices/common/diy/package/system/opkg/patches/zh-cn.patch ================================================ --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -174,9 +174,9 @@ if (res) { opkg_msg(ERROR, - "Failed to download %s, wget returned %d.\n", + "下载失败 %s, wget returned %d.\n", src, res); if (res == 4) opkg_msg(ERROR, - "Check your network settings and connectivity.\n\n"); + "请检查网络设置, 确保本设备网络可用.\n\n"); free(tmp_file_location); return -1; --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -225,5 +225,5 @@ new = pkg_hash_fetch_best_installation_candidate_by_name(package_name); if (!new) { - opkg_msg(ERROR, "Couldn't find package %s\n", package_name); + opkg_msg(ERROR, "找不到软件包 %s\n", package_name); return -1; } @@ -242,5 +242,5 @@ if (unresolved) { char **tmp = unresolved; - opkg_msg(ERROR, "Couldn't satisfy the following dependencies" + opkg_msg(ERROR, "无法满足以下依赖" " for %s:\n", package_name); while (*tmp) { @@ -271,5 +271,5 @@ if (pkg->src == NULL) { - opkg_msg(ERROR, "Package %s not available from any " + opkg_msg(ERROR, "在以下仓库未找到可用的 %s 软件包" "configured src\n", package_name); return -1; --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -222,6 +222,6 @@ if (pkg_size_kbs >= kbs_available) { - opkg_msg(ERROR, "Only have %ldkb available on filesystem %s, " - "pkg %s needs %ld\n", + opkg_msg(ERROR, "剩余可用容量不足, 文件系统 %s 当前剩余 %ldkb 可用," + "软件包 %s 需要 %ld\n", kbs_available, root_dir, pkg->name, pkg_size_kbs); return -1; @@ -1319,6 +1319,6 @@ } if (err) { - opkg_msg(ERROR, "Failed to download %s. " - "Perhaps you need to run 'opkg update'?\n", + opkg_msg(ERROR, "下载 %s 失败. " + "请更新列表后重试\n", pkg->name); return -1; --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -497,10 +497,10 @@ lock_fd = creat(lock_file, S_IRUSR | S_IWUSR | S_IRGRP); if (lock_fd == -1) { - opkg_perror(ERROR, "Could not create lock file %s", lock_file); + opkg_perror(ERROR, "有任务在执行中, 请稍后再试.", lock_file); goto err2; } if (lockf(lock_fd, F_TLOCK, (off_t) 0) == -1) { - opkg_perror(ERROR, "Could not lock %s", lock_file); + opkg_perror(ERROR, "有任务在执行中, 请稍后再试.", lock_file); if (close(lock_fd) == -1) opkg_perror(ERROR, "Couldn't close descriptor %d (%s)", ================================================ FILE: devices/common/diy.sh ================================================ #!/bin/bash #================================================= shopt -s extglob sed -i '$a src-git kiddin9 https://github.com/kiddin9/op-packages.git;main' feeds.conf.default sed -i "/telephony/d" feeds.conf.default sed -i "s?targets/%S/packages?targets/%S/\$(LINUX_VERSION)?" include/feeds.mk sed -i '/ refresh_config();/d' scripts/feeds sed -i "s?git.openwrt.org/\(project\|feed\)?github.com/openwrt?g" feeds.conf.default ./scripts/feeds update -a ./scripts/feeds install -a -p kiddin9 -f ./scripts/feeds install -a sed --follow-symlinks -i "s#%C\"#%C by Kiddin'\"#" package/base-files/files/etc/os-release sed -i -e '$a /etc/bench.log' \ -e '/\/etc\/profile/d' \ -e '/\/etc\/shinit/d' \ package/base-files/files/lib/upgrade/keep.d/base-files-essential sed -i -e '/^\/etc\/profile/d' \ -e '/^\/etc\/shinit/d' \ package/base-files/Makefile sed -i "s/192.168.1/10.0.0/" package/base-files/files/bin/config_generate sed -i "s#false; \\\#true; \\\#" include/download.mk wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/package/kernel/linux/modules/video.mk -P package/kernel/linux/modules/ wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/package/network/utils/nftables/patches/002-nftables-add-fullcone-expression-support.patch -P package/network/utils/nftables/patches/ wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/package/libs/libnftnl/patches/001-libnftnl-add-fullcone-expression-support.patch -P package/libs/libnftnl/patches/ wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/package/firmware/wireless-regdb/patches/600-custom-change-txpower-and-dfs.patch -P package/firmware/wireless-regdb/patches/ wget -N https://github.com/coolsnowwolf/lede/raw/refs/heads/master/package/system/fstools/patches/0200-ntfs3-with-utf8.patch -P package/system/fstools/patches/ wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/config/Config-kernel.in -P config/ rm -rf package/libs/openssl package/network/services/ppp git_clone_path openwrt-25.12 https://github.com/immortalwrt/immortalwrt package/libs/openssl package/network/services/ppp echo "$(date +"%s")" >version.date sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' package/Makefile sed -i "s/DEFAULT_PACKAGES:=/DEFAULT_PACKAGES:=luci-app-advancedplus luci-app-firewall luci-app-package-manager luci-app-upnp luci-app-syscontrol luci-proto-wireguard \ luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs \ coremark wget-ssl curl autocore htop nano zram-swap kmod-lib-zstd kmod-tcp-bbr bash openssh-sftp-server block-mount resolveip ds-lite swconfig luci-app-fan luci-app-filemanager luci-app-wifihistory /" include/target.mk sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-defaults.mk status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/op-packages/actions/runs" | jq -r '.workflow_runs[0].status') echo "$status" while [[ "$status" == "in_progress" || "$status" == "queued" ]];do echo "wait 5s" sleep 5 status=$(curl -H "Authorization: token $REPO_TOKEN" -s "https://api.github.com/repos/kiddin9/op-packages/actions/runs" | jq -r '.workflow_runs[0].status') done wget -N https://raw.githubusercontent.com/openwrt/packages/master/lang/golang/golang/Makefile -P feeds/packages/lang/golang/golang/ #sed -i "/call Build\/check-size,\$\$(KERNEL_SIZE)/d" include/image.mk sed -i "/+= targz/d" include/image.mk git_clone_path master https://github.com/coolsnowwolf/lede mv target/linux/generic/hack-6.12 rm -rf target/linux/generic/hack-6.12/767-net-phy-realtek-add-led* wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-6.12/613-netfilter_optional_tcp_window_check.patch -P target/linux/generic/pending-6.12/ # find target/linux/x86 -name "config*" -exec bash -c 'cat kernel.conf >> "{}"' \; sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/files/uhttpd.config #rm -rf ./feeds/packages/lang/{golang,node} sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab date=`date +%m.%d.%Y` sed -i -e "/\(# \)\?REVISION:=/c\REVISION:=$date" -e '/VERSION_CODE:=/c\VERSION_CODE:=$(REVISION)' include/version.mk sed -i 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config sed -i 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js sed -i \ -e "s/+\(luci\|luci-ssl\|uhttpd\)\( \|$\)/\2/" \ -e "s/+nginx\( \|$\)/+nginx-ssl\1/" \ -e 's/+python\( \|$\)/+python3/' \ -e 's?../../lang?$(TOPDIR)/feeds/packages/lang?' \ package/feeds/kiddin9/*/Makefile sed -i "s/OpenWrt/Kwrt/g" package/base-files/files/bin/config_generate package/base-files/image-config.in package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc config/Config-images.in Config.in include/u-boot.mk include/version.mk || true sed -i -e "s/set \${s}.country='\${country || ''}'/set \${s}.country='\${country || \"CN\"}'/g" -e "s/set \${s}.disabled=.*/set \${s}.disabled='0'/" package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc rm -rf package/feeds/packages/jool ================================================ FILE: devices/common/patches/LINUX_VERSION.patch ================================================ --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ ifneq ($(OPENWRT_BUILD),1) include $(TOPDIR)/include/toplevel.mk else include rules.mk + include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/subdir.mk include target/Makefile @@ -131,6 +132,10 @@ world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp- $(_SINGLE)$(SUBMAKE) -r package/index $(_SINGLE)$(SUBMAKE) -r json_overview_image_info $(_SINGLE)$(SUBMAKE) -r checksum + cp -f $(BIN_DIR)/packages/Packages.manifest $(BIN_DIR)/ + rm -rf $(BIN_DIR)/$(LINUX_VERSION) + mv -f $(BIN_DIR)/packages $(BIN_DIR)/$(LINUX_VERSION) 2>/dev/null + mv -f $(BIN_DIR)/profiles.json $(BIN_DIR)/profiles.json.b 2>/dev/null ifneq ($(CONFIG_CCACHE),) $(STAGING_DIR_HOST)/bin/ccache -s endif ================================================ FILE: devices/common/patches/autoreconf.patch ================================================ --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -19,6 +19,7 @@ PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 ================================================ FILE: devices/common/patches/base-files.patch ================================================ --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -395,10 +395,13 @@ default_postinst() { if [ "$PKG_UPGRADE" != "1" ]; then "$i" enable fi - "$i" start + if "$i" enabled; then + "$i" start + fi fi done + [ -x /etc/init.d/ucitrack ] && /etc/init.d/ucitrack reload return $ret } --- a/package/base-files/files/etc/shinit +++ b/package/base-files/files/etc/shinit @@ -2,6 +2,8 @@ [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi alias ll='ls -alF --color=auto' +alias reboot='(/bin/busybox reboot &);sleep 3;/bin/busybox reboot -f' +PS1='\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[m\]\[\e[32m\]\[\e[1;32m\]\@\[\e[36m\] \w\[\e[m\]\[\e[32m\]]\[\e[0m\] \$\[\e[m\] ' [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -287,11 +287,7 @@ create_backup_archive() { # Format: pkg-name{rom,overlay,unknown} # rom is used for pkgs in /rom, even if updated later if [ -d "/usr/lib/opkg/info" ]; then - tar_print_member "$INSTALLED_PACKAGES" "$(find /usr/lib/opkg/info -name "*.control" \( \ - \( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \ - \( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \ - \( -exec echo {} unknown \; \) \ - \) | sed -e 's,.*/,,;s/\.control /\t/')" || ret=1 + . /etc/profile.d/opkg.sh && opkg save elif [ -d "/lib/apk/packages" ]; then tar_print_member "$INSTALLED_PACKAGES" "$(find /lib/apk/packages -name "*.list" \( \ \( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \ @@ -299,6 +295,10 @@ create_backup_archive() { \( -exec echo {} unknown \; \) \ \) | sed -e 's,.*/,,;s/\.list /\t/')" || ret=1 fi + else + uci -q del opkg.auto + uci -q del opkg.custom + uci commit opkg fi fi --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -33,7 +33,11 @@ esac if [ -z "$FAILSAFE" ] ; then for FILE in /etc/profile.d/*.sh ; do [ -f "${FILE%.sh}.hush" ] && continue - [ -f "$FILE" ] && . "$FILE" + if [ "$FILE" == "/etc/profile.d/30-sysinfo.sh" ]; then + [ "$(which bash)" ] && env -i bash "$FILE" + else + [ -f "$FILE" ] && . "$FILE" + fi done unset FILE fi --- a/package/base-files/files/lib/preinit/02_sysinfo +++ b/package/base-files/files/lib/preinit/02_sysinfo @@ -5,6 +5,7 @@ do_sysinfo_generic() { echo "$(strings /proc/device-tree/compatible | head -1)" > /tmp/sysinfo/board_name [ ! -e /tmp/sysinfo/model -a -e /proc/device-tree/model ] && \ echo "$(cat /proc/device-tree/model)" > /tmp/sysinfo/model + sed -i "s/friendlyelec/friendlyarm/" /tmp/sysinfo/board_name } boot_hook_add preinit_main do_sysinfo_generic ================================================ FILE: devices/common/patches/china_mirrors.patch.b ================================================ --- a/scripts/download.pl +++ b/scripts/download.pl @@ -201,6 +201,10 @@ sub cleanup push @mirrors, "https://mirror.leaseweb.com/debian/$1"; push @mirrors, "https://mirror.netcologne.de/debian/$1"; } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { + push @mirrors, "https://mirrors.tencent.com/apache/$1"; + push @mirrors, "https://mirrors.aliyun.com/apache/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; @@ -211,11 +215,35 @@ sub cleanup push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1"; push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1"; } elsif ($mirror =~ /^\@GITHUB\/(.+)$/) { + my $dir = $1; + my $i = 0; + # replace the 2nd '/' with '@' for jsDelivr mirror + push @mirrors, "https://cdn.jsdelivr.net/gh/". $dir =~ s{\/}{++$i == 2 ? '@' : $&}ger; + push @mirrors, "https://raw.sevencdn.com/$dir"; + push @mirrors, "https://raw.fastgit.org/$dir"; + push @mirrors, "https://pd.zwc365.com/seturl/https://raw.githubusercontent.com/$dir"; + push @mirrors, "https://ghproxy.com/https://raw.githubusercontent.com/$dir"; + push @mirrors, "https://pd.zwc365.com/cfworker/https://raw.githubusercontent.com/$dir"; # give github a few more tries (different mirrors) for (1 .. 5) { - push @mirrors, "https://raw.githubusercontent.com/$1"; + push @mirrors, "https://raw.githubusercontent.com/$dir"; } + } elsif ($mirror =~ /^\@GHCODELOAD\/(.+)$/) { + push @mirrors, "https://pd.zwc365.com/seturl/https://codeload.github.com/$1"; + push @mirrors, "https://ghproxy.com/https://codeload.github.com/$1"; + push @mirrors, "https://pd.zwc365.com/cfworker/https://codeload.github.com/$1"; + push @mirrors, "https://codeload.github.com/$1"; + } elsif ($mirror =~ /^\@GHREPO\/(.+)$/) { + push @mirrors, "https://pd.zwc365.com/seturl/https://github.com/$1"; + push @mirrors, "https://github.com.cnpmjs.org/$1"; + push @mirrors, "https://ghproxy.com/https://github.com/$1"; + push @mirrors, "https://hub.fastgit.org/$1"; + push @mirrors, "https://github.com/$1"; } elsif ($mirror =~ /^\@GNU\/(.+)$/) { + push @mirrors, "https://mirrors.tencent.com/gnu/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1"; + push @mirrors, "https://mirrors.cqu.edu.cn/gnu/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1"; push @mirrors, "https://mirror.netcologne.de/gnu/$1"; push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1"; @@ -240,6 +268,8 @@ sub cleanup push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { + push @mirrors, "https://mirrors.cqu.edu.cn/kernel/$dir"; + push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; push @mirrors, "https://mirrors.mit.edu/kernel/$dir"; @@ -250,6 +280,7 @@ sub cleanup } } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { push @mirrors, "https://download.gnome.org/sources/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; @@ -263,6 +294,7 @@ sub cleanup } } +unshift @mirrors, "http://182.140.223.146"; push @mirrors, 'https://sources.cdn.openwrt.org'; push @mirrors, 'https://sources.openwrt.org'; push @mirrors, 'https://mirror2.openwrt.org/sources'; @@ -296,4 +328,3 @@ sub cleanup } $SIG{INT} = \&cleanup; - ================================================ FILE: devices/common/patches/cmake.patch ================================================ --- a/include/cmake.mk +++ b/include/cmake.mk @@ -127,6 +127,7 @@ define Build/Configure/Default -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ $(CMAKE_OPTIONS) \ $(CMAKE_SOURCE_DIR) \ ) ================================================ FILE: devices/common/patches/compressed-memory.patch.b ================================================ --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -809,3 +809,18 @@ endef $(eval $(call KernelPackage,crypto-xts)) + +define KernelPackage/crypto-zstd + TITLE:=zstd compression CryptoAPI module + DEPENDS:=+kmod-lib-zstd +kmod-crypto-acompress + KCONFIG:=CONFIG_CRYPTO_ZSTD + FILES:=$(LINUX_DIR)/crypto/zstd.ko + AUTOLOAD:=$(call AutoLoad,09,zstd) + $(call AddDepends/crypto) +endef + +define KernelPackage/crypto-zstd/description + Kernel module for the CryptoAPI to support Zstandard +endef + +$(eval $(call KernelPackage,crypto-zstd)) --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -166,6 +166,27 @@ endef $(eval $(call KernelPackage,lib-lz4)) +define KernelPackage/lib-lz4hc + SUBMENU:=$(LIB_MENU) + TITLE:=LZ4HC support + DEPENDS:=+kmod-lib-lz4 +kmod-crypto-acompress + HIDDEN:=1 + KCONFIG:= \ + CONFIG_CRYPTO_LZ4HC \ + CONFIG_LZ4HC_COMPRESS + FILES:= \ + $(LINUX_DIR)/crypto/lz4hc.ko \ + $(LINUX_DIR)/lib/lz4/lz4hc_compress.ko + AUTOLOAD:=$(call AutoProbe,lz4hc lz4hc_compress) +endef + +define KernelPackage/lib-lz4hc/description + Kernel module for LZ4HC compression/decompression support +endef + +$(eval $(call KernelPackage,lib-lz4hc)) + + define KernelPackage/lib-raid6 SUBMENU:=$(LIB_MENU) TITLE:=RAID6 algorithm support --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -869,6 +869,85 @@ endef $(eval $(call KernelPackage,zram)) +define KernelPackage/zsmalloc + SUBMENU:=$(OTHER_MENU) + TITLE:=ZSMALLOC support + DEPENDS:=+kmod-crypto-deflate \ + +kmod-lib-lz4 \ + @!PACKAGE_kmod-zram + KCONFIG:= \ + CONFIG_ZSMALLOC \ + CONFIG_ZSMALLOC_STAT=n + FILES:= $(LINUX_DIR)/mm/zsmalloc.ko + AUTOLOAD:=$(call AutoLoad,19,zsmalloc) +endef + +define KernelPackage/zsmalloc/description + Special purpose memory allocator for compressed memory pages +endef + +define KernelPackage/zsmalloc/config + if PACKAGE_kmod-zsmalloc + config KERNEL_PGTABLE_MAPPING + bool "zsmalloc: enable CONFIG_PGTABLE_MAPPING" + default y if arm + default n + help + Enable CONFIG_PGTABLE_MAPPING in the kernel for faster memory + allocations when using ZSMALLOC, in some architectures. Enabled + by default for the ARM architecture because it may be a huge + performance boost. + endif +endef + +$(eval $(call KernelPackage,zsmalloc)) + + +define KernelPackage/zram-writeback + SUBMENU:=$(OTHER_MENU) + TITLE:=zram with writeback support + DEPENDS:=+kmod-zsmalloc + KCONFIG:= \ + CONFIG_ZRAM \ + CONFIG_ZRAM_DEBUG=n \ + CONFIG_ZRAM_MEMORY_TRACKING=n \ + CONFIG_ZRAM_WRITEBACK=y + FILES:= \ + $(LINUX_DIR)/drivers/block/zram/zram.ko + AUTOLOAD:=$(call AutoLoad,20,zram) +endef + +define KernelPackage/zram-writeback/description + Compressed RAM disk with support for page writeback +endef + +$(eval $(call KernelPackage,zram-writeback)) + + +define KernelPackage/zswap + SUBMENU:=$(OTHER_MENU) + TITLE:=zswap compressed swapping cache + DEPENDS:=+kmod-zsmalloc + KCONFIG:= \ + CONFIG_FRONTSWAP=y \ + CONFIG_Z3FOLD \ + CONFIG_ZBUD \ + CONFIG_ZPOOL \ + CONFIG_ZSWAP=y + FILES:= \ + $(LINUX_DIR)/mm/z3fold.ko \ + $(LINUX_DIR)/mm/zbud.ko \ + $(LINUX_DIR)/mm/zpool.ko + AUTOLOAD:=$(call AutoLoad,20,z3fold zbud zpool) +endef + +define KernelPackage/zswap/description + Compressed swap cache and compressed memory allocator support +endef + +$(eval $(call KernelPackage,zswap)) + + define KernelPackage/pps SUBMENU:=$(OTHER_MENU) TITLE:=PPS support ================================================ FILE: devices/common/patches/crontab.patch ================================================ From 388238b9baf8375e5474167c987a4a8a3358b559 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Wed, 23 Apr 2025 00:03:25 +0200 Subject: [PATCH] luci-mod-system: give crontab a helper page Reference: https://github.com/openwrt/luci/pull/7495 Signed-off-by: Paul Donald --- .../resources/view/system/crontabhelper.js | 334 ++++++++++++++++++ .../share/luci/menu.d/luci-mod-system.json | 14 +- 2 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontabhelper.js diff --git a/feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontabhelper.js b/feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontabhelper.js new file mode 100644 index 000000000000..861d4d1f77a5 --- /dev/null +++ b/feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontabhelper.js @@ -0,0 +1,334 @@ +'use strict'; +'require view'; +'require fs'; +'require ui'; + +var isReadonlyView = !L.hasViewPermission() || null; + + +const yearly = { minute: '@yearly', command: '', comment: '', }; +const monthly = { minute: '@monthly', command: '', comment: '', }; +const weekly = { minute: '@weekly', command: '', comment: '', }; +const daily = { minute: '@daily', command: '', comment: '', }; +const hourly = { minute: '@hourly', command: '', comment: '', }; +const a_task = { minute: '*', hour: '*', day: '*', month: '*', weekday: '*', command: '', comment: '', }; +const alias = { minute: '@', hour: '*', day: '*', month: '*', weekday: '*', command: '', comment: '', }; + +const width = 'width:100px;'; +const double_width = 'width:300px'; +const padding = 'padding:3px;'; +const centre = 'text-align:center;'; + +return view.extend({ + load() { + return L.resolveDefault(fs.read('/etc/crontabs/root'), ''); + }, + + handleSave(ev) { + const tasks = Array.from(document.querySelectorAll('.crontab-row')).map(row => { + const getFieldValue = (fieldName) => { + const mode = row.querySelector(`.${fieldName}-mode`)?.value; + + switch (mode) { + case 'custom': + const custom = row.querySelector(`.${fieldName}-custom`)?.value?.trim(); + return custom; + case 'ignore': + return '*'; + case 'interval': + const interval = row.querySelector(`.${fieldName}-interval`)?.value?.trim(); + return interval ? `*/${interval}` : '*'; // Every Xth unit + case 'specific': + const specific = row.querySelector(`.${fieldName}-specific`)?.value?.trim(); + return specific || '*'; // Specific units + } + }; + + const comment = row.querySelector('.comment')?.value?.trim(); + const minute = row.querySelector('.minute')?.value?.trim(); + + // if it's a # comment row, just stuff the comment and return + if (minute == comment) + return { iscomment: true, comment: comment }; + else + return { + minute: getFieldValue('minute') || '*', + hour: getFieldValue('hour') || '*', + day: getFieldValue('day') || '*', + month: getFieldValue('month') || '*', + weekday: getFieldValue('weekday') || '*', + command: row.querySelector('.command')?.value?.trim(), + comment: comment ? `# ${comment}` : '', + }; + }); + + const value = tasks.map(task => { + if (task.iscomment) + return `${task.comment}`; + else if (task.minute[0] !== '@') + return `${task.minute} ${task.hour} ${task.day} ${task.month} ${task.weekday} ${task.command} ${task.comment}`; + else + return `${task.minute} ${task.command} ${task.comment}`; + }).join('\n') + '\n'; + + return fs.write('/etc/crontabs/root', value).then(() => { + ui.addTimeLimitedNotification(null, E('p', _('Contents have been saved.')), 5000, 'info'); + return fs.exec('/etc/init.d/cron', [ 'reload' ]); + }).catch(e => { + ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message))); + }); + }, + + render(crontab) { + const tasks = (crontab || '').split('\n').filter(line => line.trim()).map(line => { + if (line.startsWith('#')) + return { + // stash comment lines for saving later + minute: line, + comment: line, + }; + const parts = line.split(/\s+/); + const commentIndex = parts.findIndex(part => part.startsWith('#')); + // exclude the '#' character from comments existing in valid command rows: + if (commentIndex !== -1) parts[commentIndex] = parts[commentIndex].substring(1)?.trim(); + const comment = commentIndex !== -1 ? parts.slice(commentIndex).join(' ') : ''; + + if(parts[0][0] == '@') { + const updatedTask = { ...alias }; + updatedTask.minute = parts[0]; + updatedTask.command = commentIndex !== -1 ? parts.slice(1, commentIndex).join(' ') : parts.slice(1).join(' '); + updatedTask.comment = comment; + return updatedTask; + } + + return { + minute: parts[0] || '', + hour: parts[1] || '', + day: parts[2] || '', + month: parts[3] || '', + weekday: parts[4] || '', + command: commentIndex !== -1 ? parts.slice(5, commentIndex).join(' ') : parts.slice(5).join(' ') || '', + comment: comment || '', + }; + }); + + return E([ + E('h2', _('Scheduled Tasks')), + E('p', { 'class': 'cbi-section-descr' }, _('Define your scheduled tasks for root below.') + '
' + + _('CSV - Comma Separated Value(s)')), + E('a', { 'href': 'https://openwrt.org/docs/guide-user/base-system/cron', 'target':'_blank' }, _('Crontab help wiki')), + E('table', { 'class': 'table', }, [ + E('thead', {}, [ + E('tr', {}, [ + E('th', {}, _('Minute / Alias', 'minute or crontab alias field')), + E('th', {}, _('Hour')), + E('th', {}, _('Day')), + E('th', {}, _('Month')), + E('th', {}, _('Weekday')), + E('th', {}, _('Command')), + E('th', {}, _('Comment')), + E('th', {}, _('Action')) + ]) + ]), + E('tbody', { 'id': 'crontab-rows' }, this.renderTaskRows(tasks)), + E('hr', {}), + E('tfoot', {}, [ + E('tr', {}, [ + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', alias ) }, _('Add alias')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', yearly ) }, _('Yearly task')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', monthly ) }, _('Monthly task')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', weekly ) }, _('Weekly task')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', daily ) }, _('Daily task')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask', hourly ) }, _('Hourly task')) + ]), + E('td', { 'colspan': 1, 'style': padding }, [ + E('button', { 'class': 'btn', 'click': ui.createHandlerFn(this, 'addTask') }, _('Add custom task')) + ]), + ]) + ]) + ]) + ]); + }, + + renderTaskRows(tasks) { + const rows = []; + + tasks.forEach((task, index) => { + if (task?.minute.startsWith('#') && task?.comment){ + rows.push(this.renderCommentRow(task)); + return; + } + rows.push(E('tr', { 'class': 'crontab-hr' }, E('td', { 'colspan': 8 }, E('hr', { 'style': 'margin: 10px 0;' })))); + if (task.minute[0] == '@') + rows.push(this.renderAliasRow(task)); + else + rows.push(this.renderTaskRow(task)); + }); + + return rows; + }, + + renderAliasRow(task) { + return E('tr', { 'class': 'crontab-row', 'style': padding }, [ + this.createTimeDropdown('minute', task.minute, 'Minute'), + E('td', { 'style': padding + centre }, _('-')), // Hour - empty + E('td', { 'style': padding + centre }, _('-')), // Day - empty + E('td', { 'style': padding + centre }, _('-')), // Month - empty + E('td', { 'style': padding + centre }, _('-')), // Weekday - empty + E('td', { 'style': padding + centre }, + E('div', {}, [ + E('label', {}, _('Command')), + E('input', { 'type': 'text', 'class': 'command', 'style': double_width, 'value': task.command, 'disabled': isReadonlyView }), + ]), + ), + E('td', { 'style': padding }, + E('div', {}, [ + E('label', {}, _('Comment')), + E('input', { 'type': 'text', 'class': 'comment', 'style': width, 'value': task.comment, 'disabled': isReadonlyView }), + ]), + ), + E('td', { 'style': padding }, [ + E('button', { 'class': 'btn remove-task cbi-button-negative', 'click': ui.createHandlerFn(this, 'removeTask') }, _('Remove')) + ]) + ]); + }, + + renderTaskRow(task) { + return E('tr', { 'class': 'crontab-row' }, [ + this.createTimeDropdown('minute', task.minute, 'Minute', 0, 59), + this.createTimeDropdown('hour', task.hour, 'Hour', 0, 23), + this.createTimeDropdown('day', task.day, 'Day', 0, 31), + this.createTimeDropdown('month', task.month, 'Month', 0, 12), + this.createTimeDropdown('weekday', task.weekday, 'Weekday', 0, 6), + E('td', { 'style': padding }, E('input', { 'type': 'text', 'class': 'command', 'style': double_width, 'value': task.command, 'disabled': isReadonlyView })), + E('td', { 'style': padding }, E('input', { 'type': 'text', 'class': 'comment', 'style': width, 'value': task.comment, 'disabled': isReadonlyView })), + E('td', { 'style': padding }, [ + E('button', { 'class': 'btn remove-task cbi-button-negative', 'click': ui.createHandlerFn(this, 'removeTask') }, _('Remove')) + ]) + ]); + }, + + /* + hide the comment rows in valid fields, but don't display them. + */ + renderCommentRow(task) { + // + return E('tr', { 'class': 'crontab-row', 'style': 'display: none; ' }, [ + E('td', { 'style': padding }, + E('div', {}, [ + E('label', {}, _('Minute')), + E('input', { 'type': 'text', 'class': 'minute', 'style': width, 'value': task.comment, 'disabled': isReadonlyView }), + ]), + ), + E('td', { 'style': padding }, + E('div', {}, [ + E('label', {}, _('Comment')), + E('input', { 'type': 'text', 'class': 'comment', 'style': width, 'value': task.comment, 'disabled': isReadonlyView }), + ]), + ), + ]); + }, + + /* + creates a block of entry fields customisable to the time interval type + */ + createTimeDropdown(fieldName, value, label, min, max) { + const mode = value.includes(',') || parseInt(value, 10) >= 0 || value.startsWith('@') + ? (value.split(',').filter(v => v.startsWith('*/')).length > 1 || value.startsWith('@') ? 'custom' : 'specific') + : value.startsWith('*/') + ? 'interval' + : 'ignore'; + + const intervalValue = mode === 'interval' ? value.substring(2) : ''; + const specificValue = mode === 'specific' ? value : ''; + const customValue = mode === 'custom' ? value : ''; + + return E('td', { 'style': padding }, [ + E('div', { 'class': 'dropdown-container' }, [ + E('select', { + 'class': `${fieldName}-mode`, + 'style': width, + 'change': ev => this.updateDropdownMode(ev, fieldName) + }, [ + E('option', { 'value': 'ignore', 'style': width, + ...(mode === 'ignore' ? { 'selected': 'true' } : {}) + }, _('-')), + E('option', { 'value': 'interval', 'style': width, + ...(mode === 'interval' ? { 'selected': 'true' } : {}) + }, _('Every Xth')), + E('option', { 'value': 'specific', 'style': width, + ...(mode === 'specific' ? { 'selected': 'true' } : {}) + }, _('Specific')), + E('option', { 'value': 'custom', 'style': width, + ...(mode === 'custom' ? { 'selected': 'true' } : {}) + }, _('Custom')) + ]), + E('div', { 'class': `${fieldName}-input ignore-input`, 'style': mode === 'ignore' ? '' : 'display:none;' }, [ + E('input', { 'type': 'text', 'class': fieldName, 'value': '*', 'style': mode === 'ignore' ? 'display:none;': width, + }) + ]), + E('div', { 'class': `${fieldName}-input interval-input`, 'style': mode === 'interval' ? width : 'display:none;' }, [ + E('label', {}, _('Every')), + E('input', { 'type': 'number', 'min': min, 'max': max, 'class': `${fieldName}-interval`, 'value': intervalValue, 'style': width }), + E('span', {}, _(label.toLowerCase())) + ]), + E('div', { 'class': `${fieldName}-input specific-input`, 'style': mode === 'specific' ? width : 'display:none;' }, [ + E('label', {}, _('At')), + E('input', { 'type': 'text', 'class': `${fieldName}-specific`, 'value': specificValue, 'style': width, 'placeholder': '0,5,10,...' }), + E('span', {}, _(label.toLowerCase() + _('s (CSV)', 'pluralisation for hours, minutes, etc'))) + ]), + E('div', { 'class': `${fieldName}-input custom-input`, 'style': mode === 'custom' ? width : 'display:none;' }, [ + E('label', {}, _('Value')), + E('input', { 'type': 'text', 'class': `${fieldName}-custom`, 'value': customValue, 'style': width }) + ]), + ]) + ]); + }, + + updateDropdownMode(ev, fieldName) { + const dropdown = ev.target.closest('.dropdown-container'); + const mode = ev.target.value; + + dropdown.querySelectorAll(`.${fieldName}-input`).forEach(input => { + input.style.display = 'none'; + }); + + dropdown.querySelector(`.${fieldName}-input.${mode}-input`).style.display = ''; + }, + + addTask(param) { + const tbody = document.getElementById('crontab-rows'); + + let newTask + if (param?.type !== 'click') { + newTask = param; + } else { + newTask = a_task; + } + const newRows = this.renderTaskRows([newTask]); + newRows.forEach(row => { + tbody.appendChild(row); + }) + }, + + removeTask(ev) { + const row = ev.target.closest('.crontab-row'); + const hr = row.previousElementSibling; + if (hr) hr.remove(); + if (row) row.remove(); + }, + + handleSaveApply: null, + handleReset: null +}); diff --git a/feeds/luci/modules/luci-mod-system/root/usr/share/luci/menu.d/luci-mod-system.json b/feeds/luci/modules/luci-mod-system/root/usr/share/luci/menu.d/luci-mod-system.json index ebae989d0e00..b4eba7862444 100644 --- a/feeds/luci/modules/luci-mod-system/root/usr/share/luci/menu.d/luci-mod-system.json +++ b/feeds/luci/modules/luci-mod-system/root/usr/share/luci/menu.d/luci-mod-system.json @@ -98,6 +98,16 @@ } }, + "admin/system/crontabhelper": { + "action": { + "type": "view", + "path": "system/crontabhelper" + }, + "depends": { + "acl": [ "luci-mod-system-cron" ] + } + }, + "admin/system/mounts": { "title": "Mount Points", "order": 50, --- a/feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js +++ b/feeds/luci/modules/luci-mod-system/htdocs/luci-static/resources/view/system/crontab.js @@ -27,6 +27,7 @@ return view.extend({ return E([ E('h2', _('Scheduled Tasks')), E('p', { 'class': 'cbi-section-descr' }, _('This is the system crontab in which scheduled tasks can be defined.')), + E('p', { 'class': 'cbi-section-descr' }, _(' Scheduled Tasks Helper')), E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 25, 'disabled': isReadonlyView }, [ crontab != null ? crontab : '' ])) ]); }, ================================================ FILE: devices/common/patches/curl.patch ================================================ --- a/package/feeds/packages/curl/Config.in +++ b/package/feeds/packages/curl/Config.in @@ -4,7 +4,7 @@ comment "SSL support" choice prompt "Selected SSL library" - default LIBCURL_MBEDTLS + default LIBCURL_OPENSSL config LIBCURL_MBEDTLS bool "mbed TLS" ================================================ FILE: devices/common/patches/default-packages.patch ================================================ --- a/include/target.mk +++ b/include/target.mk @@ -50,10 +50,8 @@ DEFAULT_PACKAGES.nas:=\ # @brief Default packages for @DEVICE_TYPE router. ## DEFAULT_PACKAGES.router:=\ - dnsmasq \ + dnsmasq-full \ firewall4 \ - nftables \ - kmod-nft-offload \ odhcp6c \ odhcpd-ipv6only \ ppp \ ================================================ FILE: devices/common/patches/disable-seccomp-ujail.patch ================================================ --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1185,13 +1185,13 @@ config KERNEL_POSIX_MQUEUE config KERNEL_SECCOMP_FILTER bool - default y if !SMALL_FLASH + default n config KERNEL_SECCOMP bool "Enable seccomp support" depends on !(TARGET_uml) select KERNEL_SECCOMP_FILTER - default y if !SMALL_FLASH + default n help Build kernel with support for seccomp. --- a/include/target.mk +++ b/include/target.mk @@ -88,11 +88,6 @@ else endif endif -# include ujail on systems with enough storage -ifeq ($(filter small_flash,$(FEATURES)),) - DEFAULT_PACKAGES+=procd-ujail -endif - # Add device specific packages (here below to allow device type set from subtarget) DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE)) ================================================ FILE: devices/common/patches/dnsmasq.patch ================================================ --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -22,6 +22,8 @@ PKG_CPE_ID:=cpe:/a:thekelleys:dnsmasq PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_UPSTREAM_VERSION) +PKG_BUILD_DEPENDS:=nftables + PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 PKG_BUILD_FLAGS:=lto @@ -66,8 +68,7 @@ $(call Package/dnsmasq/Default) TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset, Nftset, Conntrack, NO_ID enabled by default) DEPENDS+=+PACKAGE_dnsmasq_full_dnssec:libnettle \ +PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset \ - +PACKAGE_dnsmasq_full_conntrack:libnetfilter-conntrack \ - +PACKAGE_dnsmasq_full_nftset:nftables-json + +PACKAGE_dnsmasq_full_conntrack:libnetfilter-conntrack VARIANT:=full PROVIDES:=dnsmasq endef @@ -187,6 +188,11 @@ define Package/dnsmasq/install $(INSTALL_DIR) $(1)/etc/uci-defaults $(INSTALL_BIN) ./files/50-dnsmasq-migrate-resolv-conf-auto.sh $(1)/etc/uci-defaults $(INSTALL_BIN) ./files/50-dnsmasq-migrate-ipset.sh $(1)/etc/uci-defaults + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_BIN) $(STAGING_DIR)/usr/lib/libnftables.so.1 $(1)/usr/lib/libnftables.so.1 + $(INSTALL_BIN) $(STAGING_DIR)/usr/lib/libjansson.so.4 $(1)/usr/lib/libjansson.so.4 + $(INSTALL_BIN) $(STAGING_DIR)/usr/lib/libnftnl.so.11 $(1)/usr/lib/libnftnl.so.11 + $(INSTALL_BIN) $(STAGING_DIR)/usr/lib/libmnl.so.0 $(1)/usr/lib/libmnl.so.0 endef Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install) --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -1204,7 +1204,6 @@ dnsmasq_start() [ -n "$instance_ifc" ] && network_get_device instance_netdev "$instance_ifc" && [ -n "$instance_netdev" ] && procd_set_param netdev $instance_netdev - procd_add_jail dnsmasq ubus log procd_add_jail_mount $CONFIGFILE $DHCPBOGUSHOSTNAMEFILE $DHCPSCRIPT $DHCPSCRIPT_DEPENDS procd_add_jail_mount $EXTRA_MOUNT $RFC6761FILE $TRUSTANCHORSFILE procd_add_jail_mount $dnsmasqconffile $dnsmasqconfdir $resolvdir $user_dhcpscript @@ -1217,6 +1216,20 @@ dnsmasq_start() [ -e "$hostsfile" ] && procd_add_jail_mount $hostsfile procd_close_instance + config_get_bool dns_redirect "$cfg" dns_redirect 0 + config_get dns_port "$cfg" port 53 + if [ "$dns_redirect" = 1 ]; then + if [ -n "$(command -v nft)" ]; then + nft add table inet dnsmasq + nft add chain inet dnsmasq prerouting "{ type nat hook prerouting priority -105; policy accept; }" + nft add rule inet dnsmasq prerouting "meta nfproto { ipv4, ipv6 } udp dport 53 counter redirect to :$dns_port comment \"DNSMASQ HIJACK\"" + else + iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port + iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port + [ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port + [ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port + fi + fi } dnsmasq_stop() @@ -1234,6 +1247,21 @@ dnsmasq_stop() rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp } +iptables_clear() +{ + config_get dns_port "$cfg" port 53 + iptables -t nat -D PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port 2>"/dev/null" + iptables -t nat -D PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port 2>"/dev/null" + [ -n "$(command -v ip6tables)" ] && ip6tables -t nat -D PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port 2>"/dev/null" + [ -n "$(command -v ip6tables)" ] && ip6tables -t nat -D PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port 2>"/dev/null" +} + +nftables_clear() +{ + ! nft --check list table inet dnsmasq > "/dev/null" 2>&1 || \ + nft delete table inet dnsmasq +} + add_interface_trigger() { local interface ignore @@ -1304,6 +1332,7 @@ start_service() { } reload_service() { + [ -n "$(command -v nft)" ] && nftables_clear || iptables_clear rc_procd start_service "$@" procd_send_signal dnsmasq "$@" } @@ -1330,4 +1359,5 @@ stop_service() { else config_foreach dnsmasq_stop dnsmasq fi + [ -n "$(command -v nft)" ] && nftables_clear || iptables_clear } ================================================ FILE: devices/common/patches/feeds.patch ================================================ --- a/include/feeds.mk +++ b/include/feeds.mk @@ -6,7 +6,7 @@ -include $(TMP_DIR)/.packageauxvars FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*)) -FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null)) +FEEDS_AVAILABLE:=$(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null) PACKAGE_SUBDIRS=$(PACKAGE_DIR) ifneq ($(CONFIG_PER_FEED_REPO),) ================================================ FILE: devices/common/patches/firewall.patch ================================================ --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -25,7 +25,8 @@ define Package/firewall4 +kmod-nft-core +kmod-nft-fib +kmod-nft-offload \ +kmod-nft-nat \ +nftables-json \ - +ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci + +ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-uci \ + +iptables +ip6tables +kmod-nft-fullcone +kmod-nft-socket +kmod-nft-tproxy EXTRA_DEPENDS:=ucode (>=2022.03.22) PROVIDES:=uci-firewall endef @@ -38,10 +39,14 @@ endef define Package/firewall4/conffiles /etc/config/firewall /etc/nftables.d/ +/etc/firewall.user endef define Package/firewall4/install $(CP) -a $(PKG_BUILD_DIR)/root/* $(1)/ + $(INSTALL_DIR) $(1)/etc/ + $(INSTALL_CONF) ./files/firewall.include $(1)/etc/firewall.user + $(INSTALL_CONF) ./files/firewall.exwan $(1)/etc/firewall.exwan endef define Build/Compile --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -30,9 +30,10 @@ define Package/firewall SECTION:=net CATEGORY:=Base system TITLE:=OpenWrt C Firewall - DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat + DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat \ + +iptables-mod-fullconenat +ip6tables-mod-fullconenat +iptables-legacy +ip6tables-legacy +kmod-ipt-nat6 +kmod-ipt-offload \ + +ipset +iptables-mod-conntrack-extra +iptables-mod-iprange +iptables-mod-socket +iptables-mod-tproxy PROVIDES:=uci-firewall - CONFLICTS:=firewall4 endef define Package/firewall/description define Package/package/network/config/firewall/description @@ -59,6 +59,7 @@ define Package/package/network/config/firewall/install $(INSTALL_CONF) ./files/firewall.config $(1)/etc/config/firewall $(INSTALL_DIR) $(1)/etc/ $(INSTALL_CONF) ./files/firewall.user $(1)/etc/firewall.user + $(INSTALL_CONF) ./files/firewall.exwan $(1)/etc/firewall.exwan $(INSTALL_DIR) $(1)/usr/share/fw3 $(INSTALL_CONF) $(PKG_BUILD_DIR)/helpers.conf $(1)/usr/share/fw3 endef --- a/package/feeds/luci/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js +++ b/package/feeds/luci/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js @@ -58,6 +58,50 @@ return view.extend({ o = s.option(form.Flag, 'drop_invalid', _('Drop invalid packets')); + if (L.hasSystemFeature('fullcone')) { + o = s.option(form.Flag, 'fullcone', _('Enable FullCone NAT')); + if (fw4) + o = s.option(form.Flag, 'fullcone6', _('Enable FullCone NAT6')); + o.depends('fullcone', '1'); + } + + o = s.option(form.Flag, 'expose_wan', _('Expose WAN'), _('Danger! Proceed at your own risk.')); + + o = s.option(form.Value, 'export', _('Ports to Expose'), _('Multiple ports can be, separated by spaces, format: 80 81 82')); + o.depends('expose_wan', '1'); + o.validate = function(section_id, value) { + if (value.match(/^(\d+\s*)+$/)) { + return true; + } + return _('Please enter valid format.'); + }; + + o = s.option(form.ListValue, 'family', _('Restrict to address family')); + o.modalonly = true; + o.rmempty = true; + o.depends('expose_wan', '1'); + o.value('', _('IPv4 and IPv6')); + o.value('ipv4', _('IPv4 only')); + o.value('ipv6', _('IPv6 only')); + + o = s.option(form.ListValue, 'proto', _('Protocol')); + o.modalonly = true; + o.rmempty = true; + o.default = 'tcp'; + o.depends('expose_wan', '1'); + o.value('tcp', _('TCP')); + o.value('udp', _('UDP')); + o.value('tudp', _('TCP+UDP')); + + o = s.option(form.Flag, 'ex_ssh', _('Expose SSH')); + o.depends('expose_wan', '1'); + o = s.option(form.Flag, 'ex_backend', _('Expose Backend')); + o.depends('expose_wan', '1'); + o = s.option(form.Value, 'backend_port', _('Backend Port'), _('国内请使用除80,443外的端口')); + o.depends('ex_backend', '1'); + o.rmempty = false; + o.datatype = 'integer'; + let p = [ s.option(form.ListValue, 'input', _('Input')), s.option(form.ListValue, 'output', _('Output')), --- a/package/network/config/firewall/files/firewall.init +++ b/package/network/config/firewall/files/firewall.init @@ -38,10 +38,12 @@ service_triggers() { } restart() { + test -f /etc/firewall.exwan && sh /etc/firewall.exwan fw3 restart } start_service() { + test -f /etc/firewall.exwan && sh /etc/firewall.exwan fw3 ${QUIET} start } @@ -50,6 +52,7 @@ stop_service() { } reload_service() { + test -f /etc/firewall.exwan && sh /etc/firewall.exwan fw3 reload } ================================================ FILE: devices/common/patches/getcwd-fix.patch ================================================ --- a/include/host-build.mk +++ b/include/host-build.mk @@ -61,7 +61,8 @@ HOST_CONFIGURE_VARS = \ CPPFLAGS="$(HOST_CPPFLAGS)" \ CXXFLAGS="$(HOST_CXXFLAGS)" \ LDFLAGS="$(HOST_LDFLAGS)" \ - CONFIG_SHELL="$(SHELL)" + CONFIG_SHELL="$(SHELL)" \ + gl_cv_func_getcwd_path_max=yes HOST_CONFIGURE_ARGS = \ --target=$(GNU_HOST_NAME) \ ================================================ FILE: devices/common/patches/imagebuilder.patch ================================================ --- a/include/image.mk +++ b/include/image.mk @@ -717,7 +717,7 @@ define Device/Build/kernel endef define Device/Build/image - GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz)) + GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz)) $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \ $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \ $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)) @@ -755,6 +755,7 @@ define Device/Build/image FILE_TYPE=$(word 1,$(subst ., ,$(2))) \ FILE_FILESYSTEM="$(1)" \ DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \ + IMAGE_SIZE="$(shell echo $$(($(call exp_units,$(IMAGE_SIZE)))))" \ DEVICE_VENDOR="$(DEVICE_VENDOR)" \ DEVICE_MODEL="$(DEVICE_MODEL)" \ DEVICE_VARIANT="$(DEVICE_VARIANT)" \ @@ -861,6 +862,7 @@ define Device/DumpInfo Target-Profile: DEVICE_$(1) Target-Profile-Name: $(DEVICE_DISPLAY) Target-Profile-Packages: $(DEVICE_PACKAGES) +Target-Profile-ImageSize: $(shell echo $$(( $(call exp_units,$(IMAGE_SIZE)) / 1024 ))) Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0) Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) $(if $(BROKEN),Target-Profile-Broken: $(BROKEN)) --- a/scripts/json_add_image_info.py +++ b/scripts/json_add_image_info.py @@ -72,6 +72,7 @@ def get_titles(): "device_packages": getenv("DEVICE_PACKAGES").split(), "supported_devices": getenv("SUPPORTED_DEVICES").split(), "titles": get_titles(), + "image_size": getenv("IMAGE_SIZE"), } }, } --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -437,6 +437,7 @@ () print "PROFILE_NAMES = ".join(" ", @profile_ids_unique)."\n"; foreach my $profile (@{$cur->{profiles}}) { print $profile->{id}.'_NAME:='.$profile->{name}."\n"; + print $profile->{id}.'_IMAGE_SIZE:='.$profile->{image_size}."\n"; print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n"; if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) { print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n"; --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -150,6 +150,7 @@ sub parse_target_metadata($) { push @{$target->{profiles}}, $profile; }; /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1; + /^Target-Profile-ImageSize:\s*(.*)\s*/ and $profile->{image_size} = $1; /^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and $profile->{has_image_metadata} = $1; /^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and $profile->{supported_devices} = [ split(/\s+/, $1) ]; /^Target-Profile-Priority:\s*(\d+)\s*$/ and do { --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -39,7 +39,8 @@ $(BIN_DIR)/$(IB_NAME).tar.zst: clean ./files/Makefile \ $(TMP_DIR)/.targetinfo \ $(TMP_DIR)/.packageinfo \ - $(PKG_BUILD_DIR)/ + $(TOPDIR)/files \ + $(PKG_BUILD_DIR)/ || true $(INSTALL_DIR) $(PKG_BUILD_DIR)/packages @@ -52,12 +53,13 @@ ifneq ($(CONFIG_USE_APK),) $(INSTALL_DATA) ./files/README.apk.md $(PKG_BUILD_DIR)/packages/README.md else - ifeq ($(CONFIG_IB_STANDALONE),) echo '## Remote package repositories' >> $(PKG_BUILD_DIR)/repositories.conf $(call FeedSourcesAppendOPKG,$(PKG_BUILD_DIR)/repositories.conf) $(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf - endif + $(SED) 's/^src\/gz \(.*\) https.*ai\/\(.*packages.*\)/src \1 file:\/\/www\/wwwroot\/dl.openwrt.ai\/\2/' $(PKG_BUILD_DIR)/repositories.conf + $(SED) 's/^src\/gz \(.*\) https.*ai\/\(.*targets.*\)/src \1 file:\/\/www\/wwwroot\/dl.openwrt.ai\/\2/' $(PKG_BUILD_DIR)/repositories.conf + $(SED) '/openwrt_core/d' $(PKG_BUILD_DIR)/repositories.conf # create an empty package index so `opkg` doesn't report an error touch $(PKG_BUILD_DIR)/packages/Packages --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -144,6 +144,33 @@ BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) BUILD_PACKAGES:=$(USER_PACKAGES) $(BUILD_PACKAGES) +IMAGE_SIZE_VALUE := $($(USER_PROFILE)_IMAGE_SIZE) +ifdef IMAGE_SIZE_VALUE + ifeq ($(shell test $(IMAGE_SIZE_VALUE) -le 35840 && echo true),true) + SMALL_FLASH := true + endif + ifeq ($(shell test $(IMAGE_SIZE_VALUE) -le 20480 && echo true),true) + XSMALL_FLASH := true + endif +endif +ifneq ($(findstring usb,$(BUILD_PACKAGES)),) + ifneq ($(XSMALL_FLASH),true) + BUILD_PACKAGES += automount luci-app-diskman + endif +endif +ifeq ($(SMALL_FLASH),true) + ifeq ($(shell grep -q small_flash $(TOPDIR)/repositories.conf || echo "not_found"),not_found) + $(shell echo "`grep kwrt_kiddin9 $(TOPDIR)/repositories.conf | sed -e 's/kiddin9/small_flash/g'`" >>$(TOPDIR)/repositories.conf) + endif + ifneq ($(findstring /www/wwwroot/,$(BIN_DIR)),) + BUILD_PACKAGES += -luci-app-istorex -luci-theme-argon -htop -bash -openssh-sftp-server -luci-nginx luci-ssl + endif +else + $(shell sed -i "/small_flash/d" $(TOPDIR)/repositories.conf) +endif +define add_zh_cn_packages +$(eval BUILD_PACKAGES += $(foreach pkg,$(BUILD_PACKAGES),$(if $(and $(filter luci-app-%,$(pkg)),$(shell $(OPKG) list | grep -q "^luci-i18n-$(patsubst luci-app-%,%,$(pkg))-zh-cn" && echo 1)),luci-i18n-$(patsubst luci-app-%,%,$(pkg))-zh-cn))) +endef BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) ifneq ($(CONFIG_USE_APK),) @@ -184,7 +211,10 @@ _call_image: staging_dir/host/.prereq-build $(MAKE) -s prepare_rootfs $(MAKE) -s build_image $(MAKE) -s json_overview_image_info +ifeq ($(findstring /www/wwwroot/,$(BIN_DIR)),) $(MAKE) -s checksum +endif + rm -rf $(KERNEL_BUILD_DIR)/tmp $(KERNEL_BUILD_DIR)/root.* $(TARGET_DIR) $(TARGET_DIR_ORIG) _call_manifest: FORCE rm -rf $(TARGET_DIR) @@ -251,9 +281,17 @@ package_install: FORCE @echo @echo Installing packages... ifeq ($(CONFIG_USE_APK),) + $(eval $(call add_zh_cn_packages)) $(OPKG) install $(wildcard $(PACKAGE_DIR)/libc_*.ipk) $(OPKG) install $(wildcard $(PACKAGE_DIR)/kernel_*.ipk) - $(OPKG) install $(BUILD_PACKAGES) + $(OPKG) install --force-maintainer $(BUILD_PACKAGES) luci-i18n-base-zh-cn || true + $(if $(USER_FILES), \ + find $(USER_FILES) -name "*.ipk" -print0 | \ + while IFS= read -r -d '' ipk; do \ + $(OPKG) install "$$ipk" && rm -f "$$ipk" || true; \ + done; \ + ) + $(OPKG) install --force-maintainer --force-reinstall my-default-settings 2>/dev/null else $(eval BUILD_PACKAGES:=$(call FormatPackages,$(BUILD_PACKAGES))) $(APK) add --arch $(ARCH_PACKAGES) --no-scripts $(BUILD_PACKAGES) @@ -280,16 +318,19 @@ else ) endif $(call prepare_rootfs,$(TARGET_DIR),$(USER_FILES),$(DISABLED_SERVICES)) + $(if $(SMALL_FLASH), \ + $(shell echo "`grep kwrt_kiddin9 $(TOPDIR)/repositories.conf | sed -e 's/kiddin9/small_flash/g'`" >>$(BUILD_DIR)/root-*/etc/opkg/distfeeds.conf) \ + ) build_image: FORCE @echo @echo Building images... rm -rf $(BUILD_DIR)/json_info_files/ if [ -d "target/linux/feeds/$(BOARD)" ]; then \ - $(NO_TRACE_MAKE) -C target/linux/feeds/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \ + nice $(NO_TRACE_MAKE) -C target/linux/feeds/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \ $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)"); \ else \ - $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \ + nice $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \ $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)"); \ fi ================================================ FILE: devices/common/patches/kernel-defaults.patch ================================================ --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -127,6 +127,7 @@ endef define Kernel/CompileModules/Default rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map + +$(KERNEL_MAKE) olddefconfig +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules # If .config did not change, use the previous timestamp to avoid package rebuilds cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \ ================================================ FILE: devices/common/patches/luci-base.patch ================================================ --- a/package/feeds/luci/luci-base/root/usr/share/rpcd/ucode/luci +++ b/package/feeds/luci/luci-base/root/usr/share/rpcd/ucode/luci @@ -222,6 +222,7 @@ const methods = { getFeatures: { call: function() { + let kernel_version = popen('echo -n `uname -r`').read('all'); let result = { firewall: access('/sbin/fw3') == true, firewall4: access('/sbin/fw4') == true, @@ -229,6 +230,7 @@ const methods = { bonding: access('/sys/module/bonding'), mii_tool: access('/usr/sbin/mii-tool'), offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true, + fullcone: access(`/lib/modules/${kernel_version}/xt_FULLCONENAT.ko`) == true || access(`/lib/modules/${kernel_version}/nft_fullcone.ko`) == true, br2684ctl: access('/usr/sbin/br2684ctl') == true, swconfig: access('/sbin/swconfig') == true, zram: access('/sys/class/zram-control') == true, @@ -565,6 +567,99 @@ const methods = { } }, + getCPUBench: { + call: function() { + return { cpubench: readfile('/etc/bench.log') || '' }; + } + }, + + getCPUInfo: { + call: function() { + if (!access('/sbin/cpuinfo')) + return {}; + + const fd = popen('/sbin/cpuinfo'); + if (fd) { + let cpuinfo = fd.read('all'); + fd.close(); + + return { cpuinfo: cpuinfo }; + } else { + return { cpuinfo: error() }; + } + } + }, + + getCPUUsage: { + call: function() { + const fd = popen('top -n1 | awk \'/^CPU/ {printf("%d%", 100 - $8)}\''); + if (fd) { + let cpuusage = fd.read('all'); + fd.close(); + + return { cpuusage: cpuusage }; + } else { + return { cpuusage: error() }; + } + } + }, + + getETHInfo: { + call: function() { + if (!access('/sbin/ethinfo')) + return {}; + + const fd = popen('/sbin/ethinfo'); + if (fd) { + let ethinfo = fd.read('all'); + if (!ethinfo) + ethinfo = '{}'; + ethinfo = json(ethinfo); + fd.close(); + + return { ethinfo: ethinfo }; + } else { + return { ethinfo: error() }; + } + } + }, + + getTempInfo: { + call: function() { + if (!access('/sbin/tempinfo')) + return {}; + + const fd = popen('/sbin/tempinfo'); + if (fd) { + let tempinfo = fd.read('all'); + fd.close(); + + return { tempinfo: tempinfo }; + } else { + return { tempinfo: error() }; + } + } + }, + + getOnlineUsers: { + call: function() { + const fd = open('/proc/net/arp', 'r'); + if (fd) { + let onlineusers = 0; + + for (let line = fd.read('line'); length(line); line = fd.read('line')) + if (match(trim(line), /^.*(0x2).*(br-lan)$/)) + onlineusers++; + + fd.close(); + + return { onlineusers: onlineusers }; + } else { + return { onlineusers: error() }; + } + } + }, + getRealtimeStats: { args: { mode: 'interface', device: 'eth0' }, call: function(request) { --- a/package/feeds/luci/luci-base/htdocs/luci-static/resources/network.js +++ b/package/feeds/luci/luci-base/htdocs/luci-static/resources/network.js @@ -4376,4 +4376,10 @@ WifiNetwork = baseclass.extend(/** @lends LuCI.network.WifiNetwork.prototype */ } }); +setTimeout(function(){ +try{ + document.getElementsByClassName('cbi-button-apply')[0].children[3].children[0].value='1' +}catch(err) { +}},1000) + return Network; --- a/package/feeds/luci/luci-base/ucode/dispatcher.uc +++ b/package/feeds/luci/luci-base/ucode/dispatcher.uc @@ -939,7 +939,12 @@ dispatch = function(_http, path) { let cookie_name = (http.getenv('HTTPS') == 'on') ? 'sysauth_https' : 'sysauth_http', cookie_secure = (http.getenv('HTTPS') == 'on') ? '; secure' : ''; - http.header('Set-Cookie', `${cookie_name}=${session.sid}; path=${build_url()}; SameSite=strict; HttpOnly${cookie_secure}`); + let cookie_p = uci.get('wizard', 'default', 'cookie_p'); + if (cookie_p == '0') { + http.header('Set-Cookie', `${cookie_name}=${session.sid}; path=${build_url()}; SameSite=strict; HttpOnly${cookie_secure}`); + } else { + http.header('Set-Cookie', `${cookie_name}=${session.sid}; Max-Age=2147483647; path=${build_url()}; SameSite=strict; HttpOnly${cookie_secure}`); + } http.redirect(build_url(...resolved.ctx.request_path)); return; --- a/package/feeds/luci/luci-base/root/www/index.html +++ b/package/feeds/luci/luci-base/root/www/index.html @@ -15,6 +15,5 @@ - LuCI - Lua Configuration Interface --- a/package/feeds/luci/luci-base/root/etc/init.d/ucitrack +++ b/package/feeds/luci/luci-base/root/etc/init.d/ucitrack @@ -8,7 +8,7 @@ register_init() { local init="$2" shift; shift - if [ -x "$init" ] && "$init" enabled && ! grep -sqE 'USE_PROCD=.' "$init"; then + if [ -x "$init" ] && ! grep -sqE 'USE_PROCD=.' "$init"; then logger -t "ucitrack" "Setting up /etc/config/$config reload trigger for non-procd $init" procd_add_config_trigger "config.change" "$config" "$init" "$@" fi --- a/package/feeds/luci/luci-base/htdocs/luci-static/resources/tools/widgets.js +++ b/package/feeds/luci/luci-base/htdocs/luci-static/resources/tools/widgets.js @@ -4,6 +4,7 @@ 'require network'; 'require firewall'; 'require fs'; +'require uci'; /** @@ -752,6 +752,81 @@ var CBIGroupSelect = form.ListValue.extend({ }, }); +var CBIWifidogxGroupSelect = form.ListValue.extend({ + __name__: 'CBI.WifidogxGroupSelect', + + // group_type: 1: Domain Group, 2: MAC Group + // add a new property to store the group type + group_type: '1', + + load: function(section_id) { + this.sappList = []; + var sections = uci.sections('wifidogx', 'group'); + + for (var i = 0; i < sections.length; i++) { + if (sections[i]['g_type'] == this.group_type) + this.sappList.push(sections[i]['.name']); + } + + return this.super('load', section_id); + }, + + setGroupType: function(group_type) { + if (group_type == 'mac') { + this.group_type = '2'; + } else if (group_type == 'wildcard') { + this.group_type = '3'; + } + }, + + filter: function(section_id, value) { + return true; + }, + + renderWidget: function(section_id, option_index, cfgvalue) { + var values = L.toArray((cfgvalue != null) ? cfgvalue : this.default), + choices = {}, + checked = {}; + + for (var i = 0; i < values.length; i++) + checked[values[i]] = true; + + values = []; + + if (!this.multiple && (this.rmempty || this.optional)) + choices[''] = E('em', _('unspecified')); + + for (var i = 0; i < this.sappList.length; i++) { + var name = this.sappList[i]; + + if (checked[name]) + values.push(name); + + choices[name] = E('span', { 'class': 'ifacebadge' }, name); + } + + var widget = new ui.Dropdown(this.multiple ? values : values[0], choices, { + id: this.cbid(section_id), + sort: true, + multiple: this.multiple, + optional: this.optional || this.rmempty, + disabled: (this.readonly != null) ? this.readonly : this.map.readonly, + select_placeholder: E('em', _('unspecified')), + display_items: this.display_size || this.size || 3, + dropdown_items: this.dropdown_size || this.size || 5, + validate: L.bind(this.validate, this, section_id), + create: !this.nocreate, + create_markup: '' + + '
  • ' + + '' + + '{{value}}: ('+_('create')+')' + + '' + + '
  • ' + }); + + return widget.render(); + } +}); return L.Class.extend({ ZoneSelect: CBIZoneSelect, @@ -761,4 +836,5 @@ return L.Class.extend({ DeviceSelect: CBIDeviceSelect, UserSelect: CBIUserSelect, GroupSelect: CBIGroupSelect, + WifidogxGroupSelect: CBIWifidogxGroupSelect, }); --- a/package/feeds/luci/luci-base/htdocs/luci-static/resources/validation.js +++ b/package/feeds/luci/luci-base/htdocs/luci-static/resources/validation.js @@ -403,6 +403,14 @@ const ValidatorFactory = baseclass.extend({ return this.assert(false, _('valid hostname')); }, + wildcard() { + // must start with '.', then remove it and check if it's a valid hostname + if (this.value[0] != '.') + return this.assert(false, _('valid wildcard hostname')); + const hostname = this.value.substr(1); + return this.apply('hostname', hostname); + }, + /** * Assert a valid UCI identifier, hostname or IP address range. * @function LuCI.validation.ValidatorFactory.types#network --- a/package/feeds/luci/luci-base/root/usr/share/luci/menu.d/luci-base.json +++ b/package/feeds/luci/luci-base/root/usr/share/luci/menu.d/luci-base.json @@ -50,6 +50,24 @@ } }, + "admin/nas": { + "title": "NAS", + "order": 60, + "action": { + "type": "firstchild", + "recurse": true + } + }, + + "admin/control": { + "title": "Control", + "order": 61, + "action": { + "type": "firstchild", + "recurse": true + } + }, + "admin/vpn": { "title": "VPN", "order": 70, ================================================ FILE: devices/common/patches/luci-dhcp.patch ================================================ --- a/package/feeds/luci/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js +++ b/package/feeds/luci/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js @@ -243,6 +243,11 @@ return view.extend({ o.optional = true; o.placeholder = '/router.local/router.lan/192.168.0.1'; + o = s.taboption('general', form.Flag, 'dns_redirect', + _('DNS Redirect'), + _('Force redirect all local DNS queries to DNSMasq, a.k.a. DNS Hijacking.')); + o.optional = true; + o = s.taboption('general', form.Flag, 'allservers', _('All servers'), _('Query all available upstream resolvers.') + ' ' + _('First answer wins.')); @@ -437,6 +442,9 @@ return view.extend({ so.rmempty = false; so.datatype = 'ipaddr("nomask")'; + so = ss.option(form.Value, 'comments', _('Comments')); + so.rmempty = true; + const ipaddrs = {}; Object.keys(hosts).forEach(function(mac) { ================================================ FILE: devices/common/patches/luci-mod-system.patch ================================================ --- a/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -101,7 +101,7 @@ return view.extend({ /* Currently the sysupgrade rpc call will not return, hence no promise handling */ fs.exec('/sbin/firstboot', [ '-r', '-y' ]); - ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect('10.0.0.1', 'kwrt.lan'); }, handleRestore: function(ev) { @@ -163,7 +163,7 @@ return view.extend({ E('p', { 'class': 'spinning' }, _('The system is rebooting now. If the restored configuration changed the current LAN IP address, you might need to reconnect manually.')) ]); - ui.awaitReconnect(window.location.host, '192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect(window.location.host, '10.0.0.1', 'kwrt.lan'); }, this)) .catch(function(e) { ui.addNotification(null, E('p', e.message)) }) .finally(function() { btn.firstChild.data = _('Upload archive...') }); @@ -263,6 +263,7 @@ return view.extend({ body.push(E('p', {}, E('label', { 'class': 'btn' }, [ opts.backup_pkgs[0], ' ', _('Include in backup a list of current installed packages at /etc/backup/installed_packages.txt') ]))); + opts.backup_pkgs[0].checked = true; }; var cntbtn = E('button', { @@ -304,6 +305,10 @@ return view.extend({ opts.keep[0].addEventListener('change', function(ev) { opts.skip_orig[0].disabled = !ev.target.checked; opts.backup_pkgs[0].disabled = !ev.target.checked; + if (ev.target.checked == false){ + opts.skip_orig[0].checked =false + opts.backup_pkgs[0].checked =false + } }); @@ -337,7 +342,7 @@ return view.extend({ if (opts['keep'][0].checked) ui.awaitReconnect(window.location.host); else - ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); + ui.awaitReconnect('10.0.0.1', 'kwrt.lan'); }, handleBackupList: function(ev) { ================================================ FILE: devices/common/patches/luci_mk.patch ================================================ --- a/feeds/luci/luci.mk +++ b/feeds/luci/luci.mk @@ -84,7 +84,7 @@ define findrev set -- $$(git log -1 --format="%ct %h" --abbrev=7 -- $(if $(1),. ':(exclude)po',po)); \ if [ -n "$$1" ]; then secs="$$(($$1 % 86400))"; \ - yday="$$(date --utc --date="@$$1" "+%y.%j")"; \ + yday="$$(date --utc --date="@$$(($$1 + 365*24*60*60))" "+%y.%j")"; \ printf '%s.%05d~%s' "$$yday" "$$secs" "$$2"; \ else \ echo "0"; \ @@ -207,9 +207,20 @@ define Package/$(PKG_NAME)/install $(call Build/Install/Default) $(CP) $(PKG_INSTALL_DIR)/* $(1)/ endif + ifneq ($(wildcard ${CURDIR}/po),) + $(INSTALL_DIR) $(1)/etc/uci-defaults + echo "uci set luci.languages.zh_cn='$(LUCI_LANG.zh_Hans)'; uci commit luci" \ + > $(1)/etc/uci-defaults/luci-i18n-$(LUCI_BASENAME)-zh-cn + $(INSTALL_DIR) $(1)$(LUCI_LIBRARYDIR)/i18n + $(foreach po,$(wildcard ${CURDIR}/po/zh_Hans/*.po), \ + po2lmo $(po) \ + $(1)$(LUCI_LIBRARYDIR)/i18n/$(basename $(notdir $(po))).zh-cn.lmo;) + endif + endef ifndef Package/$(PKG_NAME)/postinst +ifneq ($(wildcard ${CURDIR}/htdocs/luci-static/resources/view),) define Package/$(PKG_NAME)/postinst [ -n "$${IPKG_INSTROOT}" ] || { \ rm -f /tmp/luci-indexcache.* @@ -218,6 +229,16 @@ define Package/$(PKG_NAME)/postinst exit 0 } endef +else +define Package/$(PKG_NAME)/postinst +[ -n "$${IPKG_INSTROOT}" ] || {$(foreach script,$(LUCI_DEFAULTS), + (. /etc/uci-defaults/$(script)) && rm -f /etc/uci-defaults/$(script)) + rm -f /tmp/luci-indexcache.* + rm -rf /tmp/luci-modulecache/ + exit 0 +} +endef +endif endif # some generic macros that can be used by all packages @@ -334,5 +355,5 @@ define LuciTranslation endef -$(foreach lang,$(LUCI_LANGUAGES),$(if $(LUCI_LANG.$(lang)),$(eval $(call LuciTranslation,$(firstword $(LUCI_LC_ALIAS.$(lang)) $(lang)),$(lang))))) +# $(foreach lang,$(LUCI_LANGUAGES),$(if $(LUCI_LANG.$(lang)),$(eval $(call LuciTranslation,$(firstword $(LUCI_LC_ALIAS.$(lang)) $(lang)),$(lang))))) $(foreach pkg,$(LUCI_BUILD_PACKAGES),$(eval $(call BuildPackage,$(pkg)))) ================================================ FILE: devices/common/patches/netfilter.patch.b ================================================ --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -458,15 +458,100 @@ $(eval $(call KernelPackage,ipt-nat)) +define KernelPackage/ipt-cgroup + SUBMENU:=$(NF_MENU) + TITLE:=cgroup netfilter module + KCONFIG:=$(KCONFIG_IPT_CGROUP) + FILES:=$(LINUX_DIR)/net/netfilter/*cgroup*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,$(notdir $(IPT_CGROUP-m))) + DEPENDS:= kmod-ipt-core +endef +$(eval $(call KernelPackage,ipt-cgroup)) + +define KernelPackage/ipt-cgroup/description + Kernel support for cgroup netfilter module + Include: + - cgroup +endef + define KernelPackage/ipt-raw TITLE:=Netfilter IPv4 raw table support KCONFIG:=CONFIG_IP_NF_RAW FILES:=$(LINUX_DIR)/net/ipv4/netfilter/iptable_raw.ko AUTOLOAD:=$(call AutoProbe,iptable_raw) $(call AddDepends/ipt) endef $(eval $(call KernelPackage,ipt-raw)) + + +define KernelPackage/ipt-imq + TITLE:=Intermediate Queueing support + KCONFIG:= \ + CONFIG_IMQ \ + CONFIG_IMQ_BEHAVIOR_BA=y \ + CONFIG_IMQ_NUM_DEVS=2 \ + CONFIG_NETFILTER_XT_TARGET_IMQ + FILES:= \ + $(LINUX_DIR)/drivers/net/imq.$(LINUX_KMOD_SUFFIX) \ + $(foreach mod,$(IPT_IMQ-m),$(LINUX_DIR)/net/$(mod).$(LINUX_KMOD_SUFFIX)) + AUTOLOAD:=$(call AutoProbe,$(notdir imq $(IPT_IMQ-m))) + $(call AddDepends/ipt) +endef + +define KernelPackage/ipt-imq/description + Kernel support for Intermediate Queueing devices +endef + +$(eval $(call KernelPackage,ipt-imq)) + + +define KernelPackage/ipt-bandwidth + SUBMENU:=$(NF_MENU) + TITLE:=bandwidth + KCONFIG:=$(KCONFIG_IPT_BANDWIDTH) + FILES:=$(LINUX_DIR)/net/ipv4/netfilter/*bandwidth*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,$(notdir $(IPT_BANDWIDTH-m))) + DEPENDS:=@!LINUX_5_4 kmod-ipt-core +endef + +$(eval $(call KernelPackage,ipt-bandwidth)) + + +define KernelPackage/ipt-timerange + SUBMENU:=$(NF_MENU) + TITLE:=timerange + KCONFIG:=$(KCONFIG_IPT_TIMERANGE) + FILES:=$(LINUX_DIR)/net/ipv4/netfilter/*timerange*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,$(notdir $(IPT_TIMERANGE-m))) + DEPENDS:=@!LINUX_5_4 kmod-ipt-core +endef + +$(eval $(call KernelPackage,ipt-timerange)) + + +define KernelPackage/ipt-webmon + SUBMENU:=$(NF_MENU) + TITLE:=webmon + KCONFIG:=$(KCONFIG_IPT_WEBMON) + FILES:=$(LINUX_DIR)/net/ipv4/netfilter/*webmon*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,$(notdir $(IPT_WEBMON-m))) + DEPENDS:=@!LINUX_5_4 kmod-ipt-core +endef + +$(eval $(call KernelPackage,ipt-webmon)) + + +define KernelPackage/ipt-weburl + SUBMENU:=$(NF_MENU) + TITLE:=weburl + KCONFIG:=$(KCONFIG_IPT_WEBURL) + FILES:=$(LINUX_DIR)/net/ipv4/netfilter/*weburl*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,$(notdir $(IPT_WEBURL-m))) + DEPENDS:=@!LINUX_5_4 kmod-ipt-core +endef + +$(eval $(call KernelPackage,ipt-weburl)) define KernelPackage/ipt-raw6 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -111,3 +111,14 @@ +# imq + +$(eval $(call nf_add,IPT_IMQ,CONFIG_IP_NF_TARGET_IMQ, $(P_V4)ipt_IMQ)) +$(eval $(call nf_add,IPT_IMQ,CONFIG_NETFILTER_XT_TARGET_IMQ, $(P_XT)xt_IMQ)) + +# gargoyle-qos + +$(eval $(call nf_add,IPT_BANDWIDTH,CONFIG_IP_NF_MATCH_BANDWIDTH, $(P_V4)ipt_bandwidth)) +$(eval $(call nf_add,IPT_TIMERANGE,CONFIG_IP_NF_MATCH_TIMERANGE, $(P_V4)ipt_timerange)) +$(eval $(call nf_add,IPT_WEBMON,CONFIG_IP_NF_MATCH_WEBMON, $(P_V4)ipt_webmon)) +$(eval $(call nf_add,IPT_WEBURL,CONFIG_IP_NF_MATCH_WEBURL, $(P_V4)ipt_weburl)) # ipopt @@ -151,3 +162,6 @@ $(eval $(call nf_add,IPT_FLOW,CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD, $(P_XT)xt_FLOWOFFLOAD)) + +# cgroup +$(eval $(call nf_add,IPT_CGROUP,CONFIG_NETFILTER_XT_MATCH_CGROUP, $(P_XT)xt_cgroup)) # IPv6 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -170,3 +170,49 @@ endef +define Package/iptables-mod-cgroup +$(call Package/iptables/Module, +kmod-ipt-cgroup) + TITLE:=cgroup extension + endef + +define Package/iptables-mod-cgroup/description +iptables extension for cgroup support. + + Matches: + - cgroup + +endef + +define Package/iptables-mod-imq +$(call Package/iptables/Module, +kmod-ipt-imq) + TITLE:=IMQ support +endef + +define Package/iptables-mod-imq/description +iptables extension for IMQ support. + + Targets: + - IMQ + +endef + +define Package/iptables-mod-bandwidth +$(call Package/iptables/Module, +kmod-ipt-bandwidth) + TITLE:=bandwidth option extensions +endef + +define Package/iptables-mod-timerange +$(call Package/iptables/Module, +kmod-ipt-timerange) + TITLE:=timerange option extensions +endef + +define Package/iptables-mod-webmon +$(call Package/iptables/Module, +kmod-ipt-webmon) + TITLE:=webmon option extensions +endef + +define Package/iptables-mod-weburl +$(call Package/iptables/Module, +kmod-ipt-weburl) + TITLE:=weburl option extensions +endef + define Package/iptables-mod-ipopt @@ -666,2 +712,8 @@ $(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m))) +$(eval $(call BuildPlugin,iptables-mod-cgroup,$(IPT_CGROUP-m))) +$(eval $(call BuildPlugin,iptables-mod-imq,$(IPT_IMQ-m))) +$(eval $(call BuildPlugin,iptables-mod-bandwidth,$(IPT_BANDWIDTH-m))) +$(eval $(call BuildPlugin,iptables-mod-timerange,$(IPT_TIMERANGE-m))) +$(eval $(call BuildPlugin,iptables-mod-webmon,$(IPT_WEBMON-m))) +$(eval $(call BuildPlugin,iptables-mod-weburl,$(IPT_WEBURL-m))) $(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m))) ================================================ FILE: devices/common/patches/netsupport.patch ================================================ --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -64,7 +64,7 @@ define KernelPackage/bonding SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Ethernet bonding driver KCONFIG:=CONFIG_BONDING - DEPENDS:=PACKAGE_kmod-tls:kmod-tls + DEPENDS:=+PACKAGE_kmod-tls:kmod-tls FILES:=$(LINUX_DIR)/drivers/net/bonding/bonding.ko AUTOLOAD:=$(call AutoLoad,40,bonding) MODPARAMS.bonding:=max_bonds=0 ================================================ FILE: devices/common/patches/nftables.patch ================================================ --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -48,7 +48,6 @@ define Package/nftables-nojson TITLE+= no JSON support VARIANT:=nojson DEFAULT_VARIANT:=1 - CONFLICTS:=nftables-json endef define Package/nftables-json ================================================ FILE: devices/common/patches/nginx-fancyindex.patch.bak ================================================ --- package/feeds/packages/nginx/Makefile +++ package/feeds/packages/nginx/Makefile @@ -28,6 +28,7 @@ PKG_CONFIG_DEPENDS := \ CONFIG_NGINX_DAV \ CONFIG_NGINX_FLV \ CONFIG_NGINX_UBUS \ + CONFIG_NGINX_FANCYINDEX \ CONFIG_NGINX_STUB_STATUS \ CONFIG_NGINX_HTTP_CHARSET \ CONFIG_NGINX_HTTP_GZIP \ @@ -242,6 +243,9 @@ ifneq ($(BUILD_VARIANT),all-module) ifeq ($(CONFIG_NGINX_UBUS),y) ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module endif + ifeq ($(CONFIG_NGINX_FANCYINDEX),y) + ADDITIONAL_MODULES += --with-http_addition_module --add-module=$(PKG_BUILD_DIR)/nginx-fancyindex-module + endif ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y) ADDITIONAL_MODULES += --with-http_auth_request_module endif @@ -398,6 +402,7 @@ define Build/Prepare $(Prepare/nginx-ts) $(Prepare/nginx-dav-ext-module) $(Prepare/nginx-ubus-module) + $(Prepare/nginx-fancyindex-module) endef @@ -545,6 +550,22 @@ ifeq ($(CONFIG_NGINX_UBUS),y) endef endif +ifeq ($(CONFIG_NGINX_FANCYINDEX),y) + define Download/nginx-fancyindex-module + VERSION:=56934db14ccfb89d6cb452ea1b4c76225c89b8c1 + SUBDIR:=nginx-fancyindex-module + FILE:=ngx-fancyindex-$$(VERSION).tar.xz + URL:=https://github.com/aperezdc/ngx-fancyindex.git + PROTO:=git + endef + $(eval $(call Download,nginx-fancyindex-module)) + + define Prepare/nginx-fancyindex-module + $(eval $(Download/nginx-fancyindex-module)) + xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) + endef +endif + # TODO: remove after a transition period (together with pkg nginx-util): # It is for smoothly substituting nginx and nginx-mod-luci-ssl (by nginx-ssl # respectively nginx-mod-luci). Add above commented PROVIDES when removing. --- package/feeds/packages/nginx/Config_ssl.in +++ package/feeds/packages/nginx/Config_ssl.in @@ -36,6 +36,13 @@ config NGINX_STUB_STATUS Enable the stub status module which gives some status from the server. default n +config NGINX_FANCYINDEX + bool + prompt "Enable FANCYINDEX module" + help + Enable FANCYINDEX module. + default y + config NGINX_HTTP_CHARSET bool prompt "Enable HTTP charset module" ================================================ FILE: devices/common/patches/nonshared.patch ================================================ --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -19,6 +19,8 @@ PKG_MAINTAINER:=Felix Fietkau SCAN_DEPS = *.mk +PKG_FLAGS:=nonshared + include $(INCLUDE_DIR)/package.mk RSTRIP:=: ================================================ FILE: devices/common/patches/opkginstall.patch ================================================ --- a/package/feeds/luci/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js +++ b/package/feeds/luci/luci-app-package-manager/htdocs/luci-static/resources/view/package-manager.js @@ -186,7 +186,7 @@ function parseList(s, dest) val = RegExp.$2.trim(); } else if (pkg) { - dest.pkgs[pkg.name] = pkg; + dest.pkgs[pkg.name] = dest.pkgs[pkg.name] ? dest.pkgs[pkg.name] : pkg; const provides = dest.providers[pkg.name] ? [] : [ pkg.name ]; @@ -249,7 +249,7 @@ function display(pattern) const avail = packages.available.pkgs[name]; const inst = packages.installed.pkgs[name]; - if (!inst || !inst.installed) + if (!inst || !inst.installed || pkg.name.includes('kmod-') || pkg.name.includes('busybox') || pkg.name.includes('base-files')) continue; if (!avail || compareVersion(avail.version, pkg.version) <= 0) @@ -289,7 +289,7 @@ function display(pattern) 'data-action': 'install', 'click': handleInstall }, _('Install…')); - else if (inst.installed && inst.version != pkg.version) + else if (inst.installed && compareVersion(pkg.version, inst.version) > 0) btn = E('div', { 'class': 'btn cbi-button-positive', 'data-package': name, @@ -791,7 +791,8 @@ function handleInstall(ev) 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', - 'disabled': isReadonlyView + 'disabled': isReadonlyView, + 'checked': true }), ' ', E('label', { 'for': 'overwrite-cb' }), ' ', _('Allow overwriting conflicting package files') @@ -1031,6 +1032,8 @@ function handlePkg(ev) if (res.pkmcmd) dlg.appendChild(E('pre', [ res.pkmcmd ])); + const showModalFlag = (cmd !== 'update' && pkg) || res.stderr; + if (showModalFlag) { if (res.stdout) dlg.appendChild(E('pre', [ res.stdout ])); @@ -1058,6 +1061,10 @@ function handlePkg(ev) resolveFn(res); }, this, res) }, _('Dismiss')))); + } else { + ui.hideModal(); + updateLists(); + } }).catch(function(err) { ui.addNotification(null, E('p', _('Unable to execute %s %s command: %s').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg', cmd, err))); ui.hideModal(); @@ -1152,6 +1159,36 @@ return view.extend({ }, render(listData) { + const checkUpdateNeeded = function() { + return Promise.all([ + L.resolveDefault(fs.stat('/tmp/opkg-lists/kwrt_kiddin9'), null), + L.resolveDefault(fs.read('/tmp/resolv.conf.d/resolv.conf.auto'), '') + ]).then(function(results) { + const stat = results[0]; + const resolvContent = results[1]; + + let needUpdate = false; + + if (stat) { + const currentDate = new Date(); + const lastUpdateDate = new Date(stat.mtime * 1000); // Convert seconds to milliseconds + // 检查是否在今天的零点之后更新过 + const today = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); + needUpdate = lastUpdateDate < today; + } else { + needUpdate = true; + } + + // 检查 resolv.conf.auto 文件内容 + const hasResolvContent = resolvContent && resolvContent.trim().length > 0; + + // 只有当需要更新且 resolv.conf.auto 不为空时,才返回 true + return needUpdate && hasResolvContent; + }).catch(function(error) { + console.error('Error checking update status:', error); + return false; // 如果出错,不执行更新 + }); + }; const query = decodeURIComponent(L.toArray(location.search.match(/\bquery=([^=]+)\b/))[1] || ''); const view = E([], [ @@ -1193,6 +1230,7 @@ return view.extend({ E('label', {}, _('Actions') + ':'), ' ', E('span', { 'class': 'control-group' }, [ E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handlePkg, 'disabled': isReadonlyView }, [ _('Update lists…') ]), ' ', + E('button', { 'class': 'btn cbi-button-negative', 'data-command': 'upgradeall', 'click': handlePkg, 'disabled': isReadonlyView }, [ _('Upgrade all…') ]), ' ', E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload, 'disabled': isReadonlyView }, [ _('Upload Package…') ]), ' ', E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Configure %s').format(L.hasSystemFeature('apk') ? 'apk' : 'opkg') ]) ]) @@ -1278,7 +1316,17 @@ return view.extend({ ]); requestAnimationFrame(function() { - updateLists(listData) + updateLists(listData); + checkUpdateNeeded().then(function(needUpdate) { + if (needUpdate) { + setTimeout(function() { + const updateButton = document.querySelector('button[data-command="update"]'); + if (updateButton) { + updateButton.click(); + } + }, 10) + } + }); }); return view; --- a/package/feeds/luci/luci-app-package-manager/root/usr/libexec/package-manager-call +++ b/package/feeds/luci/luci-app-package-manager/root/usr/libexec/package-manager-call @@ -27,7 +27,7 @@ case "$action" in find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd fi ;; - install|update|upgrade|remove) + install|update|upgrade|upgradeall|remove) ( cmd="$ipkg_bin" @@ -89,10 +89,45 @@ case "$action" in if flock -x 200; then pkmcmd="$cmd $action $@" - $cmd $action "$@" /tmp/ipkg.out 2>/tmp/ipkg.err - code=$? - stdout=$(cat /tmp/ipkg.out) + if [ $action == "upgradeall" ]; then + $cmd update /tmp/ipkg.out 2>/tmp/ipkg.err + code=$? + if [ $code == 0 ]; then + . /etc/profile.d/opkg.sh + if [[ "$(cat `opkg export au`)" ]] && lock -n /var/lock/opkg-upgrade; then + opkg upgr >/tmp/ipkg.out 2>>/tmp/ipkg.err + code=$? + lock -u /var/lock/opkg-upgrade + else + echo "🎉 所有软件包已是最新~" >>/tmp/ipkg.out + code=0 + fi + fi + else + $cmd $action "$@" /tmp/ipkg.out 2>/tmp/ipkg.err + code=$? + fi + pkgn="$(echo $@ | cut -d - -f 3-)" + case "$action" in + install|upgrade) + if [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ]; then + rm -f /tmp/ipkg.err + ([ -f /etc/profile.d/opkg.sh ] && . /etc/profile.d/opkg.sh && opkg save) & + fi + ;; + remove) + if [ ! "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ]; then + rm -f /tmp/ipkg.err + ([ -f /etc/profile.d/opkg.sh ] && . /etc/profile.d/opkg.sh && opkg save) & + fi + ;; + esac stderr=$(cat /tmp/ipkg.err) + [ -n "$stderr" ] || { + echo "🎉 已完成, 请关闭本窗口~" >>/tmp/ipkg.out + code=0 + } + stdout=$(cat /tmp/ipkg.out) else code=255 stderr="Failed to acquire lock" @@ -110,7 +145,7 @@ case "$action" in ;; *) echo "Usage: $0 {list-installed|list-available|update}" >&2 - echo " $0 {install|upgrade|remove} pkg[ pkg...]" >&2 + echo " $0 {install|upgrade|upgradeall|remove} pkg[ pkg...]" >&2 exit 1 ;; esac --- a/package/feeds/luci/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json +++ b/package/feeds/luci/luci-app-package-manager/root/usr/share/rpcd/acl.d/luci-app-package-manager.json @@ -8,6 +8,7 @@ "/usr/libexec/package-manager-call list-available": [ "exec" ], "/etc/opkg.conf": [ "read" ], "/etc/opkg/*.conf": [ "read" ], + "/tmp/resolv.conf.d/resolv.conf.auto": [ "read" ], "/etc/apk/repositories": [ "read" ], "/etc/apk/repositories.d/distfeeds.list": [ "read" ], "/etc/apk/repositories.d/customfeeds.list": [ "read" ] @@ -24,6 +25,7 @@ "/usr/libexec/package-manager-call update": [ "exec" ], "/usr/libexec/package-manager-call upgrade": [ "exec" ], "/usr/libexec/package-manager-call upgrade *": [ "exec" ], + "/usr/libexec/package-manager-call upgradeall": [ "exec" ], "/etc/opkg.conf": [ "write" ], "/etc/opkg/*.conf": [ "write" ], "/etc/apk/repositories": [ "write" ], ================================================ FILE: devices/common/patches/package.patch ================================================ --- a/include/package.mk +++ b/include/package.mk @@ -354,3 +354,11 @@ dist: distcheck: $(Build/DistCheck) + +ifndef Package/$(PKG_NAME)/conffiles +define Package/$(PKG_NAME)/conffiles +/etc/config/ +/etc/$(PKG_NAME)/ +endef +endif + --- a/package/Makefile +++ b/package/Makefile @@ -118,8 +118,11 @@ endif $(call prepare_rootfs,$(TARGET_DIR),$(TOPDIR)/files) +PACKAGE_SUFFIX:=$(if $(CONFIG_USE_APK),apk,ipk) $(curdir)/index: FORCE @echo Generating package index... + $(FIND) $(wildcard $(PACKAGE_SUBDIRS)) -path $(PACKAGE_DIR) -prune -o \ + -type f -name '*.$(PACKAGE_SUFFIX)' -exec $(CP) -t $(PACKAGE_DIR)/ {} + ifneq ($(CONFIG_USE_APK),) @for d in $(PACKAGE_SUBDIRS); do \ mkdir -p $$d; \ ================================================ FILE: devices/common/patches/rootfs.patch ================================================ --- a/include/rootfs.mk +++ b/include/rootfs.mk @@ -88,7 +88,6 @@ define prepare_rootfs ret=$$?; \ if [ $$ret -ne 0 ]; then \ echo "postinst script $$script has failed with exit code $$ret" >&2; \ - exit 1; \ fi; \ [ -n "$(CONFIG_USE_APK)" ] && $(STAGING_DIR_HOST)/bin/tar --delete -f ./lib/apk/db/scripts.tar $$(basename $$script); \ done; \ ================================================ FILE: devices/common/patches/status.patch ================================================ --- a/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js +++ b/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js @@ -32,8 +32,7 @@ return baseclass.extend({ swap = L.isObject(systeminfo.swap) ? systeminfo.swap : {}; var fields = [ - _('Total Available'), (mem.available) ? mem.available : (mem.total && mem.free && mem.buffered) ? mem.free + mem.buffered : null, mem.total, - _('Used'), (mem.total && mem.free) ? (mem.total - mem.free) : null, mem.total, + _('Used'), (mem.total && mem.available) ? (mem.total - mem.free - mem.buffered - mem.cached) : null, mem.total, ]; if (mem.buffered) @@ -43,9 +42,9 @@ return baseclass.extend({ fields.push(_('Cached'), mem.cached, mem.total); if (swap.total > 0) - fields.push(_('Swap free'), swap.free, swap.total); + fields.push(_('Swap used'), swap.total - swap.free, swap.total); - var table = E('table', { 'class': 'table' }); + var table = E('table', { 'class': 'table memory' }); for (var i = 0; i < fields.length; i += 3) { table.appendChild(E('tr', { 'class': 'tr' }, [ --- a/package/feeds/luci/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json +++ b/package/feeds/luci/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json @@ -6,7 +6,7 @@ "/etc/services": [ "read" ] }, "ubus": { - "luci": [ "getConntrackList", "getRealtimeStats" ], + "luci": [ "getConntrackList", "getRealtimeStats", "getCPUBench", "getCPUUsage", "getOnlineUsers" ], "luci-rpc": [ "getHostHints", "getNetworkDevices", "getDHCPLeases" ], "network.rrdns": [ "lookup" ] } --- a/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js +++ b/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js @@ -18,6 +18,21 @@ var callSystemInfo = rpc.declare({ method: 'info' }); +var callCPUBench = rpc.declare({ + object: 'luci', + method: 'getCPUBench' +}); + +var callCPUInfo = rpc.declare({ + object: 'luci', + method: 'getCPUInfo' +}); + +var callTempInfo = rpc.declare({ + object: 'luci', + method: 'getTempInfo' +}); + return baseclass.extend({ title: _('System'), @@ -25,6 +45,9 @@ return baseclass.extend({ return Promise.all([ L.resolveDefault(callSystemBoard(), {}), L.resolveDefault(callSystemInfo(), {}), + L.resolveDefault(callCPUBench(), {}), + L.resolveDefault(callCPUInfo(), {}), + L.resolveDefault(callTempInfo(), {}), L.resolveDefault(callLuciVersion(), { revision: _('unknown version'), branch: 'LuCI' }), L.resolveDefault(callGetUnixtime(), 0), uci.load('system') @@ -32,7 +56,10 @@ return baseclass.extend({ render: function(data) { var boardinfo = data[0], systeminfo = data[1], - luciversion = data[2], - unixtime = data[3]; + cpubench = data[2], + cpuinfo = data[3], + tempinfo = data[4], + luciversion = data[5], + unixtime = data[6]; luciversion = luciversion.branch + ' ' + luciversion.revision; @@ -53,8 +81,6 @@ return baseclass.extend({ var fields = [ _('Hostname'), boardinfo.hostname, - _('Model'), boardinfo.model, - _('Architecture'), boardinfo.system, _('Target Platform'), (L.isObject(boardinfo.release) ? boardinfo.release.target : ''), _('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''), _('Kernel Version'), boardinfo.kernel, @@ -67,6 +93,24 @@ return baseclass.extend({ ) : null ]; + if (tempinfo.tempinfo) { + fields.splice(6, 0, _('Temperature')); + fields.splice(7, 0, tempinfo.tempinfo); + } + if (boardinfo.model == "Default string Default string") { + if (cpuinfo.cpuinfo) { + fields.splice(2, 0, _('Architecture')); + fields.splice(3, 0, cpuinfo.cpuinfo + cpubench.cpubench); + } + } else { + fields.splice(2, 0, _('Model')); + fields.splice(3, 0, boardinfo.model + cpubench.cpubench); + if (cpuinfo.cpuinfo) { + fields.splice(4, 0, _('Architecture')); + fields.splice(5, 0, cpuinfo.cpuinfo); + } + } + var table = E('table', { 'class': 'table' }); for (var i = 0; i < fields.length; i += 2) { --- a/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js +++ b/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js @@ -675,7 +675,6 @@ return view.extend({ checkLegacyRules: function(ipt4save, ipt6save) { if (ipt4save.match(/\n-A /) || ipt6save.match(/\n-A /)) { ui.addNotification(_('Legacy rules detected'), [ - E('p', _('There are legacy iptables rules present on the system. Mixing iptables and nftables rules is discouraged and may lead to incomplete traffic filtering.')), E('button', { 'class': 'btn cbi-button', 'click': function() { location.href = 'nftables/iptables' } --- a/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js +++ b/package/feeds/luci/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js @@ -309,8 +309,6 @@ return baseclass.extend({ }, render(data) { - if (L.hasSystemFeature('swconfig')) - return null; const board = JSON.parse(data[1]), known_ports = [], ================================================ FILE: devices/common/patches/use_json_object_new_int64.patch.b ================================================ --- a/package/feeds/luci/luci-lib-jsonc/src/jsonc.c +++ b/package/feeds/luci/luci-lib-jsonc/src/jsonc.c @@ -366,9 +366,7 @@ case LUA_TNUMBER: nd = lua_tonumber(L, index); - ni = lua_tointeger(L, index); - - if (nd == ni) - return json_object_new_int(nd); - + if(nd >= INT64_MIN && nd <= INT64_MAX) + return json_object_new_int64(nd); + else return json_object_new_double(nd); ================================================ FILE: devices/common/patches/wifi-scripts.patch ================================================ --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh @@ -122,6 +122,7 @@ hostapd_common_add_device_config() { config_add_int maxassoc config_add_int reg_power_type config_add_boolean stationary_ap + config_add_boolean vendor_vht config_add_string acs_chan_bias config_add_array hostapd_options @@ -141,7 +142,7 @@ hostapd_prepare_device_config() { json_get_vars country country3 country_ie beacon_int:100 doth require_mode legacy_rates \ acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \ rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_reject_assoc_timeout rssi_ignore_probe_request \ - maxassoc mbssid:0 band reg_power_type stationary_ap + maxassoc mbssid:0 band reg_power_type stationary_ap vendor_vht hostapd_set_log_options base_cfg @@ -210,6 +211,7 @@ hostapd_prepare_device_config() { set_default rate_list "24000 36000 48000 54000" set_default basic_rate_list "24000" fi + [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N" ;; a) if [ "$cell_density" -eq 1 ]; then ================================================ FILE: devices/common/patches/wireless.patch ================================================ --- a/package/feeds/luci/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/package/feeds/luci/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -1026,6 +1026,12 @@ return view.extend({ o.placeholder = 100; o.rmempty = true; + o = ss.taboption("advanced", form.Flag, 'mu_beamformer', _('MU-MIMO')); + o.default = '1'; + + o = ss.taboption('advanced', form.Flag, 'vendor_vht', _('Enable 256-QAM'), _('802.11n 2.4Ghz Only')); + o.default = o.disabled; + o = ss.taboption('advanced', form.Flag, 'rxldpc', _('Rx LDPC'), _('Low-Density Parity-Check')); o.default = '1'; ================================================ FILE: devices/common/settings.ini ================================================ REPO_URL="https://github.com/openwrt/openwrt" REPO_BRANCH="" CONFIG_FILE=".config" DIY_SH="diy.sh" FREE_UP_DISK="false" UPLOAD_BIN_DIR_FOR_ARTIFACT="false" UPLOAD_FIRMWARE_FOR_ARTIFACT="true" UPLOAD_FIRMWARE_FOR_RELEASE="false" UPLOAD_FIRMWARE_TO_COWTRANSFER="false" UPLOAD_FIRMWARE_TO_WETRANSFER="true" ================================================ FILE: devices/ipq40xx_generic/.config ================================================ CONFIG_TARGET_ipq40xx=y CONFIG_TARGET_ipq40xx_generic=y CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_dlink_dap-2610=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_eagle-pro-ai-m32-a1=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_eagle-pro-ai-r32-a1=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_extreme-networks_ws-ap391x=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_netgear_ex6100v2=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_netgear_ex6150v2=n CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_zyxel_nbg6617=n ================================================ FILE: devices/ipq40xx_generic/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #sh -c "curl -sfL https://patch-diff.githubusercontent.com/raw/openwrt/openwrt/pull/10778.patch | git apply -p1" wget -N https://github.com/immortalwrt/immortalwrt/raw/refs/heads/openwrt-25.12/target/linux/ipq40xx/patches-6.12/991-ipq40xx-unlock-cpu-frequency.patch -P target/linux/ipq40xx/patches-6.12/ ================================================ FILE: devices/ipq40xx_generic/patches/ap4220.patch ================================================ From 901be81149fd7c97fb5c7fdabe6e05e470fada00 Mon Sep 17 00:00:00 2001 From: Willem Lee <1980490718@qq.com> Date: Fri, 18 Apr 2025 05:30:01 +0800 Subject: [PATCH] ipq40xx: add support for Aliyun AP4220 Hardware specifications ------------- - SoC : Qualcomm IPQ4018 - RAM : 256 MiB DDR3 - Flash : 4 MiB SPI NOR (Winbond) + 128 MiB SPI NAND (Winbond) - WLAN : IPQ4018 built-in - 2.4 GHz : 2x2 MIMO WiFi4 - 5 GHz : 2x2 MIMO WiFi5 - Ethernet : QCA8072 10/100/1000 Mbps 1x WAN (PoE); 1x LAN - USB : 1x 2.0 - UART : 1x Rj45 port, 115200n8 - Buttons : 1x Reset - LEDs : 1x Power (green) 1x WiFi 2.4 GHz (green) 1x WiFi 5 GHz (green) - Power : 802.3at PoE Flash instructions ------------- 1. Connect the router via serial port 2. Keep pressing "@" until uboot is interrupted 3. Download the initramfs image, rename it to initramfs.bin, host it with tftp server 4. Run these commands: "tftpboot initramfs.bin && bootm" 5. After openwrt boots up, use scp or luci to upload sysupgrade.bin to upgrade. Signed-off-by: Willem Lee <1980490718@qq.com> --- .../uboot-tools/uboot-envtools/files/ipq40xx | 1 + package/firmware/ipq-wifi/Makefile | 2 + .../ipq40xx/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 8 + .../base-files/lib/upgrade/platform.sh | 3 +- .../arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts | 369 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 12 + 7 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts diff --git a/package/boot/uboot-tools/uboot-envtools/files/ipq40xx b/package/boot/uboot-tools/uboot-envtools/files/ipq40xx index 717158b0425ea5..481722a7e7c66a 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-tools/uboot-envtools/files/ipq40xx @@ -32,6 +32,7 @@ ubootenv_mtdinfo () { case "$board" in alfa-network,ap120c-ac|\ +aliyun,ap4220|\ devolo,magic-2-wifi-next|\ edgecore,ecw5211|\ glinet,gl-a1300 |\ diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 72e397443888c9..1f0b611c9ed584 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -28,6 +28,7 @@ endef 8devices_kiwi \ 8devices_mango \ alfa-network_ap120c-ax \ + aliyun_ap4220 \ aliyun_ap8220 \ arcadyan_aw1000 \ asus_rt-ax89x \ @@ -177,6 +178,7 @@ endef $(eval $(call generate-ipq-wifi-package,8devices_kiwi,8devices Kiwi)) $(eval $(call generate-ipq-wifi-package,8devices_mango,8devices Mango)) $(eval $(call generate-ipq-wifi-package,alfa-network_ap120c-ax,ALFA Network AP120C-AX)) +$(eval $(call generate-ipq-wifi-package,aliyun_ap4220,Aliyun AP4220)) $(eval $(call generate-ipq-wifi-package,aliyun_ap8220,Aliyun AP8220)) $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000)) $(eval $(call generate-ipq-wifi-package,asus_rt-ax89x,Asus RT-AX89X)) 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 57dca0e1a2a93a..27f5aefd002286 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -31,6 +31,7 @@ ipq40xx_setup_interfaces() 8dev,jalapeno|\ alfa-network,ap120c-ac|\ asus,map-ac1300|\ + aliyun,ap4220|\ asus,map-ac2200|\ cilab,meshpoint-one|\ edgecore,ecw5211|\ @@ -171,6 +172,11 @@ ipq40xx_setup_macs() 8dev,habanero-dvk) label_mac=$(mtd_get_mac_binary "ART" 0x1006) ;; + aliyun,ap4220) + wan_mac=$(mtd_get_mac_text product_info 0x40) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac="$wan_mac" + ;; asus,rt-ac42u) label_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) ;; diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 4a1a0ff31118a3..beb8aed58cfb2f 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -57,6 +57,10 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-ahb-a000000.wifi.bin") case "$board" in + aliyun,ap4220) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(mtd_get_mac_text product_info 0x40)" 2) + ;; asus,rt-ac42u) caldata_extract_ubi "Factory" 0x1000 0x2f20 ;; @@ -157,6 +161,10 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-ahb-a800000.wifi.bin") case "$board" in + aliyun,ap4220) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(mtd_get_mac_text product_info 0x40)" 3) + ;; avm,fritzbox-4040) /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 53a95611487b50..8f4f002dbea61d 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -132,7 +132,8 @@ platform_do_upgrade() { wallys,dr40x9) nand_do_upgrade "$1" ;; - alfa-network,ap120c-ac) + alfa-network,ap120c-ac|\ + aliyun,ap4220) part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" if [ "$part" = "rootfs1" ]; then fw_setenv active 2 || exit 1 diff --git a/target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts b/target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts new file mode 100644 index 00000000000000..4f9ab7f61627b0 --- /dev/null +++ b/target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4018-ap4220.dts @@ -0,0 +1,369 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + compatible = "aliyun,ap4220", "qcom,ipq4019"; + model = "Aliyun AP4220"; + + aliases { + label-mac-device = &gmac; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + bootargs-append = " root=/dev/ubiblock0_1"; + stdout-path = "serial:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + led_status: led-2 { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&tlmm 5 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + + reg_usb: regulator-usb { + compatible = "regulator-fixed"; + gpios = <&tlmm 1 GPIO_ACTIVE_LOW>; + regulator-max-microvolt = <5000000>; + regulator-min-microvolt = <5000000>; + regulator-name = "reg_usb"; + }; + + soc { + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + 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 = ; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + num-cs = <2>; + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>, <&tlmm 4 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <24000000>; + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + compatible = "u-boot,env"; + label = "APPSBLENV"; + reg = <0xe0000 0x10000>; + }; + + partition@f0000 { + label = "APPSBL"; + reg = <0xf0000 0x80000>; + read-only; + }; + + partition@170000 { + label = "ART"; + reg = <0x170000 0x10000>; + read-only; + }; + + partition@180000 { + label = "product_info"; + reg = <0x180000 0x10000>; + read-only; + }; + + partition@190000 { + label = "mtdoops"; + reg = <0x190000 0x20000>; + }; + + partition@1b0000 { + label = "priv_data1"; + reg = <0x1b0000 0x10000>; + read-only; + }; + + partition@1c0000 { + label = "priv_data2"; + reg = <0x1c0000 0x10000>; + read-only; + }; + + partition@1d0000 { + label = "priv_data3"; + reg = <0x1d0000 0x200000>; + read-only; + }; + }; + }; + + spi-nand@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "rootfs1"; + reg = <0x0 0x3000000>; + }; + + partition@3000000 { + label = "rootfs2"; + reg = <0x3000000 0x3000000>; + }; + + partition@6000000 { + label = "usrdata"; + reg = <0x6000000 0x2000000>; + }; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +ðphy0 { + status = "disabled"; +}; + +ðphy1 { + status = "disabled"; +}; + +ðphy2 { + status = "disabled"; +}; + +ðphy3 { + status = "okay"; +}; + +ðphy4 { + status = "okay"; +}; + +&gmac { + status = "okay"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; +}; + +&prng { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + + label = "wan"; +}; + +&swport5 { + status = "okay"; + + label = "lan"; +}; + +&tlmm { + mdio_pins: mdio_pinmux { + mdc { + pins = "gpio52"; + function = "mdc"; + drive-strength = <4>; + bias-pull-up; + }; + + mdio { + pins = "gpio53"; + function = "mdio"; + drive-strength = <4>; + bias-pull-up; + }; + }; + + serial_pins: serial_pinmux { + blsp_uart0 { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + drive-strength = <8>; + bias-disable; + }; + }; + + spi0_pins: spi0_pinmux { + blsp_spi0 { + pins = "gpio55", "gpio56", "gpio57"; + function = "blsp_spi0"; + drive-strength = <12>; + bias-disable; + }; + + gpio { + pins = "gpio54", "gpio4"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb3 { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; + + phy-supply = <®_usb>; +}; + +&usb3_ss_phy { + status = "okay"; + + phy-supply = <®_usb>; +}; + +&watchdog { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + + qcom,ath10k-calibration-variant = "Aliyun-AP4220"; +}; + +&wifi1 { + status = "okay"; + + qcom,ath10k-calibration-variant = "Aliyun-AP4220"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 393bb991f11e6a..475a05188a8231 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -170,6 +170,18 @@ define Device/alfa-network_ap120c-ac endef TARGET_DEVICES += alfa-network_ap120c-ac +define Device/aliyun_ap4220 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Aliyun + DEVICE_MODEL := AP4220 + SOC := qcom-ipq4018 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-aliyun_ap4220 +endef +TARGET_DEVICES += aliyun_ap4220 + define Device/aruba_glenmorangie $(call Device/FitImageLzma) DEVICE_VENDOR := Aruba ================================================ FILE: devices/ipq40xx_generic/patches/cm520.patch ================================================ --- a/target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts +++ b/target/linux/ipq40xx/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq4019-cm520-79f.dts @@ -19,6 +19,10 @@ led-upgrade = &led_sys; }; + chosen { + bootargs-append = " ubi.block=0,1 root=/dev/ubiblock0_1"; + }; + soc { tcsr@1949000 { compatible = "qcom,tcsr"; @@ -160,65 +164,8 @@ #size-cells = <1>; partition@0 { - label = "SBL1"; - reg = <0x0 0x100000>; - read-only; - }; - - partition@100000 { - label = "MIBIB"; - reg = <0x100000 0x100000>; - read-only; - }; - - partition@200000 { - label = "BOOTCONFIG"; - reg = <0x200000 0x100000>; - }; - - partition@300000 { - label = "QSEE"; - reg = <0x300000 0x100000>; - read-only; - }; - - partition@400000 { - label = "QSEE_1"; - reg = <0x400000 0x100000>; - read-only; - }; - - partition@500000 { - label = "CDT"; - reg = <0x500000 0x80000>; - read-only; - }; - - partition@580000 { - label = "CDT_1"; - reg = <0x580000 0x80000>; - read-only; - }; - - partition@600000 { - label = "BOOTCONFIG1"; - reg = <0x600000 0x80000>; - }; - - partition@680000 { - label = "APPSBLENV"; - reg = <0x680000 0x80000>; - }; - - partition@700000 { - label = "APPSBL"; - reg = <0x700000 0x200000>; - read-only; - }; - - partition@900000 { - label = "APPSBL_1"; - reg = <0x900000 0x200000>; + label = "Bootloader"; + reg = <0x0 0xb00000>; read-only; }; @@ -251,7 +198,7 @@ }; partition@b80000 { - label = "ubi"; + label = "rootfs"; reg = <0xb80000 0x7480000>; }; }; ================================================ FILE: devices/ipq40xx_generic/patches/target.patch ================================================ --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -694,7 +694,7 @@ TARGET_DEVICES += meraki_mr33 define Device/mobipromo_cm520-79f $(call Device/FitzImage) $(call Device/UbiFit) - DEVICE_VENDOR := MobiPromo + DEVICE_VENDOR := MobiPromo星际宝盒 DEVICE_MODEL := CM520-79F SOC := qcom-ipq4019 BLOCKSIZE := 128k @@ -834,7 +834,7 @@ TARGET_DEVICES += openmesh_a62 define Device/p2w_r619ac $(call Device/FitzImage) $(call Device/UbiFit) - DEVICE_VENDOR := P&W + DEVICE_VENDOR := P&W竞斗云 DEVICE_MODEL := R619AC SOC := qcom-ipq4019 DEVICE_DTS_CONFIG := config@10 ================================================ FILE: devices/ipq806x_generic/.config ================================================ CONFIG_TARGET_ipq806x=y CONFIG_TARGET_ipq806x_generic=y CONFIG_TARGET_DEVICE_ipq806x_generic_DEVICE_tplink_ad7200=n CONFIG_TARGET_DEVICE_ipq806x_generic_DEVICE_tplink_c2600=n CONFIG_TARGET_DEVICE_ipq806x_generic_DEVICE_ubnt_unifi-ac-hd=n CONFIG_PACKAGE_MAC80211_NSS_SUPPORT=y CONFIG_PACKAGE_kmod-ipsec=n ================================================ FILE: devices/ipq806x_generic/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) ================================================ FILE: devices/ipq806x_generic/patches/xiaomi_r3d.patch ================================================ From c433730d889d0dfb31bdcf4f102ca47939606c46 Mon Sep 17 00:00:00 2001 From: remittor Date: Fri, 11 Aug 2023 12:08:30 +0300 Subject: [PATCH] ipq806x: Add support for Xiaomi Mi Router HD (R3D) Xiaomi R3D is a 2.4/5 GHz band 11ac router, based on IPQ8064. Specification: * SoC: Qualcomm IPQ8064 * RAM: 512MB DDR3 * Flash: 256MB NAND (Macronix MX30UF2G18AC-TI) * Ethernet: 4x 10/100/1000 Mbps (1x WAN, 3x LAN) * WiFi: Qualcomm QCA9984 (5GHz, 4T4R, n/ac) * WiFi: Qualcomm QCA9980 (2.4GHz, 4T4R, b/g/n) * USB: 1x 3.0 * SATA: 1x SATA 3.1 (only for internal HDD 3.5") * BTN: Power, Reset * LEDS: Status(Green/Blue/Red) * UART: present as 4-pads on the PCB (3.3V, 115200-8-N-1) MAC addresses as verified by stock firmware: | Interface | MAC | ART | Format | |-------------+-------------------+---------+--------| | WAN (label) | xx:xx:xx:xx:xx:B2 | 0x0 | binary | | LAN | xx:xx:xx:xx:xx:B3 | 0x6 | binary | | WiFi 2g | xx:xx:xx:xx:xx:B4 | 0x1006 | binary | | WiFi 5g | xx:xx:xx:xx:xx:B5 | 0x5006 | binary | --- package/boot/uboot-tools/uboot-envtools/files/ipq806x | 6 +- .../ipq806x/base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 + .../ipq806x/base-files/etc/init.d/bootcount | 8 + .../base-files/lib/upgrade/platform.sh | 3 + .../ipq806x/base-files/lib/upgrade/xiaomi.sh | 441 ++++++++++++++++ .../arch/arm/boot/dts/qcom-ipq8064-r3d.dts | 479 ++++++++++++++++++ target/linux/ipq806x/image/generic.mk | 17 + 8 files changed, 963 insertions(+), 1 deletion(-) create mode 100644 target/linux/ipq806x/base-files/lib/upgrade/xiaomi.sh create mode 100644 target/linux/ipq806x/files-6.12/arch/arm/boot/dts/qcom-ipq8064-r3d.dts diff --git a/package/boot/uboot-tools/uboot-envtools/files/ipq806x b/package/boot/uboot-tools/uboot-envtools/files/ipq806x index 01a86c7b19fca..c0a781c1e21b4 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-tools/uboot-envtools/files/ipq806x @@ -52,6 +52,10 @@ qcom,ipq8064-ap148|\ nokia,ac400i) ubootenv_add_uci_config "/dev/mtd20" "0x0" "0x040000" "0x20000" ;; +xiaomi,r3d) + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" + ubootenv_add_uci_sys_config "/dev/mtd12" "0x0" "0x10000" "0x10000" + ;; ubnt,unifi-ac-hd|\ zyxel,nbg6817) ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000" @@ -59,6 +63,6 @@ zyxel,nbg6817) esac config_load ubootenv -config_foreach ubootenv_add_app_config ubootenv +config_foreach ubootenv_add_app_config exit 0 diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 4c5019cf5bd24..aa8ed06aae4b3 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -56,6 +56,9 @@ case "$FIRMWARE" in caldata_extract "0:art" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +2) ;; + xiaomi,r3d) + caldata_extract "ART" 0x1000 0x2f20 + ;; zyxel,nbg6817) caldata_extract "0:art" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) 1) @@ -92,6 +95,9 @@ case "$FIRMWARE" in caldata_extract "0:art" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:appsblenv ethaddr) +3) ;; + xiaomi,r3d) + caldata_extract "ART" 0x5000 0x2f20 + ;; zyxel,nbg6817) caldata_extract "0:art" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_ascii 0:appsblenv ethaddr) diff --git a/target/linux/ipq806x/base-files/etc/init.d/bootcount b/target/linux/ipq806x/base-files/etc/init.d/bootcount index cb32a4ed3568d..9d9ab3f100fe2 100755 --- a/target/linux/ipq806x/base-files/etc/init.d/bootcount +++ b/target/linux/ipq806x/base-files/etc/init.d/bootcount @@ -16,5 +16,13 @@ boot() { linksys,ea8500) mtd resetbc s_env || true ;; + xiaomi,r3d) + local boot_wait=$( fw_printenv boot_wait | cut -d = -f 2 ) + [ "$boot_wait" != "on" ] && fw_setenv boot_wait on + local bootdelay=$( fw_printenv bootdelay | cut -d = -f 2 ) + [ "$bootdelay" != "3" ] && fw_setenv bootdelay 3 + local uart_en=$( fw_printenv uart_en | cut -d = -f 2 ) + [ "$uart_en" != "1" ] && fw_setenv uart_en 1 + ;; esac } diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index 5ec4f513bd33d..b142fce86a082 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -71,6 +71,9 @@ platform_do_upgrade() { MTD_CONFIG_ARGS="-s 0x200000" default_do_upgrade "$1" ;; + xiaomi,r3d) + platform_do_upgrade_xiaomi "$1" 0x2800000 + ;; zyxel,nbg6817) zyxel_do_upgrade "$1" ;; diff --git a/target/linux/ipq806x/base-files/lib/upgrade/xiaomi.sh b/target/linux/ipq806x/base-files/lib/upgrade/xiaomi.sh new file mode 100644 index 0000000000000..9246e8f867e3f --- /dev/null +++ b/target/linux/ipq806x/base-files/lib/upgrade/xiaomi.sh @@ -0,0 +1,441 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +. /lib/functions.sh + +MAGIC_XIAOMI_HDR1="48445231" # "HDR1" - xiaomi image header +MAGIC_XIAOMI_BLK="beba0000" +MAGIC_UIMAGE="27051956" # uImage header +MAGIC_UBI="55424923" # "UBI#" +MAGIC_UBIFS="31181006" +MAGIC_HSQS="68737173" # "hsqs" +MAGIC_SYSUPG="7379737570677261" # TAR "sysupgrade" + +XIAOMI_PAGESIZE=2048 + +XIAOMI_FW_FILE="" +XIAOMI_FW_SIZE=0 +XIAOMI_KERNEL_PART=$CI_KERNPART +XIAOMI_KERNEL2_PART="" +XIAOMI_KERNEL2_NAMES="kernel_stock|kernel_dup" +XIAOMI_ROOTFS_PART=$CI_UBIPART +XIAOMI_ROOTFS_PARTSIZE= + +XIAOMI_RESTORE_ROOTFS2= + +log_msg() { + echo "$@" +} + +log_err() { + echo "ERROR: $@" >&2 +} + +die() { + log_err "$@" + exit 1 +} + +get_uint32_at() { + local offset=$1 + local endianness=$2 + local hex + if [ $(( $offset + 4 )) -gt $XIAOMI_FW_SIZE ]; then + echo "" + return + fi + local dd_args="if=$XIAOMI_FW_FILE skip=$offset bs=1 count=4" + if [ "$endianness" = "be" ]; then + hex=$( dd $dd_args 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"' ) + else + hex=$( dd $dd_args 2>/dev/null | hexdump -v -e '1/4 "%02x"' ) + fi + echo $( printf "%d" 0x$hex ) +} + +get_hexdump_at() { + local offset=$1 + local size=$2 + if [ $(( $offset + $size )) -gt $XIAOMI_FW_SIZE ]; then + echo "" + return + fi + local dd_args="if=$XIAOMI_FW_FILE skip=$offset bs=1 count=$size" + echo $( dd $dd_args 2>/dev/null | hexdump -v -n $size -e '1/1 "%02x"' ) +} + +get_round_up() { + local value=$1 + local base=$2 + local pad=0 + if [ -z "$base" ]; then + base=$XIAOMI_PAGESIZE + else + base=$( printf "%d" $base ) + fi + if [ $(( $value % $base )) != 0 ]; then + pad=$(( $base - $value % $base )) + fi + echo $(( $value + $pad )) +} + +get_part_size() { + local part_name=$1 + local part=$( cat /proc/mtd | grep \"$part_name\" ) + if [ -z "$part" ]; then + echo 0 + else + local mtd_size_hex=$( echo $part | awk '{print "0x"$2}' ) + echo $( printf "%d" $mtd_size_hex ) + fi +} + +xiaomi_check_sizes() { + local part_name=$1 + local img_offset=$2 + local img_size=$3 + + local mtd_size=$( get_part_size $part_name ) + if [ "$mtd_size" = "0" ]; then + echo "cannot find mtd partition with name '$part_name'" + return 1 + fi + local img_end=$(( $img_offset + $img_size )) + if [ $img_end -gt $XIAOMI_FW_SIZE ]; then + echo "incorrect image size (part: '$part_name')" + return 1 + fi + if [ $img_size -gt $mtd_size ]; then + echo "image is greater than partition '$part_name'" + return 1 + fi + echo "" + return 0 +} + +xiaomi_mtd_write() { + local part_name=$1 + local img_offset=$2 + local img_size=$3 + local part_skip=$4 + + img_size=$( get_round_up $img_size ) + local err=$( xiaomi_check_sizes $part_name $img_offset $img_size ) + if [ -n "$err" ]; then + log_err $err + return 1 + fi + if [ -n "$part_skip" ]; then + part_skip="-p $part_skip" + fi + local count=$(( $img_size / $XIAOMI_PAGESIZE )) + local dd_args="if=$XIAOMI_FW_FILE iflag=skip_bytes skip=$img_offset bs=$XIAOMI_PAGESIZE count=$count" + dd $dd_args | mtd -f $part_skip write - "$part_name" || { + log_err "Failed to flash '$part_name'" + return 1 + } + return 0 +} + +xiaomi_flash_images() { + local kernel_offset=$1 + local kernel_size=$2 + local rootfs_offset=$3 + local rootfs_size=$4 + local err + local part_skip=0 + + kernel_size=$( get_round_up $kernel_size ) + rootfs_size=$( get_round_up $rootfs_size ) + + err=$( xiaomi_check_sizes $XIAOMI_KERNEL_PART $kernel_offset $kernel_size ) + [ -n "$err" ] && { log_err $err; return 1; } + + if [ -n "$XIAOMI_KERNEL2_PART" ]; then + err=$( xiaomi_check_sizes $XIAOMI_KERNEL2_PART $kernel_offset $kernel_size ) + [ -n "$err" ] && { log_err $err; return 1; } + fi + + err=$( xiaomi_check_sizes $XIAOMI_ROOTFS_PART $rootfs_offset $rootfs_size ) + [ -n "$err" ] && { log_err $err; return 1; } + + if [ "$XIAOMI_RESTORE_ROOTFS2" = "true" -a -n "$XIAOMI_ROOTFS_PARTSIZE" ]; then + part_skip=$( printf "%d" $XIAOMI_ROOTFS_PARTSIZE ) + if [ $part_skip -lt 1000000 ]; then + part_skip=0 + fi + fi + + if [ $part_skip -gt 0 ]; then + local ksize=$(( $part_skip + $rootfs_size )) + local mtd_size=$( get_part_size $XIAOMI_ROOTFS_PART ) + if [ $ksize -gt $mtd_size ]; then + log_err "double rootfs is greater than partition '$XIAOMI_ROOTFS_PART'" + return 1 + fi + fi + + mtd erase "$XIAOMI_ROOTFS_PART" || { + log_err "Failed to erase partition '$part_name'" + return 1 + } + + xiaomi_mtd_write $XIAOMI_KERNEL_PART $kernel_offset $kernel_size || { + log_err "Failed flash data to '$XIAOMI_KERNEL_PART' partition" + return 1 + } + log_msg "Kernel image flashed to '$XIAOMI_KERNEL_PART'" + + if [ -n "$XIAOMI_KERNEL2_PART" ]; then + xiaomi_mtd_write $XIAOMI_KERNEL2_PART $kernel_offset $kernel_size || { + log_err "Failed flash data to '$XIAOMI_KERNEL2_PART' partition" + return 1 + } + log_msg "Kernel image flashed to '$XIAOMI_KERNEL2_PART'" + fi + + xiaomi_mtd_write $XIAOMI_ROOTFS_PART $rootfs_offset $rootfs_size || { + log_err "Failed flash data to '$XIAOMI_ROOTFS_PART' partition" + return 1 + } + log_msg "Rootfs image flashed to '$XIAOMI_ROOTFS_PART'!" + + if [ $part_skip -gt 0 ]; then + xiaomi_mtd_write $XIAOMI_ROOTFS_PART $rootfs_offset $rootfs_size $part_skip || { + log_err "Failed flash data to '$XIAOMI_ROOTFS_PART' partition (2)" + return 1 + } + log_msg "Rootfs image flashed to '$XIAOMI_ROOTFS_PART':$XIAOMI_ROOTFS_PARTSIZE" + fi + + log_msg "Firmware write successful! Reboot..." + sync + umount -a + reboot -f + exit 0 +} + +check_ubi_header() { + local offset=$1 + + local magic=$( get_hexdump_at $offset 4 ) + [ "$magic" != $MAGIC_UBI ] && { echo ""; return 1; } + + local magic_ubi2="55424921" # "UBI!" + offset=$(( $offset + $XIAOMI_PAGESIZE )) + magic=$( get_hexdump_at $offset 4 ) + [ "$magic" != $magic_ubi2 ] && { echo ""; return 1; } + + echo "true" + return 0 +} + +get_rootfs_offset() { + local start=$1 + local pos offset align end + + for offset in 0 1 2 3 4; do + pos=$(( $start + $offset )) + [ -n "$( check_ubi_header $pos )" ] && { echo $pos; return 0; } + done + + for align in 4 8 16 32 64 128 256 512 1024 2048 4096; do + pos=$( get_round_up $start $align ) + [ -n "$( check_ubi_header $pos )" ] && { echo $pos; return 0; } + done + + align=65536 + pos=$( get_round_up $start $align ) + end=$(( $pos + 3000000 )) + while true; do + [ $(( $pos + 150000 )) -gt $XIAOMI_FW_SIZE ] && break + [ -n "$( check_ubi_header $pos )" ] && { echo $pos; return 0; } + pos=$(( $pos + $align )) + [ $pos -ge $end ] && break + done + + echo "" + return 1 +} + +xiaomi_do_factory_upgrade() { + local err + local magic + local kernel_offset kernel_size + local rootfs_offset rootfs_size + + local kernel_mtd="$( find_mtd_index $XIAOMI_KERNEL_PART )" + if [ -z "$kernel_mtd" ]; then + log_err "partition '$XIAOMI_KERNEL_PART' not found" + return 1 + fi + log_msg "Forced factory upgrade..." + + kernel_offset=0 + kernel_size=$( get_uint32_at 12 "be" ) + kernel_size=$(( $kernel_size + 64 )) + + rootfs_offset=$( get_rootfs_offset $kernel_size ) + if [ -z "$rootfs_offset" ]; then + log_err "can't find ubinized rootfs in the firmware image" + return 1 + fi + rootfs_size=$(( $XIAOMI_FW_SIZE - $rootfs_offset )) + local rootfs_end=$(( $rootfs_offset + $rootfs_size )) + + XIAOMI_RESTORE_ROOTFS2=false + xiaomi_flash_images $kernel_offset $kernel_size $rootfs_offset $rootfs_size || { + log_err "can't flash factory image" + return 1 + } + exit 0 +} + +xiaomi_do_revert_stock() { + local err + local magic + local blk blkpos blk_magic offset file_size + local kernel_offset + local kernel_size=0 + local rootfs_offset + local rootfs_size=0 + + local kernel_mtd=$( find_mtd_index $XIAOMI_KERNEL_PART ) + if [ -z "$kernel_mtd" ]; then + log_err "partition '$XIAOMI_KERNEL_PART' not found" + return 1 + fi + log_msg "Forced revert to stock firmware..." + + for blk in 16 20 24 28 32 36; do + blkpos=$( get_uint32_at $blk ) + [ -z "$blkpos" ] && continue + [ $blkpos -lt 48 ] && continue + blk_magic=$( get_hexdump_at $blkpos 4 ) + [ "$blk_magic" != $MAGIC_XIAOMI_BLK ] && continue + offset=$(( $blkpos + 8 )) + file_size=$( get_uint32_at $offset 4 ) + [ -z "$file_size" ] && continue + [ $file_size -lt 1000000 ] && continue + offset=$(( $blkpos + 48 )) + magic=$( get_hexdump_at $offset 4 ) + if [ "$magic" = $MAGIC_UIMAGE ]; then + kernel_size=$file_size + kernel_offset=$offset + fi + if [ "$magic" = $MAGIC_UBI -o "$magic" = $MAGIC_HSQS ]; then + rootfs_size=$file_size + rootfs_offset=$offset + fi + done + if [ $kernel_size -eq 0 ]; then + log_err "incorrect stock firmware image (kernel not found)" + return 1 + fi + if [ $rootfs_size -eq 0 ]; then + log_err "incorrect stock firmware image (rootfs not found)" + return 1 + fi + + XIAOMI_RESTORE_ROOTFS2=true + xiaomi_flash_images $kernel_offset $kernel_size $rootfs_offset $rootfs_size || { + log_err "ERROR: can't revert to stock firmware" + return 1 + } + exit 0 +} + +platform_do_upgrade_xiaomi() { + XIAOMI_FW_FILE=$1 + local stock_rootfs_size=$2 + local magic + local kernel_mtd kernel2_mtd rootfs_mtd + local kernel2_part_list part_name + + XIAOMI_FW_SIZE=$( wc -c "$XIAOMI_FW_FILE" 2> /dev/null | awk '{print $1}' ) + if [ -z "$XIAOMI_FW_SIZE" ]; then + log_err "File '$XIAOMI_FW_FILE' not found!" + exit 1 + fi + if [ $XIAOMI_FW_SIZE -lt 1000000 ]; then + log_err "file '$XIAOMI_FW_FILE' is incorrect" + exit 1 + fi + + kernel_mtd=$( find_mtd_index $XIAOMI_KERNEL_PART ) + if [ -z "$kernel_mtd" ]; then + log_err "cannot find mtd partition for '$XIAOMI_KERNEL_PART'" + exit 1 + fi + kernel2_part_list=$( echo "$XIAOMI_KERNEL2_NAMES" | sed 's/|/\n/g' ) + for part_name in $kernel2_part_list; do + kernel2_mtd=$( find_mtd_index $part_name ) + if [ -n "$kernel2_mtd" ]; then + XIAOMI_KERNEL2_PART="$part_name" + log_msg "Found alt kernel partition '$XIAOMI_KERNEL2_PART'" + break + fi + done + rootfs_mtd=$( find_mtd_index $XIAOMI_ROOTFS_PART ) + if [ -z "$rootfs_mtd" ]; then + log_err "cannot find mtd partition for '$XIAOMI_ROOTFS_PART'" + exit 1 + fi + + magic=$( get_hexdump_at 0 4 ) + + # Flash factory image (uImage header) + if [ "$magic" = $MAGIC_UIMAGE ]; then + xiaomi_do_factory_upgrade + exit $? + fi + + # Revert to stock firmware ("HDR1" header) + if [ "$magic" = $MAGIC_XIAOMI_HDR1 ]; then + if [ -n "$stock_rootfs_size" ]; then + XIAOMI_ROOTFS_PARTSIZE=$stock_rootfs_size + fi + xiaomi_do_revert_stock + exit $? + fi + + magic=$( get_hexdump_at 0 8 ) + if [ "$magic" != $MAGIC_SYSUPG ]; then + log_err "incorrect image for system upgrading!" + exit 1 + fi + log_msg "SysUpgrade start..." + local tar_file=$XIAOMI_FW_FILE + local board_dir=$( tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$' ) + [ -z "$board_dir" ] && { + log_err "board dir not found" + exit 1 + } + board_dir=${board_dir%/} + + local control_len=$( (tar xf $tar_file $board_dir/CONTROL -O | wc -c) 2> /dev/null) + if [ $control_len -lt 3 ]; then + log_err "incorrect stock firmware image (CONTROL not found)" + exit 1 + fi + local kernel_len=$( (tar xf $tar_file $board_dir/kernel -O | wc -c) 2> /dev/null) + if [ $kernel_len -lt 1000000 ]; then + log_err "incorrect stock firmware image (kernel not found)" + exit 1 + fi + local rootfs_len=$( (tar xf $tar_file $board_dir/root -O | wc -c) 2> /dev/null) + if [ $rootfs_len -lt 1000000 ]; then + log_err "incorrect stock firmware image (rootfs not found)" + exit 1 + fi + + if [ -n "$XIAOMI_KERNEL2_PART" ]; then + tar Oxf $tar_file $board_dir/kernel | mtd -f write - $XIAOMI_KERNEL2_PART && { + log_msg "Kernel image flashed to '$XIAOMI_KERNEL2_PART'" + } || { + log_err "cannot flash partition '$XIAOMI_KERNEL2_PART'" + exit 1 + } + fi + + nand_do_upgrade "$XIAOMI_FW_FILE" +} diff --git a/target/linux/ipq806x/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq8064-r3d.dts b/target/linux/ipq806x/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq8064-r3d.dts new file mode 100644 index 0000000000000..fd952d230c5da --- /dev/null +++ b/target/linux/ipq806x/files-6.12/arch/arm/boot/dts/qcom/qcom-ipq8064-r3d.dts @@ -0,0 +1,479 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq8064-v2.0-smb208.dtsi" + +#include + +/ { + model = "Xiaomi Mi Router HD (R3D)"; + compatible = "xiaomi,r3d", "qcom,ipq8064"; + + memory@0 { + device_type = "memory"; + reg = <0x42000000 0x1e000000>; + }; + + reserved-memory { + rsvd@44600000 { + reg = <0x44600000 0x200000>; /* IPQ_TZ_APPS_ADDR */ + no-map; + }; + }; + + aliases { + label-mac-device = &gmac1; + + mdio-gpio0 = &mdio0; + + led-boot = &led_status_yellow; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + }; + + chosen { + bootargs = "rootfstype=squashfs noinitrd"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + wakeup-source; + }; + + power { + label = "power"; /* Labeled POWER on the device, but using for sleep mode */ + gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + wakeup-source; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_status_red: led_status_red { + label = "red:status"; + gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + + led_status_blue: led_status_blue { + label = "blue:status"; + gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + + led_status_yellow: led_status_yellow { + label = "yellow:status"; + gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; + + i2c_gpio_0 { // GSBI1 + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&i2c1_pins>; + pinctrl-names = "default"; + sda-gpios = <&qcom_pinmux 53 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&qcom_pinmux 54 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <5>; + + emc2301@2f { + compatible = "smsc,emc2301"; + reg = <0x2f>; + #address-cells = <1>; + #size-cells = <0>; + + fan@0 { + reg = <0>; + pwm-output-mode = <1>; + }; + }; + }; + + i2c_gpio_1 { // GSBI2 + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&i2c2_pins>; + pinctrl-names = "default"; + sda-gpios = <&qcom_pinmux 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&qcom_pinmux 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <5>; + + tmp75@48 { + compatible = "ti,tmp75"; + reg = <0x48>; + #address-cells = <1>; + #size-cells = <0>; + #thermal-sensor-cells = <0>; + status = "okay"; + }; + }; +}; + +// https://github.com/openwrt/openwrt/commit/622ce713ca246aa465bf28d2a743f96999085ea2 +// https://github.com/openwrt/openwrt/commit/2336c2dbb1929837f7e42d4315c8073342a5b46b +// https://forum.openwrt.org/t/failed-to-startup-an-ipq806x-router-on-kernel-5-4/60775/41 +&CPU_SPC { + status = "disabled"; +}; + +&adm_dma { + status = "okay"; +}; + +&qcom_pinmux { + i2c1_pins: i2c1_pins { // GSBI1 - EMC2301 + mux { + pins = "gpio53", "gpio54"; + function = "gsbi1"; + drive-strength = <12>; + bias-none; + input; + }; + }; + + i2c2_pins: i2c2_pins { // GSBI2 - TMP75 + mux { + pins = "gpio24", "gpio25"; + function = "gsbi2"; + drive-strength = <12>; + bias-none; + input; + }; + }; + + button_pins: button_pins { + mux { + pins = "gpio16", "gpio68"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + led_pins: led_pins { + mux { + pins = "gpio7", "gpio8", "gpio9"; + function = "gpio"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + usb_pwr_en_pins: usb_pwr_en_pins { + mux { + pins = "gpio56"; + function = "gpio"; + drive-strength = <12>; + bias-pull-up; + output-high; + }; + }; +}; + +&sata_phy { + status = "okay"; +}; + +&sata { + status = "okay"; +}; + +&hs_phy_0 { + status = "okay"; +}; + +&ss_phy_0 { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&hs_phy_1 { + status = "okay"; +}; + +&ss_phy_1 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; + pinctrl-0 = <&usb_pwr_en_pins>; + pinctrl-names = "default"; +}; + +&pcie0 { + status = "okay"; + reset-gpio = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&pcie0_pins>; + pinctrl-names = "default"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + compatible = "pci168c,0040"; + reg = <0x00010000 0 0 0 0>; + + nvmem-cells = <&macaddr_art_1006>, <&precal_art_1000>; + nvmem-cell-names = "mac-address", "pre-calibration"; + }; + }; +}; + +&pcie1 { + status = "okay"; + reset-gpio = <&qcom_pinmux 48 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&pcie1_pins>; + pinctrl-names = "default"; + max-link-speed = <1>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + compatible = "pci168c,0040"; + reg = <0x00010000 0 0 0 0>; + + nvmem-cells = <&macaddr_art_5006>, <&precal_art_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; + }; + }; +}; + +&nand { + status = "okay"; + + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + + nand@0 { + reg = <0>; + compatible = "qcom,nandcs"; + + nand-bus-width = <8>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + + nand-is-boot-medium; + qcom,boot-partitions = <0 0xf0000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "MIBIB"; + reg = <0x40000 0x80000>; + read-only; + }; + + partition@c0000 { + label = "SBL2"; + reg = <0xc0000 0x80000>; + read-only; + }; + + partition@140000 { + label = "SBL3"; + reg = <0x140000 0x80000>; + read-only; + }; + + partition@1c0000 { + label = "DDRCONFIG"; + reg = <0x1c0000 0x80000>; + read-only; + }; + + partition@240000 { + label = "SSD"; + reg = <0x240000 0x80000>; + read-only; + }; + + partition@2c0000 { + label = "TZ"; + reg = <0x2c0000 0x80000>; + read-only; + }; + + partition@340000 { + label = "RPM"; + reg = <0x340000 0x80000>; + read-only; + }; + + partition@3c0000 { + label = "APPSBL"; + reg = <0x3c0000 0x100000>; + read-only; + }; + + partition@4c0000 { + label = "APPSBLENV"; + reg = <0x4c0000 0x80000>; + }; + + art: partition@540000 { + label = "ART"; + reg = <0x540000 0x80000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { // WAN (label) + reg = <0x0 0x6>; + }; + macaddr_art_6: macaddr@6 { // LAN + reg = <0x6 0x6>; + }; + macaddr_art_1006: macaddr@1006 { // WiFi 2g + reg = <0x1006 0x6>; + }; + macaddr_art_5006: macaddr@5006 { // WiFi 5g + reg = <0x5006 0x6>; + }; + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@5c0000 { + label = "BOOTCONFIG"; + reg = <0x5c0000 0x40000>; + read-only; + }; + + partition@600000 { + label = "bdata"; + reg = <0x600000 0x80000>; + }; + + partition@680000 { + label = "crash"; + reg = <0x680000 0x80000>; + read-only; + }; + + partition@700000 { + label = "crash_syslog"; + reg = <0x700000 0x80000>; + read-only; + }; + + partition@780000 { + label = "rsvd"; + reg = <0x780000 0x80000>; + read-only; + }; + + /* Stock U-Boot support Dual Boot */ + partition@800000 { + label = "kernel_dup"; + reg = <0x800000 0x400000>; + }; + + partition@c00000 { + label = "kernel"; + reg = <0xc00000 0x400000>; + }; + + partition@1000000 { + label = "ubi"; + reg = <0x1000000 0xf000000>; + }; + }; + }; +}; + +&mdio0 { + status = "okay"; + + pinctrl-0 = <&mdio0_pins>; + pinctrl-names = "default"; + + phy0: ethernet-phy@0 { + reg = <0>; + qca,ar8327-initvals = < + 0x04 0x07600000 /* PAD0_MODE */ + 0x08 0x01000000 /* PAD5_MODE */ + 0x0c 0x00000080 /* PAD6_MODE */ + 0x7c 0x0000004e /* PORT0_STATUS */ + 0x94 0x0000004e /* PORT6_STATUS */ + 0xe0 0xc74164de /* SGMII_CTRL */ + 0xe4 0x0006a545 /* MAC_POWER_SEL */ + >; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&gmac1 { + status = "okay"; + phy-mode = "rgmii"; + qcom,id = <1>; + + pinctrl-0 = <&rgmii2_pins>; + pinctrl-names = "default"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gmac2 { + status = "okay"; + phy-mode = "sgmii"; + qcom,id = <2>; + + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index aac0a2c8fadfd..b437706cd445e 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -471,6 +471,23 @@ define Device/ubnt_unifi-ac-hd endef TARGET_DEVICES += ubnt_unifi-ac-hd +define Device/xiaomi_r3d + $(call Device/LegacyImage) + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := R3D + SOC := qcom-ipq8064 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 86016k + UBINIZE_OPTS := -E 5 + IMAGES := factory.bin sysupgrade.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(BLOCKSIZE) | check-size + DEVICE_PACKAGES := kmod-i2c-gpio kmod-hwmon-lm75 kmod-hwmon-emc2305 hwmon-drivetemp \ + kmod-usb-storage-uas ath10k-firmware-qca9984-ct ath10k-firmware-qca99x0-ct +endef +TARGET_DEVICES += xiaomi_r3d + define Device/zyxel_nbg6817 $(Device/dsa-migration) DEVICE_VENDOR := Zyxel ================================================ FILE: devices/mediatek_filogic/.config ================================================ CONFIG_TARGET_mediatek=y CONFIG_TARGET_mediatek_filogic=y CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_cudy_re3000-v1=n CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_cudy_wr3000-v1=n CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_yuncore_ax835=n CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_gatonetworks_gdsp=n CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_xiaomi_redmi-router-ax6000-stock=n ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-aigo-ags21.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* * Author:dailook */ /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "Aigo AGS21"; compatible = "aigo,ags21", "mediatek,mt7981"; chosen { bootargs = "root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs"; stdout-path = "serial0:115200n8"; }; aliases { led-boot = &status_red_led; led-failsafe = &status_red_led; led-running = &status_blue_led; led-upgrade = &status_blue_led; serial0 = &uart0; }; memory { reg = <0 0x40000000 0 0x20000000>; }; leds { compatible = "gpio-leds"; status_red_led: led-0 { label = "red:status"; gpios = <&pio 6 GPIO_ACTIVE_LOW>; }; status_blue_led: led-1 { label = "blue:status"; gpios = <&pio 4 GPIO_ACTIVE_LOW>; }; internet_led: led-2 { label = "green:status"; gpios = <&pio 29 GPIO_ACTIVE_LOW>; }; wifi_led: led-3 { label = "white:status"; gpios = <&pio 30 GPIO_ACTIVE_LOW>; }; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; mesh { label = "mesh"; linux,code = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &mmc0 { bus-width = <8>; cap-mmc-highspeed; max-frequency = <52000000>; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_4: macaddr@4 { compatible = "mac-base"; reg = <0x4 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_24: macaddr@24 { compatible = "mac-base"; reg = <0x24 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_2a: macaddr@2a { compatible = "mac-base"; reg = <0x2a 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_30: macaddr@30 { compatible = "mac-base"; reg = <0x30 0x6>; #nvmem-cell-cells = <1>; }; }; }; }; }; }; }; ð { status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_2a 0>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; nvmem-cells = <&macaddr_factory_24 0>; nvmem-cell-names = "mac-address"; }; mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; phy0: ethernet-phy@0 { compatible = "ethernet-phy-id03a2.9461"; reg = <0>; phy-mode = "gmii"; nvmem-cells = <&phy_calibration>; nvmem-cell-names = "phy-cal-data"; }; switch@0 { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 0>; ports { #address-cells = <1>; #size-cells = <0>; port@1 { reg = <1>; label = "lan1"; }; port@2 { reg = <2>; label = "lan2"; }; port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; &wifi { status = "okay"; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; band@0 { reg = <0>; nvmem-cells = <&macaddr_factory_4 0>; nvmem-cell-names = "mac-address"; }; band@1 { reg = <1>; nvmem-cells = <&macaddr_factory_30 0>; nvmem-cell-names = "mac-address"; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-bt-r320.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "BT R320"; compatible = "bt,r320", "mediatek,mt7981"; aliases { serial0 = &uart0; label-mac-device = &gmac0; }; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; stdout-path = "serial0:115200n8"; }; memory { reg = <0 0x40000000 0 0x40000000>; }; gpio-keys { compatible = "gpio-keys"; button-wps { label = "wps"; linux,code = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; wlan2g_led: led-0 { function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&pio 34 GPIO_ACTIVE_LOW>; }; wlan5g_led: led-1 { function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&pio 35 GPIO_ACTIVE_LOW>; }; }; }; ð { status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_2a 0>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; }; mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; switch@0 { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 0>; ports { #address-cells = <1>; #size-cells = <0>; port@1 { reg = <1>; label = "lan1"; }; port@2 { reg = <2>; label = "lan2"; }; port@3 { reg = <3>; label = "lan3"; }; port@4 { reg = <4>; label = "wan"; nvmem-cells = <&macaddr_factory_24 0>; nvmem-cell-names = "mac-address"; }; port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; }; }; &mmc0 { status = "okay"; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; bus-width = <8>; max-frequency = <52000000>; vmmc-supply = <®_3p3v>; cap-mmc-highspeed; non-removable; no-sd; no-sdio; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_24: macaddr@24 { compatible = "mac-base"; reg = <0x24 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_2a: macaddr@2a { compatible = "mac-base"; reg = <0x2a 0x6>; #nvmem-cell-cells = <1>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &wifi { nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; }; &usb_phy { status = "okay"; }; &xhci { status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-a10.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cmcc-a10.dtsi" / { model = "CMCC A10"; compatible = "cmcc,a10", "mediatek,mt7981"; }; &partitions { partition@580000 { label = "ubi"; reg = <0x580000 0x7000000>; }; }; &spi_nand { mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-mr3000d-ciq-256m.dts ================================================ /dts-v1/; #include "mt7981b.dtsi" / { model = "CMCC MR3000D-CIq (256M)"; compatible = "cmcc,mr3000d-ciq-256m", "mediatek,mt7981"; aliases { ethernet0 = &gmac0; led-boot = &led_run; led-failsafe = &led_blue; led-running = &led_green; led-upgrade = &led_blue; serial0 = &uart0; label-mac-device = &gmac1; }; chosen { stdout-path = "serial0:115200n8"; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; wps { label = "wps"; linux,code = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; leds { compatible = "gpio-leds"; led_run: RGB_RED { label = "RGB_RED"; gpios = <&pio 10 GPIO_ACTIVE_LOW>; default-state = "on"; }; led_green: RGB_GREEN { label = "RGB_GREEN"; gpios = <&pio 11 GPIO_ACTIVE_LOW>; default-state = "off"; }; led_blue: RGB_BLUE { label = "RGB_BLUE"; gpios = <&pio 12 GPIO_ACTIVE_LOW>; default-state = "off"; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; nvmem-cells = <&macaddr_factory_4 (-2)>; nvmem-cell-names = "mac-address"; }; }; &mdio_bus { switch0: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; dsa,member = <0 0>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch0 { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; spi_nand: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-cal-enable; spi-cal-mode = "read-data"; spi-cal-datalen = <7>; spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; spi-cal-addrlen = <5>; spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "BL2"; reg = <0x00000 0x0100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x0100000 0x0080000>; }; factory: partition@180000 { label = "Factory"; reg = <0x180000 0x0200000>; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; macaddr_factory_4: macaddr@4 { compatible = "mac-base"; reg = <0x4 0x6>; #nvmem-cell-cells = <1>; }; }; }; partition@380000 { label = "FIP"; reg = <0x380000 0x0200000>; }; partition@580000 { label = "ubi"; compatible = "linux,ubi"; reg = <0x580000 0x3000000>; }; partition@3580000 { label = "ubi1"; reg = <0x3580000 0x3000000>; }; partition@6580000 { label = "Product"; reg = <0x6580000 0x0020000>; // 128 KB }; partition@65a0000 { label = "Custom"; reg = <0x65a0000 0x1000000>; // 16 MB }; }; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = ; bias-pull-up = ; }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = ; bias-pull-down = ; }; }; }; &wifi { mediatek,mtd-eeprom = <&factory 0x0>; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cmcc-rax3000m.dts" / { model = "CMCC RAX3000M (eMMC version)"; compatible = "cmcc,rax3000m-emmc", "mediatek,mt7981"; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; }; }; &gmac0 { nvmem-cells = <&macaddr_factory_2a>; nvmem-cell-names = "mac-address"; }; &gmac1 { nvmem-cells = <&macaddr_factory_24>; nvmem-cell-names = "mac-address"; }; &mmc0 { bus-width = <8>; max-frequency = <26000000>; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; #address-cells = <1>; #size-cells = <0>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_24: macaddr@24 { reg = <0x24 0x6>; }; macaddr_factory_2a: macaddr@2a { reg = <0x2a 0x6>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-uhs-pins { mux { function = "flash"; groups = "emmc_45"; }; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cmcc-rax3000m.dts" / { model = "CMCC RAX3000M (NAND version)"; compatible = "cmcc,rax3000m-nand", "mediatek,mt7981"; aliases { label-mac-device = &gmac1; }; }; &gmac0 { nvmem-cells = <&macaddr_factory_2a>; nvmem-cell-names = "mac-address"; }; &gmac1 { nvmem-cells = <&macaddr_factory_24>; nvmem-cell-names = "mac-address"; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; flash@0 { compatible = "spi-nand"; #address-cells = <1>; #size-cells = <1>; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bl2"; reg = <0x00000 0x0100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x100000 0x80000>; }; factory: partition@180000 { label = "factory"; reg = <0x180000 0x200000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; macaddr_factory_24: macaddr@24 { reg = <0x24 0x6>; }; macaddr_factory_2a: macaddr@2a { reg = <0x2a 0x6>; }; }; }; partition@380000 { label = "fip"; reg = <0x380000 0x200000>; read-only; }; partition@580000 { label = "ubi"; reg = <0x580000 0x7200000>; }; }; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = <8>; mediatek,pull-up-adv = <0>; /* bias-disable */ }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = <8>; mediatek,pull-up-adv = <0>; /* bias-disable */ }; }; }; &wifi { mediatek,mtd-eeprom = <&factory 0x0>; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-xr30-emmc.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cmcc-xr30.dtsi" / { model = "CMCC XR30 (eMMC version)"; compatible = "cmcc,xr30-emmc", "mediatek,mt7981"; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; }; }; &gmac0 { nvmem-cells = <&macaddr_factory_2a>; nvmem-cell-names = "mac-address"; }; &gmac1 { nvmem-cells = <&macaddr_factory_24>; nvmem-cell-names = "mac-address"; }; &mmc0 { bus-width = <8>; cap-mmc-highspeed; max-frequency = <52000000>; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; #address-cells = <1>; #size-cells = <0>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_24: macaddr@24 { reg = <0x24 0x6>; }; macaddr_factory_2a: macaddr@2a { reg = <0x2a 0x6>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-uhs-pins { mux { function = "flash"; groups = "emmc_45"; }; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-xr30.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cmcc-xr30.dtsi" / { model = "CMCC XR30"; compatible = "cmcc,xr30", "mediatek,mt7981"; aliases { label-mac-device = &gmac1; }; }; &gmac0 { nvmem-cells = <&macaddr_factory_2a>; nvmem-cell-names = "mac-address"; }; &gmac1 { nvmem-cells = <&macaddr_factory_24>; nvmem-cell-names = "mac-address"; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bl2"; reg = <0x00000 0x0100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x100000 0x80000>; }; factory: partition@180000 { label = "factory"; reg = <0x180000 0x200000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; macaddr_factory_24: macaddr@24 { reg = <0x24 0x6>; }; macaddr_factory_2a: macaddr@2a { reg = <0x2a 0x6>; }; }; }; partition@380000 { label = "fip"; reg = <0x380000 0x200000>; read-only; }; partition@580000 { label = "ubi"; reg = <0x580000 0x7200000>; }; }; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = <8>; mediatek,pull-up-adv = <0>; /* bias-disable */ }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = <8>; mediatek,pull-up-adv = <0>; /* bias-disable */ }; }; }; &wifi { mediatek,mtd-eeprom = <&factory 0x0>; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cmcc-xr30.dtsi ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* * Copyright (C) 2023 Tianling Shen */ /dts-v1/; #include #include #include "mt7981b.dtsi" / { aliases { led-boot = &red_led; led-failsafe = &red_led; led-running = &white_led; led-upgrade = &red_led; serial0 = &uart0; }; chosen: chosen { stdout-path = "serial0:115200n8"; }; memory { reg = <0 0x40000000 0 0x20000000>; }; gpio-keys { compatible = "gpio-keys"; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; button-mesh { label = "mesh"; linux,code = ; linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; leds { compatible = "gpio-leds"; red_led: red { label = "red:status"; gpios = <&pio 35 GPIO_ACTIVE_LOW>; }; white_led: white { label = "white:status"; gpios = <&pio 34 GPIO_ACTIVE_LOW>; }; }; }; ð { 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-mode = "gmii"; phy-handle = <&int_gbe_phy>; }; }; &mdio_bus { switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan3"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan1"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &uart0 { status = "okay"; }; &usb_phy { status = "okay"; }; &watchdog { status = "okay"; }; &wifi { status = "okay"; }; &xhci { status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-cudy-tr3000-mod.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-cudy-tr3000-v1.dts" / { model = "Cudy TR3000 v1 112M"; compatible = "cudy,tr3000-mod", "mediatek,mt7981"; }; &spi0 { flash@0 { partitions { partition@5c0000 { label = "ubi"; reg = <0x5c0000 0x7000000>; }; }; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-ikuai-q3000.dts ================================================ /dts-v1/; #include "mt7981b.dtsi" / { compatible = "ikuai,q3000", "mediatek,mt7981-spim-snand-rfb"; model = "q3000"; aliases { led-boot = &red_led; led-failsafe = &red_led; led-running = &green_led; led-upgrade = &blue_led; }; chosen { bootargs = "console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 clk_ignore_unused"; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; wps { label = "wps"; linux,code = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; leds { compatible = "gpio-leds"; green_led: green { label = "q3000:green"; gpios = <&pio 11 1>; }; red_led: red { label = "q3000:red"; gpios = <&pio 10 1>; }; blue_led: blue { label = "q3000:blue"; gpios = <&pio 12 1>; }; }; nmbm_spim_nand { compatible = "generic,nmbm"; #address-cells = <1>; #size-cells = <1>; lower-mtd-device = <&spi_nand>; forced-create; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "BL2"; reg = <0x00000 0x0100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x0100000 0x0080000>; }; partition@180000 { label = "Factory"; reg = <0x180000 0x0200000>; }; partition@380000 { label = "FIP"; reg = <0x380000 0x0200000>; }; partition@580000 { label = "ubi"; reg = <0x580000 0x4000000>; }; }; }; sound_wm8960 { compatible = "mediatek,mt79xx-wm8960-machine"; mediatek,platform = <&afe>; audio-routing = "Headphone", "HP_L", "Headphone", "HP_R", "LINPUT1", "AMIC", "RINPUT1", "AMIC"; mediatek,audio-codec = <&wm8960>; status = "disabled"; }; sound_si3218x { compatible = "mediatek,mt79xx-si3218x-machine"; mediatek,platform = <&afe>; mediatek,ext-codec = <&proslic_spi>; status = "disabled"; }; }; &afe { pinctrl-names = "default"; pinctrl-0 = <&pcm_pins>; status = "okay"; }; &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c_pins>; status = "disabled"; wm8960: wm8960@1a { compatible = "wlf,wm8960"; reg = <0x1a>; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; ð { status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; switch@0 { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 0>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@3 { reg = <3>; label = "wan"; }; port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; }; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; spi_nand: spi_nand@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-widt = <4>; }; }; &spi1 { pinctrl-names = "default"; pinctrl-0 = <&spic_pins>; status = "okay"; proslic_spi: proslic_spi@0 { compatible = "silabs,proslic_spi"; reg = <0>; spi-max-frequency = <10000000>; spi-cpha = <1>; spi-cpol = <1>; channel_count = <1>; debug_level = <4>; /* 1 = TRC, 2 = DBG, 4 = ERR */ reset_gpio = <&pio 15 0>; ig,enable-spi = <1>; /* 1: Enable, 0: Disable */ }; }; &pio { i2c_pins: i2c-pins-g0 { mux { function = "i2c"; groups = "i2c0_0"; }; }; pcm_pins: pcm-pins-g0 { mux { function = "pcm"; groups = "pcm"; }; }; pwm0_pin: pwm0-pin-g0 { mux { function = "pwm"; groups = "pwm0_0"; }; }; pwm1_pin: pwm1-pin-g0 { mux { function = "pwm"; groups = "pwm1_0"; }; }; pwm2_pin: pwm2-pin { mux { function = "pwm"; groups = "pwm2"; }; }; spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = ; bias-pull-up = ; }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = ; bias-pull-down = ; }; }; spic_pins: spi1-pins { mux { function = "spi"; groups = "spi1_1"; }; }; uart1_pins: uart1-pins-g1 { mux { function = "uart"; groups = "uart1_1"; }; }; uart2_pins: uart2-pins-g1 { mux { function = "uart"; groups = "uart2_1"; }; }; }; &xhci { mediatek,u3p-dis-msk = <0x0>; phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-konka-komi-a31.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include #include #include #include #include "mt7981b.dtsi" / { model = "Konka KOMI A31"; compatible = "konka,komi-a31", "mediatek,mt7981"; aliases { led-boot = &red_led; led-failsafe = &red_led; led-running = &green_led; led-upgrade = &green_led; label-mac-device = &gmac1; serial0 = &uart0; }; chosen { stdout-path = "serial0:115200n8"; }; memory@40000000 { reg = <0 0x40000000 0 0x10000000>; device_type = "memory"; }; gpio-keys { compatible = "gpio-keys"; button-mesh { label = "mesh"; linux,code = ; linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; green_led: led-0 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 8 GPIO_ACTIVE_LOW>; }; led-1 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; red_led: led-2 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 34 GPIO_ACTIVE_LOW>; }; }; }; ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_2a 0>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; nvmem-cells = <&macaddr_factory_24 0>; nvmem-cell-names = "mac-address"; }; }; &mdio_bus { switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = ; bias-disable; /* bias-disable */ }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = ; bias-disable; /* bias-disable */ }; }; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; spi_nand: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bl2"; reg = <0x0 0x100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x100000 0x80000>; }; partition@180000 { label = "factory"; reg = <0x180000 0x200000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_24: macaddr@24 { compatible = "mac-base"; reg = <0x24 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_2a: macaddr@2a { compatible = "mac-base"; reg = <0x2a 0x6>; #nvmem-cell-cells = <1>; }; }; }; partition@380000 { label = "fip"; reg = <0x380000 0x200000>; }; partition@580000 { compatible = "linux,ubi"; label = "ubi"; reg = <0x580000 0x7000000>; }; }; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &wifi { #address-cells = <1>; #size-cells = <0>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; band@0 { reg = <0>; nvmem-cells = <&macaddr_factory_2a 1>; nvmem-cell-names = "mac-address"; }; band@1 { reg = <1>; nvmem-cells = <&macaddr_factory_2a 2>; nvmem-cell-names = "mac-address"; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-newland-nl-wr8103.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "Newland NL-WR8103"; compatible = "newland,nl-wr8103", "mediatek,mt7981"; aliases { led-boot = &red_led; led-failsafe = &red_led; led-running = &green_led; led-upgrade = &green_led; label-mac-device = &gmac1; serial0 = &uart0; }; chosen { stdout-path = "serial0:115200n8"; }; memory@40000000 { reg = <0 0x40000000 0 0x10000000>; }; gpio-keys { compatible = "gpio-keys"; button-mesh { label = "mesh"; linux,code = ; linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; green_led: led-0 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; led-1 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; red_led: led-2 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; }; }; ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_4 0>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; nvmem-cells = <&macaddr_factory_4 2>; nvmem-cell-names = "mac-address"; }; }; &mdio_bus { switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; conf-pu { pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; drive-strength = ; bias-pull-up = ; }; conf-pd { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; drive-strength = ; bias-pull-down = ; }; }; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; spi_nand: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "BL2"; reg = <0x0 0x100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x100000 0x80000>; }; partition@180000 { label = "Factory"; reg = <0x180000 0x200000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_4: macaddr@4 { compatible = "mac-base"; reg = <0x4 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_a: macaddr@a { compatible = "mac-base"; reg = <0xa 0x6>; #nvmem-cell-cells = <1>; }; }; }; partition@380000 { label = "FIP"; reg = <0x380000 0x200000>; read-only; }; partition@580000 { label = "ubi"; reg = <0x580000 0x7200000>; }; }; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &wifi { nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts ================================================ /dts-v1/; #include "mt7981b.dtsi" / { model = "NRadio C8-660"; compatible = "nradio,c8-660", "mediatek,mt7981"; aliases { led-boot = &status_blue; led-failsafe = &status_blue; led-running = &status_blue; led-upgrade = &status_blue; serial0 = &uart0; }; chosen { stdout-path = "serial0:115200n8"; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; wps { label = "wps"; linux,code = ; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; }; gpio-export { compatible = "gpio-export"; cpepower { gpio-export,name = "cpe-pwr"; gpio-export,output = <0>; gpios = <&pio 25 GPIO_ACTIVE_LOW>; }; cpesel0 { gpio-export,name = "cpe-sel0"; gpio-export,output = <1>; gpios = <&pio 24 GPIO_ACTIVE_HIGH>; }; }; gpio-leds { compatible = "gpio-leds"; status_blue: status { label = "blue:status"; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; cmode5 { label = "blue:cmode5"; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; cmode4 { label = "blue:cmode4"; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; wifi { label = "blue:wifi"; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; }; }; &uart0 { status = "okay"; }; &watchdog { 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-mode = "2500base-x"; phy-handle = <&phy21>; }; }; &mdio_bus { reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>, <&pio 8 GPIO_ACTIVE_LOW>; reset-delay-us = <600>; reset-post-delay-us = <20000>; phy5: ethernet-phy@5 { reg = <5>; compatible = "ethernet-phy-ieee802.3-c45"; mxl,led-config = <0x3f0 0x330 0x0 0x0>; }; phy21: ethernet-phy@21 { reg = <21>; compatible = "ethernet-phy-ieee802.3-c45"; }; switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; dsa,member = <0 0>; reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@1 { reg = <1>; label = "lan1"; }; port@2 { reg = <2>; label = "lan2"; }; port@3 { reg = <3>; label = "lan3"; }; port@5 { reg = <5>; label = "lan4"; phy-mode = "2500base-x"; phy-handle = <&phy5>; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; status = "okay"; spi_nand: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spi-nand"; reg = <0>; spi-max-frequency = <52000000>; spi-cal-enable; spi-cal-mode = "read-data"; spi-cal-datalen = <7>; spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; spi-cal-addrlen = <5>; spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "BL2"; reg = <0x00000 0x0100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x0100000 0x0080000>; }; factory: partition@180000 { label = "Factory"; reg = <0x180000 0x0180000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; }; }; partition@300000 { label = "bdinfo"; reg = <0x300000 0x0080000>; }; partition@380000 { label = "FIP"; reg = <0x380000 0x0200000>; read-only; }; partition@580000 { label = "ubi_oem"; reg = <0x580000 0x4000000>; }; partition@4580000 { label = "app_data"; reg = <0x4580000 0x1000000>; }; partition@5580000 { label = "ubi"; reg = <0x5580000 0x18a80000>; compatible = "linux,ubi"; }; }; }; }; &pio { spi0_flash_pins: spi0-pins { mux { function = "spi"; groups = "spi0", "spi0_wp_hold"; }; }; }; &usb_phy { status = "okay"; }; &xhci { status = "okay"; }; &wifi { nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-nradio-c8-668gl.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b.dtsi" / { model = "NRadio C8-668GL"; compatible = "nradio,c8-668gl", "mediatek,mt7981"; aliases { ethernet0 = &gmac0; led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; serial0 = &uart0; }; chosen { stdout-path = "serial0:115200n1"; /* If official system version < 1.9.2.n6.c3, use root=PARTLABEL=rootfs */ bootargs = "console=ttyS0,115200n1 root=PARTLABEL=rootfs_2nd rootwait"; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; wps { label = "wps"; linux,code = ; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; }; gpio-export { compatible = "gpio-export"; #size-cells = <0>; cpepower { gpio-export,name = "cpe-pwr"; gpio-export,output = <0>; gpios = <&pio 31 GPIO_ACTIVE_LOW>; }; cpesel0 { gpio-export,name = "cpe-sel0"; gpio-export,output = <1>; gpios = <&pio 30 GPIO_ACTIVE_HIGH>; }; }; leds { compatible = "gpio-leds"; led_power: power { color = ; function = LED_FUNCTION_POWER; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; led-cellular-5g { color = ; function = LED_FUNCTION_INDICATOR; function-enumerator = <0>; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; led-cellular-4g { color = ; function = LED_FUNCTION_INDICATOR; function-enumerator = <1>; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; led-wifi { color = ; function = LED_FUNCTION_WLAN; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &mmc0 { pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; bus-width = <8>; max-frequency = <52000000>; cap-mmc-highspeed; vmmc-supply = <®_3p3v>; non-removable; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-env { partname = "u-boot-env"; nvmem-layout { compatible = "u-boot,env"; }; }; block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; ð { 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-mode = "2500base-x"; phy-handle = <&phy21>; }; mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; phy5: ethernet-phy@5 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <5>; reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>; reset-assert-us = <600>; reset-deassert-us = <20000>; }; phy21: ethernet-phy@21 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <21>; reset-gpios = <&pio 8 GPIO_ACTIVE_LOW>; reset-assert-us = <600>; reset-deassert-us = <20000>; }; switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; ports { #address-cells = <1>; #size-cells = <0>; port@1 { reg = <1>; label = "lan1"; }; port@2 { reg = <2>; label = "lan2"; }; port@3 { reg = <3>; label = "lan3"; }; port@5 { reg = <5>; label = "lan4"; phy-mode = "2500base-x"; phy-handle = <&phy5>; }; port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; }; }; &usb_phy { status = "okay"; }; &xhci { status = "okay"; }; &wifi { nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-philips-hy3000.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* * Copyright (C) 2023 Tianling Shen */ /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "Philips-hy3000"; compatible = "philips,hy3000", "mediatek,mt7981"; aliases { led-boot = &status_red_led; led-failsafe = &status_red_led; led-running = &status_green_led; led-upgrade = &status_red_led; serial0 = &uart0; }; chosen: chosen { bootargs = "root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs"; stdout-path = "serial0:115200n8"; }; memory { reg = <0 0x40000000 0 0x20000000>; }; gpio-keys { compatible = "gpio-keys"; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; button-mesh { label = "mesh"; linux,code = ; linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; status_red_led: led-0 { label = "red:status"; gpios = <&pio 8 GPIO_ACTIVE_HIGH>; }; status_green_led: led-1 { label = "green:status"; gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; }; }; &mmc0 { bus-width = <8>; cap-mmc-highspeed; max-frequency = <52000000>; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_74: macaddr@74 { compatible = "mac-base"; reg = <0x74 0x6>; #nvmem-cell-cells = <1>; }; }; }; }; }; }; }; ð { status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_74 0>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; phy-mode = "gmii"; phy-handle = <&int_gbe_phy>; }; }; &mdio_bus { switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "wan"; }; port@1 { reg = <1>; label = "lan1"; }; port@2 { reg = <2>; label = "lan2"; }; port@3 { reg = <3>; label = "lan3"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; &uart0 { status = "okay"; }; &usb_phy { status = "okay"; }; &watchdog { status = "okay"; }; &xhci { status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-sl-3000-emmc.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "SL-3000 eMMC bootstrap versions"; compatible = "sl,3000-emmc", "mediatek,mt7981"; aliases { serial0 = &uart0; led-boot = &status_red_led; led-failsafe = &status_red_led; led-running = &status_green_led; led-upgrade = &status_blue_led; }; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; stdout-path = "serial0:115200n8"; }; memory@40000000 { reg = <0 0x40000000 0 0x20000000>; }; gpio-keys { compatible = "gpio-keys"; button-mesh { label = "mesh"; linux,code = ; linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; button-reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; }; gpio-leds { compatible = "gpio-leds"; status_red_led: led-0 { label = "red:status"; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; status_green_led: led-1 { label = "green:status"; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; status_blue_led: led-2 { label = "blue:status"; gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; }; }; ð { 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 { status = "disabled"; }; mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; switch@0 { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 0>; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@3 { reg = <3>; label = "wan"; }; port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; }; }; &mmc0 { bus-width = <8>; cap-mmc-highspeed; max-frequency = <52000000>; no-sd; no-sdio; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_a: macaddr@a { compatible = "mac-base"; reg = <0xa 0x6>; #nvmem-cell-cells = <1>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; &wifi { status = "okay"; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; band@0 { reg = <0>; nvmem-cells = <&macaddr_factory_a 0>; nvmem-cell-names = "mac-address"; }; band@1 { reg = <1>; nvmem-cells = <&macaddr_factory_a 1>; nvmem-cell-names = "mac-address"; }; }; &usb_phy { status = "okay"; }; &xhci { status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-sl-3000.dts ================================================ /dts-v1/; #include "mt7981b.dtsi" / { model = "SL-3000"; compatible = "sl,3000", "mediatek,mt7981"; aliases { led-boot = &led_run; led-failsafe = &led_blue; led-running = &led_green; led-upgrade = &led_blue; serial0 = &uart0; label-mac-device = &wan; }; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; stdout-path = "serial0:115200n8"; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; wps { label = "wps"; linux,code = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; }; }; leds { compatible = "gpio-leds"; led_run: RGB_RED { label = "RGB_RED"; gpios = <&pio 10 GPIO_ACTIVE_LOW>; default-state = "on"; }; led_green: RGB_GREEN { label = "RGB_GREEN"; gpios = <&pio 11 GPIO_ACTIVE_LOW>; default-state = "off"; }; led_blue: RGB_BLUE { label = "RGB_BLUE"; gpios = <&pio 12 GPIO_ACTIVE_LOW>; default-state = "off"; }; }; reg_3p3v: regulator-3p3v { compatible = "regulator-fixed"; regulator-name = "fixed-3.3V"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-boot-on; regulator-always-on; }; }; &uart0 { status = "okay"; }; &watchdog { status = "okay"; }; ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; status = "okay"; gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "2500base-x"; nvmem-cells = <&macaddr_factory_4 (-1)>; nvmem-cell-names = "mac-address"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; &mdio_bus { switch0: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; dsa,member = <0 0>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch0 { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; wan: port@3 { reg = <3>; label = "wan"; nvmem-cells = <&macaddr_factory_4 (-2)>; nvmem-cell-names = "mac-address"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &mmc0 { pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; bus-width = <8>; max-frequency = <52000000>; cap-mmc-highspeed; vmmc-supply = <®_3p3v>; non-removable; status = "okay"; }; &spi2 { pinctrl-names = "default"; pinctrl-0 = <&spi2_flash_pins>; status = "okay"; spi_nor@0 { #address-cells = <1>; #size-cells = <1>; compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@00000 { label = "BL2"; reg = <0x00000 0x0100000>; }; partition@100000 { label = "u-boot-env"; reg = <0x0100000 0x0080000>; }; factory: partition@180000 { label = "Factory"; reg = <0x180000 0x0200000>; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; macaddr_factory_4: macaddr@4 { compatible = "mac-base"; reg = <0x4 0x6>; #nvmem-cell-cells = <1>; }; }; }; partition@380000 { label = "FIP"; reg = <0x380000 0x0200000>; }; partition@580000 { label = "firmware"; reg = <0x580000 0x1900000>; }; partition@1e80000 { label = "Product"; reg = <0x1e80000 0x20000>; }; partition@1ea0000 { label = "Custom"; reg = <0x1ea0000 0x160000>; }; }; }; }; &pio { spi2_flash_pins: spi2-pins { mux { function = "spi"; groups = "spi2", "spi2_wp_hold"; }; conf-pu { pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; drive-strength = ; bias-pull-up = ; }; conf-pd { pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; drive-strength = ; bias-pull-down = ; }; }; mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; conf-cmd-dat { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO", "SPI0_CS", "SPI0_HOLD", "SPI0_WP", "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO"; input-enable; drive-strength = ; bias-pull-up = ; }; conf-clk { pins = "SPI1_CS"; drive-strength = ; bias-pull-down = ; }; conf-rst { pins = "PWM0"; drive-strength = ; bias-pull-up = ; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; conf-cmd-dat { pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO", "SPI0_CS", "SPI0_HOLD", "SPI0_WP", "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO"; input-enable; drive-strength = ; bias-pull-up = ; }; conf-clk { pins = "SPI1_CS"; drive-strength = ; bias-pull-down = ; }; conf-rst { pins = "PWM0"; drive-strength = ; bias-pull-up = ; }; }; }; &wifi { mediatek,mtd-eeprom = <&factory 0x0>; status = "okay"; }; &xhci { status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-umi-uax3000e.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include #include #include #include "mt7981b.dtsi" / { model = "UMI UAX3000E eMMC version"; compatible = "umi,uax3000e", "mediatek,mt7981"; chosen { bootargs = "root=PARTLABEL=rootfs rootwait"; stdout-path = "serial0:115200n8"; }; aliases { led-boot = &red_led; led-failsafe = &red_led; led-running = &green_led; led-upgrade = &blue_led; serial0 = &uart0; }; memory { reg = <0 0x40000000 0 0x40000000>; }; gpio-leds { compatible = "gpio-leds"; red_led: led-0 { label = "red:power"; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; green_led: led-1 { label = "green:wan"; gpios = <&pio 34 GPIO_ACTIVE_LOW>; }; blue_led: led-2 { label = "blue:status"; gpios = <&pio 35 GPIO_ACTIVE_LOW>; }; }; gpio-keys { compatible = "gpio-keys"; reset { label = "reset"; linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; }; }; ð { 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-mode = "gmii"; phy-handle = <&int_gbe_phy>; }; }; &mdio_bus { switch: switch@1f { compatible = "mediatek,mt7531"; reg = <31>; reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&pio>; interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; }; }; &switch { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; label = "lan1"; }; port@1 { reg = <1>; label = "lan2"; }; port@2 { reg = <2>; label = "lan3"; }; port@6 { reg = <6>; ethernet = <&gmac0>; phy-mode = "2500base-x"; fixed-link { speed = <2500>; full-duplex; pause; }; }; }; }; &mmc0 { bus-width = <8>; cap-mmc-highspeed; max-frequency = <52000000>; no-sd; no-sdio; non-removable; pinctrl-names = "default", "state_uhs"; pinctrl-0 = <&mmc0_pins_default>; pinctrl-1 = <&mmc0_pins_uhs>; vmmc-supply = <®_3p3v>; status = "okay"; card@0 { compatible = "mmc-card"; reg = <0>; block { compatible = "block-device"; partitions { block-partition-factory { partname = "factory"; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1000>; }; macaddr_factory_24: macaddr@24 { compatible = "mac-base"; reg = <0x24 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_0a: macaddr@0a { compatible = "mac-base"; reg = <0x0a 0x6>; #nvmem-cell-cells = <1>; }; }; }; }; }; }; }; &pio { mmc0_pins_default: mmc0-pins-default { mux { function = "flash"; groups = "emmc_45"; }; }; mmc0_pins_uhs: mmc0-pins-uhs { mux { function = "flash"; groups = "emmc_45"; }; }; }; &uart0 { status = "okay"; }; &usb_phy { status = "okay"; }; &watchdog { status = "okay"; }; &xhci { status = "okay"; }; &wifi { nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "mt7981b-xiaomi-mi-router-wr30u.dtsi" / { model = "Xiaomi Mi Router WR30U"; compatible = "xiaomi,mi-router-wr30u", "mediatek,mt7981"; }; &spi_nand { mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <64>; }; &partitions { partition@600000 { label = "ubi"; reg = <0x600000 0x7000000>; }; }; ================================================ FILE: devices/mediatek_filogic/diy/target/linux/mediatek/dts/mt7987a-glinet-gl-mt3600be.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* * Copyright (C) 2026 Tianling Shen */ /dts-v1/; #include #include #include "mt7987a.dtsi" / { model = "GL.iNet GL-MT3600BE"; compatible = "glinet,gl-mt3600be", "mediatek,mt7987a", "mediatek,mt7987"; aliases { serial0 = &uart0; label-mac-device = &gmac0; led-boot = &led_status_white; led-failsafe = &led_status_blue; led-running = &led_status_blue; led-upgrade = &led_status_blue; }; chosen { bootargs = "console=ttyS0,115200n1 earlycon=uart8250,mmio32,0x11000000 pci=pcie_bus_perf"; stdout-path = "serial0:115200n8"; }; gpio-leds { compatible = "gpio-leds"; led_status_blue: led-0 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 48 GPIO_ACTIVE_LOW>; }; led_status_white: led-1 { color = ; function = LED_FUNCTION_STATUS; gpios = <&pio 49 GPIO_ACTIVE_LOW>; }; }; gpio-keys { compatible = "gpio-keys"; button-mode { label = "mode"; linux,code = ; linux,input-type = ; gpios = <&pio 3 GPIO_ACTIVE_HIGH>; debounce-interval = <10>; }; button-reset { label = "reset"; linux,code = ; gpios = <&pio 4 GPIO_ACTIVE_LOW>; debounce-interval = <10>; }; }; fan_3p3v: regulator-fan-3p3v { compatible = "regulator-fixed"; enable-active-high; gpios = <&pio 6 GPIO_ACTIVE_HIGH>; regulator-name = "fan"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; usb_vbus: regulator-usb-vbus { compatible = "regulator-fixed"; enable-active-high; gpios = <&pio 14 GPIO_ACTIVE_HIGH>; regulator-name = "usb_vbus"; regulator-boot-on; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; }; }; &fan { fan-supply = <&fan_3p3v>; interrupt-parent = <&pio>; interrupts = <5 IRQ_TYPE_EDGE_RISING>; pwms = <&pwm 1 50000 0>; status = "okay"; }; &gmac0 { nvmem-cells = <&macaddr_factory_4000 0>; nvmem-cell-names = "mac-address"; phy-handle = <&phy7>; phy-mode = "2500base-x"; status = "okay"; }; &gmac1 { nvmem-cells = <&macaddr_factory_4000 1>; nvmem-cell-names = "mac-address"; phy-handle = <&phy15>; phy-mode = "internal"; status = "okay"; }; &mdio { reset-delay-us = <10000>; reset-gpios = <&pio 0 GPIO_ACTIVE_LOW>; phy7: phy@7 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <7>; interrupt-parent = <&pio>; interrupts = <41 IRQ_TYPE_LEVEL_LOW>; reset-assert-us = <100000>; reset-deassert-us = <100000>; reset-gpios = <&pio 42 GPIO_ACTIVE_LOW>; }; phy15: phy@f { compatible = "ethernet-phy-ieee802.3-c45"; reg = <15>; pinctrl-names = "i2p5gbe-led"; pinctrl-0 = <&i2p5gbe_led0_pins>; }; }; &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie0_pins>; reset-gpios = <&pio 38 GPIO_ACTIVE_HIGH>; status = "okay"; pcie@0,0 { reg = <0x0000 0 0 0 0>; mt7990@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; #address-cells = <1>; #size-cells = <0>; device_type = "pci"; ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>; nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; band@0 { reg = <0>; nvmem-cells = <&macaddr_factory_4006 0>; nvmem-cell-names = "mac-address"; }; band@1 { reg = <1>; nvmem-cells = <&macaddr_factory_4006 1>; nvmem-cell-names = "mac-address"; }; }; }; }; &pio { pwm1_pins: pwm1-pins { mux { function = "pwm"; groups = "pwm1_0"; }; }; }; &pwm { pinctrl-names = "default"; pinctrl-0 = <&pwm1_pins>; status = "okay"; }; &spi2 { pinctrl-names = "default"; pinctrl-0 = <&spi2_flash_pins>; status = "okay"; flash@0 { compatible = "spi-nand"; reg = <0>; spi-cal-enable; spi-cal-mode = "read-data"; spi-cal-datalen = <7>; spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>; spi-cal-addrlen = <5>; spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; spi-max-frequency = <52000000>; spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; mediatek,nmbm; mediatek,bmt-max-ratio = <1>; mediatek,bmt-max-reserved-blocks = <256>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "BL2"; reg = <0x0 0x100000>; read-only; }; partition@100000 { label = "u-boot-env"; reg = <0x100000 0x80000>; }; partition@180000 { label = "Factory"; reg = <0x180000 0x400000>; read-only; nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; #size-cells = <1>; eeprom_factory_0: eeprom@0 { reg = <0x0 0x1e00>; }; macaddr_factory_4000: macaddr@4000 { compatible = "mac-base"; reg = <0x4000 0x6>; #nvmem-cell-cells = <1>; }; macaddr_factory_4006: macaddr@4006 { compatible = "mac-base"; reg = <0x4006 0x6>; #nvmem-cell-cells = <1>; }; }; }; partition@580000 { label = "FIP"; reg = <0x580000 0x200000>; read-only; }; partition@780000 { label = "log"; reg = <0x780000 0x40000>; read-only; }; partition@7c0000 { label = "CFG"; reg = <0x7c0000 0x40000>; read-only; }; partition@800000 { label = "ubi"; reg = <0x800000 0x1d800000>; compatible = "linux,ubi"; }; }; }; }; &ssusb { vbus-supply = <&usb_vbus>; status = "okay"; }; &tphyu3port0 { status = "okay"; }; &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins>; status = "okay"; }; ================================================ FILE: devices/mediatek_filogic/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh sed -i -E -e 's/ ?root=\/dev\/fit0 rootwait//' -e "/rootdisk =/d" -e '/bootargs.* = ""/d' target/linux/mediatek/dts/*{qihoo-360t7,netcore-n60*,h3c-magic-nx30-pro,jdcloud-re-cp-03,cmcc-rax3000m,jcg-q30-pro,tplink-tl-xdr*,abt-asr3000,komi-a31,nokia-ea0326gmp}.dts ================================================ FILE: devices/mediatek_filogic/patches/01-360t7.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts +++ b/target/linux/mediatek/dts/mt7981b-qihoo-360t7.dts @@ -105,6 +105,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -159,7 +163,7 @@ partition@7300000 { label = "log"; - reg = <0x7300000 0x0700000>; + reg = <0x7300000 0x0400000>; read-only; }; }; --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -149,17 +149,10 @@ define Device/abt_asr3000 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot abt_asr3000 + IMAGE_SIZE := 114816k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += abt_asr3000 @@ -835,21 +828,21 @@ define Device/cetron_ct3003 endef TARGET_DEVICES += cetron_ct3003 -define Device/cmcc_a10-stock +define Device/cmcc_a10 DEVICE_VENDOR := CMCC - DEVICE_MODEL := A10 (stock layout) + DEVICE_MODEL := A10 DEVICE_ALT0_VENDOR := SuperElectron - DEVICE_ALT0_MODEL := ZN-M5 (stock layout) + DEVICE_ALT0_MODEL := ZN-M5 DEVICE_ALT1_VENDOR := SuperElectron - DEVICE_ALT1_MODEL := ZN-M8 (stock layout) - DEVICE_DTS := mt7981b-cmcc-a10-stock + DEVICE_ALT1_MODEL := ZN-M8 + DEVICE_DTS := mt7981b-cmcc-a10 DEVICE_DTS_DIR := ../dts SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 - IMAGE_SIZE := 65536k + IMAGE_SIZE := 114688k KERNEL_IN_UBI := 1 IMAGES += factory.bin IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) @@ -859,7 +852,7 @@ define Device/cmcc_a10-stock KERNEL_INITRAMFS = kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd endef -TARGET_DEVICES += cmcc_a10-stock +TARGET_DEVICES += cmcc_a10 define Device/cmcc_a10-ubootmod DEVICE_VENDOR := CMCC @@ -929,7 +922,6 @@ define Device/cmcc_rax3000m ARTIFACT/nand-ddr4-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand-ddr4 ARTIFACT/nand-ddr4-preloader.bin := mt7981-bl2 spim-nand-ddr4 endef -TARGET_DEVICES += cmcc_rax3000m define Device/comfast_cf-e393ax DEVICE_VENDOR := COMFAST @@ -970,7 +962,7 @@ endef define Device/comfast_cf-wr632ax DEVICE_DTS := mt7981b-comfast-cf-wr632ax - IMAGE_SIZE := 65536k + IMAGE_SIZE := 116736k IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata SUPPORTED_DEVICES += cf-wr632ax $(call Device/comfast_cf-wr632ax-common) @@ -1175,30 +1167,20 @@ define Device/cudy_tr3000-v1 endef TARGET_DEVICES += cudy_tr3000-v1 -define Device/cudy_tr3000-v1-ubootmod +define Device/cudy_tr3000-mod DEVICE_VENDOR := Cudy DEVICE_MODEL := TR3000 - DEVICE_VARIANT := v1 (OpenWrt U-Boot layout) - DEVICE_DTS := mt7981b-cudy-tr3000-v1-ubootmod + DEVICE_VARIANT := v1 112M + DEVICE_DTS := mt7981b-cudy-tr3000-mod DEVICE_DTS_DIR := ../dts DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 cudy-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot cudy_tr3000-v1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef -TARGET_DEVICES += cudy_tr3000-v1-ubootmod +TARGET_DEVICES += cudy_tr3000-mod define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy @@ -1411,7 +1393,7 @@ define Device/gatonetworks_gdsp DEVICE_DTC_FLAGS := --pad 4096 IMAGES := sysupgrade.itb IMAGE_SIZE := 32768k - DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs fitblk \ + DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs \ kmod-mt7915e kmod-mt7981-firmware \ kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \ mt7981-wo-firmware @@ -1530,19 +1512,11 @@ define Device/h3c_magic-nx30-pro BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 IMAGE_SIZE := 65536k - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot h3c_magic-nx30-pro endef TARGET_DEVICES += h3c_magic-nx30-pro @@ -1703,45 +1677,23 @@ define Device/jcg_q30-pro UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 + IMAGE_SIZE := 114816k KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot jcg_q30-pro + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += jcg_q30-pro define Device/jdcloud_re-cp-03 DEVICE_VENDOR := JDCloud - DEVICE_MODEL := RE-CP-03 + DEVICE_MODEL := AX6000 Baili(RE-CP-03) DEVICE_DTS := mt7986a-jdcloud-re-cp-03 DEVICE_DTS_DIR := ../dts - DEVICE_DTC_FLAGS := --pad 4096 - DEVICE_DTS_LOADADDR := 0x43f00000 DEVICE_PACKAGES := kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware \ - e2fsprogs f2fsck mkf2fs - KERNEL_LOADADDR := 0x44000000 - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - IMAGES := sysupgrade.itb - IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \ - pad-rootfs | append-metadata - ARTIFACTS :=gpt.bin preloader.bin bl31-uboot.fip - ARTIFACT/gpt.bin := mt798x-gpt emmc - ARTIFACT/preloader.bin := mt7986-bl2 emmc-ddr4 - ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot jdcloud_re-cp-03 + e2fsprogs f2fsck mkf2fs losetup kmod-mmc kmod-nls-cp437 kmod-nls-iso8859-1 blkid blockdev + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += jdcloud_re-cp-03 @@ -1859,18 +1811,14 @@ define Device/konka_komi-a31 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 + IMAGE_SIZE := 114688k KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL := kernel-bin | gzip KERNEL_INITRAMFS := kernel-bin | lzma | \ fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot konka_komi-a31 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += konka_komi-a31 @@ -2161,18 +2109,11 @@ define Device/netcore_n60 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata DEVICE_PACKAGES := kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot netcore_n60 + IMAGE_SIZE := 112640k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += netcore_n60 @@ -2185,18 +2126,11 @@ define Device/netcore_n60-pro BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata DEVICE_PACKAGES := kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware kmod-usb3 - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4 - ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot netcore_n60-pro + IMAGE_SIZE := 112640k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += netcore_n60-pro @@ -2361,20 +2295,32 @@ define Device/nokia_ea0326gmp BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot nokia_ea0326gmp + IMAGE_SIZE := 112640k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += nokia_ea0326gmp +define Device/nradio_c8-660 + DEVICE_VENDOR := NRadio + DEVICE_MODEL := C8-660 + DEVICE_DTS := mt7981b-nradio-c8-660 + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 131072k + KERNEL_IN_UBI := 1 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-usb-serial-option kmod-usb-net-cdc-ether kmod-usb-net-qmi-wwan \ + kmod-usb3 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += nradio_c8-660 + define Device/nradio_c8-668gl DEVICE_VENDOR := NRadio DEVICE_MODEL := C8-668GL @@ -2463,7 +2409,7 @@ define Device/openwrt_one UBINIZE_PARTS := fip=:$(STAGING_DIR_IMAGE)/mt7981_openwrt_one-snand-u-boot.fip \ $(if $(IB),recovery=:$(STAGING_DIR_IMAGE)/mediatek-filogic-openwrt_one-initramfs.itb,\ recovery=:$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)) \ - $(if $(wildcard $(TOPDIR)/openwrt-mediatek-filogic-openwrt_one-calibration.itb), calibration=:$(TOPDIR)/openwrt-mediatek-filogic-openwrt_one-calibration.itb) + $(if $(wildcard $(TOPDIR)/kwrt-mediatek-filogic-openwrt_one-calibration.itb), calibration=:$(TOPDIR)/kwrt-mediatek-filogic-openwrt_one-calibration.itb) endef TARGET_DEVICES += openwrt_one @@ -2475,19 +2421,12 @@ define Device/qihoo_360t7 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 + IMAGE_SIZE := 112640k KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 - ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot qihoo_360t7 endef TARGET_DEVICES += qihoo_360t7 @@ -2762,17 +2701,8 @@ define Device/tplink_tl-xdr-common BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 - UBOOTENV_IN_UBI := 1 - IMAGES := sysupgrade.itb - KERNEL_INITRAMFS_SUFFIX := -recovery.itb - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | \ - fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k - IMAGE/sysupgrade.itb := append-kernel | \ - fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | append-metadata - DEVICE_PACKAGES := fitblk kmod-usb3 kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware - ARTIFACTS := preloader.bin bl31-uboot.fip - ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef define Device/tplink_tl-xdr4288 @@ -2989,14 +2919,18 @@ endif endef TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod -define Device/xiaomi_mi-router-wr30u-stock +define Device/xiaomi_mi-router-wr30u DEVICE_VENDOR := Xiaomi - DEVICE_MODEL := Mi Router WR30U (stock layout) - DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-stock + DEVICE_MODEL := Mi Router WR30U + DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u DEVICE_DTS_DIR := ../dts UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 + IMAGE_SIZE := 114688k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware ifeq ($(IB),) ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) @@ -3006,7 +2940,7 @@ endif endif IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef -TARGET_DEVICES += xiaomi_mi-router-wr30u-stock +TARGET_DEVICES += xiaomi_mi-router-wr30u define Device/xiaomi_mi-router-wr30u-ubootmod DEVICE_VENDOR := Xiaomi @@ -3087,6 +3021,23 @@ endif endef TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod +define Device/xiaomi_redmi-router-ax6000 + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Redmi Router AX6000 + DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-leds-ws2812b kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + IMAGE_SIZE := 112640k + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_redmi-router-ax6000 + define Device/yuncore_ax835 DEVICE_VENDOR := YunCore DEVICE_MODEL := AX835 @@ -3269,3 +3220,237 @@ define Device/zyxel_nwa50ax-pro IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_nwa50ax-pro + +define Device/philips_hy3000 + DEVICE_VENDOR := Philips + DEVICE_MODEL := HY3000 + DEVICE_DTS := mt7981b-philips-hy3000 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 f2fsck mkf2fs + SUPPORTED_DEVICES += philips,hy3000 + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += philips_hy3000 + +define Device/sl_3000-emmc + DEVICE_VENDOR := SL + DEVICE_MODEL := 3000 eMMC + DEVICE_DTS := mt7981b-sl-3000-emmc + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware blkid blockdev fdisk f2fsck mkf2fs kmod-mmc + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += sl_3000-emmc + +define Device/bt_r320 + DEVICE_VENDOR := Globitel + DEVICE_MODEL := BT-R320 + DEVICE_DTS := mt7981b-bt-r320 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware e2fsprogs f2fsck mkf2fs + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += bt_r320 + +define Device/newland_nl-wr8103 + DEVICE_VENDOR := Newland + DEVICE_MODEL := NL-WR8103 + DEVICE_DTS := mt7981b-newland-nl-wr8103 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 116736k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += newland_nl-wr8103 + +define Device/umi_uax3000e + DEVICE_VENDOR := UMI + DEVICE_MODEL := UAX3000E + DEVICE_DTS := mt7981b-umi-uax3000e + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option \ + kmod-usb3 blkid blockdev fdisk f2fsck mkf2fs kmod-mmc mmc-utils + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += umi_uax3000e + +define Device/glinet_gl-mt3600be + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-MT3600BE + DEVICE_DTS := mt7987a-glinet-gl-mt3600be + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := mt7987-2p5g-phy-firmware kmod-mt7990-firmware \ + kmod-hwmon-pwmfan kmod-usb3 + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd + KERNEL_IN_UBI := 1 + KERNEL_LOADADDR := 0x40000000 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 483328k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += glinet_gl-mt3600be + +define Device/ikuai_q3000 + DEVICE_VENDOR := iKuai + DEVICE_MODEL := Q3000 + DEVICE_DTS := mt7981b-ikuai-q3000 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES := ikuai,q3000 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 114816k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += ikuai_q3000 + +define Device/imou_lc-hx3001 + DEVICE_VENDOR := IMOU + DEVICE_MODEL := LC-HX3001 + DEVICE_DTS := mt7981b-imou-lc-hx3001 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + SUPPORTED_DEVICES += imou,lc-hx3001 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 113152k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd +endef +TARGET_DEVICES += imou_lc-hx3001 + +define Device/cmcc_rax3000m-nand + DEVICE_VENDOR := CMCC + DEVICE_MODEL := RAX3000M NAND + DEVICE_DTS := mt7981b-cmcc-rax3000m-nand + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \ + e2fsprogs f2fsck mkf2fs + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 116736k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += cmcc_rax3000m-nand + +define Device/cmcc_rax3000m-emmc + DEVICE_VENDOR := CMCC + DEVICE_MODEL := RAX3000M eMMC + DEVICE_DTS := mt7981b-cmcc-rax3000m-emmc + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \ + e2fsprogs f2fsck mkf2fs losetup kmod-fs-f2fs kmod-mmc + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += cmcc_rax3000m-emmc + +define Device/cmcc_xr30 + DEVICE_VENDOR := CMCC + DEVICE_MODEL := XR30 NAND + DEVICE_DTS := mt7981b-cmcc-xr30 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \ + e2fsprogs f2fsck mkf2fs + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 116736k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += cmcc_xr30 + +define Device/cmcc_xr30-emmc + DEVICE_VENDOR := CMCC + DEVICE_MODEL := XR30 eMMC (RAX3000Z增强版) + DEVICE_DTS := mt7981b-cmcc-xr30-emmc + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \ + e2fsprogs f2fsck mkf2fs losetup kmod-fs-f2fs kmod-mmc + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += cmcc_xr30-emmc + +define Device/cmcc_mr3000d-ciq-256m + DEVICE_VENDOR := CMCC + DEVICE_MODEL := MR3000D-CIq (256M) + DEVICE_DTS := mt7981b-cmcc-mr3000d-ciq-256m + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware uboot-envtools + SUPPORTED_DEVICES := cmcc,mr3000d-ciq-256m mt7981-spim-nand-gsw-wr3000k + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + KERNEL = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS = kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),) + ARTIFACTS := initramfs-MR3000D-CIq-factory.bin + ARTIFACT/initramfs-MR3000D-CIq-factory.bin := append-image-stage initramfs-kernel.bin | sysupgrade-initramfs-tar | append-metadata | tenbay-factory MR3000D-CIq +endif +endif +endef +TARGET_DEVICES += cmcc_mr3000d-ciq-256m + +define Device/aigo_ags21 + DEVICE_VENDOR := Aigo + DEVICE_MODEL := AGS21 + DEVICE_DTS := mt7981b-aigo-ags21 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware automount coremark blkid blockdev fdisk f2fsck mkf2fs kmod-mmc mmc-utils + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += aigo_ags21 ================================================ FILE: devices/mediatek_filogic/patches/02-ax6000.patch ================================================ new file mode 100644 index 0000000000000..759baae3aeb18 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7986a-xiaomi-redmi-router-ax6000.dtsi" + +/ { + model = "Xiaomi Redmi Router AX6000"; + compatible = "xiaomi,redmi-router-ax6000", "mediatek,mt7986a"; +}; + +&spi_nand_flash { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; + +&partitions { + partition@580000 { + label = "crash"; + reg = <0x580000 0x40000>; + }; + + partition@5c0000 { + label = "crash_log"; + reg = <0x5c0000 0x40000>; + }; + + partition@600000 { + label = "ubi"; + reg = <0x600000 0x6e00000>; + }; +}; --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -30,9 +30,9 @@ set_preinit_iface() { ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u|\ xiaomi,mi-router-wr30u-ubootmod|\ - xiaomi,redmi-router-ax6000-stock|\ + xiaomi,redmi-router-ax6000|\ xiaomi,redmi-router-ax6000-ubootmod) ip link set eth0 up ifname=lan4 ================================================ FILE: devices/mediatek_filogic/patches/03-nx30.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-h3c-magic-nx30-pro.dts @@ -112,6 +112,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; ================================================ FILE: devices/mediatek_filogic/patches/08-cmcc_rax3000m.patch ================================================ --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -10,12 +10,17 @@ mediatek_setup_interfaces() case $board in abt,asr3000|\ buffalo,wsr-6000ax8|\ - cmcc,rax3000m|\ + cmcc,mr3000d-ciq-256m|\ + cmcc,rax3000m*|\ + cmcc,xr30*|\ + imou,lc-hx3001|\ + umi,uax3000e|\ h3c,magic-nx30-pro|\ imou,hx21|\ konka,komi-a31|\ netis,nx30v2|\ netis,nx31|\ + newland,nl-wr8103|\ nokia,ea0326gmp|\ mercusys,mr80x-v3|\ routerich,ax3000-v1|\ @@ -38,6 +43,9 @@ mediatek_setup_interfaces() acer,vero-w6m) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" internet ;; + aigo,ags21) + ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 + ;; arcadyan,mozart) ucidef_set_interfaces_lan_wan "lan0 eth1" eth2 ;; @@ -46,17 +54,21 @@ mediatek_setup_interfaces() asus,zenwifi-bt8|\ asus,zenwifi-bt8-ubootmod|\ cetron,ct3003|\ - cmcc,a10-stock|\ + cmcc,a10|\ cmcc,a10-ubootmod|\ confiabits,mt7981|\ creatlentem,clt-r30b1|\ creatlentem,clt-r30b1-112m|\ cudy,wr3000-v1|\ + ikuai,q3000|\ jcg,q30-pro|\ keenetic,kn-3711|\ keenetic,kn-3811|\ netis,nx32u|\ qihoo,360t7|\ + philips,hy3000|\ + sl,3000*|\ + bt,r320|\ routerich,ax3000|\ routerich,ax3000-ubootmod|\ routerich,be7200|\ @@ -70,6 +82,7 @@ mediatek_setup_interfaces() mediatek,mt7981-rfb|\ netcore,n60|\ netcore,n60-pro|\ + nradio,c8-660|\ nradio,c8-668gl|\ ruijie,rg-x60-pro|\ unielec,u7981-01*|\ @@ -130,7 +143,8 @@ mediatek_setup_interfaces() cudy,m3000-v1|\ cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ - cudy,tr3000-v1-ubootmod|\ + cudy,tr3000-mod|\ + glinet,gl-mt3600be|\ glinet,gl-mt2500|\ glinet,gl-mt2500-airoha|\ glinet,gl-mt3000|\ @@ -170,6 +186,10 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" "0:lan0" "1:lan1" "2:lan2" "6@eth0" ucidef_set_interfaces_lan_wan "eth0.1 eth0.2 eth0.3" eth1 ;; + ikuai,q3000) + wan_mac=$(mtd_get_mac_binary $part_name 0x10048) + lan_mac=$(macaddr_add $wan_mac 1) + ;; mercusys,mr90x-v1|\ mercusys,mr90x-v1-ubi) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 @@ -193,11 +213,21 @@ mediatek_setup_interfaces() tplink,re6000xd) ucidef_set_interface_lan "lan1 lan2 eth1" ;; + philips,hy3000) + lan_mac=$(mmc_get_mac_binary factory 0x74) + wan_mac=$(macaddr factory $lan_mac 1) + label_mac=$wan_mac + ;; + sl,3000-emmc) + lan_mac=$(mmc_get_mac_binary factory 0x04) + wan_mac=$(macaddr_add "$lan_mac" -2) + label_mac=$lan_mac + ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u|\ xiaomi,mi-router-wr30u-ubootmod|\ - xiaomi,redmi-router-ax6000-stock|\ + xiaomi,redmi-router-ax6000|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan ;; @@ -238,6 +268,12 @@ mediatek_setup_macs() bananapi,bpi-r4-lite) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + imou,lc-hx3001) + lan_mac=$(mtd_get_mac_ascii u-boot-env mac) + [ -n "$lan_mac" ] || lan_mac=$(macaddr_add $(mtd_get_mac_binary Factory 0x4) -1) + wan_mac=$(macaddr_add $lan_mac 2) + label_mac="$lan_mac" + ;; h3c,magic-nx30-pro) wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) @@ -261,11 +297,17 @@ mediatek_setup_macs() lan_mac=$(mtd_get_mac_ascii u-boot-env mac) label_mac=$lan_mac ;; + nradio,c8-660|\ nradio,c8-668gl) lan_mac=$(mmc_get_mac_ascii bdinfo "fac_mac ") wan_mac=$(macaddr_add "$lan_mac" 2) label_mac=$lan_mac ;; + newland,nl-wr8103) + label_mac=$(mtd_get_mac_binary Factory 0x04) + wan_mac=$(macaddr_add "$label_mac" -2) + lan_mac=$label_mac + ;; qihoo,360t7) lan_mac=$(mtd_get_mac_ascii factory lanMac) wan_mac=$(macaddr_add "$lan_mac" 1) @@ -286,9 +328,9 @@ mediatek_setup_macs() ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u|\ xiaomi,mi-router-wr30u-ubootmod|\ - xiaomi,redmi-router-ax6000-stock|\ + xiaomi,redmi-router-ax6000|\ xiaomi,redmi-router-ax6000-ubootmod) wan_mac=$(mtd_get_mac_ascii Bdata ethaddr_wan) label_mac=$wan_mac --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -17,6 +17,12 @@ case "$FIRMWARE" in tplink,fr365-v1) ln -sf /tmp/wlan/radio /lib/firmware/$FIRMWARE ;; + umi,uax3000e|\ + sl,3000-emmc|\ + cmcc,rax3000m-emmc|\ + cmcc,xr30-emmc) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; esac ;; "mediatek/mt7986_eeprom_mt7975_dual.bin") @@ -35,6 +40,10 @@ case "$FIRMWARE" in ln -sf /tmp/tp_data/MT7986_EEPROM.bin \ /lib/firmware/$FIRMWARE ;; + glinet,gl-mt6000|\ + jdcloud,re-cp-03) + caldata_extract_mmc "factory" 0x0 0x1000 + ;; esac ;; "mediatek/mt7996/mt7992_eeprom.bin") ================================================ FILE: devices/mediatek_filogic/patches/09-jcg_q30-pro.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts +++ b/target/linux/mediatek/dts/mt7981b-jcg-q30-pro.dts @@ -103,6 +103,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -142,12 +146,11 @@ partition@380000 { label = "fip"; reg = <0x0380000 0x0200000>; - read-only; }; partition@580000 { label = "ubi"; - reg = <0x0580000 0x7000000>; + reg = <0x0580000 0x6e80000>; compatible = "linux,ubi"; volumes { ================================================ FILE: devices/mediatek_filogic/patches/12-asr3000.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts +++ b/target/linux/mediatek/dts/mt7981b-abt-asr3000.dts @@ -155,6 +155,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -208,13 +212,12 @@ partition@380000 { label = "fip"; reg = <0x380000 0x200000>; - read-only; }; partition@580000 { compatible = "linux,ubi"; label = "ubi"; - reg = <0x580000 0x7a80000>; + reg = <0x580000 0x6e80000>; volumes { ubi_rootdisk: ubi-volume-fit { ================================================ FILE: devices/mediatek_filogic/patches/16-komi-a31.patch ================================================ --- 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 @@ -95,7 +95,7 @@ case "$board" in cudy,re3000-v1|\ cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ - cudy,tr3000-v1-ubootmod|\ + cudy,tr3000-mod|\ cudy,wbr3000uax-v1|\ cudy,wbr3000uax-v1-ubootmod|\ cudy,wr3000e-v1|\ @@ -189,11 +189,18 @@ case "$board" in [ "$PHYNBR" = "0" ] && echo "$addr_2g" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && echo "$addr_5g" > /sys${DEVPATH}/macaddress ;; + imou,lc-hx3001) + addr=$(mtd_get_mac_ascii u-boot-env mac) + [ -n "$addr" ] || addr=$(macaddr_add $(mtd_get_mac_binary Factory 0x4) -1) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress + ;; nokia,ea0326gmp) addr=$(cat /sys/class/net/eth0/address) [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress ;; + c8-668gl|\ nradio,c8-668gl) hw_mac_addr=$(mmc_get_mac_ascii bdinfo "fac_mac ") [ "$PHYNBR" = "0" ] && echo "$hw_mac_addr" > /sys${DEVPATH}/macaddress @@ -227,6 +234,26 @@ case "$board" in tplink,tl-xtr8488) [ "$PHYNBR" = "1" ] && get_mac_label > /sys${DEVPATH}/macaddress ;; + umi,uax3000e) + addr=$(mmc_get_mac_binary factory 0x24) + [ "$PHYNBR" = "0" ] && macaddr_add $addr > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; + newland,nl-wr8103) + addr=$(mtd_get_mac_binary Factory 0x0A) + [ "$PHYNBR" = "0" ] && macaddr_add $addr > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress + ;; + sl,3000-emmc) + label_mac=$(mmc_get_mac_binary factory 0x04) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; + bt,r320) + label_mac=$(mmc_get_mac_binary factory 0x4) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; routerich,ax3000|\ routerich,ax3000-ubootmod|\ zbtlink,zbt-z8102ax|\ ================================================ FILE: devices/mediatek_filogic/patches/17-lc-hx3001.patch ================================================ --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-imou-lc-hx3001.dts @@ -0,0 +1,239 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981b.dtsi" + +/ { + model = "IMOU LC-HX3001 (uboot layout)"; + compatible = "imou,lc-hx3001", "mediatek,mt7981"; + + aliases { + led-boot = &power_led; + led-failsafe = &power_led; + led-running = &power_led; + led-upgrade = &power_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + button-mesh { + label = "mesh"; + linux,code = ; + linux,input-type = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power_led: led-0 { + label = "green:power"; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + + led-1 { + label = "green:wlan"; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + led-2 { + label = "red:wan"; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + led-3 { + label = "green:wan"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + led-4 { + label = "green:lan"; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + 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-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x100000>; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x7280000>; + }; + }; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = <8>; + bias-pull-up = <103>; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = <8>; + bias-pull-down = <103>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -24,6 +24,10 @@ acer,predator-w6x-stock|\ acer,predator-w6x-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:status" "eth1" ;; +aigo,ags21) + ucidef_set_led_netdev "internet" "INTERNET" "green:status" "eth1" + ucidef_set_led_netdev "wlan" "WLAN" "white:status" "phy1-ap0" + ;; asus,rt-ax52|\ asus,rt-ax57m|\ snr,snr-cpe-ax2) @@ -97,6 +101,11 @@ cudy,wbr3000uax-v1-ubootmod) elecom,wrc-x3000gs3) ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" ;; +imou,lc-hx3001) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link" + ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link" + ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "phy1-ap0" "link" + ;; glinet,gl-x3000|\ glinet,gl-xe3000) ucidef_set_led_default "power" "POWER" "green:power" "1" @@ -145,6 +154,15 @@ mercusys,mr85x) ucidef_set_led_switch "lan2" "lan-2" "green:lan-2" "switch0" "0x04" ucidef_set_led_netdev "wan" "wan" "green:wan" "eth1" "link tx rx" ;; +ikuai,q3000) + ucidef_set_led_default "green" "GREEN" "q3000:green" "1" + ucidef_set_led_default "blue" "BLUE" "q3000:blue" "0" + ucidef_set_led_default "red" "RED" "q3000:red" "0" + ;; +bt,r320) + ucidef_set_led_netdev "wlan2g" "2.4G" "green:wlan-2ghz" "phy0-ap0" + ucidef_set_led_netdev "wlan5g" "5G" "green:wlan-5ghz" "phy1-ap0" + ;; mercusys,mr90x-v1|\ mercusys,mr90x-v1-ubi) ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx" @@ -190,6 +208,10 @@ nokia,ea0326gmp) ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link" ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "phy1-ap0" "link" ;; +nradio,c8-660) + ucidef_set_led_netdev "wifi" "WIFI" "blue:wifi" "phy0-ap0" + ucidef_set_led_netdev "5g" "5G" "blue:cmode5" "eth1" "link tx rx" + ;; nradio,c8-668gl) ucidef_set_led_netdev "wifi" "WIFI" "blue:wlan" "phy1-ap0" "link" ucidef_set_led_netdev "5g" "5G" "blue:indicator-0" "eth1" "link" @@ -315,11 +337,11 @@ wavlink,wl-wn586x3b) ucidef_set_led_netdev "lan-2" "lan-2" "blue:lan-2" "lan2" "link tx rx" ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth1" "link tx rx" ;; -xiaomi,mi-router-wr30u-stock|\ +xiaomi,mi-router-wr30u|\ xiaomi,mi-router-wr30u-ubootmod) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ;; -xiaomi,redmi-router-ax6000-stock|\ +xiaomi,redmi-router-ax6000|\ xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_led_netdev "wan" "wan" "rgb:network" "wan" ;; ================================================ FILE: devices/mediatek_filogic/patches/19-ct3003.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts +++ b/target/linux/mediatek/dts/mt7981b-cetron-ct3003.dts @@ -159,18 +159,9 @@ partition@580000 { label = "ubi"; - reg = <0x0580000 0x2000000>; + reg = <0x0580000 0x7000000>; }; - partition@2580000 { - label = "ubi_backup"; - reg = <0x2580000 0x2000000>; - }; - - partition@4580000 { - label = "Config_backup"; - reg = <0x4580000 0x0400000>; - }; }; }; }; ================================================ FILE: devices/mediatek_filogic/patches/20-ea0326gmp.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts +++ b/target/linux/mediatek/dts/mt7981b-nokia-ea0326gmp.dts @@ -164,6 +163,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -223,13 +226,7 @@ partition@980000 { compatible = "linux,ubi"; label = "ubi"; - reg = <0x980000 0x7680000>; - - volumes { - ubi_rootdisk: ubi-volume-fit { - volname = "fit"; - }; - }; + reg = <0x980000 0x6e00000>; }; }; }; ================================================ FILE: devices/mediatek_filogic/patches/22-netcore-n60-pro.patch ================================================ --- a/target/linux/mediatek/dts/mt7986a-netcore-n60-pro.dts +++ b/target/linux/mediatek/dts/mt7986a-netcore-n60-pro.dts @@ -242,6 +242,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -290,7 +294,7 @@ partition@580000 { label = "ubi"; - reg = <0x0580000 0x7a80000>; + reg = <0x0580000 0x7280000>; compatible = "linux,ubi"; volumes { --- a/target/linux/mediatek/dts/mt7981b-comfast-cf-wr632ax.dts +++ b/target/linux/mediatek/dts/mt7981b-comfast-cf-wr632ax.dts @@ -14,5 +14,5 @@ }; &ubi { - reg = <0x580000 0x4000000>; + reg = <0x580000 0x07200000>; }; ================================================ FILE: devices/mediatek_filogic/patches/22-netcore-n60.patch ================================================ --- a/target/linux/mediatek/dts/mt7986a-netcore-n60.dts +++ b/target/linux/mediatek/dts/mt7986a-netcore-n60.dts @@ -175,6 +175,10 @@ spi-tx-bus-width = <4>; spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -200,7 +204,6 @@ partition@380000 { label = "FIP"; reg = <0x0380000 0x0200000>; - read-only; }; partition@580000 { ================================================ FILE: devices/mediatek_filogic/patches/23-ax3000t.patch ================================================ --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts @@ -18,8 +18,8 @@ &partitions { // ubi_kernel is the ubi partition in stock. partition@600000 { - label = "ubi_kernel"; - reg = <0x600000 0x2200000>; + label = "ubi"; + reg = <0x600000 0x7000000>; }; /* ubi is the result of squashing @@ -28,8 +28,8 @@ * - overlay * - data */ - partition@2800000 { - label = "ubi"; - reg = <0x2800000 0x4e00000>; + partition@7600000 { + label = "KF"; + reg = <0x7600000 0x40000>; }; }; ================================================ FILE: devices/mediatek_filogic/patches/25-platform.patch ================================================ --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -65,10 +65,10 @@ xiaomi_initial_setup() local board=$(board_name) case "$board" in xiaomi,mi-router-ax3000t|\ - xiaomi,mi-router-wr30u-stock) + xiaomi,mi-router-wr30u) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" ;; - xiaomi,redmi-router-ax6000-stock) + xiaomi,redmi-router-ax6000) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)" ;; esac @@ -78,7 +78,6 @@ platform_do_upgrade() { local board=$(board_name) case "$board" in - abt,asr3000|\ acer,predator-w6x-ubootmod|\ asus,zenwifi-bt8-ubootmod|\ bananapi,bpi-r3|\ @@ -89,34 +88,21 @@ platform_do_upgrade() { bananapi,bpi-r4-lite|\ bazis,ax3000wm|\ cmcc,a10-ubootmod|\ - cmcc,rax3000m|\ comfast,cf-wr632ax-ubootmod|\ cudy,tr3000-v1-ubootmod|\ cudy,wbr3000uax-v1-ubootmod|\ gatonetworks,gdsp|\ - h3c,magic-nx30-pro|\ imou,hx21|\ - jcg,q30-pro|\ - jdcloud,re-cp-03|\ - konka,komi-a31|\ mediatek,mt7981-rfb|\ mediatek,mt7988a-rfb|\ mercusys,mr90x-v1-ubi|\ netis,nx30v2|\ netis,nx31|\ netis,nx32u|\ - nokia,ea0326gmp|\ openwrt,one|\ - netcore,n60|\ - netcore,n60-pro|\ - qihoo,360t7|\ routerich,ax3000-ubootmod|\ routerich,be7200|\ snr,snr-cpe-ax2|\ - tplink,tl-xdr4288|\ - tplink,tl-xdr6086|\ - tplink,tl-xdr6088|\ - tplink,tl-xtr8488|\ xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod|\ xiaomi,mi-router-wr30u-ubootmod|\ @@ -126,8 +112,11 @@ platform_do_upgrade() { acer,predator-w6|\ acer,predator-w6d|\ acer,vero-w6m|\ + aigo,ags21|\ airpi,ap3000m|\ arcadyan,mozart|\ + cmcc,rax3000m-emmc|\ + cmcc,xr30-emmc|\ glinet,gl-mt2500|\ glinet,gl-mt2500-airoha|\ glinet,gl-mt6000|\ @@ -135,12 +124,16 @@ platform_do_upgrade() { glinet,gl-xe3000|\ huasifei,wh3000|\ huasifei,wh3000-pro|\ + philips,hy3000|\ + sl,3000*|\ + bt,r320|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ smartrg,sdg-8632|\ smartrg,sdg-8733|\ smartrg,sdg-8733a|\ + umi,uax3000e|\ smartrg,sdg-8734) CI_KERNPART="kernel" CI_ROOTPART="rootfs" @@ -251,13 +244,6 @@ platform_do_upgrade() { ;; esac ;; - xiaomi,mi-router-ax3000t|\ - xiaomi,mi-router-wr30u-stock|\ - xiaomi,redmi-router-ax6000-stock) - CI_KERN_UBIPART=ubi_kernel - CI_ROOT_UBIPART=ubi - nand_do_upgrade "$1" - ;; *) nand_do_upgrade "$1" ;; @@ -354,6 +340,8 @@ platform_copy_config() { acer,vero-w6m|\ airpi,ap3000m|\ arcadyan,mozart|\ + cmcc,rax3000m-emmc|\ + cmcc,xr30-emmc|\ glinet,gl-mt2500|\ glinet,gl-mt2500-airoha|\ glinet,gl-mt6000|\ @@ -363,6 +351,9 @@ platform_copy_config() { huasifei,wh3000-pro|\ jdcloud,re-cp-03|\ nradio,c8-668gl|\ + philips,hy3000|\ + sl,3000*|\ + bt,r320|\ smartrg,sdg-8612|\ smartrg,sdg-8614|\ smartrg,sdg-8622|\ @@ -376,6 +367,18 @@ platform_copy_config() { esac } +tenbay_dualboot_fixup() +{ + [ "$(rootfs_type)" = "tmpfs" ] || return 0 + + if ! fw_printenv -n boot_from &>/dev/null; then + echo "unable to read uboot-env" + return 1 + fi + + fw_setenv boot_from ubi +} + platform_pre_upgrade() { local board=$(board_name) @@ -393,9 +396,12 @@ platform_pre_upgrade() { buffalo_initial_setup ;; xiaomi,mi-router-ax3000t|\ - xiaomi,mi-router-wr30u-stock|\ - xiaomi,redmi-router-ax6000-stock) + xiaomi,mi-router-wr30u|\ + xiaomi,redmi-router-ax6000) xiaomi_initial_setup ;; + cmcc,mr3000d-ciq-256m) + tenbay_dualboot_fixup + ;; esac } ================================================ FILE: devices/mediatek_filogic/patches/26-ruijie-rg-x60-pro.patch ================================================ --- a/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts +++ b/target/linux/mediatek/dts/mt7986a-ruijie-rg-x60-pro.dts @@ -199,7 +199,6 @@ partition@380000 { label = "FIP"; reg = <0x380000 0x200000>; - read-only; }; partition@580000 { @@ -216,7 +215,7 @@ partition@680000 { label = "ubi"; - reg = <0x680000 0x3f00000>; + reg = <0x680000 0x6b00000>; }; }; }; ================================================ FILE: devices/mediatek_filogic/patches/99-bpi-r4-lite.patch.b ================================================ --- a/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh +++ b/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh @@ -12,6 +12,7 @@ unielec,u7623-02) bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ +bananapi,bpi-r4-lite|\ bananapi,bpi-r4-poe) [ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] && fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)" --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -53,6 +53,9 @@ bananapi,bpi-r4-poe) ucidef_set_led_netdev "lan2" "lan2" "mt7530-0:02:green:lan" "lan2" "link tx rx" ucidef_set_led_netdev "lan3" "lan3" "mt7530-0:03:green:lan" "lan3" "link tx rx" ;; +bananapi,bpi-r4-lite) + ucidef_set_led_netdev "sfp0" "sfp0" "green:sfp" "sfp0" "link tx rx" + ;; cudy,re3000-v1|\ wavlink,wl-wn573hx3) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" "link tx rx" --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -171,6 +171,9 @@ mediatek_setup_macs() bananapi,bpi-r4) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) ;; + bananapi,bpi-r4-lite) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 sfp0" "eth1" + ;; h3c,magic-nx30-pro) wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr) lan_mac=$(macaddr_add "$wan_mac" 1) --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -71,6 +71,7 @@ platform_do_upgrade() { bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ + bananapi,bpi-r4-lite|\ cmcc,a10-ubootmod|\ cmcc,rax3000m|\ cudy,tr3000-v1-ubootmod|\ @@ -197,6 +198,7 @@ platform_check_image() { bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ + bananapi,bpi-r4-lite|\ cmcc,rax3000m) [ "$magic" != "d00dfeed" ] && { echo "Invalid image type." @@ -219,6 +221,7 @@ platform_copy_config() { bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ + bananapi,bpi-r4-lite|\ cmcc,rax3000m) if [ "$CI_METHOD" = "emmc" ]; then emmc_copy_config --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -638,6 +638,67 @@ endif endef TARGET_DEVICES += bananapi_bpi-r4-poe +define Device/bananapi_bpi-r4-lite + DEVICE_VENDOR := Bananapi + DEVICE_MODEL := BPi-R4 Lite + DEVICE_DTS := mt7987a-bananapi-bpi-r4-lite + DEVICE_DTS_OVERLAY:= mt7987a-bananapi-bpi-r4-lite-1pcie-2L mt7987a-bananapi-bpi-r4-lite-2pcie-1L \ + mt7987a-bananapi-bpi-r4-lite-emmc mt7987a-bananapi-bpi-r4-lite-sd \ + mt7987a-bananapi-bpi-r4-lite-nand mt7987a-bananapi-bpi-r4-lite-nor + DEVICE_DTS_CONFIG := config-mt7987a-bananapi-bpi-r4-lite + DEVICE_DTC_FLAGS := --pad 4096 + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x4ff00000 + DEVICE_PACKAGES := mt7987-2p5g-phy-firmware kmod-eeprom-at24 \ + kmod-gpio-pca953x kmod-i2c-mux-pca954x kmod-rtc-pcf8563 \ + kmod-sfp e2fsprogs mkf2fs + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + KERNEL_LOADADDR := 0x40000000 + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + KERNEL_IN_UBI := 1 + IMAGES := sysupgrade.itb + IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata + ARTIFACTS := \ + emmc-preloader.bin emmc-bl31-uboot.fip \ + nor-preloader.bin nor-bl31-uboot.fip \ + sdcard.img.gz \ + snand-preloader.bin snand-bl31-uboot.fip + ARTIFACT/emmc-preloader.bin := mt7987-bl2 emmc-comb + ARTIFACT/emmc-bl31-uboot.fip := mt7987-bl31-uboot bananapi_bpi-r4-lite-emmc + ARTIFACT/nor-preloader.bin := mt7987-bl2 nor-comb + ARTIFACT/nor-bl31-uboot.fip := mt7987-bl31-uboot bananapi_bpi-r4-lite-nor + ARTIFACT/snand-preloader.bin := mt7987-bl2 spim-nand2-ubi-comb + ARTIFACT/snand-bl31-uboot.fip := mt7987-bl31-uboot bananapi_bpi-r4-lite-snand + ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ + pad-to 17k | mt7987-bl2 sdmmc-comb |\ + pad-to 6656k | mt7987-bl31-uboot bananapi_bpi-r4-lite-sdmmc |\ + $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ + pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\ + ) \ + pad-to 44M | mt7987-bl2 spim-nand2-ubi-comb |\ + pad-to 45M | mt7987-bl31-uboot bananapi_bpi-r4-lite-snand |\ + pad-to 49M | mt7987-bl2 nor-comb |\ + pad-to 50M | mt7987-bl31-uboot bananapi_bpi-r4-lite-nor |\ + pad-to 51M | mt7987-bl2 emmc-comb |\ + pad-to 52M | mt7987-bl31-uboot bananapi_bpi-r4-lite-emmc |\ + pad-to 56M | mt798x-gpt emmc |\ + $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ + pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ + ) \ + gzip +ifeq ($(DUMP),) + IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m +endif +endef +TARGET_DEVICES += bananapi_bpi-r4-lite + define Device/cetron_ct3003 DEVICE_VENDOR := Cetron DEVICE_MODEL := CT3003 --- a/package/firmware/linux-firmware/mediatek.mk +++ b/package/firmware/linux-firmware/mediatek.mk @@ -97,6 +97,16 @@ define Package/mt7986-wo-firmware/install endef $(eval $(call BuildPackage,mt7986-wo-firmware)) +Package/mt7987-2p5g-phy-firmware = $(call Package/firmware-default,MT7987 built-in 2.5G Ethernet PHY firmware,,LICENCE.mediatek) +define Package/mt7987-2p5g-phy-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek/mt7987 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/mediatek/mt7987/i2p5ge-phy-DSPBitTb.bin \ + $(PKG_BUILD_DIR)/mediatek/mt7987/i2p5ge-phy-pmb.bin \ + $(1)/lib/firmware/mediatek/mt7987 +endef +$(eval $(call BuildPackage,mt7987-2p5g-phy-firmware)) + Package/mt7988-2p5g-phy-firmware = $(call Package/firmware-default,MT7988 built-in 2.5G Ethernet PHY firmware,,LICENCE.mediatek) define Package/mt7988-2p5g-phy-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek/mt7988 ================================================ FILE: devices/mediatek_filogic/patches/Winbond-NMBM-fix.patch ================================================ --- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_nmbm.c +++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_nmbm.c @@ -2200,11 +2200,15 @@ static int nmbm_attach(struct nmbm_instance *ni) if (ni->signature.nand_size != bmtd.total_blks << bmtd.blk_shift || ni->signature.block_size != bmtd.blk_size || ni->signature.page_size != bmtd.pg_size || - ni->signature.spare_size != bmtd.mtd->oobsize) { + ni->signature.spare_size > bmtd.mtd->oobsize) { nlog_err(ni, "NMBM configuration mismatch\n"); return -EINVAL; } + if (ni->signature.spare_size < bmtd.mtd->oobsize) + nlog_warn(ni, "NMBM spare size (%u) is less than mtd oob size (%u)\n", + ni->signature.spare_size, bmtd.mtd->oobsize); + success = nmbm_load_existing(ni); if (!success) return -ENODEV; ================================================ FILE: devices/mediatek_filogic/patches/ags21.patch ================================================ --- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic @@ -58,13 +58,15 @@ zyxel,ex5601-t0-ubootmod) acer,predator-w6|\ acer,predator-w6d|\ acer,vero-w6m|\ +aigo,ags21|\ glinet,gl-mt2500|\ glinet,gl-mt2500-airoha|\ glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ huasifei,wh3000|\ -nradio,c8-668gl) +nradio,c8-668gl|\ +umi,uax3000e) ubootenv_add_mmc "u-boot-env" "" "0x0" "0x80000" ;; asiarf,ap7986-003|\ @@ -84,6 +86,7 @@ bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ bananapi,bpi-r4-lite|\ bananapi,bpi-r4-poe|\ +bt,r320|\ cmcc,rax3000m|\ jdcloud,re-cp-03) . /lib/upgrade/fit.sh @@ -146,11 +149,14 @@ ubnt,unifi-6-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" ;; xiaomi,mi-router-ax3000t|\ -xiaomi,mi-router-wr30u-stock|\ -xiaomi,redmi-router-ax6000-stock) +xiaomi,mi-router-wr30u|\ +xiaomi,redmi-router-ax6000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000" ;; +cmcc,mr3000d-ciq-256m) + ubootenv_add_uci_config "/dev/mtd1" "0" "0x20000" "0x20000" 1 + ;; zyxel,ex5601-t0) ubootenv_add_mtd "u-boot-env" "0x0" "0x20000" "0x40000" "2" ;; ================================================ FILE: devices/mediatek_filogic/patches/ax6s.patch ================================================ --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -438,18 +438,10 @@ define Device/xiaomi_redmi-router-ax6s UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 - KERNEL := kernel-bin | gzip - KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + KERNEL_SIZE := 6144k KERNEL_INITRAMFS_SUFFIX := -recovery.itb - IMAGES := sysupgrade.itb - IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata - ARTIFACTS := ubi-loader.itb - ARTIFACT/ubi-loader.itb := uboot-bin xiaomi_redmi-router-ax6s-ubi-loader | lzma | uboot-fit lzma -ifneq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),) - ARTIFACTS += factory.bin - ARTIFACT/factory.bin := uboot-bin xiaomi_redmi-router-ax6s-ubi-loader | lzma | uboot-fit lzma | pad-to 512k | ubinize-image fit squashfs-sysupgrade.itb -endif - DEVICE_COMPAT_VERSION := 2.0 - DEVICE_COMPAT_MESSAGE := Flash layout changes require a manual reinstall using factory.bin. + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += xiaomi_redmi-router-ax6s --- a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts +++ b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts @@ -22,8 +22,7 @@ chosen { stdout-path = "serial0:115200n8"; - rootdisk = <&ubi_rootfs>; - bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 ubi.block=0,fit root=/dev/fit0"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512"; }; memory { @@ -297,8 +296,8 @@ }; partition@2c0000 { - label = "ubi-loader"; - reg = <0x2c0000 0x80000>; + label = "kernel"; + reg = <0x2c0000 0x600000>; }; /* ubi partition is the result of squashing @@ -308,16 +307,9 @@ * - overlay * - obr */ - partition@340000 { + partition@8c0000 { label = "ubi"; - reg = <0x340000 0x7280000>; - compatible = "linux,ubi"; - - volumes { - ubi_rootfs: ubi-volume-fit { - volname = "fit"; - }; - }; + reg = <0x8c0000 0x6d00000>; }; }; }; ================================================ FILE: devices/mediatek_filogic/patches/tr3000-mod.patch ================================================ --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -5,7 +5,7 @@ set_preinit_iface() { cudy,m3000-v2-yt8821|\ cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ - cudy,tr3000-v1-ubootmod|\ + cudy,tr3000-mod|\ glinet,gl-mt2500|\ glinet,gl-mt2500-airoha|\ glinet,gl-mt3000|\ ================================================ FILE: devices/mediatek_mt7622/.config ================================================ CONFIG_TARGET_mediatek=y CONFIG_TARGET_mediatek_mt7622=y CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_dlink_eagle-pro-ai-m32-a1=n CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_dlink_eagle-pro-ai-r32-a1=n CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_elecom_wrc-x3200gst3=n ================================================ FILE: devices/mediatek_mt7622/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #curl -sfL https://raw.githubusercontent.com/x-wrt/x-wrt/master/target/linux/mediatek/patches-5.15/995-0001-hwnat-add-natflow-flow-offload-support.patch -o target/linux/mediatek/patches-5.15/995-0001-hwnat-add-natflow-flow-offload-support.patch ================================================ FILE: devices/mvebu_cortexa9/.config ================================================ CONFIG_TARGET_mvebu=y CONFIG_TARGET_mvebu_cortexa9=y CONFIG_TARGET_DEVICE_mvebu_cortexa9_DEVICE_plathome_openblocks-ax3-4=n CONFIG_TARGET_DEVICE_mvebu_cortexa9_DEVICE_synology_ds213j=n CONFIG_TARGET_DEVICE_mvebu_cortexa9_DEVICE_iij_sa-w2=n CONFIG_TARGET_DEVICE_mvebu_cortexa9_DEVICE_linksys_wrt1900ac-v1=n CONFIG_TARGET_ROOTFS_TARGZ=n ================================================ FILE: devices/mvebu_cortexa9/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) ================================================ FILE: devices/qualcommax_ipq50xx/.config ================================================ CONFIG_TARGET_qualcommax=y CONFIG_TARGET_qualcommax_ipq50xx=y ================================================ FILE: devices/qualcommax_ipq50xx/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-re-cs-03.dts ================================================ // SPDX-License-Identifier: GPL-2.0-only /dts-v1/; #include "ipq5018.dtsi" #include "ipq5018-ess.dtsi" #include "ipq5018-qcn6122.dtsi" #include #include #include / { #address-cells = <0x2>; #size-cells = <0x2>; model = "JDCloud RE-CS-03"; compatible = "jdcloud,re-cs-03", "qcom,ipq5018"; interrupt-parent = <&intc>; aliases { sdhc1 = &sdhc_1; serial0 = &blsp1_uart1; ethernet0 = "/soc/dp1"; ethernet1 = "/soc/dp2"; led-boot = &led_red; led-failsafe = &led_red; led-running = &led_blue; led-upgrade = &led_green; }; chosen { stdout-path = "serial0"; bootargs-append = " swiotlb=1 coherent_pool=2M"; }; reserved-memory { q6_mem_regions: q6_mem_regions@4B000000 { no-map; reg = <0x0 0x4B000000 0x0 0x3900000>; }; q6_code_data: q6_code_data@4B000000 { no-map; reg = <0x0 0x4B000000 0x0 01000000>; }; q6_ipq5018_data: q6_ipq5018_data@4C000000 { no-map; reg = <0x0 0x4C000000 0x0 0xE00000>; }; m3_dump: m3_dump@4CE00000 { no-map; reg = <0x0 0x4CE00000 0x0 0x100000>; }; q6_etr_region: q6_etr_dump@4CF00000 { no-map; reg = <0x0 0x4CF00000 0x0 0x100000>; }; q6_caldb_region: q6_caldb_region@4D000000 { no-map; reg = <0x0 0x4D000000 0x0 0x200000>; }; q6_qcn6122_data1: q6_qcn6122_data1@4D200000 { no-map; reg = <0x0 0x4D200000 0x0 0x1000000>; }; m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 { no-map; reg = <0x0 0x4E200000 0x0 0x100000>; }; q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 { no-map; reg = <0x0 0x4E300000 0x0 0x100000>; }; q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 { no-map; reg = <0x0 0x4E400000 0x0 0x500000>; }; }; soc { ess-instance { num_devices = <0x2>; ess-switch@0x39c00000 { compatible = "qcom,ess-switch-ipq50xx"; device_id = <0>; switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/ cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/ qcom,port_phyinfo { port@0 { port_id = <1>; phy_address = <7>; }; port@1 { port_id = <2>; forced-speed = <1000>; forced-duplex = <1>; }; }; }; ess-switch1@1 { compatible = "qcom,ess-switch-qca83xx"; device_id = <1>; switch_access_mode = "mdio"; mdio-bus = <&mdio1>; reset_gpio = <&tlmm 39 0>; switch_cpu_bmp = <0x40>; /* cpu port bitmap */ switch_lan_bmp = <0x1e>; /* lan port bitmap */ switch_wan_bmp = <0x0>; /* wan port bitmap */ qca,ar8327-initvals = < 0x00004 0x7600000 /* PAD0_MODE */ 0x00008 0x1000000 /* PAD5_MODE */ 0x0000c 0x80 /* PAD6_MODE */ 0x00010 0x2613a0 /* PORT6 FORCE MODE*/ 0x000e4 0xaa545 /* MAC_POWER_SEL */ 0x000e0 0xc74164de /* SGMII_CTRL */ 0x0007c 0x4e /* PORT0_STATUS */ 0x00094 0x4e /* PORT6_STATUS */ >; qcom,port_phyinfo { port@0 { port_id = <1>; phy_address = <0>; }; port@1 { port_id = <2>; phy_address = <1>; }; port@2 { port_id = <3>; phy_address = <2>; }; port@3 { port_id = <4>; phy_address = <3>; }; }; }; }; dp1 { device_type = "network"; compatible = "qcom,nss-dp"; clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>; clock-names = "nss-snoc-gmac-axi-clk"; qcom,id = <1>; reg = <0x39C00000 0x10000>; interrupts = ; qcom,mactype = <2>; qcom,link-poll = <1>; qcom,phy-mdio-addr = <7>; mdio-bus = <&mdio0>; local-mac-address = [000000000000]; phy-mode = "sgmii"; qcom,rx-page-mode = <0>; }; dp2 { device_type = "network"; compatible = "qcom,nss-dp"; clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>; clock-names = "nss-snoc-gmac-axi-clk"; qcom,id = <2>; reg = <0x39D00000 0x10000>; interrupts = ; qcom,mactype = <2>; local-mac-address = [000000000000]; phy-mode = "sgmii"; qcom,rx-page-mode = <0>; }; }; keys { compatible = "gpio-keys"; pinctrl-0 = <&button_pins>; pinctrl-names = "default"; reset { label = "reset"; linux,code = ; gpios = <&tlmm 25 GPIO_ACTIVE_LOW>; linux,input-type = <1>; debounce-interval = <60>; }; wps { label = "wps"; linux,code = ; gpios = <&tlmm 38 GPIO_ACTIVE_LOW>; linux,input-type = <1>; debounce-interval = <60>; }; }; leds { compatible = "gpio-leds"; pinctrl-0 = <&leds_pins>; pinctrl-names = "default"; led_blue: status_blue { label = "blue:status"; gpio = <&tlmm 31 GPIO_ACTIVE_HIGH>; }; led_green: status_green { label = "green:status"; gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; }; led_red: status_red { label = "red:status"; gpio = <&tlmm 33 GPIO_ACTIVE_HIGH>; }; }; }; &blsp1_uart1 { status = "ok"; }; &mdio0 { status = "ok"; ethernet-phy@0 { reg = <7>; }; }; &mdio1 { pinctrl-0 = <&mdio1_pins>; pinctrl-names = "default"; phy-reset-gpio = <&tlmm 39 0>; status = "ok"; ethernet-phy@0 { reg = <0>; }; ethernet-phy@1 { reg = <1>; }; ethernet-phy@2 { reg = <2>; }; ethernet-phy@3 { reg = <3>; }; }; &q6v5_wcss { compatible = "qcom,ipq5018-q6-mpd"; firmware = "IPQ5018/q6_fw.mdt"; #address-cells = <1>; #size-cells = <1>; ranges; reg = <0x0cd00000 0x4040>, <0x1938000 0x8>, <0x193d204 0x4>; reg-names = "qdsp6", "tcsr-msip", "tcsr-q6"; resets = <&gcc GCC_WCSSAON_RESET>, <&gcc GCC_WCSS_Q6_BCR>; reset-names = "wcss_aon_reset", "wcss_q6_reset"; clocks = <&gcc GCC_Q6_AXIS_CLK>, <&gcc GCC_WCSS_ECAHB_CLK>, <&gcc GCC_Q6_AXIM_CLK>, <&gcc GCC_Q6_AXIM2_CLK>, <&gcc GCC_Q6_AHB_CLK>, <&gcc GCC_Q6_AHB_S_CLK>, <&gcc GCC_WCSS_AXI_S_CLK>; clock-names = "gcc_q6_axis_clk", "gcc_wcss_ecahb_clk", "gcc_q6_axim_clk", "gcc_q6_axim2_clk", "gcc_q6_ahb_clk", "gcc_q6_ahb_s_clk", "gcc_wcss_axi_s_clk"; memory-region = <&q6_mem_regions>, <&q6_etr_region>, <&q6_caldb_region>; qcom,rproc = <&q6v5_wcss>; qcom,bootargs_smem = <507>; boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>, <0x2 0x4 0x2 0x12 0x0 0x0>; }; &sdhc_1 { pinctrl-0 = <&emmc_pins>; pinctrl-names = "default"; status = "ok"; }; &tlmm { button_pins: button_pins { mux { pins = "gpio25", "gpio38"; function = "gpio"; drive-strength = <8>; bias-pull-up; }; }; leds_pins: leds_pins { mux { pins = "gpio31", "gpio32", "gpio33"; function = "gpio"; drive-strength = <8>; bias-pull-down; output-low; }; }; mdio1_pins: mdio_pinmux { mux_0 { pins = "gpio36"; function = "mdc"; drive-strength = <8>; bias-pull-up; }; mux_1 { pins = "gpio37"; function = "mdio"; drive-strength = <8>; bias-pull-up; }; }; emmc_pins: emmc_pins { emmc_clk { pins = "gpio9"; function = "sdc1_clk"; drive-strength = <8>; bias-disable; }; emmc_cmd { pins = "gpio8"; function = "sdc1_cmd"; drive-strength = <8>; bias-pull-up; }; emmc_data { pins = "gpio4", "gpio5", "gpio6", "gpio7"; function = "sdc1_data"; drive-strength = <8>; bias-disable; }; }; }; &wifi { qcom,multipd_arch; qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; qcom,rproc = <&q6_wcss_pd1>; qcom,board_id = <0x24>; qcom,bdf-addr = <0x0 0x4C000000 0x4C000000 0x0 0x0>; qcom,caldb-addr = <0x0 0x4D000000 0 0 0>; mem-region = <&q6_ipq5018_data>; qcom,caldb-size = <0x200000>; status = "ok"; }; &wifi1 { qcom,multipd_arch; qcom,userpd-subsys-name = "q6v5_wcss_userpd2"; qcom,rproc = <&q6_wcss_pd2>; qcom,tgt-mem-mode = <1>; qcom,board_id = <0x60>; qcom,bdf-addr = <0x0 0x4D200000 0x4CF00000 0x0 0x0>; qcom,caldb-addr = <0x0 0x4E400000 0 0 0>; mem-region = <&q6_qcn6122_data1>; qcom,caldb-size = <0x500000>; status = "ok"; }; ================================================ FILE: devices/qualcommax_ipq50xx/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) ================================================ FILE: devices/qualcommax_ipq50xx/patches/ath11k-smallbuffers.patch ================================================ From 2858400d263dae0d476f88a7cb7c4540eeb7783f Mon Sep 17 00:00:00 2001 From: Ziyang Huang Date: Fri, 9 Jan 2026 23:15:13 +0800 Subject: [PATCH] mac80211: ath11k: provide smallbuffers variant Signed-off-by: Ziyang Huang --- package/kernel/mac80211/Makefile | 1 + package/kernel/mac80211/ath.mk | 23 ++++++++-- ...introduct-CONFIG_ATH11K_SMALLBUFFERS.patch | 43 +++++++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath11k/951-wifi-ath11k-introduct-CONFIG_ATH11K_SMALLBUFFERS.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 0beb264db16c38..864b0af8a6cebf 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -280,6 +280,7 @@ C_DEFINES= ifeq ($(BUILD_VARIANT),smallbuffers) C_DEFINES+= -DCONFIG_ATH10K_SMALLBUFFERS + C_DEFINES+= -DCONFIG_ATH11K_SMALLBUFFERS endif MAKE_OPTS:= \ diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 9adb8914cd5829..e87cef5600e75b 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -1,6 +1,6 @@ PKG_DRIVERS += \ ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k ath10k-smallbuffers \ - ath11k ath11k-ahb ath11k-pci ath12k carl9170 owl-loader ar5523 wil6210 qcom-qmi-helpers + ath11k ath11k-smallbuffers ath11k-ahb ath11k-pci ath12k carl9170 owl-loader ar5523 wil6210 qcom-qmi-helpers PKG_CONFIG_DEPENDS += \ CONFIG_PACKAGE_ATH_DEBUG \ @@ -65,7 +65,8 @@ config-$(CONFIG_ATH12K_THERMAL) += ATH12K_THERMAL config-$(call config_package,ath9k-htc) += ATH9K_HTC config-$(call config_package,ath10k,regular) += ATH10K ATH10K_PCI config-$(call config_package,ath10k-smallbuffers,smallbuffers) += ATH10K ATH10K_PCI ATH10K_SMALLBUFFERS -config-$(call config_package,ath11k) += ATH11K +config-$(call config_package,ath11k,regular) += ATH11K +config-$(call config_package,ath11k-smallbuffers,smallbuffers) += ATH11K ATH11K_SMALLBUFFERS config-$(call config_package,ath11k-ahb) += ATH11K_AHB config-$(call config_package,ath11k-pci) += ATH11K_PCI config-$(call config_package,ath12k) += ATH12K @@ -312,16 +313,24 @@ define KernelPackage/ath10k-smallbuffers PROVIDES:=@kmod-ath10k-any endef -define KernelPackage/ath11k +define KernelPackage/ath11k/Default $(call KernelPackage/mac80211/Default) TITLE:=Qualcomm 802.11ax wireless chipset support (common code) URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath11k DEPENDS+= +kmod-ath +@DRIVER_11AC_SUPPORT +@DRIVER_11AX_SUPPORT \ +kmod-crypto-michael-mic +ATH11K_THERMAL:kmod-hwmon-core \ +ATH11K_THERMAL:kmod-thermal +kmod-qcom-qmi-helpers + PROVIDES:=kmod-ath11k FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k.ko endef +define KernelPackage/ath11k + $(call KernelPackage/ath11k/Default) + VARIANT:=regular + DEFAULT_VARIANT:=1 + CONFLICTS:=kmod-ath11k-smallbuffers +endef + define KernelPackage/ath11k/description This module adds support for Qualcomm Technologies 802.11ax family of chipsets. @@ -331,11 +340,17 @@ define KernelPackage/ath11k/config config ATH11K_THERMAL bool "Enable thermal sensors and throttling support" - depends on PACKAGE_kmod-ath11k + depends on PACKAGE_kmod-ath11k || PACKAGE_kmod-ath11k-smallbuffers default y if TARGET_qualcommax endef +define KernelPackage/ath11k-smallbuffers + $(call KernelPackage/ath11k/Default) + TITLE+= (small buffers for low-RAM devices) + VARIANT:=smallbuffers +endef + define KernelPackage/ath11k-ahb $(call KernelPackage/mac80211/Default) TITLE:=Qualcomm 802.11ax AHB wireless chipset support diff --git a/package/kernel/mac80211/patches/ath11k/951-wifi-ath11k-introduct-CONFIG_ATH11K_SMALLBUFFERS.patch b/package/kernel/mac80211/patches/ath11k/951-wifi-ath11k-introduct-CONFIG_ATH11K_SMALLBUFFERS.patch new file mode 100644 index 00000000000000..aa56ac0600f370 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/951-wifi-ath11k-introduct-CONFIG_ATH11K_SMALLBUFFERS.patch @@ -0,0 +1,43 @@ +From 4032fbc94b8cde0ff761b6dd6a278420e6f052b4 Mon Sep 17 00:00:00 2001 +From: Ziyang Huang +Date: Sun, 8 Sep 2024 16:52:04 +0800 +Subject: [PATCH 1/1] wifi: ath11k: introduct CONFIG_ATH11K_SMALLBUFFERS + +Signed-off-by: Ziyang Huang +--- + drivers/net/wireless/ath/ath11k/dp.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h +index 7a55afd33be8..d3d3b2aa800c 100644 +--- a/drivers/net/wireless/ath/ath11k/dp.h ++++ b/drivers/net/wireless/ath/ath11k/dp.h +@@ -206,7 +206,7 @@ struct ath11k_pdev_dp { + #define DP_WBM_RELEASE_RING_SIZE 64 + #define DP_TCL_DATA_RING_SIZE 512 + #define DP_TCL_DATA_RING_SIZE_WCN6750 2048 +-#define DP_TX_COMP_RING_SIZE 32768 ++#define DP_TX_COMP_RING_SIZE (!IS_ENABLED(CONFIG_ATH11K_SMALLBUFFERS) ? 32768 : 2048) + #define DP_TX_IDR_SIZE DP_TX_COMP_RING_SIZE + #define DP_TCL_CMD_RING_SIZE 32 + #define DP_TCL_STATUS_RING_SIZE 32 +@@ -217,12 +217,12 @@ struct ath11k_pdev_dp { + #define DP_REO_EXCEPTION_RING_SIZE 128 + #define DP_REO_CMD_RING_SIZE 256 + #define DP_REO_STATUS_RING_SIZE 2048 +-#define DP_RXDMA_BUF_RING_SIZE 4096 ++#define DP_RXDMA_BUF_RING_SIZE (!IS_ENABLED(CONFIG_ATH11K_SMALLBUFFERS) ? 4096 : 1024) + #define DP_RXDMA_REFILL_RING_SIZE 2048 + #define DP_RXDMA_ERR_DST_RING_SIZE 1024 +-#define DP_RXDMA_MON_STATUS_RING_SIZE 1024 +-#define DP_RXDMA_MONITOR_BUF_RING_SIZE 4096 +-#define DP_RXDMA_MONITOR_DST_RING_SIZE 2048 ++#define DP_RXDMA_MON_STATUS_RING_SIZE (!IS_ENABLED(CONFIG_ATH11K_SMALLBUFFERS) ? 1024 : 512) ++#define DP_RXDMA_MONITOR_BUF_RING_SIZE (!IS_ENABLED(CONFIG_ATH11K_SMALLBUFFERS) ? 4096 : 128) ++#define DP_RXDMA_MONITOR_DST_RING_SIZE (!IS_ENABLED(CONFIG_ATH11K_SMALLBUFFERS) ? 2048 : 128) + #define DP_RXDMA_MONITOR_DESC_RING_SIZE 4096 + + #define DP_RX_RELEASE_RING_NUM 3 +-- +2.40.1 + ================================================ FILE: devices/qualcommax_ipq50xx/patches/fix.patch ================================================ diff --git a/target/linux/qualcommax/patches-6.12/999-fix-netdev-cacheline-size.patch b/target/linux/qualcommax/patches-6.12/999-fix-netdev-cacheline-size.patch new file mode 100644 index 00000000000000..1481f8844bf45e --- /dev/null +++ b/target/linux/qualcommax/patches-6.12/999-fix-netdev-cacheline-size.patch @@ -0,0 +1,11 @@ +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -12060,7 +12060,7 @@ static void __init net_dev_struct_check(void) + #ifdef CONFIG_NET_XGRESS + CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_tx, tcx_egress); + #endif +- CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160); ++ CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 192); + + /* TXRX read-mostly hotpath */ + CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, lstats); --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -57,6 +57,18 @@ define Device/glinet_gl-b3000 endef TARGET_DEVICES += glinet_gl-b3000 +define Device/jdcloud_re-cs-03 + $(call Device/FitImage) + $(call Device/EmmcImage) + SOC := ipq5018 + BLOCKSIZE := 64k + KERNEL_SIZE := 6144k + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := AX3000 + DEVICE_DTS_CONFIG := config@mp03.5-c2 +endef +TARGET_DEVICES += jdcloud_re-cs-03 + define Device/iodata_wn-dax3000gr $(call Device/FitImageLzma) DEVICE_VENDOR := I-O DATA --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -120,6 +120,11 @@ platform_do_upgrade() { glinet,gl-b3000) glinet_do_upgrade "$1" ;; + jdcloud,re-cs-03) + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; linksys,mr5500|\ linksys,mx2000|\ linksys,mx5500|\ @@ -157,3 +162,12 @@ platform_do_upgrade() { ;; esac } + +platform_copy_config() { + case "$(board_name)" in + jdcloud,re-cs-03) + emmc_copy_config + ;; + esac + return 0; +} ================================================ FILE: devices/qualcommax_ipq50xx/patches/pz-l8-enable-wifi.patch ================================================ --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -14,6 +14,8 @@ PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk define Build/Compile + $(CP) ./files/board-cmcc_pz-l8.ipq5018 $(PKG_BUILD_DIR)/ + $(CP) ./files/board-cmcc_pz-l8.qcn6122 $(PKG_BUILD_DIR)/ endef # Use ath10k-bdencoder from https://github.com/qca/qca-swiss-army-knife.git @@ -35,6 +35,7 @@ ALLWIFIBOARDS:= \ asus_rt-ax89x \ buffalo_wxr-5950ax12 \ cambiumnetworks_xe34 \ + cmcc_pz-l8 \ cmcc_rm2-6 \ compex_wpq873 \ dynalink_dl-wrx36 \ @@ -218,6 +219,7 @@ $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000)) $(eval $(call generate-ipq-wifi-package,asus_rt-ax89x,Asus RT-AX89X)) $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12)) $(eval $(call generate-ipq-wifi-package,cambiumnetworks_xe34,Cambium Networks XE3-4)) +$(eval $(call generate-ipq-wifi-package,cmcc_pz-l8,CMCC PZ-L8)) $(eval $(call generate-ipq-wifi-package,cmcc_rm2-6,CMCC RM2-6)) $(eval $(call generate-ipq-wifi-package,compex_wpq873,Compex WPQ-873)) $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-pz-l8.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-pz-l8.dts @@ -350,13 +350,12 @@ }; }; -/* - * ath11k Wi-Fi consumes too large memory spaces and too few spaces are - * available for users. To prevent OOM when using LuCI or other softwares, - * disable Wi-Fi related peripherals at the moment. - */ &q6v5_wcss { - status = "disabled"; + boot-args = ; }; &wifi { @@ -368,7 +367,7 @@ ieee80211-freq-limit = <2400000 2483000>; - status = "disabled"; + status = "okay"; }; &wifi1 { @@ -382,5 +381,5 @@ ieee80211-freq-limit = <5150000 5730000>; - status = "disabled"; + status = "okay"; }; --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -46,6 +46,7 @@ define Device/cmcc_pz-l8 PAGESIZE := 2048 IMAGE_SIZE := 59392k NAND_SIZE := 128m + DEVICE_PACKAGES := kmod-ath11k-smallbuffers ath11k-firmware-ipq5018-qcn6122 ipq-wifi-cmcc_pz-l8 endef TARGET_DEVICES += cmcc_pz-l8 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -39,6 +39,12 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + cmcc,pz-l8) + caldata_extract "0:art" 0x1000 0x20000 + label_mac=$(cat /sys/class/net/eth0/address) + ath11k_patch_mac $(macaddr_add $label_mac 2) 0 + ath11k_set_macflag + ;; xiaomi,ax6000) caldata_extract "0:art" 0x1000 0x20000 ;; @@ -88,6 +94,12 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; + cmcc,pz-l8) + caldata_extract "0:art" 0x1000 0x20000 + label_mac=$(cat /sys/class/net/eth0/address) + ath11k_patch_mac $(macaddr_add $label_mac 3) 0 + ath11k_set_macflag + ;; esac ;; "ath11k/QCN6122/hw1.0/cal-ahb-b00b040.wifi.bin") --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-pz-l8.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-pz-l8.dts @@ -232,6 +232,18 @@ #address-cells = <1>; #size-cells = <0>; + port@0 { + reg = <0>; + phy-mode = "sgmii"; + ethernet = <&dp2>; + qca,sgmii-enable-pll; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + port@1 { reg = <1>; label = "lan3"; @@ -256,26 +268,11 @@ phy-handle = <&qca8337_3>; }; - /* - * WAN cannot work if added - * port@5 { - * reg = <5>; - * phy-handle = <&qca8337_4>; - * phy-mode = "gmii"; - * ethernet = <&dp1>; - * }; - */ - - port@6 { - reg = <6>; - phy-mode = "sgmii"; - ethernet = <&dp2>; - qca,sgmii-enable-pll; - - fixed-link { - speed = <1000>; - full-duplex; - }; + port@5 { + reg = <5>; + phy-handle = <&qca8337_4>; + phy-mode = "gmii"; + ethernet = <&dp1>; }; }; }; --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -16,7 +16,14 @@ ipq50xx_setup_interfaces() glinet,gl-b3000) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; - cmcc,pz-l8|\ + cmcc,pz-l8) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ucidef_set_network_device_conduit "lan1" "eth1" + ucidef_set_network_device_conduit "lan2" "eth1" + ucidef_set_network_device_conduit "lan3" "eth1" + ucidef_set_network_device_conduit "wan" "eth0" + ;; + jdcloud,re-cs-03|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56|\ ================================================ FILE: devices/qualcommax_ipq60xx/.config ================================================ CONFIG_TARGET_qualcommax=y CONFIG_TARGET_qualcommax_ipq60xx=y ================================================ FILE: devices/qualcommax_ipq60xx/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) rm -rf package/boot package/firmware/ipq-wifi target/linux/generic target/linux/qualcommax package/firmware/ath11k-firmware package/kernel/mac80211 package/kernel/nat46 git_clone_path 25.12-nss https://github.com/LiBwrt/openwrt-6.x target/linux/generic target/linux/qualcommax package/boot package/firmware/ipq-wifi package/firmware/ath11k-firmware package/kernel/mac80211 package/kernel/nat46 wget -N https://github.com/LiBwrt/openwrt-6.x/raw/refs/heads/25.12-nss/include/image-commands.mk -P include/ wget -N https://github.com/LiBwrt/openwrt-6.x/raw/refs/heads/25.12-nss/config/Config-ipq.in -P config/ wget -N https://github.com/LiBwrt/openwrt-6.x/raw/refs/heads/25.12-nss/Config.in -P ./ rm -rf feeds/kiddin9/shortcut-fe git clone https://github.com/qosmio/nss-packages.git package/nss-packages git clone https://github.com/qosmio/sqm-scripts-nss.git package/sqm-scripts-nss sed -i "/ECM_INTERFACE_RAWIP_ENABLE/d" package/nss-packages/qca-nss-ecm/Makefile rm -rf package/nss-packages/nss-userspace-oss sed -i "s/luci uboot-envtools wpad-openssl/luci uboot-envtools wpad-mbedtls/" target/linux/qualcommax/Makefile ================================================ FILE: devices/qualcommax_ipq60xx/patches/ax6600.patch ================================================ --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -360,7 +360,7 @@ define Device/jdcloud_re-ss-01 $(call Device/FitImage) $(call Device/EmmcImage) DEVICE_VENDOR := JDCloud - DEVICE_MODEL := RE-SS-01 + DEVICE_MODEL := AX1800 Pro KERNEL_SIZE := 6144k SOC := ipq6000 DEVICE_DTS_CONFIG := config@cp03-c2 @@ -373,7 +373,7 @@ define Device/jdcloud_re-cs-02 $(call Device/FitImage) $(call Device/EmmcImage) DEVICE_VENDOR := JDCloud - DEVICE_MODEL := RE-CS-02 + DEVICE_MODEL := AX6600 KERNEL_SIZE := 6144k SOC := ipq6010 DEVICE_DTS_CONFIG := config@cp03-c3 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -330,7 +330,7 @@ define KernelPackage/ipt-ipopt KCONFIG:=$(KCONFIG_IPT_IPOPT) FILES:=$(foreach mod,$(IPT_IPOPT-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPOPT-m))) - $(call AddDepends/ipt) + $(call AddDepends/ipt,+kmod-nf-conntrack) endef define KernelPackage/ipt-ipopt/description ================================================ FILE: devices/qualcommax_ipq807x/.config ================================================ CONFIG_TARGET_qualcommax=y CONFIG_TARGET_qualcommax_ipq807x=y CONFIG_TARGET_DEVICE_qualcommax_ipq807x_DEVICE_asus_rt-ax89x=n CONFIG_TARGET_DEVICE_qualcommax_ipq807x_DEVICE_netgear_wax218-web-ui=n CONFIG_TARGET_DEVICE_qualcommax_ipq807x_DEVICE_netgear_rax120v2=n ================================================ FILE: devices/qualcommax_ipq807x/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* Copyright (c) 2021, Robert Marko */ /dts-v1/; #include "ipq8071-ax3600.dtsi" / { model = "Xiaomi AX3600"; compatible = "xiaomi,ax3600", "qcom,ipq8074"; aliases { /* Aliases as required by u-boot to patch MAC addresses */ ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; }; chosen { bootargs-append = " root=/dev/ubiblock0_1"; }; leds { compatible = "gpio-leds"; led_system_blue: system-blue { label = "blue:system"; gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; }; led_system_yellow: system-yellow { label = "yellow:system"; gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>; }; network-yellow { label = "yellow:network"; gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>; }; network-blue { label = "blue:network"; gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; }; aiot { label = "blue:aiot"; gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>; linux,default-trigger = "phy0tpt"; }; }; }; &pcie_qmp0 { status = "okay"; }; &pcie0 { status = "okay"; perst-gpio = <&tlmm 52 GPIO_ACTIVE_HIGH>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; ranges; wifi0: wifi@1,0 { status = "okay"; compatible = "qcom,ath10k"; reg = <0x00010000 0 0 0 0>; qcom,ath10k-calibration-variant = "Xiaomi-AX3600"; nvmem-cell-names = "calibration"; nvmem-cells = <&caldata_qca9889>; }; }; }; &wifi { qcom,ath11k-calibration-variant = "Xiaomi-AX3600"; }; &qpic_nand { /delete-node/ partitions; nand@0 { /delete-node/ partitions; partitions { compatible = "qcom,smem-part"; }; }; }; &dp2 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp3 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp4 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp5 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &wifi0 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; ================================================ FILE: devices/qualcommax_ipq807x/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* Copyright (c) 2021, Zhijun You */ /dts-v1/; #include "ipq8071-ax3600.dtsi" / { model = "Redmi AX6"; compatible = "redmi,ax6", "qcom,ipq8074"; aliases { /* Aliases as required by u-boot to patch MAC addresses */ ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; }; chosen { bootargs-append = " root=/dev/ubiblock0_1"; }; leds { compatible = "gpio-leds"; led_system_blue: system-blue { label = "blue:system"; gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; }; led_system_yellow: system-yellow { label = "yellow:system"; gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>; }; network-blue { label = "blue:network"; gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; }; network-yellow { label = "yellow:network"; gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>; }; }; }; /* AX6 can both have NAND of 256MiB or 128MiB. * To be on the safe side, assume 128MiB of NAND. */ &rootfs { reg = <0x2dc0000 0x5220000>; }; &wifi { qcom,ath11k-calibration-variant = "Redmi-AX6"; }; &qpic_nand { /delete-node/ partitions; nand@0 { /delete-node/ partitions; partitions { compatible = "qcom,smem-part"; }; }; }; &dp2 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp3 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp4 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp5 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; ================================================ FILE: devices/qualcommax_ipq807x/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /* Copyright (c) 2021, Robert Marko */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" #include "ipq8074-ess.dtsi" #include #include #include / { model = "Xiaomi AX9000"; compatible = "xiaomi,ax9000", "qcom,ipq8074"; aliases { serial0 = &blsp1_uart5; led-boot = &led_system_yellow; led-failsafe = &led_system_yellow; led-running = &led_system_blue; led-upgrade = &led_system_yellow; /* Aliases as required by u-boot to patch MAC addresses */ ethernet0 = &dp1; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; label-mac-device = &dp5; }; chosen { stdout-path = "serial0:115200n8"; bootargs-append = " root=/dev/ubiblock0_1"; }; keys { compatible = "gpio-keys"; reset { label = "reset"; gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; linux,code = ; }; wps { label = "wps"; /* Labeled Mesh on the device */ gpios = <&tlmm 46 GPIO_ACTIVE_LOW>; linux,code = ; }; }; leds { compatible = "gpio-leds"; led_system_blue: system-blue { label = "blue:system"; gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>; color = ; }; led_system_yellow: system-yellow { label = "yellow:system"; gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>; color = ; }; network-yellow { label = "yellow:network"; gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; color = ; }; network-blue { label = "blue:network"; gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>; color = ; }; top-red { label = "red:top"; gpios = <&tlmm 63 GPIO_ACTIVE_HIGH>; color = ; default-state = "keep"; }; top-green { label = "green:top"; gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>; color = ; default-state = "keep"; }; top-blue { label = "blue:top"; gpios = <&tlmm 66 GPIO_ACTIVE_HIGH>; color = ; default-state = "keep"; }; }; }; &tlmm { mdio_pins: mdio-pins { mdc { pins = "gpio68"; function = "mdc"; drive-strength = <8>; bias-pull-up; }; mdio { pins = "gpio69"; function = "mdio"; drive-strength = <8>; bias-pull-up; }; }; i2c_pins: i2c-pins { pins = "gpio0", "gpio2"; function = "blsp5_i2c"; drive-strength = <8>; bias-disable; }; }; &blsp1_uart5 { status = "okay"; }; &blsp1_i2c6 { status = "okay"; pinctrl-0 = <&i2c_pins>; pinctrl-names = "default"; }; &prng { status = "okay"; }; &cryptobam { status = "okay"; }; &crypto { status = "okay"; }; &qpic_bam { status = "okay"; }; &qpic_nand { status = "okay"; /* * Bootloader will find the NAND DT node by the compatible and * then "fixup" it by adding the partitions from the SMEM table * using the legacy bindings thus making it impossible for us * to change the partition table or utilize NVMEM for calibration. * So add a dummy partitions node that bootloader will populate * and set it as disabled so the kernel ignores it instead of * printing warnings due to the broken way bootloader adds the * partitions. */ partitions { status = "disabled"; }; nand@0 { reg = <0>; nand-ecc-strength = <4>; nand-ecc-step-size = <512>; nand-bus-width = <8>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "0:sbl1"; reg = <0x0 0x100000>; read-only; }; partition@100000 { label = "0:mibib"; reg = <0x100000 0x100000>; read-only; }; partition@200000 { label = "0:bootconfig"; reg = <0x200000 0x80000>; read-only; }; partition@280000 { label = "0:bootconfig1"; reg = <0x280000 0x80000>; read-only; }; partition@300000 { label = "0:qsee"; reg = <0x300000 0x300000>; read-only; }; partition@600000 { label = "0:qsee_1"; reg = <0x600000 0x300000>; read-only; }; partition@900000 { label = "0:devcfg"; reg = <0x900000 0x80000>; read-only; }; partition@980000 { label = "0:devcfg_1"; reg = <0x980000 0x80000>; read-only; }; partition@a00000 { label = "0:apdp"; reg = <0xa00000 0x80000>; read-only; }; partition@a80000 { label = "0:apdp_1"; reg = <0xa80000 0x80000>; read-only; }; partition@b00000 { label = "0:rpm"; reg = <0xb00000 0x80000>; read-only; }; partition@b80000 { label = "0:rpm_1"; reg = <0xb80000 0x80000>; read-only; }; partition@c00000 { label = "0:cdt"; reg = <0xc00000 0x80000>; read-only; }; partition@c80000 { label = "0:cdt_1"; reg = <0xc80000 0x80000>; read-only; }; partition@d00000 { label = "0:appsblenv"; reg = <0xd00000 0x80000>; }; partition@d80000 { label = "0:appsbl"; reg = <0xd80000 0x100000>; read-only; }; partition@e80000 { label = "0:appsbl_1"; reg = <0xe80000 0x100000>; read-only; }; partition@f80000 { label = "0:art"; reg = <0xf80000 0x80000>; read-only; compatible = "nvmem-cells"; #address-cells = <1>; #size-cells = <1>; macaddr_dp1: macaddr@0 { reg = <0x0 0x6>; }; macaddr_dp2: macaddr@6 { reg = <0x6 0x6>; }; macaddr_dp3: macaddr@c { reg = <0xc 0x6>; }; macaddr_dp4: macaddr@12 { reg = <0x12 0x6>; }; macaddr_dp5: macaddr@18 { reg = <0x18 0x6>; }; caldata_qca9889: caldata@4d000 { reg = <0x4d000 0x844>; }; }; partition@1000000 { label = "bdata"; reg = <0x1000000 0x80000>; }; partition@1080000 { /* This is crash + crash_syslog parts combined */ label = "pstore"; reg = <0x1080000 0x100000>; }; partition@1180000 { label = "ubi_kernel"; reg = <0x1180000 0x3800000>; }; partition@4980000 { label = "rootfs"; reg = <0x4980000 0xb680000>; }; }; }; }; &qusb_phy_0 { status = "okay"; }; &ssphy_0 { status = "okay"; }; &usb_0 { status = "okay"; }; &mdio { status = "okay"; pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; }; qca8075_1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; }; qca8075_2: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <2>; }; qca8075_3: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; }; qca8081: ethernet-phy@24 { compatible = "ethernet-phy-id004d.d101"; reg = <24>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; }; }; &switch { status = "okay"; switch_cpu_bmp = <0x1>; /* cpu port bitmap */ switch_lan_bmp = <0x1e>; /* lan port bitmap */ switch_wan_bmp = <0x20>; /* wan port bitmap */ switch_mac_mode = <0xb>; /* mac mode for uniphy instance0*/ switch_mac_mode1 = <0xc>; /* mac mode for uniphy instance1*/ switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/ bm_tick_mode = <0>; /* bm tick mode */ tm_tick_mode = <0>; /* tm tick mode */ qcom,port_phyinfo { port@0 { port_id = <1>; phy_address = <0>; }; port@1 { port_id = <2>; phy_address = <1>; }; port@2 { port_id = <3>; phy_address = <2>; }; port@3 { port_id = <4>; phy_address = <3>; }; port@4 { port_id = <5>; phy_address = <24>; port_mac_sel = "QGMAC_PORT"; }; }; }; &dp1 { status = "okay"; phy-handle = <&qca8075_0>; label = "lan4"; nvmem-cells = <&macaddr_dp1>; nvmem-cell-names = "mac-address"; }; &dp2 { status = "okay"; phy-handle = <&qca8075_1>; label = "lan3"; nvmem-cells = <&macaddr_dp2>; nvmem-cell-names = "mac-address"; }; &dp3 { status = "okay"; phy-handle = <&qca8075_2>; label = "lan2"; nvmem-cells = <&macaddr_dp3>; nvmem-cell-names = "mac-address"; }; &dp4 { status = "okay"; phy-handle = <&qca8075_3>; label = "lan1"; nvmem-cells = <&macaddr_dp4>; nvmem-cell-names = "mac-address"; }; &dp5 { status = "okay"; phy-handle = <&qca8081>; label = "wan"; nvmem-cells = <&macaddr_dp5>; nvmem-cell-names = "mac-address"; }; &edma { status = "okay"; }; &pcie_qmp0 { status = "okay"; }; &pcie0 { status = "okay"; perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; ranges; wifi@1,0 { status = "okay"; /* ath11k has no DT compatible for PCI cards */ compatible = "pci17cb,1104"; reg = <0x00010000 0 0 0 0>; qcom,ath11k-calibration-variant = "Xiaomi-AX9000"; }; }; }; &pcie_qmp1 { status = "okay"; }; &pcie1 { status = "okay"; perst-gpio = <&tlmm 62 GPIO_ACTIVE_HIGH>; bridge@1,0 { reg = <0x00010000 0 0 0 0>; #address-cells = <3>; #size-cells = <2>; ranges; wifi1: wifi@1,0 { status = "okay"; compatible = "qcom,ath10k"; reg = <0x00010000 0 0 0 0>; qcom,ath10k-calibration-variant = "Xiaomi-AX9000"; }; }; }; &wifi { status = "okay"; qcom,ath11k-calibration-variant = "Xiaomi-AX9000"; }; &qpic_nand { /delete-node/ partitions; nand@0 { /delete-node/ partitions; partitions { compatible = "qcom,smem-part"; }; }; }; &dp1 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp2 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp3 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp4 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &dp5 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; &wifi1 { /delete-property/ nvmem-cells; /delete-property/ nvmem-cell-names; }; ================================================ FILE: devices/qualcommax_ipq807x/diy/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nss.dtsi ================================================ // SPDX-License-Identifier: GPL-2.0-only / { nss_dummy_reg: nss-regulator { compatible = "regulator-fixed"; regulator-name = "nss-reg"; regulator-min-microvolt = <848000>; regulator-max-microvolt = <848000>; regulator-always-on; regulator-boot-on; }; }; &soc { nss-common { compatible = "qcom,nss-common"; reg = <0x01868010 0x1000>; reg-names = "nss-misc-reset"; memory-region = <&nss_region>; }; nss0: nss@40000000 { compatible = "qcom,nss"; interrupts = , , , , , , , , , ; reg = <0x39000000 0x1000>, <0x38000000 0x30000>, <0x0b111000 0x1000>; reg-names = "nphys", "vphys", "qgic-phys"; clocks = <&gcc GCC_NSS_NOC_CLK>, <&gcc GCC_NSS_PTP_REF_CLK>, <&gcc GCC_NSS_CSR_CLK>, <&gcc GCC_NSS_CFG_CLK>, <&gcc GCC_NSS_IMEM_CLK>, <&gcc GCC_NSSNOC_QOSGEN_REF_CLK>, <&gcc GCC_MEM_NOC_NSS_AXI_CLK>, <&gcc GCC_NSSNOC_SNOC_CLK>, <&gcc GCC_NSSNOC_TIMEOUT_REF_CLK>, <&gcc GCC_NSS_CE_AXI_CLK>, <&gcc GCC_NSS_CE_APB_CLK>, <&gcc GCC_NSSNOC_CE_AXI_CLK>, <&gcc GCC_NSSNOC_CE_APB_CLK>, <&gcc GCC_NSSNOC_UBI0_AHB_CLK>, <&gcc GCC_UBI0_CORE_CLK>, <&gcc GCC_UBI0_AHB_CLK>, <&gcc GCC_UBI0_AXI_CLK>, <&gcc GCC_UBI0_MPT_CLK>, <&gcc GCC_UBI0_NC_AXI_CLK>; clock-names = "nss-noc-clk", "nss-ptp-ref-clk", "nss-csr-clk", "nss-cfg-clk", "nss-imem-clk", "nss-nssnoc-qosgen-ref-clk", "nss-mem-noc-nss-axi-clk", "nss-nssnoc-snoc-clk", "nss-nssnoc-timeout-ref-clk", "nss-ce-axi-clk", "nss-ce-apb-clk", "nss-nssnoc-ce-axi-clk", "nss-nssnoc-ce-apb-clk", "nss-nssnoc-ahb-clk", "nss-core-clk", "nss-ahb-clk", "nss-axi-clk", "nss-mpt-clk", "nss-nc-axi-clk"; qcom,id = <0>; qcom,num-queue = <4>; qcom,num-irq = <10>; qcom,num-pri = <4>; qcom,load-addr = <0x40000000>; qcom,low-frequency = <187200000>; qcom,mid-frequency = <748800000>; qcom,max-frequency = <1689600000>; qcom,bridge-enabled; qcom,ipv4-enabled; qcom,ipv4-reasm-enabled; qcom,ipv6-enabled; qcom,ipv6-reasm-enabled; qcom,wlanredirect-enabled; qcom,tun6rd-enabled; qcom,l2tpv2-enabled; qcom,gre-enabled; qcom,gre-redir-enabled; qcom,gre-redir-mark-enabled; qcom,map-t-enabled; qcom,portid-enabled; qcom,ppe-enabled; qcom,pppoe-enabled; qcom,pptp-enabled; qcom,tunipip6-enabled; qcom,shaping-enabled; qcom,wlan-dataplane-offload-enabled; qcom,vlan-enabled; qcom,igs-enabled; qcom,vxlan-enabled; qcom,match-enabled; qcom,mirror-enabled; qcom,udp-st-enabled; mx-supply = <&nss_dummy_reg>; npu-supply = <&nss_dummy_reg>; }; nss1: nss@40800000 { compatible = "qcom,nss"; interrupts = , , , , , , , , ; reg = <0x39400000 0x1000>, <0x38030000 0x30000>, <0x0b111000 0x1000>; reg-names = "nphys", "vphys", "qgic-phys"; clocks = <&gcc GCC_NSS_NOC_CLK>, <&gcc GCC_NSS_PTP_REF_CLK>, <&gcc GCC_NSS_CSR_CLK>, <&gcc GCC_NSS_CFG_CLK>, <&gcc GCC_NSS_IMEM_CLK>, <&gcc GCC_NSSNOC_QOSGEN_REF_CLK>, <&gcc GCC_MEM_NOC_NSS_AXI_CLK>, <&gcc GCC_NSSNOC_SNOC_CLK>, <&gcc GCC_NSSNOC_TIMEOUT_REF_CLK>, <&gcc GCC_NSS_CE_AXI_CLK>, <&gcc GCC_NSS_CE_APB_CLK>, <&gcc GCC_NSSNOC_CE_AXI_CLK>, <&gcc GCC_NSSNOC_CE_APB_CLK>, <&gcc GCC_NSSNOC_UBI1_AHB_CLK>, <&gcc GCC_UBI1_CORE_CLK>, <&gcc GCC_UBI1_AHB_CLK>, <&gcc GCC_UBI1_AXI_CLK>, <&gcc GCC_UBI1_MPT_CLK>, <&gcc GCC_UBI1_NC_AXI_CLK>; clock-names = "nss-noc-clk", "nss-ptp-ref-clk", "nss-csr-clk", "nss-cfg-clk", "nss-imem-clk", "nss-nssnoc-qosgen-ref-clk", "nss-mem-noc-nss-axi-clk", "nss-nssnoc-snoc-clk", "nss-nssnoc-timeout-ref-clk", "nss-ce-axi-clk", "nss-ce-apb-clk", "nss-nssnoc-ce-axi-clk", "nss-nssnoc-ce-apb-clk", "nss-nssnoc-ahb-clk", "nss-core-clk", "nss-ahb-clk", "nss-axi-clk", "nss-mpt-clk", "nss-nc-axi-clk"; qcom,id = <1>; qcom,num-queue = <4>; qcom,num-irq = <9>; qcom,num-pri = <4>; qcom,load-addr = <0x40800000>; qcom,capwap-enabled; qcom,dtls-enabled; qcom,tls-enabled; qcom,crypto-enabled; qcom,ipsec-enabled; qcom,qvpn-enabled; qcom,pvxlan-enabled; qcom,clmap-enabled; qcom,rmnet_rx-enabled; }; nss_crypto: qcom,nss_crypto { compatible = "qcom,nss-crypto"; #address-cells = <1>; #size-cells = <1>; qcom,max-contexts = <64>; qcom,max-context-size = <32>; ranges; eip197_node { compatible = "qcom,eip197"; reg-names = "crypto_pbase"; reg = <0x39800000 0x7ffff>; clocks = <&gcc GCC_NSS_CRYPTO_CLK>, <&gcc GCC_NSSNOC_CRYPTO_CLK>, <&gcc GCC_CRYPTO_PPE_CLK>; clock-names = "crypto_clk", "crypto_nocclk", "crypto_ppeclk"; clock-frequency = /bits/ 64 <600000000 600000000 300000000>; qcom,dma-mask = <0xff>; qcom,transform-enabled; qcom,aes128-cbc; qcom,aes192-cbc; qcom,aes256-cbc; qcom,aes128-ctr; qcom,aes192-ctr; qcom,aes256-ctr; qcom,aes128-ecb; qcom,aes192-ecb; qcom,aes256-ecb; qcom,3des-cbc; qcom,md5-hash; qcom,sha160-hash; qcom,sha224-hash; qcom,sha384-hash; qcom,sha512-hash; qcom,sha256-hash; qcom,md5-hmac; qcom,sha160-hmac; qcom,sha224-hmac; qcom,sha256-hmac; qcom,sha384-hmac; qcom,sha512-hmac; qcom,aes128-gcm-gmac; qcom,aes192-gcm-gmac; qcom,aes256-gcm-gmac; qcom,aes128-cbc-md5-hmac; qcom,aes128-cbc-sha160-hmac; qcom,aes192-cbc-md5-hmac; qcom,aes192-cbc-sha160-hmac; qcom,aes256-cbc-md5-hmac; qcom,aes256-cbc-sha160-hmac; qcom,aes128-ctr-sha160-hmac; qcom,aes192-ctr-sha160-hmac; qcom,aes256-ctr-sha160-hmac; qcom,aes128-ctr-md5-hmac; qcom,aes192-ctr-md5-hmac; qcom,aes256-ctr-md5-hmac; qcom,3des-cbc-md5-hmac; qcom,3des-cbc-sha160-hmac; qcom,aes128-cbc-sha256-hmac; qcom,aes192-cbc-sha256-hmac; qcom,aes256-cbc-sha256-hmac; qcom,aes128-ctr-sha256-hmac; qcom,aes192-ctr-sha256-hmac; qcom,aes256-ctr-sha256-hmac; qcom,3des-cbc-sha256-hmac; qcom,aes128-cbc-sha384-hmac; qcom,aes192-cbc-sha384-hmac; qcom,aes256-cbc-sha384-hmac; qcom,aes128-ctr-sha384-hmac; qcom,aes192-ctr-sha384-hmac; qcom,aes256-ctr-sha384-hmac; qcom,aes128-cbc-sha512-hmac; qcom,aes192-cbc-sha512-hmac; qcom,aes256-cbc-sha512-hmac; qcom,aes128-ctr-sha512-hmac; qcom,aes192-ctr-sha512-hmac; qcom,aes256-ctr-sha512-hmac; engine0 { reg_offset = <0x80000>; qcom,ifpp-enabled; qcom,ipue-enabled; qcom,ofpp-enabled; qcom,opue-enabled; }; }; }; }; ================================================ FILE: devices/qualcommax_ipq807x/diy/target/linux/qualcommax/patches-6.12/0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch ================================================ From ad2d07f71739351eeea1d8a120c0918e2c4b265f Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 22 Dec 2021 12:23:34 +0100 Subject: [PATCH] arm64: dts: ipq8074: add reserved memory nodes IPQ8074 has multiple reserved memory ranges, if they are not defined then weird things tend to happen, board hangs and resets when PCI or WLAN is used etc. So, to avoid all of that add the reserved memory nodes from the downstream 5.4 kernel from QCA. This is their default layout meant for devices with 1GB of RAM, but devices with lower ammounts can override the Q6 node. Signed-off-by: Robert Marko --- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -86,6 +86,16 @@ #size-cells = <2>; ranges; + nss_region: nss@40000000 { + no-map; + reg = <0x0 0x40000000 0x0 0x01000000>; + }; + + tzapp_region: tzapp@4a400000 { + no-map; + reg = <0x0 0x4a400000 0x0 0x00200000>; + }; + smem@4ab00000 { compatible = "qcom,smem"; reg = <0x0 0x4ab00000 0x0 0x00100000>; @@ -108,6 +118,21 @@ reg = <0x0 0x4ac00000 0x0 0x400000>; no-map; }; + + q6_region: wcnss@4b000000 { + no-map; + reg = <0x0 0x4b000000 0x0 0x05f00000>; + }; + + q6_etr_region: q6_etr_dump@50f00000 { + no-map; + reg = <0x0 0x50f00000 0x0 0x00100000>; + }; + + m3_dump_region: m3_dump@51000000 { + no-map; + reg = <0x0 0x51000000 0x0 0x100000>; + }; }; firmware { ================================================ FILE: devices/qualcommax_ipq807x/diy.sh ================================================ #!/bin/bash shopt -s extglob ================================================ FILE: devices/qualcommax_ipq807x/patches/04-stock.patch ================================================ --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount +++ b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount @@ -9,5 +9,13 @@ boot() { netgear,wax630) fw_setenv boot_count 0 ;; + redmi,ax6|\ + xiaomi,ax3600|\ + xiaomi,ax9000) + # OTA handling should not be used. Reset it just in case. + fw_setenv flag_ota_reboot 0 + # Not strictly needed but useful to handle partition crash condition + fw_setenv flag_boot_success 1 + ;; esac } --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -83,20 +83,29 @@ platform_do_upgrade() { redmi,ax6|\ xiaomi,ax3600|\ xiaomi,ax9000) - # Make sure that UART is enabled - fw_setenv boot_wait on - fw_setenv uart_en 1 + part_num="$(fw_printenv -n flag_boot_rootfs)" + if [ "$part_num" -eq "1" ]; then + CI_UBIPART="rootfs_1" + target_num=1 + # Reset fail flag for the current partition + # With both partition set to fail, the partition 2 (bit 1) + # is loaded + fw_setenv flag_try_sys2_failed 0 + else + CI_UBIPART="rootfs" + target_num=0 + # Reset fail flag for the current partition + # or uboot will skip the loading of this partition + fw_setenv flag_try_sys1_failed 0 + fi + + # Tell uboot to switch partition + fw_setenv flag_boot_rootfs "$target_num" + fw_setenv flag_last_success "$target_num" - # Enforce single partition. - fw_setenv flag_boot_rootfs 0 - fw_setenv flag_last_success 0 - fw_setenv flag_boot_success 1 - fw_setenv flag_try_sys1_failed 8 - fw_setenv flag_try_sys2_failed 8 + # Reset success flag + fw_setenv flag_boot_success 0 - # Kernel and rootfs are placed in 2 different UBI - CI_KERN_UBIPART="ubi_kernel" - CI_ROOT_UBIPART="rootfs" nand_do_upgrade "$1" ;; *) --- /dev/null +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,20 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +board=$(board_name) + +case "$FIRMWARE" in +"ath10k/cal-pci-0000:01:00.0.bin") + case "$board" in + xiaomi,ax3600) + caldata_extract "0:art" 0x33000 0x844 + ;; + esac + ;; +*) + exit 1 + ;; +esac ================================================ FILE: devices/ramips_mt7620/.config ================================================ CONFIG_TARGET_ramips=y CONFIG_TARGET_ramips_mt7620=y CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_aigale_ai-br100=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ampedwireless_b1200ex=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_asus_rp-n53=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_buffalo_whr-300hp2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_buffalo_whr-600d=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_buffalo_wmr-300=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_comfast_cf-wr800n=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_dlink_dch-m225=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_dlink_dir-806a-b1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_dlink_dir-810l=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_dlink_dwr-116-a1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_dovado_tiny-ac=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_edimax_br-6208ac-v2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_edimax_br-6478ac-v2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_edimax_ew-7476rpc=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_edimax_ew-7478ac=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_edimax_ew-7478apc=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_humax_e2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_hootoo_ht-tm05=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_iodata_wn-ac1167gr=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_iodata_wn-ac733gr3=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_iptime_a104ns=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_lb-link_bl-w1200=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_linksys_e1700=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_ex2700=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_ex3700=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_ex6120=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_ex6130=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_jwnr2010-v5=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_wn3000rp-v3=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_netgear_wn3100rp-v2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_nexx_wt3020-4m=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_nexx_wt3020-8m=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_phicomm_k2-v22.4=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_phicomm_k2-v22.5=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_phicomm_k2g=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_phicomm_psg1208=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_phicomm_psg1218b=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_planex_cs-qr10=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_planex_db-wrt01=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_planex_mzk-750dhp=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_planex_mzk-ex300np=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_planex_mzk-ex750np=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ralink_mt7620a-evb=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ralink_mt7620a-mt7530-evb=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ralink_mt7620a-mt7610e-evb=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ralink_mt7620a-v22sg-evb=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_ravpower_rp-wd03=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_rostelecom_rt-fl-1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_rostelecom_s1010=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_sitecom_wlr-4100-v1-002=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_snr_cpe-w4n-mt=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-c20i=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-c20-v1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-c2-v1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-c5-v4=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-c50-v1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_archer-mr200=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_ec220-g5-v2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_re200-v1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_tplink_re210-v1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_trendnet_tew-810dr=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_trendnet_tha103ac=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_vonets_var11n-300=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_wavlink_wl-wn530hg4=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_wavlink_wl-wn531g3=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_wavlink_wl-wn531g3-a2=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_wavlink_wl-wn535k1=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_wavlink_wl-wn579x3=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_yukai_bocco=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zbtlink_zbt-cpe102=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zbtlink_zbt-wa05=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zbtlink_zbt-we2026=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zbtlink_zbt-wr8305rt=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zte_q7=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zyxel_keenetic-lite-iii-a=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zyxel_keenetic-omni=n CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_zyxel_keenetic-omni-ii=n ================================================ FILE: devices/ramips_mt7620/diy.sh ================================================ #!/bin/bash shopt -s extglob sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true sed -i '/# start dockerd/,/# end dockerd/d' .config ================================================ FILE: devices/ramips_mt7620/patches/mir3.patch ================================================ From aa2cc7b9d5124216f0ea377f9ffe28e494da20c6 Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sat, 18 Nov 2017 21:35:39 +0800 Subject: [PATCH] ramips: add xiaomi_miwifi-r3 support Specification: - CPU: 580 MHz - Flash size: 128 MiB NAND - RAM size: 128 MiB DDR2 - Wireless No1: SoC-integrated: MT7620A 2x2 MIMO 802.11b/g/n (2.4 GHz) - Wireless No2: On-board chip: MT7612E 2x2 MIMO 802.11a/n/ac (5 GHz) - Switch: MT7620 built-in 10/100 switch w/ vlan support - USB: 2.0 x1 Flash instructions: 1. access ssh via https://wiki.openwrt.org/toh/xiaomi/mir3 2. in ssh: nvram set flag_last_success=1 nvram set boot_wait=on nvram set uart_en=1 nvram commit mtd write lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin kernel1 mtd write lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin rootfs0 reboot If you want to revert back to stock fw while on LEDE: insert usb stick (FAT/FAT32) with stock fw renamed to miwifi.bin fw_setenv flag_last_success 0 power off the device hold the reset button and power on the device, keep holding the reset button until yellow led starts blinking. Signed-off-by: Chen Minqiang --- package/boot/uboot-tools/uboot-envtools/files/ramips | 1 + .../ramips/dts/mt7620a_xiaomi_miwifi-r3.dts | 187 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 17 ++ .../mt7620/base-files/etc/board.d/02_network | 8 + .../mt7620/base-files/lib/upgrade/platform.sh | 7 + 5 files changed, 220 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts diff --git a/package/boot/uboot-tools/uboot-envtools/files/ramips b/package/boot/uboot-tools/uboot-envtools/files/ramips index 05ca7ffd12c8..6afc4470f7a7 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/ramips +++ b/package/boot/uboot-tools/uboot-envtools/files/ramips @@ -79,6 +79,7 @@ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ +xiaomi,miwifi-r3|\ xiaomi,redmi-router-ac2100) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x4000" "0x20000" diff --git a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts new file mode 100644 index 000000000000..301b6e3a02e6 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts @@ -0,0 +1,187 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "xiaomi,miwifi-r3", "ralink,mt7620a-soc"; + model = "Xiaomi Mi Router R3"; + + aliases { + led-status = &led_status_blue; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: blue { + label = "blue:status"; + gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + yellow { + label = "yellow:status"; + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + }; + + red { + label = "red:status"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + }; + + nand { + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + compatible = "mtk,mt7620-nand"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "Config"; + reg = <0x40000 0x40000>; + }; + + partition@80000 { + label = "Bdata"; + reg = <0x80000 0x40000>; + read-only; + }; + + factory: partition@0xc0000 { + label = "factory"; + reg = <0xc0000 0x40000>; + read-only; + }; + + partition@100000 { + label = "crash"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "crash_syslog"; + reg = <0x140000 0x40000>; + read-only; + }; + + partition@180000 { + label = "reserved0"; + reg = <0x180000 0x80000>; + read-only; + }; + + partition@200000 { + label = "kernel_stock"; + reg = <0x200000 0x400000>; + }; + + partition@600000 { + label = "kernel"; + reg = <0x600000 0x400000>; + }; + + /* ubi partition is the result of squashing + * next consequent stock partitions: + * - rootfs0 (rootfs partition for stock kernel0), + * - rootfs1 (rootfs partition for stock failsafe kernel1), + * - overlay (used as ubi overlay in stock fw) + * resulting 117,5MiB space for packages. + */ + partition@a00000 { + label = "ubi"; + reg = <0xa00000 0x7600000>; + }; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + groups = "rgmii1"; + function = "gpio"; + }; + + pa { + groups = "pa"; + function = "pa"; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index a9dea1db57f9..ebf4cfc4117c 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1248,6 +1248,23 @@ define Device/xiaomi_miwifi-mini endef TARGET_DEVICES += xiaomi_miwifi-mini +define Device/xiaomi_miwifi-r3 + SOC := mt7620a + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 32768k + UBINIZE_OPTS := -E 5 + IMAGES += kernel1.bin rootfs0.bin + IMAGE/kernel1.bin := append-kernel | check-size $$$$(KERNEL_SIZE) + IMAGE/rootfs0.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router R3 + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci uboot-envtools +endef +TARGET_DEVICES += xiaomi_miwifi-r3 + define Device/youku_x2 SOC := mt7620a IMAGE_SIZE := 16064k 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 f7bc41669f80..e252b6e04611 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 @@ -278,6 +278,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "4:wan" "6@eth0" ;; + xiaomi,miwifi-r3) + ucidef_add_switch "switch0" \ + "1:lan" "4:lan" "0:wan" "6@eth0" + ;; zbtlink,zbt-we1026-5g-16m) ucidef_add_switch "switch0" \ "0:lan" "6t@eth0" @@ -434,6 +438,10 @@ ramips_setup_macs() tplink,ec220-g5-v2) wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1) ;; + xiaomi,miwifi-r3) + wan_mac=$(mtd_get_mac_binary factory 0x28) + lan_mac=$(macaddr_setbit_la "$wan_mac") + ;; wavlink,wl-wn531g3|\ wavlink,wl-wn531g3-a2|\ zbtlink,zbt-we1026-5g-16m) diff --git a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh index 9f71dc918e50..5519312289fa 100755 --- a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh @@ -30,6 +30,11 @@ platform_do_upgrade() { } default_do_upgrade "$1" ;; + xiaomi,miwifi-r3) + # this make it compatible with breed + dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock" + nand_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; ================================================ FILE: devices/ramips_mt7620/patches/tblsection.patch ================================================ --- a/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm +++ b/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm @@ -123,6 +123,7 @@

    <%=self.title%>

    local isempty, section, i, k = true, nil, nil for i, k in ipairs(self:cfgsections()) do + if i <= 100 then isempty = false section = k @@ -165,6 +166,8 @@

    <%=self.title%>

    <%- end -%> + <%- i=i+1 -%> + <%- end -%> <%- end -%> <%- if isempty then -%> ================================================ FILE: devices/ramips_mt7621/.config ================================================ CONFIG_TARGET_ramips=y CONFIG_TARGET_ramips_mt7621=y CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_dna_valokuitu-plus-ex400=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-1167gs2-b=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-1750gsv=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-1900gst=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-2533ghbk-i=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-2533ghbk2-t=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-2533gs2=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-x3200gst3=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_iodata_wn-gx300gr=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_linksys_re6500=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_mediatek_ap-mt7621a-v60=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_ruijie_rg-ew1200g-pro-v1.1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_storylink_sap-g3200u3=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_eap235-wall-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_eap613-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_eap615-wall-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_re350-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_re650-v2=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_tl-wpa8631p-v3=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_winstars_ws-wn583a6=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_re650-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_tplink_re500-v1=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_iodata_wnpr2600g=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_iodata_wn-ax1167gr=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-2533gst=n CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_elecom_wrc-1750gs=n ================================================ FILE: devices/ramips_mt7621/diy/target/linux/ramips/dts/mt7621_ht-jsh_0211.dts ================================================ // SPDX-License-Identifier: GPL-2.0-only #include "mt7621.dtsi" #include #include / { compatible = "ht-jsh,0211", "mediatek,mt7621-soc"; model = "HT-JSH-0211"; keys { compatible = "gpio-keys"; reset { label = "reset"; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; linux,code = ; }; }; }; &spi0 { status = "okay"; flash@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "Bootloader"; reg = <0x0 0x30000>; read-only; }; partition@30000 { label = "Config"; reg = <0x30000 0x10000>; read-only; }; factory: partition@40000 { label = "Factory"; reg = <0x40000 0x10000>; read-only; }; partition@50000 { compatible = "denx,uimage"; label = "firmware"; reg = <0x50000 0xfb0000>; }; }; }; }; &pcie { status = "okay"; }; &pcie0 { mt76@0,0 { reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0>; }; }; &gmac0 { mtd-mac-address = <&factory 0xe000>; }; &gmac1 { mtd-mac-address = <&factory 0xe006>; status = "okay"; }; &switch0 { status = "disabled"; }; &state_default { gpio { groups = "i2c"; function = "gpio"; }; }; ================================================ FILE: devices/ramips_mt7621/diy/target/linux/ramips/dts/mt7621_zte_e8820s.dts ================================================ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "mt7621.dtsi" #include #include / { compatible = "zte,e8820s", "mediatek,mt7621-soc"; model = "ZTE E8820S"; aliases { led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; label-mac-device = &gmac0; }; chosen { bootargs = "console=ttyS0,115200"; }; leds { compatible = "gpio-leds"; led_power: power { label = "white:power"; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; led_sys: sys { label = "white:sys"; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; }; keys { compatible = "gpio-keys"; reset { label = "reset"; gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; linux,code = ; }; wps { label = "wps"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; linux,code = ; }; wifi { label = "wifi"; gpios = <&gpio 10 GPIO_ACTIVE_LOW>; linux,code = ; }; }; }; &nand { status = "okay"; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "u-boot"; reg = <0x0 0x80000>; read-only; }; partition@80000 { label = "u-boot-env"; reg = <0x80000 0x80000>; read-only; }; factory: partition@100000 { label = "factory"; reg = <0x100000 0x40000>; read-only; }; partition@140000 { label = "kernel"; reg = <0x140000 0x400000>; }; partition@540000 { label = "ubi"; reg = <0x540000 0x7a40000>; }; }; }; &pcie { status = "okay"; }; &pcie0 { wifi@0,0 { compatible = "pci14c3,7603"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; ieee80211-freq-limit = <2400000 2500000>; led { led-active-low; }; }; }; &pcie1 { wifi@0,0 { compatible = "pci14c3,7662"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; led { led-sources = <2>; led-active-low; }; }; }; &gmac0 { mtd-mac-address = <&factory 0xe000>; }; &gmac1 { mtd-mac-address = <&factory 0xe006>; status = "okay"; }; &switch0 { ports { port@0 { status = "okay"; label = "lan1"; }; port@1 { status = "okay"; label = "lan2"; }; port@2 { status = "okay"; label = "lan3"; }; port@3 { status = "okay"; label = "lan4"; }; port@4 { status = "okay"; label = "wan"; mtd-mac-address = <&factory 0xe000>; }; }; }; &state_default { gpio { groups = "i2c", "jtag", "uart2", "uart3", "wdt"; function = "gpio"; }; }; ================================================ FILE: devices/ramips_mt7621/diy/target/linux/ramips/dts/mt7621_zte_e8820v2.dts ================================================ /dts-v1/; #include "mt7621.dtsi" #include #include / { compatible = "zte,e8820v2", "mediatek,mt7621-soc"; model = "ZTE E8820V2"; aliases { led-boot = &led_sys; led-failsafe = &led_sys; led-running = &led_sys; led-upgrade = &led_sys; }; chosen { bootargs = "console=ttyS0,115200"; }; leds { compatible = "gpio-leds"; led_sys:sys { label = "e8820v2:white:sys"; gpios = <&gpio 29 GPIO_ACTIVE_LOW>; }; led_power:power { label = "e8820v2:white:power"; gpios = <&gpio 31 GPIO_ACTIVE_LOW>; }; }; keys { compatible = "gpio-keys"; reset { label = "reset"; gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,code = ; }; wps { label = "wps"; gpios = <&gpio 24 GPIO_ACTIVE_LOW>; linux,code = ; }; }; }; &spi0 { status = "okay"; m25p80@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "u-boot"; reg = <0x0 0x30000>; read-only; }; partition@30000 { label = "u-boot-env"; reg = <0x30000 0x10000>; read-only; }; factory: partition@40000 { label = "factory"; reg = <0x40000 0x10000>; read-only; }; partition@50000 { compatible = "denx,uimage"; label = "firmware"; reg = <0x50000 0xfb0000>; }; }; }; }; &pcie { status = "okay"; }; &pcie0 { mt76@0,0 { reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; led { led-active-low; }; }; }; &pcie1 { mt76@0,0 { reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; led { led-sources = <2>; led-active-low; }; }; }; &gmac0 { mtd-mac-address = <&factory 0xe000>; }; &switch0 { ports { port@4 { status = "okay"; label = "wan"; mtd-mac-address = <&factory 0xe006>; }; port@0 { status = "okay"; label = "lan1"; }; port@1 { status = "okay"; label = "lan2"; }; port@2 { status = "okay"; label = "lan3"; }; port@3 { status = "okay"; label = "lan4"; }; }; }; &state_default { gpio { groups = "i2c", "uart2", "uart3", "wdt"; function = "gpio"; }; }; ================================================ FILE: devices/ramips_mt7621/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) sed -i "s/DEVICE_MODEL := HC5962$/DEVICE_MODEL := HC5962 \/ B70/" target/linux/ramips/image/mt7621.mk sed -i '/# start dockerd/,/# end dockerd/d' .config sed -i "s/--max-leb-cnt=96/--max-leb-cnt=128/g" target/linux/ramips/image/mt7621.mk ================================================ FILE: devices/ramips_mt7621/patches/02-cr660x.patch ================================================ --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -157,6 +157,55 @@ define Device/nand IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef +define Device/phicomm_k2p-32m + IMAGE_SIZE := 32128k + DEVICE_VENDOR := Phicomm + DEVICE_MODEL := K2P + DEVICE_VARIANT := 32M + SUPPORTED_DEVICES += k2p-32M + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware +endef +TARGET_DEVICES += phicomm_k2p-32m + +define Device/jdcloud_luban + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := Luban 鲁班 + DEVICE_PACKAGES += kmod-mt7915e kmod-mt7915-firmware uboot-envtools kmod-mmc kmod-sdhci kmod-sdhci-mt7620 kmod-fs-ext4 wpad-mini -wpad-basic-mbedtls -coremark -htop -bash -openssh-sftp-server +endef +TARGET_DEVICES += jdcloud_luban + +define Device/zte_e8820s + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 129280k + IMAGES += factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size + DEVICE_VENDOR := ZTE + DEVICE_MODEL := E8820S + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += zte_e8820s + +define Device/zte_e8820v2 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := ZTE + DEVICE_MODEL := E8820V2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb2 \ + kmod-usb-ledtrig-usbport wpad-mini -wpad-basic-mbedtls -coremark -htop -bash -openssh-sftp-server +endef +TARGET_DEVICES += zte_e8820v2 + define Device/adslr_g7 $(Device/dsa-migration) IMAGE_SIZE := 16064k @@ -2427,7 +2486,6 @@ define Device/xiaomi_nand_separate $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Xiaomi - IMAGES += kernel1.bin rootfs0.bin IMAGE/kernel1.bin := append-kernel IMAGE/rootfs0.bin := append-ubi | check-size endef @@ -2511,30 +2569,14 @@ define Device/xiaomi_mi-router-cr660x $(Device/nand) $(Device/uimage-lzma-loader) DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router CR660X / TR60X IMAGE_SIZE := 128512k - IMAGES += firmware.bin - IMAGE/firmware.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size DEVICE_PACKAGES += kmod-mt7915-firmware endef - -define Device/xiaomi_mi-router-cr6606 - $(Device/xiaomi_mi-router-cr660x) - DEVICE_MODEL := Mi Router CR6606 -endef -TARGET_DEVICES += xiaomi_mi-router-cr6606 - -define Device/xiaomi_mi-router-cr6608 - $(Device/xiaomi_mi-router-cr660x) - DEVICE_MODEL := Mi Router CR6608 -endef -TARGET_DEVICES += xiaomi_mi-router-cr6608 - -define Device/xiaomi_mi-router-cr6609 - $(Device/xiaomi_mi-router-cr660x) - DEVICE_MODEL := Mi Router CR6609 -endef -TARGET_DEVICES += xiaomi_mi-router-cr6609 +TARGET_DEVICES += xiaomi_mi-router-cr660x define Device/xiaomi_redmi-router-ac2100 $(Device/xiaomi_nand_separate) --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-cr660x.dtsi" + +/ { + compatible = "xiaomi,mi-router-cr660x", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router CR6606 / CR6608 / CR6609"; +}; --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -131,9 +131,7 @@ tplink,tl-wpa8631p-v3) xiaomi,mi-router-ac2100) ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" ;; -xiaomi,mi-router-cr6606|\ -xiaomi,mi-router-cr6608|\ -xiaomi,mi-router-cr6609) +xiaomi,mi-router-cr660x) ucidef_set_led_netdev "internet" "Internet" "blue:net" "wan" ;; xiaomi,redmi-router-ac2100) --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -28,9 +28,7 @@ ramips_setup_interfaces() tplink,mr600-v2-eu|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ - xiaomi,mi-router-cr6608|\ - xiaomi,mi-router-cr6609|\ + xiaomi,mi-router-cr660x|\ xiaomi,redmi-router-ac2100|\ z-router,zr-2660|\ zyxel,wsm20) --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -151,9 +151,8 @@ platform_do_upgrade() { xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ - xiaomi,mi-router-cr6608|\ - xiaomi,mi-router-cr6609|\ + xiaomi,mi-router-cr660x|\ + zte,e8820s|\ xiaomi,redmi-router-ac2100|\ z-router,zr-2660|\ zyxel,nwa50ax|\ --- a/package/boot/uboot-tools/uboot-envtools/files/ramips +++ b/package/boot/uboot-tools/uboot-envtools/files/ramips @@ -73,9 +73,7 @@ zyxel,nr7101) ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x1000" "0x80000" ;; bolt,arion|\ -xiaomi,mi-router-cr6606|\ -xiaomi,mi-router-cr6608|\ -xiaomi,mi-router-cr6609) +xiaomi,mi-router-cr660x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ;; esac ================================================ FILE: devices/ramips_mt7621/patches/ht-jsh_0211.patch ================================================ diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1908f60bc37bc..bc6a3ac05ae3a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -802,6 +802,15 @@ define Device/huasifei_ws1208v2 endef TARGET_DEVICES += huasifei_ws1208v2 +define Device/ht-jsh_0211 + $(Device/dsa-migration) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := HT-JSH + DEVICE_MODEL := 0211 + DEVICE_PACKAGES := kmod-mt7603 +endef +TARGET_DEVICES += ht-jsh_0211 + define Device/iodata_wn-ax1167gr $(Device/dsa-migration) $(Device/uimage-lzma-loader) --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -112,6 +112,10 @@ ramips_setup_interfaces() dlink,covr-x1860-a1) ucidef_set_interfaces_lan_wan "ethernet" "internet" ;; + ht-jsh,0211) + ucidef_add_switch "switch0" \ + "0:wan" "2:lan" "3:lan" "6u@eth0" "5u@eth1" + ;; elecom,wmc-s1267gs2|\ linksys,re6500|\ netgear,wac104|\ ================================================ FILE: devices/ramips_mt7621/patches/jcg_q20-pb-boot.patch ================================================ --- a/target/linux/ramips/dts/mt7621_jcg_q20.dts +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dts @@ -50,22 +50,6 @@ linux,code = ; }; }; - - ubi-concat { - compatible = "mtd-concat"; - devices = <&ubiconcat0 &ubiconcat1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "ubi"; - reg = <0x0 0x5900000>; - }; - }; - }; }; &nand { @@ -79,12 +63,18 @@ partition@0 { label = "Bootloader"; reg = <0x0 0x80000>; - read-only; }; partition@80000 { - label = "Config"; - reg = <0x80000 0x80000>; + label = "Nvram"; + reg = <0x80000 0x40000>; + read-only; + }; + + partition@c0000 { + label = "Bdata"; + reg = <0xc0000 0x40000>; + read-only; }; factory: partition@100000 { @@ -94,40 +84,26 @@ }; partition@180000 { - label = "kernel"; - reg = <0x180000 0x400000>; - }; - - ubiconcat0: partition@580000 { - label = "ubiconcat0"; - reg = <0x580000 0x1c00000>; - }; - - partition@2180000 { - label = "firmware_backup"; - reg = <0x2180000 0x2000000>; - }; - - partition@4180000 { - label = "rootfs_data_back"; - reg = <0x4180000 0x80000>; + label = "crash"; + reg = <0x180000 0x40000>; read-only; }; - partition@4200000 { - label = "nvram_config"; - reg = <0x4200000 0x80000>; + partition@1c0000 { + label = "crash_log"; + reg = <0x1c0000 0x40000>; read-only; }; - ubiconcat1: partition@4280000 { - label = "ubiconcat1"; - reg = <0x4280000 0x3d00000>; + partition@200000 { + label = "kernel"; + reg = <0x200000 0x400000>; }; - /* - * last 512 KiB are for the bad block table - */ + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7980000>; + }; }; }; ================================================ FILE: devices/ramips_mt7621/patches/k2p_32m.patch ================================================ diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dtsi similarity index 94% rename from target/linux/ramips/dts/mt7621_phicomm_k2p.dts rename to target/linux/ramips/dts/mt7621_phicomm_k2p.dtsi index b18d12608acc7..8f72ac2a48280 100644 --- a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dtsi @@ -4,9 +4,6 @@ #include / { - compatible = "phicomm,k2p", "mediatek,mt7621-soc"; - model = "Phicomm K2P"; - aliases { led-boot = &led_blue; led-failsafe = &led_blue; @@ -47,7 +44,7 @@ &spi0 { status = "okay"; - flash@0 { + flash: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; @@ -81,10 +78,9 @@ read-only; }; - partition@a0000 { + firmware: partition@a0000 { compatible = "denx,uimage"; label = "firmware"; - reg = <0xa0000 0xf60000>; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts new file mode 100644 index 0000000000000..5bad6f2d9562d --- /dev/null +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts @@ -0,0 +1,10 @@ +#include "mt7621_phicomm_k2p.dtsi" + +/ { + compatible = "phicomm,k2p", "mediatek,mt7621-soc"; + model = "Phicomm K2P"; +}; + +&firmware { + reg = <0xa0000 0x1f60000>; +}; diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p-32m.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p-32m.dts new file mode 100644 index 0000000000000..5bad6f2d9562d --- /dev/null +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p-32m.dts @@ -0,0 +1,14 @@ +#include "mt7621_phicomm_k2p.dtsi" + +/ { + compatible = "phicomm,k2p-32m", "mediatek,mt7621-soc"; + model = "Phicomm K2P (32M)"; +}; + +&firmware { + reg = <0xa0000 0x1f60000>; +}; + +&flash { + broken-flash-reset; +}; --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -28,7 +28,8 @@ case "$board" in > /sys${DEVPATH}/macaddress ;; dlink,dir-853-r1|\ - phicomm,k2p) + phicomm,k2p|\ + phicomm,k2p-32m) if [ "$PHYNBR" = "0" ]; then base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -1) macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress ================================================ FILE: devices/ramips_mt7621/patches/luban.patch ================================================ diff --git a/target/linux/ramips/dts/mt7621_jdcloud_luban.dts b/target/linux/ramips/dts/mt7621_jdcloud_luban.dts new file mode 100644 index 0000000..ed1ebed --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jdcloud_luban.dts @@ -0,0 +1,171 @@ +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "jdcloud,luban", "mediatek,mt7621-soc"; + model = "JDCloud luban"; + + aliases { + led-boot = &led_r1; + led-failsafe = &led_r1; + led-running = &led_g1; + led-upgrade = &led_b1; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led_r1: led_r1 { + label = "led_r1"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_b1: led_b1 { + label = "led_b1"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + led_g1: led_g1 { + label = "led_g1"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + broken-flash-reset; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x40000>; + read-only; + }; + + partition@90000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x90000 0xf70000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uart2", "uart3"; + function = "gpio"; + }; +}; + +&sdhci { + status = "okay"; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_3fff4>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_3fffa>; + nvmem-cell-names = "mac-address"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_3fff4: macaddr@3fff4 { + reg = <0x3fff4 0x6>; + }; + + macaddr_factory_3fffa: macaddr@3fffa { + reg = <0x3fffa 0x6>; + }; +}; ================================================ FILE: devices/ramips_mt7621/patches/tblsection.patch ================================================ --- a/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm +++ b/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm @@ -123,6 +123,7 @@

    <%=self.title%>

    local isempty, section, i, k = true, nil, nil for i, k in ipairs(self:cfgsections()) do + if i <= 100 then isempty = false section = k @@ -165,6 +166,8 @@

    <%=self.title%>

    <%- end -%> + <%- i=i+1 -%> + <%- end -%> <%- end -%> <%- if isempty then -%> ================================================ FILE: devices/ramips_mt7621/patches/zte_e8820s.patch ================================================ diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index aad2e32b36210..a6a4707fc295d 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -157,6 +157,16 @@ zyxel,lte5398-m904) ucidef_set_led_netdev "internet" "LTE/3G Internet Activity" "green:internet" "wwan0" "rx tx" ;; +zte,e8820s) + ucidef_set_led_netdev "sys" "SYS_LED" "white:sys" "eth0" "tx rx" + ucidef_set_led_timer "power" "POWER_LED" "white:sys" "100" "8000" + ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "ra0" + ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "rai0" + ;; +zte,e8820v2) + ucidef_set_led_netdev "sys" "SYS_LED" "white:sys" "eth0" "tx rx" + ucidef_set_led_timer "power" "POWER_LED" "white:power" "100" "8000" + ;; esac board_config_flush ================================================ FILE: devices/ramips_mt76x8/.config ================================================ CONFIG_TARGET_ramips=y CONFIG_TARGET_ramips_mt76x8=y CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_7links_wlr-1230=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_7links_wlr-1240=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_alfa-network_awusfree1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_asus_rt-n10p-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_asus_rt-n11p-b1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_asus_rt-n12-vp-b1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_buffalo_wcr-1166ds=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_comfast_cf-wr617ac=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_comfast_cf-wr758ac-v1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_comfast_cf-wr758ac-v2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_cudy_wr1000=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_dlink_dap-1325-a1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_duzun_dm06=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_elecom_wrc-1167fs=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_glinet_vixmini=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_iptime_a3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_iptime_a604m=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_jotale_js76x8-8m=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_mediatek_mt7628an-eval-board=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_mercury_mac1200r-v2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_motorola_mwr03=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_netgear_r6020=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_netgear_r6080=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_rakwireless_rak633=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_totolink_a3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_totolink_lr1200=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c20-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c20-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c50-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c50-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-c50-v6=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_archer-mr200-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re200-v2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re200-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re200-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re205-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re220-v2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re305-v1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re305-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_re365-v1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-mr3020-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-mr3420-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-mr6400-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-mr6400-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wa801nd-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr802n-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr840n-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr840n-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v13=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr841n-v14=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr842n-v5=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr850n-v2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr902ac-v3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_tplink_tl-wr902ac-v4=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_vocore_vocore2-lite=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn531a3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn570ha1=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn575a3=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn576a2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn577a2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_wavlink_wl-wn578a2=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_yuncore_cpe200=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_yuncore_m300=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_zbtlink_zbt-we1226=n CONFIG_TARGET_DEVICE_ramips_mt76x8_DEVICE_zbtlink_zbt-we2426-b=n ================================================ FILE: devices/ramips_mt76x8/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true sed -i '/# start dockerd/,/# end dockerd/d' .config #sh -c "curl -sfL https://patch-diff.githubusercontent.com/raw/openwrt/openwrt/pull/11287.patch | patch -d './' -p1 --forward" #curl -sfL https://raw.githubusercontent.com/x-wrt/x-wrt/master/target/linux/mediatek/patches-5.15/995-0001-hwnat-add-natflow-flow-offload-support.patch -o target/linux/ramips/patches-5.15/995-0001-hwnat-add-natflow-flow-offload-support.patch #svn export --force https://github.com/x-wrt/x-wrt/trunk/target/linux/ramips/files/drivers/net/ethernet/ralink target/linux/ramips/files/drivers/net/ethernet/ralink #sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += luci-app-natflow-users natflow-boot/' target/linux/ramips/Makefile ================================================ FILE: devices/ramips_mt76x8/patches/tblsection.patch ================================================ --- a/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm +++ b/package/feeds/luci/luci-compat/luasrc/view/cbi/tblsection.htm @@ -123,6 +123,7 @@

    <%=self.title%>

    local isempty, section, i, k = true, nil, nil for i, k in ipairs(self:cfgsections()) do + if i <= 100 then isempty = false section = k @@ -165,6 +166,8 @@

    <%=self.title%>

    <%- end -%> + <%- i=i+1 -%> + <%- end -%> <%- end -%> <%- if isempty then -%> ================================================ FILE: devices/rockchip_armv8/.config ================================================ CONFIG_TARGET_rockchip=y CONFIG_TARGET_rockchip_armv8=y CONFIG_TARGET_DEVICE_rockchip_armv8_DEVICE_radxa_rock-pi-4a=n CONFIG_TARGET_KERNEL_PARTSIZE=32 ================================================ FILE: devices/rockchip_armv8/README.md ================================================ Kernel等部分源码来源 https://github.com/coolsnowwolf/lede 感谢 ================================================ FILE: devices/rockchip_armv8/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh rm -rf package/boot target/linux/rockchip git_clone_path master https://github.com/coolsnowwolf/lede target/linux/rockchip package/boot wget -N https://github.com/istoreos/istoreos/raw/refs/heads/istoreos-23.05/target/linux/rockchip/patches-5.15/305-r2s-pwm-fan.patch -P target/linux/rockchip/patches-6.12/ wget -N https://github.com/coolsnowwolf/lede/raw/refs/heads/master/target/linux/generic/backport-6.12/203-v6.15-drivers-base-component-add-function-to-query-the-bound.patch -P target/linux/generic/backport-6.12/ sed -i "/KernelPackage,ptp/d" package/kernel/linux/modules/other.mk rm -rf target/linux/rockchip/armv8/base-files/etc/uci-defaults/13_opkg_update package/feeds/kiddin9/pcat-manager package/feeds/kiddin9/*_QMI_WWAN sed -i -e 's,kmod-r8168,kmod-r8169,g' target/linux/rockchip/image/armv8.mk sed -i -e 's,wpad-openssl,wpad-basic-mbedtls,g' target/linux/rockchip/image/armv8.mk sed -i -e '/KERNEL_TESTING_PATCHVER/d' -e 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-drm-rockchip luci-app-diskman/' -e 's/autocore-arm/autocore/' target/linux/rockchip/Makefile sed -i 's/Ariaboard/光影猫/' target/linux/rockchip/image/armv8.mk ================================================ FILE: devices/rockchip_armv8/patches/55-xgp.patch.b ================================================ --- a/target/linux/rockchip/image/Makefile +++ b/target/linux/rockchip/image/Makefile @@ -20,6 +20,23 @@ define Build/boot-common $(CP) $(IMAGE_KERNEL) $@.boot/kernel.img endef +define Build/boot-combined + # This creates a new folder copies the dtbs (as rockchip*.dtb) + # and the kernel image (as kernel.img) + rm -fR $@.boot + mkdir -p $@.boot + + i=0; \ + for dts in $(DEVICE_DTS); do \ + dts=$$(echo $${dts} | cut -d'/' -f2); \ + $(CP) $(KDIR)/image-$$(echo $${dts} | cut -d'/' -f2).dtb $@.boot/rockchip$$(perl -e 'printf "%b\n",'$$i).dtb; \ + let i+=1; \ + done + + $(LN) rockchip0.dtb $@.boot/rockchip.dtb + $(CP) $(IMAGE_KERNEL) $@.boot/kernel.img +endef + define Build/boot-script # Make an U-boot image and copy it to the boot partition mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $(if $(1),$(1),mmc).bootscript $@.boot/boot.scr diff --git a/target/linux/rockchip/image/nlnet-xgp.bootscript b/target/linux/rockchip/image/nlnet-xgp.bootscript new file mode 100644 index 0000000000000..80df26f6c1520 --- /dev/null +++ b/target/linux/rockchip/image/nlnet-xgp.bootscript @@ -0,0 +1,38 @@ +# nlnet-xgp rk3568 combined image, board detected by ADC + +env delete hwrev +env delete coreboard_adc_value +env delete motherboard_adc_value + +# using SARADC CH1 to detect coreboard hwrev +# using SARADC CH7 to detect motherboard hwrev + +adc single saradc@fe720000 1 coreboard_adc_value +adc single saradc@fe720000 7 motherboard_adc_value + +if test -n "$coreboard_adc_value"; then + if test "$coreboard_adc_value" -lt 225000; then + echo coreboard rev02 + fi +fi + +if test -n "$motherboard_adc_value"; then + if test "$motherboard_adc_value" -lt 225000; then + echo motherboard rev03 + setenv hwrev 1 + fi +fi + +env delete coreboard_adc_value +env delete motherboard_adc_value + +part uuid mmc ${devnum}:2 uuid + +setenv bootargs "console=ttyS2,1500000 earlycon=uart8250,mmio32,0xfe660000 root=PARTUUID=${uuid} rw rootwait" + +load mmc ${devnum}:1 ${fdt_addr_r} rockchip${hwrev}.dtb +load mmc ${devnum}:1 ${kernel_addr_r} kernel.img + +env delete hwrev + +booti ${kernel_addr_r} - ${fdt_addr_r} ================================================ FILE: devices/rockchip_armv8/patches/Photonicat_wireless.patch ================================================ diff --git a/package/firmware/linux-firmware/qca_ath10k.mk b/package/firmware/linux-firmware/qca_ath10k.mk index b3bfe8a3919803..a4ce0b01e410f2 100644 --- a/package/firmware/linux-firmware/qca_ath10k.mk +++ b/package/firmware/linux-firmware/qca_ath10k.mk @@ -32,6 +32,24 @@ define Package/ath10k-firmware-qca9377/install endef $(eval $(call BuildPackage,ath10k-firmware-qca9377)) +Package/ath10k-board-qca9377-sdio = $(call Package/firmware-default,ath10k qca9377 board sdio firmware) +define Package/ath10k-board-qca9377-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9377/hw1.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9377/hw1.0/board.bin \ + $(1)/lib/firmware/ath10k/QCA9377/hw1.0/board.bin +endef +$(eval $(call BuildPackage,ath10k-board-qca9377-sdio)) + +Package/ath10k-firmware-qca9377-sdio = $(call Package/firmware-default,ath10k qca9377 sdio firmware,+ath10k-board-qca9377-sdio) +define Package/ath10k-firmware-qca9377-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9377/hw1.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9377/hw1.0/firmware-sdio-5.bin \ + $(1)/lib/firmware/ath10k/QCA9377/hw1.0/firmware-sdio-5.bin +endef +$(eval $(call BuildPackage,ath10k-firmware-qca9377-sdio)) + Package/ath10k-board-qca9887 = $(call Package/firmware-default,ath10k qca9887 board firmware,,LICENSE.QualcommAtheros_ath10k) define Package/ath10k-board-qca9887/install $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 1d4b37d259bb0f..3404227c604488 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -1,5 +1,5 @@ PKG_DRIVERS += \ - ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k ath10k-smallbuffers \ + ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k ath10k-sdio ath10k-smallbuffers \ ath11k ath11k-ahb ath11k-pci ath12k carl9170 owl-loader ar5523 wil6210 qcom-qmi-helpers PKG_CONFIG_DEPENDS += \ @@ -40,7 +40,7 @@ ifdef CONFIG_PACKAGE_MAC80211_TRACING endif config-$(call config_package,qcom-qmi-helpers) += QCOM_QMI_HELPERS -config-$(call config_package,ath,regular smallbuffers) += ATH_CARDS ATH_COMMON +config-$(call config_package,ath,regular sdio smallbuffers) += ATH_CARDS ATH_COMMON config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH11K_DEBUG ATH12K_DEBUG ATH9K_STATION_STATISTICS config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL ATH11K_SPECTRAL @@ -62,6 +62,7 @@ config-$(CONFIG_ATH11K_THERMAL) += ATH11K_THERMAL config-$(call config_package,ath9k-htc) += ATH9K_HTC config-$(call config_package,ath10k,regular) += ATH10K ATH10K_PCI +config-$(call config_package,ath10k-sdio,sdio) += ATH10K ATH10K_SDIO config-$(call config_package,ath10k-smallbuffers,smallbuffers) += ATH10K ATH10K_PCI ATH10K_SMALLBUFFERS config-$(call config_package,ath11k) += ATH11K config-$(call config_package,ath11k-ahb) += ATH11K_AHB @@ -294,8 +295,27 @@ define KernelPackage/ath10k/config config ATH10K_THERMAL bool "Enable thermal sensors and throttling support" - depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers + depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-sdio || PACKAGE_kmod-ath10k-smallbuffers + +endef +define KernelPackage/ath10k-sdio + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11ac SDIO wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k + DEPENDS+= +kmod-ath +kmod-mmc +@DRIVER_11AC_SUPPORT \ + +ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_sdio.ko + AUTOLOAD:=$(call AutoProbe,ath10k_core ath10k_sdio) + MODPARAMS.ath10k_core:=frame_mode=2 + VARIANT:=sdio +endef + +define KernelPackage/ath10k-sdio/description + This module adds support for wireless adapters based on + Atheros IEEE 802.11ac family of chipsets with SDIO bus. endef define KernelPackage/ath10k-smallbuffers diff --git a/package/kernel/mac80211/patches/ath10k/911-ath10k-disable-caldata-prefetch-for-sdio-bus.patch b/package/kernel/mac80211/patches/ath10k/911-ath10k-disable-caldata-prefetch-for-sdio-bus.patch new file mode 100644 index 00000000000000..8ca8f3b55b6a6e --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/911-ath10k-disable-caldata-prefetch-for-sdio-bus.patch @@ -0,0 +1,12 @@ +--- a/drivers/net/wireless/ath/ath10k/debug.c ++++ b/drivers/net/wireless/ath/ath10k/debug.c +@@ -1260,6 +1260,9 @@ static int ath10k_debug_cal_data_fetch(s + if (ar->hw_params.cal_data_len == 0) + return -EOPNOTSUPP; + ++ if (ar->hif.bus == ATH10K_BUS_SDIO) ++ return -EINVAL; ++ + hi_addr = host_interest_item_address(HI_ITEM(hi_board_data)); + + ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr)); ================================================ FILE: devices/rockchip_armv8/patches/add_extra_CPU_FLAGS.b ================================================ --- a/include/target.mk +++ b/include/target.mk @@ -259,9 +259,18 @@ ifeq ($(DUMP),1) CPU_CFLAGS_arc700 = -mcpu=arc700 CPU_CFLAGS_archs = -mcpu=archs endif + ifeq ($(BOARD),rockchip) + CPU_CFLAGS = -O3 -pipe + CPU_CFLAGS_cortex-a53 = -mcpu=cortex-a53 + CPU_CFLAGS_cortex-a55 = -march=armv8-a+crypto+crc -mcpu=cortex-a55+crypto+crc -mtune=cortex-a55 + CPU_CFLAGS_cortex-a73 = -march=armv8-a+crypto+crc -mcpu=cortex-a73.cortex-a53+crypto+crc -mtune=cortex-a73.cortex-a53 + ifneq ($(SOC_CFLAGS),) + CPU_CFLAGS_generic = $(SOC_CFLAGS) + endif + endif ifneq ($(CPU_TYPE),) ifndef CPU_CFLAGS_$(CPU_TYPE) - $(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type) + $(warning CPU_TYPE "$(CPU_TYPE)" "doesn't correspond to a known type") endif endif DEFAULT_CFLAGS=$(strip $(CPU_CFLAGS) $(CPU_CFLAGS_$(CPU_TYPE)) $(CPU_CFLAGS_$(CPU_SUBTYPE))) ================================================ FILE: devices/rockchip_armv8/patches/nanopi-zero2.patch ================================================ --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -264,6 +264,17 @@ define Device/friendlyarm_nanopi-r6s endef TARGET_DEVICES += friendlyarm_nanopi-r76s +define Device/friendlyarm_nanopi-zero2 + DEVICE_VENDOR := FriendlyARM + DEVICE_MODEL := NanoPi Zero2 + SOC := rk3328 + UBOOT_DEVICE_NAME := nanopi-r2s-rk3328 + IMAGE/sysupgrade.img.gz := boot-common | boot-script | pine64-bin | gzip | append-metadata + DEVICE_PACKAGES := -luci-app-gpsysupgrade kmod-gpio-button-hotplug kmod-usb-net-rtl8152 + DEVICE_DTS = rockchip/rk3328-nanopi-r2s +endef +TARGET_DEVICES += friendlyarm_nanopi-zero2 + define Device/firefly_station-p2 DEVICE_VENDOR := Firefly DEVICE_MODEL := Station P2 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -67,6 +67,17 @@ rockchip_setup_interfaces() friendlyarm,nanopi-r5s) ucidef_set_interfaces_lan_wan 'eth1 eth2' 'eth0' ;; + friendlyarm,nanopi-neo3|\ + friendlyarm,nanopc-t4|\ + friendlyarm,nanopi-m4|\ + friendlyarm,nanopi-m6|\ + friendlyarm,nanopi-zero2|\ + friendlyarm,nanopi-neo3-plus|\ + friendlyarm,nanopi-neo4|\ + friendlyarm,cm3588|\ + friendlyarm,som-rk3399) + ucidef_set_interfaces_lan_wan 'wlan0' 'eth0' + ;; lyt,t68m) ucidef_set_network_device_path lan1 'platform/fe2a0000.ethernet' ucidef_set_network_device_path lan2 'platform/fe010000.ethernet' --- a/target/linux/rockchip/image/Makefile +++ b/target/linux/rockchip/image/Makefile @@ -79,4 +79,16 @@ endif include $(SUBTARGET).mk +define Image/Build + if [[ "$(PROFILE_SANITIZED)" == "friendlyarm_nanopi-zero2" ]]; then \ + export IMG_PREFIX="$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))"; \ + export BIN_DIR=$(BIN_DIR); \ + export TOPDIR=$(TOPDIR); \ + export MORE=$(MORE); \ + export ROOTFS_PARTSIZE=$(shell echo $$(($(ROOTFS_PARTSIZE)/1024/1024))); \ + cd /data/packit/friendlywrt24-rk3528; \ + . ~/packit/packit_nanopi.sh; \ + fi +endef + $(eval $(call BuildImage)) ================================================ FILE: devices/rockchip_armv8/patches/r4s-fan.patch ================================================ diff --git a/target/linux/rockchip/patches-6.12/304-r4s-pwm-fan.patch b/target/linux/rockchip/patches-6.12/304-r4s-pwm-fan.patch new file mode 100644 index 000000000000..546ca54589c2 --- /dev/null +++ b/target/linux/rockchip/patches-6.12/304-r4s-pwm-fan.patch @@ -0,0 +1,55 @@ +From 930d10b5a37004c428ad1c9747a1424e85567e3f Mon Sep 17 00:00:00 2001 +From: jjm2473 <1129525450@qq.com> +Date: Wed, 15 Mar 2023 16:18:26 +0800 +Subject: [PATCH] rockchip: add pwm-fan for R4S(E) + +--- + .../boot/dts/rockchip/rk3399-nanopi-r4s.dts | 36 +++++++++++++++++++ + .../boot/dts/rockchip/rk3399-nanopi-r4se.dts | 36 +++++++++++++++++++ + 2 files changed, 72 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +@@ -69,6 +69,42 @@ + regulator-always-on; + regulator-boot-on; + }; ++ ++ fan: pwm-fan { ++ compatible = "pwm-fan"; ++ cooling-levels = <0 18 102 170 255>; ++ #cooling-cells = <2>; ++ fan-supply = <&vdd_5v>; ++ pwms = <&pwm1 0 50000 0>; ++ }; ++}; ++ ++&cpu_thermal { ++ trips { ++ cpu_warm: cpu_warm { ++ temperature = <55000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ ++ cpu_hot: cpu_hot { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "active"; ++ }; ++ }; ++ ++ cooling-maps { ++ map2 { ++ trip = <&cpu_warm>; ++ cooling-device = <&fan THERMAL_NO_LIMIT 1>; ++ }; ++ ++ map3 { ++ trip = <&cpu_hot>; ++ cooling-device = <&fan 2 THERMAL_NO_LIMIT>; ++ }; ++ }; + }; + + &emmc_phy { ================================================ FILE: devices/siflower_sf21/.config ================================================ CONFIG_TARGET_siflower=y CONFIG_TARGET_siflower_sf21=y ================================================ FILE: devices/siflower_sf21/diy.sh ================================================ #!/bin/bash shopt -s extglob ================================================ FILE: devices/sunxi_cortexa53/.config ================================================ CONFIG_TARGET_sunxi=y CONFIG_TARGET_sunxi_cortexa53=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_friendlyarm_nanopi-neo-plus2=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_friendlyarm_nanopi-neo2=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_friendlyarm_nanopi-r1s-h5=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_xunlong_orangepi-one-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_xunlong_orangepi-pc2=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_xunlong_orangepi-zero-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_xunlong_orangepi-zero2=y CONFIG_TARGET_DEVICE_sunxi_cortexa53_DEVICE_xunlong_orangepi-zero3=y ================================================ FILE: devices/sunxi_cortexa53/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152 kmod-rtl8189es/' target/linux/sunxi/Makefile ================================================ FILE: devices/sunxi_cortexa7/.config ================================================ CONFIG_TARGET_sunxi=y CONFIG_TARGET_sunxi_cortexa7=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_friendlyarm_nanopi-m1-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_friendlyarm_nanopi-neo=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_friendlyarm_nanopi-neo-air=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_friendlyarm_nanopi-r1=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_friendlyarm_zeropi=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-2=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-one=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-pc=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-pc-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-r1=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_xunlong_orangepi-zero=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_sinovoip_bananapi-p2-zero=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_sinovoip_bananapi-m3=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_sinovoip_bananapi-m2-plus=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_sinovoip_bananapi-m2-berry=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_sinovoip_bananapi-m2-ultra=y CONFIG_TARGET_DEVICE_sunxi_cortexa7_DEVICE_mele_m9=y ================================================ FILE: devices/sunxi_cortexa7/diy.sh ================================================ #!/bin/bash shopt -s extglob SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.1.sh sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += fdisk lsblk kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152 kmod-rtl8189es/' target/linux/sunxi/Makefile ================================================ FILE: devices/x86_64/.config ================================================ CONFIG_TARGET_x86=y CONFIG_TARGET_x86_64=y CONFIG_TARGET_ROOTFS_TARGZ=y # EFI支持: CONFIG_GRUB_IMAGES=y CONFIG_GRUB_EFI_IMAGES=y CONFIG_VMDK_IMAGES=n ================================================ FILE: devices/x86_64/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh git_clone_path master https://github.com/coolsnowwolf/lede target/linux/x86/files target/linux/x86/patches-6.12 wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/x86/base-files/etc/board.d/02_network -P target/linux/x86/base-files/etc/board.d/ sed -i 's/kmod-r8169/kmod-r8168/' target/linux/x86/image/64.mk sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-fs-f2fs kmod-mmc kmod-sdhci kmod-usb-hid usbutils pciutils lm-sensors-detect kmod-atlantic kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8101 kmod-r8125 kmod-r8126 kmod-8139cp kmod-8139too kmod-i40e kmod-drm-amdgpu kmod-mlx4-core kmod-mlx5-core fdisk lsblk kmod-phy-broadcom kmod-ixgbevf/' target/linux/x86/Makefile sed -i 's/256/1024/g' target/linux/x86/image/Makefile ================================================ FILE: devices/x86_64/patches/Intel_gpu.patch ================================================ diff --git a/package/kernel/linux/modules/virt.mk b/package/kernel/linux/modules/virt.mk index 5ed0d5dbbf2..a853a8c7980 100644 --- a/package/kernel/linux/modules/virt.mk +++ b/package/kernel/linux/modules/virt.mk @@ -4,6 +4,50 @@ # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # +define KernelPackage/vfio-mdev + SUBMENU:=Virtualization + TITLE:=VFIO driver support to to virtualize devices + DEPENDS:=@TARGET_x86_64 + KCONFIG:= \ + CONFIG_IOMMU_API=y \ + CONFIG_MMU=y \ + CONFIG_VFIO=y \ + CONFIG_VFIO_MDEV \ + CONFIG_VFIO_MDEV_DEVICE \ + CONFIG_VFIO_NOIOMMU=y \ + CONFIG_VFIO_PCI=y \ + CONFIG_VFIO_PCI_IGD=y + FILES:= \ + $(LINUX_DIR)/drivers/vfio/mdev/mdev.ko \ + $(LINUX_DIR)/drivers/vfio/mdev/vfio_mdev.ko@lt5.10 + AUTOLOAD:=$(call AutoProbe,mdev vfio_mdev) +endef + +define KernelPackage/vfio-mdev/description + Provides a framework to virtualize devices. +endef + +$(eval $(call KernelPackage,vfio-mdev)) + +define KernelPackage/i915-gvt + SUBMENU:=Virtualization + TITLE:=Enable KVM/VFIO support for Intel GVT-g + DEPENDS:=@TARGET_x86_64 +kmod-kvm-intel +kmod-drm-i915 +kmod-vfio-mdev + KCONFIG:= CONFIG_DRM_I915_GVT_KVMGT + FILES:= \ + $(LINUX_DIR)/drivers/gpu/drm/i915/gvt/kvmgt.ko@lt5.18 \ + $(LINUX_DIR)/drivers/gpu/drm/i915/kvmgt.ko@ge5.18 + AUTOLOAD:=$(call AutoProbe,kvmgt) +endef + +define KernelPackage/i915-gvt/description + Enable Intel GVT-g graphics virtualization technology host support with + integrated graphics. With GVT-g, it's possible to have one integrated + graphics device shared by multiple VMs under KVM. +endef + +$(eval $(call KernelPackage,i915-gvt)) + define KernelPackage/irqbypass SUBMENU:=Virtualization TITLE:=IRQ offload/bypass manager ================================================ FILE: devices/x86_64/patches/def_set_interfaces_lan_wan.patch ================================================ --- a/target/linux/x86/base-files/etc/board.d/02_network +++ b/target/linux/x86/base-files/etc/board.d/02_network @@ -39,6 +39,9 @@ traverse-technologies-geos) xiaoma-m12) ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 eth5 eth6" "eth0" ;; +*) + [ "$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -cvE "(@|\.)")" -gt 2 ] && ucidef_set_interfaces_lan_wan "$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -vE "(@|\.|eth1)" | tr "\n" " " | sed "s/ $//")" "eth1" + ;; esac board_config_flush ================================================ FILE: devices/x86_64/patches/image-commands.patch ================================================ --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -419,6 +419,17 @@ endef # Convert a raw image into a $1 type image. # E.g. | qemu-image vdi +define Build/qemu-exsi + if command -v qemu-img; then \ + name="$(subst .vmdk.zip,,$@)"; \ + qemu-img convert -f raw -O $1 $@ $$name.vmdk; \ + rm -f $@; \ + zip -jm $@ $$name*.vmdk; \ + else \ + echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \ + fi +endef + define Build/qemu-image if command -v qemu-img; then \ qemu-img convert -f raw -O $1 $@ $@.new; \ ================================================ FILE: devices/x86_64/patches/image.patch ================================================ From c7bc056650227ba6003414356f57b33cdb2603b7 Mon Sep 17 00:00:00 2001 From: kiddin9 <48883331+kiddin9@users.noreply.github.com> Date: Sat, 23 Apr 2022 18:38:12 +0800 Subject: [PATCH] Update Makefile --- target/linux/x86/image/Makefile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 322131c2a488..0b4ed1d272eb 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -108,22 +108,18 @@ define Device/Default IMAGE/combined.img := grub-config pc | combined | grub-install | append-metadata IMAGE/combined.img.gz := grub-config pc | combined | grub-install | gzip | append-metadata IMAGE/combined.vdi := grub-config pc | combined | grub-install | qemu-image vdi - IMAGE/combined.vmdk := grub-config pc | combined | grub-install | qemu-image vmdk + IMAGE/combined.vmdk.zip := grub-config pc | combined | grub-install | qemu-exsi vmdk -o adapter_type=lsilogic -o subformat=monolithicFlat IMAGE/combined.vhdx := grub-config pc | combined | grub-install | qemu-image vhdx -o subformat=dynamic - IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) - IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip ARTIFACT/image-efi.iso := grub-config iso | iso efi IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata IMAGE/combined-efi.vdi := grub-config efi | combined efi | grub-install efi | qemu-image vdi - IMAGE/combined-efi.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk + IMAGE/combined-efi.vmdk.zip := grub-config efi | combined efi | grub-install efi | qemu-exsi vmdk -o adapter_type=lsilogic -o subformat=monolithicFlat IMAGE/combined-efi.vhdx := grub-config efi | combined efi | grub-install efi | qemu-image vhdx -o subformat=dynamic ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) - IMAGES-y := rootfs.img.gz IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img.gz IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img.gz else - IMAGES-y := rootfs.img IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img endif @@ -139,8 +135,8 @@ define Device/Default IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vdi endif ifeq ($(CONFIG_VMDK_IMAGES),y) - IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vmdk - IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vmdk + IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vmdk.zip + IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vmdk.zip endif ifeq ($(CONFIG_VHDX_IMAGES),y) IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vhdx ================================================ FILE: devices/x86_generic/.config ================================================ CONFIG_TARGET_x86=y CONFIG_TARGET_x86_generic=y CONFIG_TARGET_ROOTFS_TARGZ=y # EFI支持: CONFIG_GRUB_IMAGES=y CONFIG_GRUB_EFI_IMAGES=y CONFIG_VMDK_IMAGES=n ================================================ FILE: devices/x86_generic/diy.sh ================================================ #!/bin/bash SHELL_FOLDER=$(dirname $(readlink -f "$0")) #bash $SHELL_FOLDER/../common/kernel_6.6.sh git_clone_path master https://github.com/coolsnowwolf/lede target/linux/x86/files target/linux/x86/patches-6.12 sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-fs-f2fs kmod-mmc kmod-sdhci kmod-usb-hid amd64-microcode intel-microcode usbutils pciutils lm-sensors-detect kmod-alx kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8125 kmod-r8126 kmod-r8101 kmod-8139cp kmod-8139too kmod-i40e kmod-i40evf kmod-mlx4-core kmod-mlx5-core fdisk lsblk/' target/linux/x86/Makefile sed -i 's/kmod-r8169/kmod-r8168/' target/linux/x86/image/generic.mk sed -i 's/256/1024/g' target/linux/x86/image/Makefile sed -i "s/DEVICE_MODEL := x86/DEVICE_MODEL := x86\/32/" target/linux/x86/image/generic.mk ================================================ FILE: devices/x86_generic/patches/image-commands.patch ================================================ --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -419,6 +419,17 @@ endef # Convert a raw image into a $1 type image. # E.g. | qemu-image vdi +define Build/qemu-exsi + if command -v qemu-img; then \ + name="$(subst .vmdk.zip,,$@)"; \ + qemu-img convert -f raw -O $1 $@ $$name.vmdk; \ + rm -f $@; \ + zip -jm $@ $$name*.vmdk; \ + else \ + echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \ + fi +endef + define Build/qemu-image if command -v qemu-img; then \ qemu-img convert -f raw -O $1 $@ $@.new; \ ================================================ FILE: devices/x86_generic/patches/image.patch ================================================ From c7bc056650227ba6003414356f57b33cdb2603b7 Mon Sep 17 00:00:00 2001 From: kiddin9 <48883331+kiddin9@users.noreply.github.com> Date: Sat, 23 Apr 2022 18:38:12 +0800 Subject: [PATCH] Update Makefile --- target/linux/x86/image/Makefile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 322131c2a488..0b4ed1d272eb 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -108,22 +108,18 @@ define Device/Default IMAGE/combined.img := grub-config pc | combined | grub-install | append-metadata IMAGE/combined.img.gz := grub-config pc | combined | grub-install | gzip | append-metadata IMAGE/combined.vdi := grub-config pc | combined | grub-install | qemu-image vdi - IMAGE/combined.vmdk := grub-config pc | combined | grub-install | qemu-image vmdk + IMAGE/combined.vmdk.zip := grub-config pc | combined | grub-install | qemu-exsi vmdk -o adapter_type=lsilogic -o subformat=monolithicFlat IMAGE/combined.vhdx := grub-config pc | combined | grub-install | qemu-image vhdx -o subformat=dynamic - IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) - IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip ARTIFACT/image-efi.iso := grub-config iso | iso efi IMAGE/combined-efi.img := grub-config efi | combined efi | grub-install efi | append-metadata IMAGE/combined-efi.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata IMAGE/combined-efi.vdi := grub-config efi | combined efi | grub-install efi | qemu-image vdi - IMAGE/combined-efi.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk + IMAGE/combined-efi.vmdk.zip := grub-config efi | combined efi | grub-install efi | qemu-exsi vmdk -o adapter_type=lsilogic -o subformat=monolithicFlat IMAGE/combined-efi.vhdx := grub-config efi | combined efi | grub-install efi | qemu-image vhdx -o subformat=dynamic ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) - IMAGES-y := rootfs.img.gz IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img.gz IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img.gz else - IMAGES-y := rootfs.img IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.img IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.img endif @@ -139,8 +135,8 @@ define Device/Default IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vdi endif ifeq ($(CONFIG_VMDK_IMAGES),y) - IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vmdk - IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vmdk + IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vmdk.zip + IMAGES-$$(CONFIG_GRUB_EFI_IMAGES) += combined-efi.vmdk.zip endif ifeq ($(CONFIG_VHDX_IMAGES),y) IMAGES-$$(CONFIG_GRUB_IMAGES) += combined.vhdx