$ ./slim.sh ssrp # 编译官方库里没有编译的包,只需要编译一次,编译完在./bin/packages目录下,不用删除以后复用
$ ./slim.sh image # 打包ROM,收工。各种格式的rom在./bin/targets下- 构建过程需要下载包,注意网速
- 构建环境依赖docker
- 自行修改OWT_PACKAGES增删你需要的包
| #!/bin/sh | |
| # official docker images | |
| TAG="x86-64-23.05.0" | |
| OPENWRT_SDK="openwrt/sdk:$TAG" | |
| OPENWRT_BUILDER="openwrt/imagebuilder:$TAG" | |
| OPENWRT_HOME_DIR="/builder" | |
| # builder targets | |
| OWT_PROFILE="generic" | |
| OWT_PACKAGES="lua qosify tc-full tc-mod-iptables zlib \ | |
| curl \ | |
| luci luci-ssl luci-base luci-i18n-base-zh-cn luci-app-firewall luci-i18n-firewall-zh-cn luci-app-opkg luci-i18n-opkg-zh-cn \ | |
| luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system \ | |
| luci-proto-ppp luci-proto-ipv6 \ | |
| luci-theme-bootstrap \ | |
| luci-app-mwan3 luci-i18n-mwan3-zh-cn \ | |
| ddns-scripts-cloudflare luci-app-ddns luci-i18n-ddns-zh-cn \ | |
| dnsmasq-full -dnsmasq luci-compat luci-lib-ipkg luci-app-ssr-plus luci-i18n-ssr-plus-zh-cn \ | |
| luci-app-upnp luci-i18n-upnp-zh-cn" | |
| usage() | |
| { | |
| echo "Usage: $0 <ssrp|image|all>" | |
| exit 0 | |
| } | |
| pull_docker_image() | |
| { | |
| if [[ "$(docker image ls -q $1 2> /dev/null)" == "" ]]; then | |
| echo "Fetching docker image $1 ..." | |
| docker pull $1 || exit -1 | |
| fi | |
| } | |
| build_ssrp() | |
| { | |
| docker run --rm -v "$(pwd)"/bin/:$OPENWRT_HOME_DIR/bin -it $OPENWRT_SDK sh -c \ | |
| "echo src-git helloworld https://github.com/fw876/helloworld.git >> feeds.conf.default && ./scripts/feeds update -a && ./scripts/feeds install -a -f -p helloworld && make defconfig && make package/luci-app-ssr-plus/compile -j\$(nproc)" | |
| } | |
| build_image() | |
| { | |
| docker run --rm -v "$(pwd)"/bin/:$OPENWRT_HOME_DIR/bin -it $OPENWRT_BUILDER sh -c \ | |
| "cp -rf bin/packages/x86_64/helloworld/* ./packages/ && make PROFILE=$OWT_PROFILE PACKAGES=\"$OWT_PACKAGES\" image" | |
| } | |
| case "$1" in | |
| ssrp) | |
| pull_docker_image $OPENWRT_SDK | |
| build_ssrp | |
| ;; | |
| image) | |
| pull_docker_image $OPENWRT_BUILDER | |
| build_image | |
| ;; | |
| all) | |
| $0 ssrp | |
| $0 image | |
| ;; | |
| -h|--help|help) | |
| usage | |
| ;; | |
| *) | |
| usage | |
| ;; | |
| esac |
full build
light build