Skip to content

Instantly share code, notes, and snippets.

@Ran-Xing
Created March 22, 2023 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ran-Xing/875ce6c019ac9ba566697489372a9725 to your computer and use it in GitHub Desktop.
Save Ran-Xing/875ce6c019ac9ba566697489372a9725 to your computer and use it in GitHub Desktop.
openwrt builder docker lede
FROM ubuntu:20.04
WORKDIR /app
RUN apt-get -qq update \
&& apt-get -qq upgrade \
&& ln -sf "/usr/share/zoneinfo/${TZ}" /etc/localtime \
&& echo "${TZ}" > /etc/timezone \
&& ln -sf "$(which bash)" "$(which sh)" \
&& apt-get -qq full-upgrade \
&& apt-get -qq install \
ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils zsh curl wget axel \
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
RUN curl -s https://gist.githubusercontent.com/Ran-Xing/0e47c9b793887d201bab9de2a07a740c/raw/b3ef029a11a111a8c7920decc38e610f6b8e7354/zsh_init.sh | bash || echo "ok!"
CMD ["/bin/zsh"]
  1. 下载源代码
git clone https://github.com/coolsnowwolf/lede
  1. 创建容器
docker run -it \
  --name openwrt-build \
  -v ./lede:/app \
  openwrt zsh
  1. 进入容器
docker exec -it openwrt-build zsh
  1. 更新 feeds 并选择配置
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
  1. 下载 dl 库,编译固件 (-j 后面是线程数,第一次编译推荐用单线程)
make download -j8
make V=s -j1

二次编译:

cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)

如果需要重新配置:

rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)

编译完成后输出路径:bin/targets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment