├── .config ├── .github └── workflows │ ├── build-openwrt.yml │ └── schedule_build.yml ├── LICENSE ├── README.md └── diy.sh /.config: -------------------------------------------------------------------------------- 1 | CONFIG_TARGET_x86=y 2 | CONFIG_TARGET_x86_64=y 3 | CONFIG_TARGET_x86_64_Generic=y 4 | CONFIG_ARIA2_BITTORRENT=y 5 | CONFIG_ARIA2_NOXML=y 6 | CONFIG_ARIA2_OPENSSL=y 7 | CONFIG_ARIA2_WEBSOCKET=y 8 | CONFIG_PACKAGE_aria2=y 9 | CONFIG_PACKAGE_ariang=y 10 | CONFIG_PACKAGE_kcptun-client=y 11 | CONFIG_PACKAGE_luci-app-aria2=y 12 | CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=y 13 | CONFIG_PACKAGE_luci-i18n-aria2-zh-cn=y 14 | CONFIG_PACKAGE_luci-theme-material=y 15 | CONFIG_PACKAGE_vim=y 16 | CONFIG_TARGET_ROOTFS_TARGZ=y 17 | # CONFIG_TARGET_x86_geode_Generic is not set 18 | # CONFIG_TARGET_x86_geode_Geos is not set 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/build-openwrt.yml: -------------------------------------------------------------------------------- 1 | #================================================= 2 | # https://github.com/P3TERX/Actions-OpenWrt 3 | # Description: Build OpenWrt using GitHub Actions 4 | # Lisence: MIT 5 | # Author: P3TERX 6 | # Blog: https://p3terx.com 7 | #================================================= 8 | 9 | name: Build OpenWrt 10 | 11 | on: 12 | release: 13 | types: published 14 | push: 15 | branches: 16 | - master 17 | paths: 18 | - '.config' 19 | 20 | env: 21 | REPO_URL: https://github.com/coolsnowwolf/lede 22 | REPO_BRANCH: master 23 | CONFIG_FILE: .config 24 | DIY_SH: diy.sh 25 | SSH_ACTIONS: true 26 | UPLOAD_BIN_DIR: false 27 | UPLOAD_FIRMWARE: true 28 | UPLOAD_COWTRANSFER: true 29 | TZ: Asia/Shanghai 30 | 31 | jobs: 32 | build: 33 | runs-on: ubuntu-latest 34 | if: github.event.repository.owner.id == github.event.sender.id 35 | 36 | steps: 37 | - name: Checkout 38 | uses: actions/checkout@master 39 | 40 | - name: Initialization environment 41 | env: 42 | DEBIAN_FRONTEND: noninteractive 43 | run: | 44 | sudo swapoff /swapfile 45 | sudo rm -rf /swapfile /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc 46 | sudo -E apt-get -qq update 47 | sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf 48 | sudo -E apt-get -qq autoremove --purge 49 | sudo -E apt-get -qq clean 50 | curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc 51 | 52 | - name: Clone source code 53 | run: git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt 54 | 55 | - name: Update feeds 56 | run: cd openwrt && ./scripts/feeds update -a 57 | 58 | - name: Install feeds 59 | run: cd openwrt && ./scripts/feeds install -a 60 | 61 | - name: Load custom configuration 62 | run: | 63 | [ -e files ] && mv files openwrt/files 64 | [ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config 65 | chmod +x $DIY_SH 66 | cd openwrt 67 | ../$DIY_SH 68 | 69 | - name: SSH connection to Actions 70 | uses: P3TERX/debugger-action@master 71 | if: env.SSH_ACTIONS == 'true' 72 | 73 | - name: Download package 74 | id: package 75 | run: | 76 | cd openwrt 77 | make defconfig 78 | make download -j8 79 | find dl -size -1024c -exec ls -l {} \; 80 | find dl -size -1024c -exec rm -f {} \; 81 | 82 | - name: Compile the firmware 83 | id: compile 84 | run: | 85 | cd openwrt 86 | echo -e "$(nproc) thread compile" 87 | make -j$(nproc) || make -j1 V=s 88 | echo "::set-output name=status::success" 89 | 90 | - name: Upload bin directory 91 | uses: actions/upload-artifact@master 92 | if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' 93 | with: 94 | name: OpenWrt_bin 95 | path: openwrt/bin 96 | 97 | # 目录结构 98 | # openwrt/bin/targets/x86/64/config.seed 99 | # openwrt/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.img 100 | # openwrt/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.vmdk 101 | # openwrt/bin/targets/x86/64/openwrt-x86-64-generic-rootfs.tar.gz 102 | # openwrt/bin/targets/x86/64/openwrt-x86-64-generic.manifest 103 | # openwrt/bin/targets/x86/64/openwrt-x86-64-rootfs-squashfs.img 104 | # openwrt/bin/targets/x86/64/openwrt-x86-64-vmlinuz 105 | # openwrt/bin/targets/x86/64/sha256sums 106 | - name: Organize files 107 | id: organize 108 | if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() 109 | run: | 110 | cd openwrt/bin/targets/*/* 111 | rm -rf packages 112 | echo "::set-env name=FIRMWARE::$PWD" 113 | echo "::set-output name=status::success" 114 | 115 | - name: Upload firmware directory 116 | uses: actions/upload-artifact@master 117 | if: steps.organize.outputs.status == 'success' && !cancelled() 118 | with: 119 | name: OpenWrt_firmware 120 | path: ${{ env.FIRMWARE }} 121 | 122 | - name: Upload firmware to cowtransfer 123 | if: env.UPLOAD_COWTRANSFER == 'true' && !cancelled() 124 | run: | 125 | curl -fsSL https://git.io/cowtransfer | sh 126 | ./cowtransfer-uploader -b 2621440 -s -p 99 -t 3 --hash --silent ${FIRMWARE} 127 | -------------------------------------------------------------------------------- /.github/workflows/schedule_build.yml: -------------------------------------------------------------------------------- 1 | name: Schedule Build Lean's OpenWrt 2 | 3 | on: 4 | # 每个月1号自动构建 5 | schedule: 6 | - cron: 0 0 1 * * 7 | push: 8 | branches: 9 | master 10 | paths: 11 | - ".github/workflows/schedule_build.yml" 12 | 13 | env: 14 | REPO_URL: https://github.com/coolsnowwolf/lede 15 | REPO_BRANCH: master 16 | CONFIG_FILE_URL: https://raw.githubusercontent.com/esirplayground/AutoBuild-OpenWrt/master/x86_64.config 17 | DIY_SH: diy.sh 18 | SSH_ACTIONS: false 19 | UPLOAD_BIN_DIR: false 20 | UPLOAD_FIRMWARE: false 21 | UPLOAD_COWTRANSFER: true 22 | TZ: Asia/Shanghai 23 | REPOSITORY: crazygit/lean-openwrt-x86-64 24 | 25 | jobs: 26 | build: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@master 31 | 32 | - name: Initialization environment 33 | env: 34 | DEBIAN_FRONTEND: noninteractive 35 | run: | 36 | sudo swapoff /swapfile 37 | sudo rm -rf /swapfile /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc 38 | sudo -E apt-get -qq update 39 | sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf 40 | sudo -E apt-get -qq autoremove --purge 41 | sudo -E apt-get -qq clean 42 | curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc 43 | 44 | - name: Clone source code 45 | run: git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt 46 | 47 | - name: Update feeds 48 | run: cd openwrt && ./scripts/feeds update -a 49 | 50 | - name: Install feeds 51 | run: cd openwrt && ./scripts/feeds install -a 52 | 53 | - name: Load custom configuration 54 | run: | 55 | [ -e files ] && mv files openwrt/files 56 | wget -q $CONFIG_FILE_URL -O openwrt/.config 57 | # 添加自定义的target选项,并删除一些无用的配置项 58 | grep "CONFIG_TARGET_ROOTFS_TARGZ=y" openwrt/.config || echo 'CONFIG_TARGET_ROOTFS_TARGZ=y' >> openwrt/.config 59 | sed -i '/CONFIG_KERNEL_BUILD_USER/d' openwrt/.config 60 | sed -i '/CONFIG_GRUB_TITLE/d' openwrt/.config 61 | cat openwrt/.config 62 | chmod +x $DIY_SH 63 | cd openwrt 64 | ../$DIY_SH 65 | 66 | - name: SSH connection to Actions 67 | uses: P3TERX/debugger-action@master 68 | if: env.SSH_ACTIONS == 'true' 69 | 70 | - name: Download package 71 | id: package 72 | run: | 73 | cd openwrt 74 | make defconfig 75 | make download -j8 76 | find dl -size -1024c -exec ls -l {} \; 77 | find dl -size -1024c -exec rm -f {} \; 78 | 79 | - name: Compile the firmware 80 | id: compile 81 | run: | 82 | cd openwrt 83 | echo -e "$(nproc) thread compile" 84 | make -j$(nproc) || make -j1 V=s 85 | echo "::set-output name=status::success" 86 | 87 | - name: Upload bin directory 88 | uses: actions/upload-artifact@master 89 | if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' 90 | with: 91 | name: OpenWrt_bin 92 | path: openwrt/bin 93 | 94 | # 目录结构 95 | # openwrt/bin/targets/x86/64/config.seed 96 | # openwrt/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.img 97 | # openwrt/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.vmdk 98 | # openwrt/bin/targets/x86/64/openwrt-x86-64-generic-rootfs.tar.gz 99 | # openwrt/bin/targets/x86/64/openwrt-x86-64-generic.manifest 100 | # openwrt/bin/targets/x86/64/openwrt-x86-64-rootfs-squashfs.img 101 | # openwrt/bin/targets/x86/64/openwrt-x86-64-vmlinuz 102 | # openwrt/bin/targets/x86/64/sha256sums 103 | - name: Organize files 104 | id: organize 105 | if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() 106 | run: | 107 | cd openwrt/bin/targets/*/* 108 | rm -rf packages 109 | echo "::set-env name=FIRMWARE::$PWD" 110 | echo "::set-output name=status::success" 111 | 112 | - name: Upload firmware directory 113 | uses: actions/upload-artifact@master 114 | if: steps.organize.outputs.status == 'success' && !cancelled() 115 | with: 116 | name: OpenWrt_firmware 117 | path: ${{ env.FIRMWARE }} 118 | 119 | - name: Upload firmware to cowtransfer 120 | if: env.UPLOAD_COWTRANSFER == 'true' && !cancelled() 121 | run: | 122 | curl -fsSL https://git.io/cowtransfer | sh 123 | ./cowtransfer-uploader -b 2621440 -s -p 99 -t 3 --hash --silent ${FIRMWARE} 124 | 125 | # action不稳定,有时间要报could not read Username for 'https://github.com',采用自己下载的方式 126 | #- name: Download Build Dockerfile 127 | # uses: actions/checkout@v2 128 | # with: 129 | # repository: crazygit/openwrt-x86-64 130 | # ref: master 131 | # path: dockerfile_dir 132 | 133 | - name: Prepare build docker image dir 134 | run: | 135 | git clone --depth 1 https://github.com/crazygit/openwrt-x86-64.git -b master dockerfile_dir 136 | cp openwrt/bin/targets/x86/64/openwrt-x86-64-generic-rootfs.tar.gz dockerfile_dir/openwrt.tar.gz 137 | 138 | - name: Publish to Registry 139 | uses: elgohr/Publish-Docker-Github-Action@master 140 | env: 141 | FIRMWARE: openwrt.tar.gz 142 | with: 143 | workdir: dockerfile_dir 144 | name: ${{ env.REPOSITORY }} 145 | username: ${{ secrets.DOCKER_USERNAME }} 146 | password: ${{ secrets.DOCKER_TOKEN }} 147 | buildargs: FIRMWARE 148 | snapshot: true 149 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 P3TERX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 自动构建Lean's 大神的OpenWrt固件 2 | 3 | 每个月1号,自动拉取最新的Lean大神的代码,配置常用软件构建镜像 4 | 5 | ```bash 6 | $ docker pull crazygit/lean-openwrt-x86-64:latest 7 | ``` 8 | 9 | 如果你偏好纯净的官方原版本的OpenWrt固件,可以使用我编译的原版固件 10 | 11 | ```bash 12 | $ docker pull crazygit/openwrt-x86-64 13 | ``` 14 | 15 | 自己编译的固件打包成Docker镜像以及使用配置,请参考: 16 | 17 | 18 | 19 | Lean's大神项目地址: 20 | 21 | 22 | 23 | 本库使用的github action是基于`P3TERX`大神的模板做了修改 24 | 25 | 26 | 27 | github action相关的使用,请参考[原作者的博客](https://p3terx.com/archives/build-openwrt-with-github-actions.html) 28 | 29 | ## 补充 30 | 31 | 如下根据自身的使用场景,基于[原作者博客](https://p3terx.com/archives/build-openwrt-with-github-actions.html)内容的基础上,做的一点补充 32 | 33 | ### 如何生成`.config` 34 | 35 | `.config`文件的作用就是定制编译过程中需要做的配置 36 | 如: 37 | * 系统的配置 38 | * 需要预装的软件包 39 | 40 | 它的生成方式有如下几种 41 | 42 | ### 方法一(拿来主义) 43 | 44 | 直接使用别人配置好的,如下是别的大神挑选的常用预装软件生成的配置,下载下来即可使用 45 | 46 | 47 | 48 | ### 方法二(自己动手) 49 | 50 | 直接在`.github/workflows/build-openwrt.yml`开启ssh登录,然后ssh到服务端执行`make menuconfig`进行定制 51 | 52 | ### 方法三(自娱自乐) 53 | 54 | 这个方法其实是方法二的变形,只是所有的东西都要你自己来,自己搭建编译环境生成`.config`, 55 | 56 | 首先参考[链接](https://github.com/coolsnowwolf/lede)搭建本地编译环境,然后执行 57 | 58 | ```bash 59 | $ make menuconfig 60 | ``` 61 | 62 | 选择要安装的软件包和定制的配置项 63 | 64 | ```bash 65 | $ ./scripts/diffconfig.sh > diffconfig # write the changes to diffconfig 66 | $ cp diffconfig .config # write changes to .config 67 | $ make defconfig # expand to full config 68 | ``` 69 | 70 | 编译步骤定制可以参考: 71 | 72 | 73 | -------------------------------------------------------------------------------- /diy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #================================================= 3 | # Description: DIY script 4 | # Lisence: MIT 5 | # Author: P3TERX 6 | # Blog: https://p3terx.com 7 | #================================================= 8 | # Modify default IP 9 | #sed -i 's/192.168.1.1/192.168.50.5/g' package/base-files/files/bin/config_generate 10 | --------------------------------------------------------------------------------