Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Building OpenWRT on Ubuntu 22.04.1 LTS

Tech Aug 5 2

Setting Up the Build Environment

Before compiling OpenWRT, we need to install the necessary development dependencies on Ubuntu 22.04.1 LTS:

sudo apt-get update
sudo apt-get install -y libncurses5-dev zlib1g-dev gawk flex patch git-core g++ subversion

Creating a Dedicated User Account

For security and best practices, it's recommended to compile OpenWRT using a non-root user account:

sudo adduser developer

Switch to the newly created user account:

sudo su - developer

Downloading OpenWRT Source Code

Navigate to the home directory and clone the OpenWRT repository:

cd ~/
git clone https://git.openwrt.org/openwrt/openwrt.git

Using Screen for Long-Runing Compilation

Since OpenWRT compilation can take several hours, it's wise to use screen to maintain the session in case of network disconncetion:

sudo apt-get install -y screen

Basic screen commands:

  • Start a new session: screen -S build_session
  • List active sessions: screen -ls
  • Reconnect to a session: screen -r build_session
  • Force reconnection: screen -dr build_session
  • Detach from session: Press Ctrl+A then D

Inside a screen session:

  • Create new window: Ctrl+A then C
  • Switch to next window: Ctrl+A then N
  • Switch to previous window: Ctrl+A then P
  • View session info: Ctrl+A then "

To end a screen session properly:

  1. Close all windows in the session or exit each one individually
  2. Type exit in the last window to terminate the session

Preparing the OpenWRT Build Directory

Navigate to the OpenWRT source directory and clean previous build artifacts:

cd ~/openwrt
make clean          # Remove binary files
make dirclean       # Remove binaries and cross-compilation tools
make distclean      # Remove all downloaded packages, configs, and feeds

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.