Archived
Public Access
Adapt CI and installer to self-hosted Gitea, cross-compile arm64
Retarget the build pipeline and installer from GitHub to the git.chilldove.com Gitea instance (icePigeon/linux-kernel-bbrv3). - build.yml: replace gh CLI release checks and softprops/action-gh-release with Gitea REST API calls (curl); drop the GitHub-only delete-workflow-runs cleanup job; authenticate via the auto-injected GITEA_TOKEN. - Avoid actions/upload-artifact@v4 / download-artifact@v4 (they abort on Gitea as GHES): pass the config baseline between jobs via Gitea release assets instead of artifacts, and drop the redundant deb/marker artifacts. - Cross-compile arm64 on the single x86_64 runner (CROSS_COMPILE=aarch64-linux-gnu-, gcc-aarch64-linux-gnu); thread CROSS_COMPILE through prepare-kernel-config.sh olddefconfig. - install.sh: fetch releases from the Gitea API, self-update and CVE detector from Gitea raw URLs, token-authenticated asset downloads, paginate the release list; keep GITHUB_TOKEN/GH_TOKEN as fallbacks. - README.md: point install/download URLs at Gitea, reword GitHub -> Gitea, remove the GitHub-only Star History widget. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+150
-96
@@ -1,5 +1,16 @@
|
||||
name: 构建带有BBRv3的内核
|
||||
|
||||
# Gitea Actions reads workflows from .github/workflows/ (and .gitea/workflows/).
|
||||
# This workflow targets a self-hosted Gitea instance:
|
||||
# * release existence checks, creation and asset uploads go through the Gitea
|
||||
# REST API (curl), not the GitHub `gh` CLI;
|
||||
# * config-baseline data is passed between jobs via Gitea release assets, NOT via
|
||||
# actions/upload-artifact@v4 — the upstream artifact v4 actions detect Gitea as
|
||||
# GHES and abort, so they are avoided entirely;
|
||||
# * arm64 kernels are cross-compiled on the x86_64 runner
|
||||
# (CROSS_COMPILE=aarch64-linux-gnu-), so only a single ubuntu-latest runner is
|
||||
# required.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
@@ -7,13 +18,14 @@ on:
|
||||
- cron: "17 3 * * *"
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
# Gitea auto-injects GITHUB_TOKEN / GITEA_TOKEN into Actions jobs.
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Gitea REST API base for this repo, e.g.
|
||||
# https://git.chilldove.com/api/v1/repos/icePigeon/linux-kernel-bbrv3
|
||||
GITEA_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: bbrv3-kernel-build
|
||||
@@ -51,11 +63,20 @@ jobs:
|
||||
echo "raw_kernel_version=$raw_version" >> "$GITHUB_OUTPUT"
|
||||
echo "kernel_version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Returns 0 when a release with the given tag already exists on Gitea.
|
||||
release_exists() {
|
||||
local tag="$1" code
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"$GITEA_API/releases/tags/$tag" || echo 000)
|
||||
[ "$code" = "200" ]
|
||||
}
|
||||
|
||||
missing=0
|
||||
for arch in x86_64 arm64; do
|
||||
for suffix in "" "-max"; do
|
||||
tag="$arch-$version$suffix"
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
if release_exists "$tag"; then
|
||||
echo "$tag already exists."
|
||||
else
|
||||
echo "$tag is missing."
|
||||
@@ -72,44 +93,38 @@ jobs:
|
||||
echo "At least one release for $version is missing; build will continue."
|
||||
fi
|
||||
|
||||
cleanup:
|
||||
build:
|
||||
needs: preflight
|
||||
if: needs.preflight.outputs.build_needed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 删除旧的工作流运行记录
|
||||
uses: Mattraks/delete-workflow-runs@main
|
||||
with:
|
||||
retain_days: 0
|
||||
keep_minimum_runs: 0
|
||||
|
||||
build:
|
||||
needs: [preflight, cleanup]
|
||||
if: ${{ always() && needs.preflight.outputs.build_needed == 'true' && needs.cleanup.result == 'success' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# All targets build on a single x86_64 runner; arm64 is cross-compiled.
|
||||
- arch: x86_64
|
||||
runs_on: ubuntu-latest
|
||||
cross_compile: ""
|
||||
profile: standard
|
||||
profile_name: BBRv3
|
||||
release_suffix: ""
|
||||
localversion: -bbrv3
|
||||
- arch: arm64
|
||||
runs_on: ubuntu-24.04-arm
|
||||
runs_on: ubuntu-latest
|
||||
cross_compile: aarch64-linux-gnu-
|
||||
profile: standard
|
||||
profile_name: BBRv3
|
||||
release_suffix: ""
|
||||
localversion: -bbrv3
|
||||
- arch: x86_64
|
||||
runs_on: ubuntu-latest
|
||||
cross_compile: ""
|
||||
profile: max
|
||||
profile_name: BBRv3 Max
|
||||
release_suffix: -max
|
||||
localversion: -bbrv3-max
|
||||
- arch: arm64
|
||||
runs_on: ubuntu-24.04-arm
|
||||
runs_on: ubuntu-latest
|
||||
cross_compile: aarch64-linux-gnu-
|
||||
profile: max
|
||||
profile_name: BBRv3 Max
|
||||
release_suffix: -max
|
||||
@@ -121,14 +136,19 @@ jobs:
|
||||
steps:
|
||||
- name: 检查是否已发布
|
||||
id: check_release
|
||||
env:
|
||||
TAG: ${{ matrix.arch }}-${{ needs.preflight.outputs.kernel_version }}${{ matrix.release_suffix }}
|
||||
PROFILE_NAME: ${{ matrix.profile_name }}
|
||||
run: |
|
||||
tag="${{ matrix.arch }}-${{ env.KERNEL_VERSION }}${{ matrix.release_suffix }}"
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"$GITEA_API/releases/tags/$TAG" || echo 000)
|
||||
if [ "$code" = "200" ]; then
|
||||
echo "BUILD_NEEDED=false" >> "$GITHUB_ENV"
|
||||
echo "$tag already exists; skipping build."
|
||||
echo "$TAG already exists; skipping build."
|
||||
else
|
||||
echo "BUILD_NEEDED=true" >> "$GITHUB_ENV"
|
||||
echo "$tag does not exist; building latest kernel with ${{ matrix.profile_name }}."
|
||||
echo "$TAG does not exist; building latest kernel with $PROFILE_NAME."
|
||||
fi
|
||||
|
||||
- name: 检出代码
|
||||
@@ -146,6 +166,11 @@ jobs:
|
||||
dpkg-dev fakeroot kmod cpio dwarves \
|
||||
libdw-dev lz4 zstd xz-utils curl jq
|
||||
|
||||
- name: 安装 ARM64 交叉编译工具链
|
||||
if: env.BUILD_NEEDED == 'true' && matrix.arch == 'arm64'
|
||||
run: |
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
|
||||
- name: 创建源码目录
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
run: mkdir -p ./kernel/linux
|
||||
@@ -154,7 +179,7 @@ jobs:
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
working-directory: ./kernel
|
||||
run: |
|
||||
branch=$(echo "${{ env.KERNEL_VERSION }}" | grep -oP '^\d+\.\d+')
|
||||
branch=$(echo "$KERNEL_VERSION" | grep -oP '^\d+\.\d+')
|
||||
git clone --depth=1 --branch linux-$branch.y \
|
||||
https://github.com/gregkh/linux.git linux
|
||||
|
||||
@@ -174,11 +199,13 @@ jobs:
|
||||
- name: 编译声明
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
working-directory: ./kernel/linux
|
||||
env:
|
||||
PROFILE: ${{ matrix.profile }}
|
||||
run: |
|
||||
grep -v "MODULE_DESCRIPTION" net/ipv4/tcp_bbr.c > net/ipv4/tcp_bbr.c.tmp
|
||||
mv net/ipv4/tcp_bbr.c.tmp net/ipv4/tcp_bbr.c
|
||||
|
||||
if [ "${{ matrix.profile }}" = "max" ]; then
|
||||
if [ "$PROFILE" = "max" ]; then
|
||||
echo 'MODULE_DESCRIPTION("TCP BBR v3 Max - aggressive throughput profile by Joey");' >> net/ipv4/tcp_bbr.c
|
||||
else
|
||||
echo 'MODULE_DESCRIPTION("TCP BBR v3 (Bottleneck Bandwidth and RTT) - Compiled & Optimized by Joey");' >> net/ipv4/tcp_bbr.c
|
||||
@@ -190,7 +217,7 @@ jobs:
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
working-directory: ./kernel/linux
|
||||
run: |
|
||||
IFS='.' read -r v p s <<< "${{ env.KERNEL_VERSION }}"
|
||||
IFS='.' read -r v p s <<< "$KERNEL_VERSION"
|
||||
sed -i "s/^VERSION *=.*/VERSION = $v/" Makefile
|
||||
sed -i "s/^PATCHLEVEL *=.*/PATCHLEVEL = $p/" Makefile
|
||||
sed -i "s/^SUBLEVEL *=.*/SUBLEVEL = $s/" Makefile
|
||||
@@ -199,24 +226,24 @@ jobs:
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
timeout-minutes: 8
|
||||
working-directory: ./kernel/linux
|
||||
env:
|
||||
TARGET_ARCH: ${{ matrix.arch }}
|
||||
CROSS_COMPILE: ${{ matrix.cross_compile }}
|
||||
run: |
|
||||
bash "$GITHUB_WORKSPACE/scripts/prepare-kernel-config.sh" "${{ matrix.arch }}"
|
||||
|
||||
- name: 上传最终配置文件
|
||||
if: env.BUILD_NEEDED == 'true' && matrix.profile == 'standard'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: config-${{ matrix.arch }}-${{ matrix.profile }}-${{ env.KERNEL_VERSION }}
|
||||
path: ./build-configs/${{ matrix.arch }}*.config
|
||||
bash "$GITHUB_WORKSPACE/scripts/prepare-kernel-config.sh" "$TARGET_ARCH"
|
||||
|
||||
- name: 构建内核 Debian 包
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
working-directory: ./kernel/linux
|
||||
env:
|
||||
TARGET_ARCH: ${{ matrix.arch }}
|
||||
LOCALVERSION_SUFFIX: ${{ matrix.localversion }}
|
||||
CROSS_COMPILE: ${{ matrix.cross_compile }}
|
||||
run: |
|
||||
if [ "${{ matrix.arch }}" = "arm64" ]; then
|
||||
make ARCH=arm64 bindeb-pkg -j$(nproc) LOCALVERSION=${{ matrix.localversion }} KDEB_COMPRESS=gzip skipdbg=true
|
||||
if [ "$TARGET_ARCH" = "arm64" ]; then
|
||||
make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILE" bindeb-pkg -j$(nproc) LOCALVERSION="$LOCALVERSION_SUFFIX" KDEB_COMPRESS=gzip skipdbg=true
|
||||
else
|
||||
make bindeb-pkg -j$(nproc) LOCALVERSION=${{ matrix.localversion }} KDEB_COMPRESS=gzip skipdbg=true
|
||||
make bindeb-pkg -j$(nproc) LOCALVERSION="$LOCALVERSION_SUFFIX" KDEB_COMPRESS=gzip skipdbg=true
|
||||
fi
|
||||
|
||||
- name: 检查 deb 包
|
||||
@@ -231,93 +258,120 @@ jobs:
|
||||
|
||||
- name: 发布前复查是否已发布
|
||||
if: env.BUILD_NEEDED == 'true'
|
||||
env:
|
||||
TAG: ${{ matrix.arch }}-${{ needs.preflight.outputs.kernel_version }}${{ matrix.release_suffix }}
|
||||
run: |
|
||||
tag="${{ matrix.arch }}-${KERNEL_VERSION}${{ matrix.release_suffix }}"
|
||||
if gh release view "$tag" >/dev/null 2>&1; then
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"$GITEA_API/releases/tags/$TAG" || echo 000)
|
||||
if [ "$code" = "200" ]; then
|
||||
echo "PUBLISH_NEEDED=false" >> "$GITHUB_ENV"
|
||||
echo "$tag was published while this job was running; skipping upload and release."
|
||||
echo "$TAG was published while this job was running; skipping upload and release."
|
||||
else
|
||||
echo "PUBLISH_NEEDED=true" >> "$GITHUB_ENV"
|
||||
mkdir -p ./publish-markers
|
||||
touch "./publish-markers/${{ matrix.arch }}-${{ matrix.profile }}"
|
||||
echo "$tag still missing; publishing this build."
|
||||
echo "$TAG still missing; publishing this build."
|
||||
fi
|
||||
|
||||
- name: 上传发布标记
|
||||
- name: 发布到 Gitea Release
|
||||
if: env.BUILD_NEEDED == 'true' && env.PUBLISH_NEEDED == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: publish-${{ matrix.arch }}-${{ matrix.profile }}-${{ env.KERNEL_VERSION }}
|
||||
path: ./publish-markers/${{ matrix.arch }}-${{ matrix.profile }}
|
||||
env:
|
||||
TAG: ${{ matrix.arch }}-${{ needs.preflight.outputs.kernel_version }}${{ matrix.release_suffix }}
|
||||
PROFILE_NAME: ${{ matrix.profile_name }}
|
||||
TARGET_ARCH: ${{ matrix.arch }}
|
||||
TARGET_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
body="带有 $PROFILE_NAME 的最新内核,适用于 $TARGET_ARCH 架构。Compiled & Optimized by Joey."
|
||||
|
||||
- name: 上传 deb 包
|
||||
if: env.BUILD_NEEDED == 'true' && env.PUBLISH_NEEDED == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: deb-${{ matrix.arch }}-${{ matrix.profile }}
|
||||
path: ./kernel/linux-*.deb
|
||||
auth=(-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
- name: 发布到 GitHub Release
|
||||
if: env.BUILD_NEEDED == 'true' && env.PUBLISH_NEEDED == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ matrix.arch }}-${{ env.KERNEL_VERSION }}${{ matrix.release_suffix }}
|
||||
files: |
|
||||
./kernel/linux-*.deb
|
||||
./build-configs/${{ matrix.arch }}-${{ env.KERNEL_VERSION }}.config
|
||||
body: "带有 ${{ matrix.profile_name }} 的最新内核,适用于 ${{ matrix.arch }} 架构。Compiled & Optimized by Joey."
|
||||
# Reuse an existing release for this tag, otherwise create it.
|
||||
release_id=$(curl -sS "${auth[@]}" "$GITEA_API/releases/tags/$TAG" | jq -r '.id // empty')
|
||||
if [ -z "$release_id" ]; then
|
||||
release_id=$(curl -sS "${auth[@]}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST "$GITEA_API/releases" \
|
||||
-d "$(jq -n \
|
||||
--arg tag "$TAG" \
|
||||
--arg target "$TARGET_SHA" \
|
||||
--arg name "$TAG" \
|
||||
--arg body "$body" \
|
||||
'{tag_name:$tag, target_commitish:$target, name:$name, body:$body, draft:false, prerelease:false}')" \
|
||||
| jq -r '.id // empty')
|
||||
fi
|
||||
if [ -z "$release_id" ] || [ "$release_id" = "null" ]; then
|
||||
echo "Failed to resolve or create Gitea release for $TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Collect assets: kernel debs plus the versioned arch config.
|
||||
shopt -s nullglob
|
||||
assets=( ./kernel/linux-*.deb )
|
||||
cfg="./build-configs/$TARGET_ARCH-$KERNEL_VERSION.config"
|
||||
[ -f "$cfg" ] && assets+=( "$cfg" )
|
||||
|
||||
if [ "${#assets[@]}" -eq 0 ]; then
|
||||
echo "No assets found to upload for $TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for f in "${assets[@]}"; do
|
||||
name=$(basename "$f")
|
||||
echo "Uploading $name to release $TAG (id=$release_id)"
|
||||
curl -fsS "${auth[@]}" \
|
||||
-X POST "$GITEA_API/releases/$release_id/assets?name=$name" \
|
||||
-F "attachment=@$f" >/dev/null
|
||||
done
|
||||
echo "Published $TAG with ${#assets[@]} asset(s)."
|
||||
|
||||
update-config-baseline:
|
||||
needs: [preflight, build]
|
||||
if: ${{ always() && needs.preflight.outputs.build_needed == 'true' && needs.build.result == 'success' }}
|
||||
if: ${{ needs.preflight.outputs.build_needed == 'true' && needs.build.result == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
KERNEL_VERSION: ${{ needs.preflight.outputs.kernel_version }}
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 下载本轮最终配置
|
||||
uses: actions/download-artifact@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
pattern: config-*-standard-*
|
||||
path: ./generated-configs
|
||||
merge-multiple: true
|
||||
|
||||
- name: 下载发布标记
|
||||
uses: actions/download-artifact@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
pattern: publish-*-standard-*
|
||||
path: ./publish-markers
|
||||
merge-multiple: true
|
||||
|
||||
- name: 回写配置基线
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
if [ ! -d ./publish-markers ] || ! find ./publish-markers -type f | grep -q .; then
|
||||
echo "No published architectures found; skipping baseline update."
|
||||
exit 0
|
||||
fi
|
||||
auth=(-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
if [ ! -f ./generated-configs/x86_64.config ] && [ ! -f ./generated-configs/arm64.config ]; then
|
||||
echo "No generated configs found; nothing to update."
|
||||
exit 0
|
||||
fi
|
||||
# Pull the generated .config for a freshly published standard release back
|
||||
# into the repo baseline. Config travels as a Gitea release asset (named
|
||||
# "<arch>-<version>.config"), so no actions/artifact is needed.
|
||||
refresh_baseline() {
|
||||
local arch="$1" baseline="$2"
|
||||
local tag="$arch-$KERNEL_VERSION" # standard release (no -max)
|
||||
local rel asset_name url
|
||||
rel=$(curl -sS "${auth[@]}" "$GITEA_API/releases/tags/$tag")
|
||||
if [ -z "$(echo "$rel" | jq -r '.id // empty')" ]; then
|
||||
echo "Release $tag not found; skipping $baseline."
|
||||
return 0
|
||||
fi
|
||||
asset_name="$arch-$KERNEL_VERSION.config"
|
||||
url=$(echo "$rel" | jq -r --arg n "$asset_name" \
|
||||
'.assets[]? | select(.name == $n) | .browser_download_url' | head -n1)
|
||||
if [ -z "$url" ]; then
|
||||
echo "Config asset $asset_name not found on $tag; skipping $baseline."
|
||||
return 0
|
||||
fi
|
||||
curl -fsSL "${auth[@]}" -o "$baseline" "$url"
|
||||
echo "Refreshed $baseline from $tag."
|
||||
}
|
||||
|
||||
if [ -f ./publish-markers/x86_64-standard ] && [ -f ./generated-configs/x86_64.config ]; then
|
||||
cp ./generated-configs/x86_64.config ./x86-64.config
|
||||
fi
|
||||
if [ -f ./publish-markers/arm64-standard ] && [ -f ./generated-configs/arm64.config ]; then
|
||||
cp ./generated-configs/arm64.config ./arm64.config
|
||||
fi
|
||||
refresh_baseline x86_64 x86-64.config
|
||||
refresh_baseline arm64 arm64.config
|
||||
|
||||
if git diff --quiet -- x86-64.config arm64.config; then
|
||||
echo "Generated configs match current baselines."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "gitea-actions[bot]@noreply.git.chilldove.com"
|
||||
git add x86-64.config arm64.config
|
||||
git commit -m "Refresh generated kernel config baselines [skip ci]"
|
||||
git push
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
脚本入口:
|
||||
|
||||
```bash
|
||||
bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh)
|
||||
bash <(curl -fsSL https://git.chilldove.com/icePigeon/linux-kernel-bbrv3/raw/branch/main/install.sh)
|
||||
```
|
||||
|
||||
首次运行后脚本会自动安装联网快捷命令,后续可直接运行:
|
||||
@@ -14,9 +14,9 @@ bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/i
|
||||
b
|
||||
```
|
||||
|
||||
快捷命令每次都会从 GitHub 拉取最新版脚本执行,不使用本地缓存脚本。
|
||||
快捷命令每次都会从 Gitea 拉取最新版脚本执行,不使用本地缓存脚本。
|
||||
|
||||
脚本会自动识别当前系统架构,从本仓库 GitHub Releases 下载匹配的 BBRv3 内核 `.deb` 包,并提供安装、指定版本安装、状态检查、加速模式切换和卸载功能。安装内核时可选择标准 BBRv3 或 BBRv3 Max 激进吞吐内核。
|
||||
脚本会自动识别当前系统架构,从本仓库 Gitea Releases 下载匹配的 BBRv3 内核 `.deb` 包,并提供安装、指定版本安装、状态检查、加速模式切换和卸载功能。安装内核时可选择标准 BBRv3 或 BBRv3 Max 激进吞吐内核。
|
||||
|
||||
## 支持环境
|
||||
|
||||
@@ -87,7 +87,7 @@ linux-7.1.y -> patches/bbrv3-linux-7.1.patch
|
||||
## 安装最新版
|
||||
|
||||
```bash
|
||||
bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh)
|
||||
bash <(curl -fsSL https://git.chilldove.com/icePigeon/linux-kernel-bbrv3/raw/branch/main/install.sh)
|
||||
```
|
||||
|
||||
首次运行后也可以直接输入:
|
||||
@@ -109,16 +109,16 @@ b
|
||||
- 检查系统是否为 Debian/Ubuntu。
|
||||
- 检查架构是否为 `x86_64` 或 `aarch64`。
|
||||
- 让用户选择标准 BBRv3 或 BBRv3 Max 激进吞吐内核。
|
||||
- 从 GitHub Releases 获取当前架构和内核类型匹配的最新版本。
|
||||
- 从 Gitea Releases 获取当前架构和内核类型匹配的最新版本。
|
||||
- 下载非 debug 的内核 `.deb` 包。
|
||||
- 安装新内核并更新引导配置。
|
||||
- 提示是否重启。
|
||||
|
||||
如果遇到 GitHub API rate limit,可先设置 token:
|
||||
如果访问私有仓库或遇到 Gitea API 限流,可先设置 token:
|
||||
|
||||
```bash
|
||||
export GITHUB_TOKEN=你的 GitHub Token
|
||||
bash <(curl -fsSL https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh)
|
||||
export GITEA_TOKEN=你的 Gitea Token
|
||||
bash <(curl -fsSL https://git.chilldove.com/icePigeon/linux-kernel-bbrv3/raw/branch/main/install.sh)
|
||||
```
|
||||
|
||||
## 指定版本安装
|
||||
@@ -351,14 +351,14 @@ CVE-2026-31431 对应的 AEAD userspace 接口在新构建内核中由内核配
|
||||
|
||||
```bash
|
||||
command -v python3 >/dev/null 2>&1 || (sudo apt update && sudo apt install -y python3)
|
||||
curl -fsSL -o cve_2026_31431_detector.py https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/cve_2026_31431_detector.py
|
||||
curl -fsSL -o cve_2026_31431_detector.py https://git.chilldove.com/icePigeon/linux-kernel-bbrv3/raw/branch/main/cve_2026_31431_detector.py
|
||||
chmod +x cve_2026_31431_detector.py
|
||||
sudo python3 cve_2026_31431_detector.py
|
||||
```
|
||||
|
||||
## 内核包来源
|
||||
|
||||
`.deb` 内核包由 GitHub Actions 构建并发布到本仓库 Releases。
|
||||
`.deb` 内核包由 Gitea Actions 构建并发布到本仓库 Releases。
|
||||
|
||||
构建流程会:
|
||||
|
||||
@@ -394,13 +394,3 @@ sudo python3 cve_2026_31431_detector.py
|
||||
## 免责声明
|
||||
|
||||
内核升级有风险。安装前建议确认 VPS 控制台、救援模式或旧内核启动项可用。使用本项目构建或安装的内核造成的系统启动失败、网络异常或数据损失,由使用者自行承担。
|
||||
|
||||
## Star History
|
||||
|
||||
<a href="https://star-history.com/#byJoey/Actions-bbr-v3&Timeline">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=byJoey/Actions-bbr-v3&type=Timeline&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=byJoey/Actions-bbr-v3&type=Timeline" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=byJoey/Actions-bbr-v3&type=Timeline" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
+54
-20
@@ -43,41 +43,77 @@ SYSCTL_CONF="/etc/sysctl.d/99-joeyblog.conf"
|
||||
MODULES_CONF="/etc/modules-load.d/joeyblog-qdisc.conf"
|
||||
# 安全加固配置(Dirty Frag 风险面收敛)
|
||||
SECURITY_MODPROBE_CONF="/etc/modprobe.d/99-joeyblog-security.conf"
|
||||
# Gitea 仓库坐标(自建实例 git.chilldove.com)
|
||||
GITEA_HOST="https://git.chilldove.com"
|
||||
GITEA_OWNER="icePigeon"
|
||||
GITEA_REPO="linux-kernel-bbrv3"
|
||||
GITEA_BRANCH="main"
|
||||
# Gitea Releases API
|
||||
RELEASES_API="$GITEA_HOST/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases"
|
||||
# 脚本远程入口和本地快捷命令
|
||||
INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/byJoey/Actions-bbr-v3/main/install.sh"
|
||||
INSTALL_SCRIPT_URL="$GITEA_HOST/$GITEA_OWNER/$GITEA_REPO/raw/branch/$GITEA_BRANCH/install.sh"
|
||||
QUICK_COMMAND_PATH="/usr/local/bin/b"
|
||||
# 可选:提升 GitHub API 限额(支持 GITHUB_TOKEN / GH_TOKEN)
|
||||
GITHUB_API_TOKEN="${GITHUB_TOKEN:-${GH_TOKEN:-}}"
|
||||
# 可选:访问私有仓库或提升 Gitea API 限额(支持 GITEA_TOKEN / GITHUB_TOKEN / GH_TOKEN)
|
||||
GITEA_API_TOKEN="${GITEA_TOKEN:-${GITHUB_TOKEN:-${GH_TOKEN:-}}}"
|
||||
SPEEDTEST_BIN="speedtest"
|
||||
OOKLA_SPEEDTEST_VERSION="1.2.0"
|
||||
|
||||
gh_api_get() {
|
||||
api_get() {
|
||||
local url="$1"
|
||||
if [[ -n "$GITHUB_API_TOKEN" ]]; then
|
||||
if [[ -n "$GITEA_API_TOKEN" ]]; then
|
||||
curl -fsSL \
|
||||
-H "Authorization: Bearer $GITHUB_API_TOKEN" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: token $GITEA_API_TOKEN" \
|
||||
-H "Accept: application/json" \
|
||||
"$url"
|
||||
else
|
||||
curl -fsSL "$url"
|
||||
fi
|
||||
}
|
||||
|
||||
# 分页拉取全部 release(Gitea 单页上限为 50),合并成一个 JSON 数组返回
|
||||
fetch_all_releases() {
|
||||
local page=1 combined="[]" data count
|
||||
while :; do
|
||||
data=$(api_get "$RELEASES_API?limit=50&page=$page") || return 1
|
||||
# 出错或非数组(例如 {"message":...})时原样返回,交给 check_release_api_response 处理
|
||||
if ! echo "$data" | jq -e 'type=="array"' > /dev/null 2>&1; then
|
||||
printf '%s' "$data"
|
||||
return 0
|
||||
fi
|
||||
count=$(echo "$data" | jq 'length')
|
||||
combined=$(jq -n --argjson a "$combined" --argjson b "$data" '$a + $b')
|
||||
[ "$count" -lt 50 ] && break
|
||||
page=$((page + 1))
|
||||
[ "$page" -gt 20 ] && break
|
||||
done
|
||||
printf '%s' "$combined"
|
||||
}
|
||||
|
||||
# 下载 release 资源;存在 token 时带上鉴权头以支持私有仓库
|
||||
wget_asset() {
|
||||
local url="$1"
|
||||
if [[ -n "$GITEA_API_TOKEN" ]]; then
|
||||
wget -q --show-progress --header="Authorization: token $GITEA_API_TOKEN" "$url" -P /tmp/
|
||||
else
|
||||
wget -q --show-progress "$url" -P /tmp/
|
||||
fi
|
||||
}
|
||||
|
||||
check_release_api_response() {
|
||||
local response="$1"
|
||||
local api_message=""
|
||||
api_message=$(echo "$response" | jq -r 'if type=="object" then .message // "" else "" end')
|
||||
|
||||
if [[ -n "$api_message" ]]; then
|
||||
echo -e "\033[31mGitHub API 返回错误:$api_message\033[0m"
|
||||
if echo "$api_message" | grep -qi "rate limit exceeded"; then
|
||||
echo -e "\033[33m提示:可先执行 export GITHUB_TOKEN=你的令牌,再重新运行脚本。\033[0m"
|
||||
echo -e "\033[31mGitea API 返回错误:$api_message\033[0m"
|
||||
if echo "$api_message" | grep -qiE "rate limit|not found|permission|unauthor"; then
|
||||
echo -e "\033[33m提示:私有仓库或受限访问可先执行 export GITEA_TOKEN=你的令牌,再重新运行脚本。\033[0m"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! echo "$response" | jq -e 'type=="array"' > /dev/null 2>&1; then
|
||||
echo -e "\033[31mGitHub API 返回数据格式异常,无法继续。\033[0m"
|
||||
echo -e "\033[31mGitea API 返回数据格式异常,无法继续。\033[0m"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1117,11 +1153,10 @@ install_latest_version() {
|
||||
assert_supported_kernel_install_system || return 1
|
||||
profile_label=$(get_profile_label "$profile")
|
||||
|
||||
echo -e "\033[36m正在从 GitHub 获取 ${profile_label} 最新版本信息...\033[0m"
|
||||
BASE_URL="https://api.github.com/repos/byJoey/Actions-bbr-v3/releases"
|
||||
RELEASE_DATA=$(gh_api_get "$BASE_URL")
|
||||
echo -e "\033[36m正在从 Gitea 获取 ${profile_label} 最新版本信息...\033[0m"
|
||||
RELEASE_DATA=$(fetch_all_releases)
|
||||
if [[ -z "$RELEASE_DATA" ]]; then
|
||||
echo -e "\033[31m从 GitHub 获取版本信息失败。请检查网络连接或 API 状态。\033[0m"
|
||||
echo -e "\033[31m从 Gitea 获取版本信息失败。请检查网络连接或 API 状态。\033[0m"
|
||||
return 1
|
||||
fi
|
||||
check_release_api_response "$RELEASE_DATA" || return 1
|
||||
@@ -1163,7 +1198,7 @@ install_latest_version() {
|
||||
|
||||
for URL in $ASSET_URLS; do
|
||||
echo -e "\033[36m正在下载文件:$URL\033[0m"
|
||||
wget -q --show-progress "$URL" -P /tmp/ || { echo -e "\033[31m下载失败:$URL\033[0m"; return 1; }
|
||||
wget_asset "$URL" || { echo -e "\033[31m下载失败:$URL\033[0m"; return 1; }
|
||||
done
|
||||
|
||||
install_packages
|
||||
@@ -1178,10 +1213,9 @@ install_specific_version() {
|
||||
assert_supported_kernel_install_system || return 1
|
||||
profile_label=$(get_profile_label "$profile")
|
||||
|
||||
BASE_URL="https://api.github.com/repos/byJoey/Actions-bbr-v3/releases"
|
||||
RELEASE_DATA=$(gh_api_get "$BASE_URL")
|
||||
RELEASE_DATA=$(fetch_all_releases)
|
||||
if [[ -z "$RELEASE_DATA" ]]; then
|
||||
echo -e "\033[31m从 GitHub 获取版本信息失败。请检查网络连接或 API 状态。\033[0m"
|
||||
echo -e "\033[31m从 Gitea 获取版本信息失败。请检查网络连接或 API 状态。\033[0m"
|
||||
return 1
|
||||
fi
|
||||
check_release_api_response "$RELEASE_DATA" || return 1
|
||||
@@ -1227,7 +1261,7 @@ install_specific_version() {
|
||||
|
||||
for URL in $ASSET_URLS; do
|
||||
echo -e "\033[36m下载中:$URL\033[0m"
|
||||
wget -q --show-progress "$URL" -P /tmp/ || { echo -e "\033[31m下载失败:$URL\033[0m"; return 1; }
|
||||
wget_asset "$URL" || { echo -e "\033[31m下载失败:$URL\033[0m"; return 1; }
|
||||
done
|
||||
|
||||
install_packages
|
||||
|
||||
@@ -5,7 +5,9 @@ arch="${1:?usage: prepare-kernel-config.sh <x86_64|arm64>}"
|
||||
|
||||
run_olddefconfig() {
|
||||
if [ "$arch" = "arm64" ]; then
|
||||
timeout 300 make ARCH=arm64 olddefconfig < /dev/null
|
||||
# CROSS_COMPILE is exported by the workflow when building arm64 on an x86_64
|
||||
# host; passing it through keeps Kconfig cc-option probes on the cross toolchain.
|
||||
timeout 300 make ARCH=arm64 ${CROSS_COMPILE:+CROSS_COMPILE=$CROSS_COMPILE} olddefconfig < /dev/null
|
||||
else
|
||||
timeout 300 make olddefconfig < /dev/null
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user