diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..44a35aa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM fedora:35 + +RUN yum update -y + +RUN dnf -y groupinstall 'Development Tools' + +RUN dnf -y install bash-completion bzip2 gcc gcc-c++ git make ncurses-devel patch \ + rsync tar unzip wget which diffutils python2 python3 perl-base \ + perl-Data-Dumper perl-File-Compare perl-File-Copy perl-FindBin \ + perl-Thread-Queue vim + +RUN useradd -m user && \ + echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user + +USER user +WORKDIR /home/user + +# set dummy git config +RUN git config --global user.name "user" && git \ + config --global user.email "user@example.com" diff --git a/README.md b/README.md index 65a12fa..19a6720 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,70 @@ -# openwrt-builder -Build openWRT system image +# Openwrt +Build OpenWRT system image + +## How to + +Container image to build Openwrt image based on https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem +To build own container image: + +```shell +sudo yum install -y git podman +git clone https://github.com/danpawlik/openwrt-builder +cd openwrt-builder +podman build -t openwrt-builder -f Dockerfile +``` + +## Example + +how to use: +``` +mkdir -p openwrt-builder +podman run -it -u user -v $(pwd)/openwrt-builder/:/home/user:z,rw quay.io/dpawlik/openwrt:fedora35 /bin/bash +``` + +Then inside the container (from https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem): + +```shell +git clone https://git.openwrt.org/openwrt/openwrt.git +cd openwrt +git pull +``` + +Select a specific code revision: + +```shell +git branch -a +git tag +git checkout v21.02.1 +``` + +Update the feeds: + +```shell +./scripts/feeds update -a +./scripts/feeds install -a +``` + +Configure the firmware image and the kernel: + +```shell +make menuconfig +``` + +If you have own config file, replace it. For example: + +```shell +curl -SL https://downloads.openwrt.org/snapshots/targets/ath79/mikrotik/config.buildinfo > .config +``` + +Then: + +```shell +# make kernel_menuconfig +make -j4 kernel_menuconfig +``` + +Build the firmware image: + +```shell +make -j $(nproc) defconfig download clean world +```