Presentation On Openwrt

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31
At a glance
Powered by AI
OpenWrt is an open source operating system for embedded devices that provides a minimalistic Linux distribution and tools to build firmware images. It addresses challenges of supporting different hardware platforms and strong memory constraints.

OpenWrt is a set of Makefiles and tools that builds firmware images containing a toolchain, kernel and packages. It addresses supporting different hardware, binary drivers, memory constraints and abstracting hardware configuration.

OpenWrt uses Makefiles to build firmware images containing a compiled toolchain, kernel and packages for a target architecture. It provides tools to customize images with additional files and packages.

Introduction

Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

The OpenWrt embedded development framework


Florian Fainelli
[email protected]
Fosdem 2008
Brussels
Lenght : 1 hour

February 24, 2008

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Summary I
Introduction
What is OpenWrt
Challenges
Design
What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Summary II
Software architecture
System and package configuration
Developing with OpenWrt
Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree
Deploying OpenWrt
Supported root filesystems
Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Summary III
The Image builder
The SDK

Becoming a developper

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Challenges

What is OpenWrt

Minimalistic Busybox/Linux distribution GPL licensed

Set of Makefiles and tools building an embedded rootfs

Packages and repositories

Hardware donators, package maintainers and kernel hackers


community

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Challenges

Challenges

Lots of different hardware platform can run Linux

Lots of binary drivers

Strong memory footprint constraints

Hardware configuration and maintenance abstraction

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

What is OpenWrt

OpenWrt is a set of Makefiles and sources that :

Builds the appropriate toolchain for your device

Compiles the appropriate kernel w/ patches and options

Provides software as IPKG packages

Builds the optionnal tools to flash your device

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Getting OpenWrt

Subversion reposirotyr at
https://svn.openwrt.org/openwrt and Trac interface

trunk/ directory for development branch

kamikaze and whiterussian tags for stable versions

packages/ directory for non-kernel related packages

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

uClibc buildroot heritage

OpenWrt was created in late 2003, and used a modified uClibc


buildroot :

Needed to be hacked to have support for a package maintainer

Lots of Makefile writting to add support for a software

Could use more Makefile templating

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Key directories

There are four key directories in the base:

tools

toolchain

package

target

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Packages and external repositories

OpenWrt uses IPKG as the package format and manager.

OpenWrt provides essential and kernel-related packages in


trunk/

Other packages are split into a different repository packages/


which subsections

Support for external repository can be done either in


/etc/ipkg.conf or in the feeds

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Packages feeds

Package feeds allows you to provide your own set of packages :

Source feeds can be fetched using svn

They appear as packages while running make menuconfig

User can choose to build them directly into the rootfs or as


separate packages

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Toolchain

Switch between binutils, gcc, kernel-headers versions and


uClibc tuples

Change compiler CFLAGS to tune/optimize size and features

Add custom patches to any of the above components

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Software architecture

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

System and package configuration

OpenWrt uses UCI :

Universal Configuration Interface

MIB-like structure (config.section.key=value)

Born from the lack of NVRAM on all supported hardware

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

UCI specificites

C library, easy to link with

program can interface with it to store their configuration

Config to MIB bridges to easily manage devices using SNMP

More configuration storage backends : LDAP, SQL

Web interface with integrated UCI support

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

What is OpenWrt
Getting OpenWrt
uClibc buildroot heritage
Key directories
Packages and external repositories
Packages feeds
Toolchain
Toolchain
System and package configuration

Add UCI configuration for your package

For instance adding a new configuration file is as simple as creating


a new file in /etc/config/package which should contain the
following lines:
config
option

<type> ["<name>"]
<name> "<value>"

Florian Fainelli [email protected]

# Section
# Option

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Creating packages

Typical package directory layout :

package/<name> /Makefile

package/<name> /patches

package/<name> /files

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Package source download

Support for different download methods :

GIT

Subversion

CVS

HTTP

local source

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Example
For instance, if you wish to checkout a particular revision of a
package using Subversion, just define the following download
method in your package Makefile

PKG_VER:=963
PKG_BRANCH:=batman-adv-userspace
PKG_VERSION:=r\$(PKG\_REV)
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_URL:=http://downloads.open-mesh.net/svn/batman/\
trunk/
Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Creating kernel modules packages

Extending the kernel/rootfs with modules is really easy within


OpenWrt :

Build-time update the kernel configuration based on your


kernel modules selection

External kernel modules are seen as packages, they use the


KernelPackage instead

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Adding support for a new target

Adding support for a new kernel is made easy :

Create target/linux/<my target> directory

Define the kernel version you want to use

Add your additionnal patches in target/linux/<my


target>/ /patches

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Copying architecture files


You can also put your files in target/linux/<my
target>/ /files :

They will be copied at kernel build time

They should match the kernel directory structure


arch/mips/kernel/*

You can directly version C files that are part of your drivers,
architecture code ..

Only need to generate patches against Kconfig and Makefiles

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Using quilt

OpenWrt natively supports using quilt :

Refresh, create and update patches for any component

Test modifications with make


component/subcomponent/compile

Patches modifications are tracked with Subversion in your


local copy

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Creating packages
Package source download
Creating kernel modules packages
Adding support for a new target
Using quilt
Building an external kernel tree

Building an external kernel tree

OpenWrt supports the building of an external kernel tree :

Test a git kernel tree with your board code

Use the OpenWrt toolchain to cross-compile for other


architectures

Test local modifications to a git subtree for later inclusion in


mainline

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Supported root filesystems


The Image builder
The SDK

Supported root filesystems

OpenWrt has currently support for :

JFFS2, SquashFS, Ext2/3, CPIO, TGZ

With LZMA, GZIP, BZIP2 compression (when applicable)

Binary firmware generation tools (Broadcom, ZyXEL,


Mikrotik ...)

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Supported root filesystems


The Image builder
The SDK

The Image builder

Deployment tools

Contains compiled toolchain and kernel for your architecture

Add custom files / IPKG packages to include in the rootfs

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Supported root filesystems


The Image builder
The SDK

The SDK

Contains the compiled toolchain

Useful for packages upgrading and live testing

Package maintainers tool

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Becoming a developper

Submit patches to the mainling-list


[email protected]

Do as much test and bugreport as you can

Port OpenWrt to a new device / architecture

Write documentation

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Promoting OpenWrt

Ideal firmware for Wireless communities, Wireless ISPs ..

Fastest embedded platform to port a new architecture on

Abstracted network and Wireless configuration for all


supported hardware

Florian Fainelli [email protected]

The OpenWrt embedded development framework

Introduction
Design
Developing with OpenWrt
Deploying OpenWrt
Becoming a developper

Thank you very much

Thank you very much for your attention, question session is now
open.

Florian Fainelli [email protected]

The OpenWrt embedded development framework

You might also like