Version 1 (modified by k.szczesny@…, 9 years ago) (diff)

Created new page

This page is about creating a build environment on OpenSUSE which will allow you to build DebWrt for your router of choice. I am not 100% sure, but I believe this guide should allow you to build DebWrt on any Linux system. This page is current at the time of writing [20 Feb 2011].

Prerequisites & Assumptions

  • You have an up to date OpenSUSE system
  • You know your way around the system
  • You have a lot of patience
  • You want your DebWrt router to be Debian Squeeze based


Download current release of debootstrap.

cd ~

Unpack the archive

cd /
ar p ~/debootstrap_1.0.26_all.deb data.tar.gz | tar zx

Now you should have access to debootstrap. Make sure it works:

# sudo debootstrap --version
root's password:
debootstrap 1.0.26

If not - make sure you have /usr/sbin added to your PATH variable.

Create your build environment

Go somewhere you have few spare GB of disk space and set up your build environment there. For me it was /srv/krystian/x so if you see this path somewhere in my listings, know this is path to my build directory. To make things easier let's just assign a variable name to it: DEBWRT_BUILD

export DEBWRT_BUILD=/path/to/your/build/dir

Create the build environment:

sudo debootstrap --arch=amd64 squeeze $DEBWRT_BUILD

You might want to adjust the --arch parameter to suite your architecture. Plase note that Debian uses amd64 name for x86_64 architecture. After a moment you should have your build environment created.

Configure the environment

First thing to do is to chroot to your new environment and set your locale to C.

sudo chroot $DEBWRT_BUILD
export LANG=C

Installing required packages

Install few packages which are needed during the build. Please note, there are probably packages missing from this listing, so in case you get an error somewhere down the road about something missing... install it. If you get an error saying a package is not found, just use aptitude and search for it as there might be a typo.

apt-get install sudo fakeroot gawk python unzip flex zlibc build-essential libncurses5-dev subversion zlib1g-dev git

You will be asked whether you want to install from unverified source. Answer yes.

Add and configure a user

Now add a user, which will be used during the build process

# adduser debwrt
Adding user `debwrt' ...
Adding new group `debwrt' (1002) ...
Adding new user `debwrt' (1002) with group `debwrt' ...
Creating home directory `/home/debwrt' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for debwrt
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] 

Password doesn't really matter, since we will never use it. Now it's time to allow our user to use sudo without password. You can use visudo to add this line to the file:


Since we will be working in /usr/src directory, we want to make sure our user has proper rights in this directory. Since this is a chrooted env used only for build purposes I am just going to change owner:

chown -R debwrt /usr/src

Build DebWrt

Change user to debwrt and download DebWrt sources:

su debwrt
cd /usr/src
svn checkout debwrt
cd debwrt

You will probably want to change the device for which we are going to build the release, so:

make menuconfig

and adjust DebWrt settings to your needs. I am not gonig to cover in here any particular settings. There are other wiki pages which cover all of that. What we want to achieve here is a proper build with no customizations.

After you set everything up:


This should take a little bit of time and you should end up with an output like:

Make DebWrt completed

DEBWRTVERSION : angel - 2.0-1 - [ 20 February 2011 (r174) ]
TARGET_ARCH   : mips
BOARD         : ar71xx
SUB_BOARD     : generic_WNDR3700
LINUX_VERSION :  (default)

And you are done. If there was something wrong with the build, maybe there's something you have to install or check current tickets on DebWrt Trac for known issues.