你提到的 fetchlinux 可能有几种情况:
下面我按通用优化思路 + 常见场景给你一套可落地方案。
aria2c -x16 -s16 https://example.com/linux.iso
# 示例:Ubuntu
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
squid / nginx 做缓存❌ 低效:
curl url > a
curl url > b
✅ 优化:
curl -s url > tmp
cp tmp a
cp tmp b
if [ ! -f file ] || [ "$(sha256sum file)" != "$expect" ]; then
fetch
fi
fetch_one() {
curl -s "$1" -o "$2"
}
fetch_one url1 f1 &
fetch_one url2 f2 &
wait
sysctl -w net.core.rmem_max=16777216
sysctl -w net.ipv4.tcp_window_scaling=1
mount -t tmpfs tmpfs /fetch_cache
BB_NO_NETWORK = "0"
BB_GENERATE_MIRROR_TARBALLS = "1"
BR2_PRIMARY_SITE="http://mirror"
BR2_BACKUP_SITE="http://backup"
你可以补充:
我可以直接帮你改脚本或给配置。