Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-user:virtualization:obtain.firmware.docker [2023/03/02 12:54] – add docker build instructoins oliv3rdocs:guide-user:virtualization:obtain.firmware.docker [2024/09/25 17:09] (current) – symlink already present with latest alpine image and py3-distutils-extra is missing as was deprecated https://peps.python.org/pep-0632/ aivaras-s
Line 4: Line 4:
  
 You can use a premade [[https://www.docker.io/|Docker]] image to build yourself an OpenWrt firmware image. A list of known such Docker images (see instructions how to use them on their pages): You can use a premade [[https://www.docker.io/|Docker]] image to build yourself an OpenWrt firmware image. A list of known such Docker images (see instructions how to use them on their pages):
-  * [[https://gitlab.com/openwrt/docker|Official OpenWRT Docker images]] which can be pulled from [[https://hub.docker.com/u/openwrtorg|Docker hub]]+  * [[https://github.com/openwrt/docker|Official OpenWRT Docker images]] which can be pulled from [[https://hub.docker.com/r/openwrt|Docker hub]]
   * [[https://github.com/noonien/docker-openwrt-buildroot|noonien/docker-openwrt-buildroot]]   * [[https://github.com/noonien/docker-openwrt-buildroot|noonien/docker-openwrt-buildroot]]
   * [[https://github.com/galalmounir/openwrt-image-builder|galalmounir/openwrt-image-builder]]   * [[https://github.com/galalmounir/openwrt-image-builder|galalmounir/openwrt-image-builder]]
Line 11: Line 11:
  
 ===== Building OpenWRT using Docker ====== ===== Building OpenWRT using Docker ======
-First, an image needs to be obtained. Lets start with the most basic example, where a custom container is build. This can be skipped by instead pulling one of the OpenWRT containers from a container registery.+First, an image needs to be obtained. Lets start with the most basic example, where a custom container is build. This can be skipped by instead pulling one of the OpenWRT containers from a container registry.
  
 <hidden Alpine Container><code - Containerfile-alpine> <hidden Alpine Container><code - Containerfile-alpine>
Line 57: Line 57:
     'wget' \     'wget' \
     'zlib-dev' \     'zlib-dev' \
 +    'py3-distutils-extra' \
   && \   && \
-  ln -s '/usr/lib/libncurses.so' '/usr/lib/libtinfo.so' && \ 
   addgroup 'buildbot' && \   addgroup 'buildbot' && \
   adduser -s '/bin/bash' -G 'buildbot' -D 'buildbot'   adduser -s '/bin/bash' -G 'buildbot' -D 'buildbot'
Line 98: Line 98:
 </code></hidden> </code></hidden>
  
-After placing (either) downloading either/both of these files, a OpenWRT repository is needed. After cloning or downloading the OpenWRT repository it might be a thought to create a dedicated worktree, when not wanting to build using master. `cd <openwrt repo>; git worktree add ../openwrt-<branch name> -b <branch name>; cd ../openwrt-<branch name>`. This will create a new git branch and check it out on a worktree.+After placing (either) downloading either/both of these files, a OpenWRT repository is needed. After cloning or downloading the OpenWRT repository it might be a thought to create a dedicated worktree, when not wanting to build using master. <code>cd <openwrt repo>; git worktree add ../openwrt-<branch name> -b <branch name>; cd ../openwrt-<branch name></code>. This will create a new git branch and check it out on a worktree.
  
-Next, the container is to be built, using either `podmanor `docker`.+Next, the container is to be built, using either **podman** or **docker**.
  
 Note, while not strictly necessary, we don't want to copy all of the repository files into the container context. Doing so won't hurt or break anything, but it wastes space and costs time and won't even be accessible when running the container. Note, while not strictly necessary, we don't want to copy all of the repository files into the container context. Doing so won't hurt or break anything, but it wastes space and costs time and won't even be accessible when running the container.
  
-To avoid copying needless files, a `.dockerignorefile is used, which can be either in the same location as the Dockerfile or in the current working directory.+To avoid copying needless files, a //.dockerignore// file is used, which can be either in the same location as the //Dockerfile// or in the current working directory.
  
-```+<code>
 echo "*" > .dockerignore echo "*" > .dockerignore
-```+</code>
  
 Building the container is as simple as: Building the container is as simple as:
-```+<code>
 docker build --rm --tag openwrt:alpine --file <path-to-containerfile>/Containerfile-alpine <path-to-openwrt> docker build --rm --tag openwrt:alpine --file <path-to-containerfile>/Containerfile-alpine <path-to-openwrt>
-```+</code>
  
 The tag can be named whatever of course, dated or likewise. The container only occasionally has to be rebuild, when 'host dependencies' are changed or updated. The tag can be named whatever of course, dated or likewise. The container only occasionally has to be rebuild, when 'host dependencies' are changed or updated.
  
 Finally, the container can be used to launch a build environment Finally, the container can be used to launch a build environment
-```+<code>
 docker run --interactive --rm --tty --ulimit 'nofile=1024:262144' --volume "$(pwd):/workdir" --workdir '/workdir' openwrt:alpine /bin/bash docker run --interactive --rm --tty --ulimit 'nofile=1024:262144' --volume "$(pwd):/workdir" --workdir '/workdir' openwrt:alpine /bin/bash
 <hostname>:/workdir$ <hostname>:/workdir$
-```+</code>
 From here, any normal OpenWRT command can be used as expected (`make menuconfig` etc). It is recommended to create an alias such as From here, any normal OpenWRT command can be used as expected (`make menuconfig` etc). It is recommended to create an alias such as
-`alias make='make -j10 V=sc'to build more verbose with multiple jobs, but this is completely optional.+<code>alias make='make -j10 V=sc'</code> to build more verbose with multiple jobs, but this is completely optional.
  
 ===== OpenWrt Cloud Builder API ===== ===== OpenWrt Cloud Builder API =====
  • Last modified: 2023/03/02 12:54
  • by oliv3r