SlideShare ist ein Scribd-Unternehmen logo
1 von 20
OpenWRT
Basic tutorial guide, memo.
by Antony.Wu
1
OpenWRT builtroot
• It is a set of Makefiles and patches that allows users to generate
a cross-toolchain and a root filesystem for embeded system.
• It generates cross-compiler toolchain and use the toolchain to
build an image for your target board, such as AR-5387un router.
• It can also download packages (feeds), patches (using quilt) it
for you.
• # make toolchain/gdb/prepare QUILT=1
• <modify files in build_dir/>
• # make toolchain/gdb/updatevim
• It has modified make targets: component/name/action.
• # make toolchain/gdb/compile V=s
• V=s means “Verboase = stdout/stderror”
• # make toolchain/gdb/clean V=s
2
V=?
s standard output/error
w shows only warning
3
Get OpenWRT buildroot
Main repositories and feeds
− # git clone git://git.openwrt.org/openwrt.git
− # git clone git://git.openwrt.org/packages.git
Barrier Breaker
− # git clone git://git.openwrt.org/14.07/openwrt.git
− # git clone git://git.openwrt.org/14.07/packages.git
− # svn co -r 42990
svn://svn.openwrt.org/openwrt/branches/barrier_bre
aker
4
Setup OpenWRT environment
Using Fedora distribution, you need the following
package ready.
− # yum install -y subversion binutils bzip2 gcc gcc-c++ gawk
gettext flex ncurses-devel zlib-devel make patch unzip perl-
ExtUtils-MakeMaker glibc glibc-devel glibc-static quilt
ncurses-lib sed sdcc intltool sharutils bison wget
Check environment variables
− # echo $SED # must be empty, or issue '# unset SED'
− # echo $GREP_OPTIONS # don't contain '--initial-tab'
Set the PATH:
− PATH=$PATH:<buildroot dir>/staging_dir/host/bin
− PATH=$PATH:<buildroot dir>/staging_dir/toolchain-
<platform>-<gcc_ver>-<libc_ver>/bin
5
Understand OpenWRT Feeds
It is a set of packages, like a ‘yum repo’, or ‘apt-get repo’ on
desktop linux.
 The script downloads the packages info into ‘feeds/’ .
 The script installs packages into ‘package/feeds/’
 Packages in feeds selectable by CONFIG_PACKAGE_xxxx in .config
file.
The repo is configured in the feeds.conf or feeds.conf.default
(such as yum repo configured in /etc/yum.repos.d)
A script is used to control those packages
 # ./scripts/feeds update -a
 Package index (information) will be stored into feeds/
 # ./scripts/feeds install <package_name>
 Src will be checkouted into package/feeds/<package_name>
OpenWRT Make
• Clean
• # make clean # rm -rf bin build_dir
• # make dirclean # rm -rf bin build_dir staging_dir toolchain logs
• # make distclean # all above, rm all downloaded packages and .config
• Ignore errors
• #IGNORE_ERRORS=1 make <make options>
• component/name/action.
• Clean Linux objects
• # make target/linux/clean V=s
• Clean package luci.
• # make package/luci/clean
6
OpenWRT Make sequence
1. # make tools/install
2. # make toolchain/install
3. # make target/compile
4. # make package/cleanup
5. # make package/compile
6. # make package/install
7. # make package/preconfig
8. # make target/install
9. # make package/index
You can issue them, one by
one, in order, so that you
can check and debug
each step.
7
Create OpenWRT package
• Special Makefile template.
• Please refer to BuildPackage variables
PKG_NAME:=broadcom-wl
PKG_VERSION:=5.10.56.27.3
PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
…
…
$(eval $(call KernelPackage,brcm-wl))
$(eval $(call KernelPackage,brcm-wl-mini))
$(eval $(call BuildPackage,wlc))
$(eval $(call BuildPackage,wl))
$(eval $(call BuildPackage,nas))
• BuildPackage only takes one argument directly – the
name of the package to be built, in this case “wlc".
# ls -l package/broadcom-wl/
files # default config.
Makefile
patches # patches from diff
src # source code
8
Create OpenWRT package 2
• BuildPackage define ‘Package/’
• The following describe the ‘define’ you may need:
define Package/broadcom-wl/Default
<action>
endef
• Package/description : description
• Package/conffiles : config-files installed by this pkg.
• Build/Prepare (optional): How to unpack/patch src.
• Build/Configure (optional) : How to configure src.
• Build/Compile (optional) : How to compile src.
• Build/InstallDev (optoinal) : Lib. needed
• Please refer to BuildPackage defines
Note: ‘define’ in makefile is like
‘=‘ operator.
Define the action when calling
‘Package/broadcom/wl/Default ‘
9
Create OpenWRT package 3
• Override Build option
• Autoconf
• Eg. CONFIGURE_VARS += ac_cv_header_regex_h=no
• Eg. CONFIGURE_ARGS += --disable-native-affinity
• Compiler flags
• Eg. TARGET_CFLAGS+= -Wall
• Make
• Eg. MAKE_VARS = CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)
$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)"  …
• Eg. MAKE_FLAGS = $(TARGET_CONFIGURE_OPTS)  CROSS="$
(TARGET_CROSS)" ARCH="$(ARCH)“
• CMake and Scons
• CMAKE_OPTIONS, CMAKE_HOST_OPTIONS
• SCONS_VARS
10
Create OpenWRT package 4
• Adding configuration options
• Add MENU:=1
• Add Config.in Package/<name>/config
Makefile:
define Package/mjpg-streamer/config source
"$(SOURCE)/Config.in“
endef
Config.in:
menu "Configuration" depends on PACKAGE_mjpg-streamer
config MJPEG_STREAMER_AUTOSTART
bool "Autostart enabled" default n
• How to check your configuration
Makefile:
ifeq ($(CONFIG_MJPEG_STREAMER_INPUT_UVC),y)
$(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib
endif
11
Create OpenWRT package 5
• Working on local application source
• Using feeds to tracking your state-of-the-art
work.
# ln -s /path/to/local/awesome_app_tree/.git feeds/my_cool_feed/awesome_app/git-src
# make package/awesome_app/{clean,compile} V=s
• Using USE_SOURCE_DIR
# make package/awesome_app/clean V=s
# make package/awesome_app/prepare USE_SOURCE_DIR=~/src/awesome_src V=s
# make package/awesome_app/clean V=s
• make prepare needs to be run every time
• make package/awesome_app/{clean,compile}
USE_SOURCE_DIR=~blah doesn't work
12
OpenWRT kernel package

Adding configuration options

Add .mk file
#vim package/kernel/modules/block.mk
define KernelPackage/loop
SUBMENU:=$(BLOCK_MENU)
TITLE:=Loopback device support
KCONFIG:= CONFIG_BLK_DEV_LOOP CONFIG_BLK_DEV_CRYPTOLOOP=n
FLES:=$(LINUX_DIR)/drivers/block/loop.ko
AUTOLOAD:=$(call AutoLoad,30,loop)
endef
$(eval $(call KernelPackage,loop))
 Announce to build system.
# touch package/kernel/linux/Makefile

Add a kernel module that is not part of kernel
distribution
 Please refer to ‘package/madwifi/Makefile’ 13
What’s in the following slides?
1. # make tools/install
2. # make toolchain/install
3. # make target/compile
4. # make package/cleanup
5. # make package/compile
6. # make package/install
7. # make package/preconfig
8. # make target/install
9. # make package/index
You can issue them, one by
one, in order, so that you
can check and debug
each step.
14
External Toolchain
 Compile everything with the target board,
you will have a dir named toolchain, called
build1

Copy the .config-file from the build1 and
make menuconfig.
[*] Advanced configuration options (for developers)
[*] Use external toolchain
Target name: arm-openwrt-linux-uclibcgnueabi (in my case, yours may vary)
Toolchain prefix: arm-openwrt-linux-uclibcgnueabi- (mind the dash at the end)
Toolchain root: /path/to/toolchain/staging_dir/toolchain-arm_v5te_gcc-
linaro_uClibc-0.9.32_eabi
15
Alter download procedure

$DL_DIR is the location for download

Through "include/download.mk“

Init in “rules.mk”

To share downloaded packages

Put them in a shared location /opt/…

Check them in download procedure “define
Download” in file “download.mk”

MEMO: we can use shell to do this.

Eg . test -e /opt/dl/$(FILE) && ln -s /opt/dl/$(FILE) $(DL_DIR)/$(FILE) || (
$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$
(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$
(DownloadMethod/unknown)) )
16
What has been added?
dl/ # for downloaded src.
build_dir/ # source code location
├── host
├── target-mips_mips32_uClibc-0.9.33.2
└── toolchain-mips_mips32_gcc-4.8.3_uClibc-0.9.33.2
logs/ # for compile logs
├── target
├── toolchain
└── tools
staging_dir/ # built out binary files.
├── host
├── target-mips_mips32_uClibc-0.9.33.2
└── toolchain-mips_mips32_gcc-4.8.3_uClibc-0.9.33.2
tmp/
17
What’s in the following slides?
1. # make tools/install
2. # make toolchain/install
3. # make target/compile
4. # make package/cleanup
5. # make package/compile
6. # make package/install
7. # make package/preconfig
8. # make target/install
9. # make package/index
You can issue them, one by
one, in order, so that you
can check and debug
each step.
18
Add our own BSP in target

The makefile in target will go into each
subdir.

Create a dir <BSP> of yours in the target dir.

Create a Makefile contains the following target.
all, download, prepare,
compile, install, clean

This also apply to the general ruls
 Eg # make target/<BSP>/prepare
19
Reference
1. http://wiki.openwrt.org/doc/start
2. http://wiki.openwrt.org/about/toolchain
3. http://wiki.openwrt.org/doc/devel/packages
20

Weitere ähnliche Inhalte

Was ist angesagt?

Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
Openwrt startup
Openwrt startupOpenwrt startup
Openwrt startup晓东 杜
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDPDaniel T. Lee
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptablesKernel TLV
 
BGP (border gateway routing protocol)
BGP (border gateway routing protocol)BGP (border gateway routing protocol)
BGP (border gateway routing protocol)Netwax Lab
 
Deploying IP/MPLS VPN - Cisco Networkers 2010
Deploying IP/MPLS VPN - Cisco Networkers 2010Deploying IP/MPLS VPN - Cisco Networkers 2010
Deploying IP/MPLS VPN - Cisco Networkers 2010Febrian ‎
 
ML2/OVN アーキテクチャ概観
ML2/OVN アーキテクチャ概観ML2/OVN アーキテクチャ概観
ML2/OVN アーキテクチャ概観Yamato Tanaka
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Jian-Hong Pan
 
An Overview of Border Gateway Protocol (BGP)
An Overview of Border Gateway Protocol (BGP)An Overview of Border Gateway Protocol (BGP)
An Overview of Border Gateway Protocol (BGP)Jasim Alam
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking ExplainedThomas Graf
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 
20150511 jun lee_openstack neutron 분석 (최종)
20150511 jun lee_openstack neutron 분석 (최종)20150511 jun lee_openstack neutron 분석 (최종)
20150511 jun lee_openstack neutron 분석 (최종)rootfs32
 
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]APNIC
 
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...LF_DPDK
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN ControllerSumit Arora
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Ahmed El-Arabawy
 

Was ist angesagt? (20)

Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Openwrt startup
Openwrt startupOpenwrt startup
Openwrt startup
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
BGP (border gateway routing protocol)
BGP (border gateway routing protocol)BGP (border gateway routing protocol)
BGP (border gateway routing protocol)
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
Deploying IP/MPLS VPN - Cisco Networkers 2010
Deploying IP/MPLS VPN - Cisco Networkers 2010Deploying IP/MPLS VPN - Cisco Networkers 2010
Deploying IP/MPLS VPN - Cisco Networkers 2010
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
ML2/OVN アーキテクチャ概観
ML2/OVN アーキテクチャ概観ML2/OVN アーキテクチャ概観
ML2/OVN アーキテクチャ概観
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
 
An Overview of Border Gateway Protocol (BGP)
An Overview of Border Gateway Protocol (BGP)An Overview of Border Gateway Protocol (BGP)
An Overview of Border Gateway Protocol (BGP)
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
20150511 jun lee_openstack neutron 분석 (최종)
20150511 jun lee_openstack neutron 분석 (최종)20150511 jun lee_openstack neutron 분석 (최종)
20150511 jun lee_openstack neutron 분석 (최종)
 
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]
MPLS L3 VPN Tutorial, by Nurul Islam Roman [APNIC 38]
 
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...
LF_DPDK17_Serverless DPDK - How SmartNIC resident DPDK Accelerates Packet Pro...
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
 

Ähnlich wie OpenWRT guide and memo

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semSagun Baijal
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semSagun Baijal
 
How to make debian package from scratch (linux)
How to make debian package from scratch (linux)How to make debian package from scratch (linux)
How to make debian package from scratch (linux)Thierry Gayet
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
ZopeSkel & Buildout packages
ZopeSkel & Buildout packagesZopeSkel & Buildout packages
ZopeSkel & Buildout packagesQuintagroup
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake TutorialFu Haiping
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
LOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfLOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfThninh2
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
 

Ähnlich wie OpenWRT guide and memo (20)

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
 
How to make debian package from scratch (linux)
How to make debian package from scratch (linux)How to make debian package from scratch (linux)
How to make debian package from scratch (linux)
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
ZopeSkel & Buildout packages
ZopeSkel & Buildout packagesZopeSkel & Buildout packages
ZopeSkel & Buildout packages
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 
C make cache
C make cacheC make cache
C make cache
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
PHP selber bauen
PHP selber bauenPHP selber bauen
PHP selber bauen
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Autotools
AutotoolsAutotools
Autotools
 
LOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdfLOSS_C11- Programming Linux 20221006.pdf
LOSS_C11- Programming Linux 20221006.pdf
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 

Kürzlich hochgeladen

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 

Kürzlich hochgeladen (20)

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 

OpenWRT guide and memo

  • 1. OpenWRT Basic tutorial guide, memo. by Antony.Wu 1
  • 2. OpenWRT builtroot • It is a set of Makefiles and patches that allows users to generate a cross-toolchain and a root filesystem for embeded system. • It generates cross-compiler toolchain and use the toolchain to build an image for your target board, such as AR-5387un router. • It can also download packages (feeds), patches (using quilt) it for you. • # make toolchain/gdb/prepare QUILT=1 • <modify files in build_dir/> • # make toolchain/gdb/updatevim • It has modified make targets: component/name/action. • # make toolchain/gdb/compile V=s • V=s means “Verboase = stdout/stderror” • # make toolchain/gdb/clean V=s 2 V=? s standard output/error w shows only warning
  • 3. 3 Get OpenWRT buildroot Main repositories and feeds − # git clone git://git.openwrt.org/openwrt.git − # git clone git://git.openwrt.org/packages.git Barrier Breaker − # git clone git://git.openwrt.org/14.07/openwrt.git − # git clone git://git.openwrt.org/14.07/packages.git − # svn co -r 42990 svn://svn.openwrt.org/openwrt/branches/barrier_bre aker
  • 4. 4 Setup OpenWRT environment Using Fedora distribution, you need the following package ready. − # yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl- ExtUtils-MakeMaker glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison wget Check environment variables − # echo $SED # must be empty, or issue '# unset SED' − # echo $GREP_OPTIONS # don't contain '--initial-tab' Set the PATH: − PATH=$PATH:<buildroot dir>/staging_dir/host/bin − PATH=$PATH:<buildroot dir>/staging_dir/toolchain- <platform>-<gcc_ver>-<libc_ver>/bin
  • 5. 5 Understand OpenWRT Feeds It is a set of packages, like a ‘yum repo’, or ‘apt-get repo’ on desktop linux.  The script downloads the packages info into ‘feeds/’ .  The script installs packages into ‘package/feeds/’  Packages in feeds selectable by CONFIG_PACKAGE_xxxx in .config file. The repo is configured in the feeds.conf or feeds.conf.default (such as yum repo configured in /etc/yum.repos.d) A script is used to control those packages  # ./scripts/feeds update -a  Package index (information) will be stored into feeds/  # ./scripts/feeds install <package_name>  Src will be checkouted into package/feeds/<package_name>
  • 6. OpenWRT Make • Clean • # make clean # rm -rf bin build_dir • # make dirclean # rm -rf bin build_dir staging_dir toolchain logs • # make distclean # all above, rm all downloaded packages and .config • Ignore errors • #IGNORE_ERRORS=1 make <make options> • component/name/action. • Clean Linux objects • # make target/linux/clean V=s • Clean package luci. • # make package/luci/clean 6
  • 7. OpenWRT Make sequence 1. # make tools/install 2. # make toolchain/install 3. # make target/compile 4. # make package/cleanup 5. # make package/compile 6. # make package/install 7. # make package/preconfig 8. # make target/install 9. # make package/index You can issue them, one by one, in order, so that you can check and debug each step. 7
  • 8. Create OpenWRT package • Special Makefile template. • Please refer to BuildPackage variables PKG_NAME:=broadcom-wl PKG_VERSION:=5.10.56.27.3 PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources … … $(eval $(call KernelPackage,brcm-wl)) $(eval $(call KernelPackage,brcm-wl-mini)) $(eval $(call BuildPackage,wlc)) $(eval $(call BuildPackage,wl)) $(eval $(call BuildPackage,nas)) • BuildPackage only takes one argument directly – the name of the package to be built, in this case “wlc". # ls -l package/broadcom-wl/ files # default config. Makefile patches # patches from diff src # source code 8
  • 9. Create OpenWRT package 2 • BuildPackage define ‘Package/’ • The following describe the ‘define’ you may need: define Package/broadcom-wl/Default <action> endef • Package/description : description • Package/conffiles : config-files installed by this pkg. • Build/Prepare (optional): How to unpack/patch src. • Build/Configure (optional) : How to configure src. • Build/Compile (optional) : How to compile src. • Build/InstallDev (optoinal) : Lib. needed • Please refer to BuildPackage defines Note: ‘define’ in makefile is like ‘=‘ operator. Define the action when calling ‘Package/broadcom/wl/Default ‘ 9
  • 10. Create OpenWRT package 3 • Override Build option • Autoconf • Eg. CONFIGURE_VARS += ac_cv_header_regex_h=no • Eg. CONFIGURE_ARGS += --disable-native-affinity • Compiler flags • Eg. TARGET_CFLAGS+= -Wall • Make • Eg. MAKE_VARS = CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" … • Eg. MAKE_FLAGS = $(TARGET_CONFIGURE_OPTS) CROSS="$ (TARGET_CROSS)" ARCH="$(ARCH)“ • CMake and Scons • CMAKE_OPTIONS, CMAKE_HOST_OPTIONS • SCONS_VARS 10
  • 11. Create OpenWRT package 4 • Adding configuration options • Add MENU:=1 • Add Config.in Package/<name>/config Makefile: define Package/mjpg-streamer/config source "$(SOURCE)/Config.in“ endef Config.in: menu "Configuration" depends on PACKAGE_mjpg-streamer config MJPEG_STREAMER_AUTOSTART bool "Autostart enabled" default n • How to check your configuration Makefile: ifeq ($(CONFIG_MJPEG_STREAMER_INPUT_UVC),y) $(CP) $(PKG_BUILD_DIR)/input_uvc.so $(1)/usr/lib endif 11
  • 12. Create OpenWRT package 5 • Working on local application source • Using feeds to tracking your state-of-the-art work. # ln -s /path/to/local/awesome_app_tree/.git feeds/my_cool_feed/awesome_app/git-src # make package/awesome_app/{clean,compile} V=s • Using USE_SOURCE_DIR # make package/awesome_app/clean V=s # make package/awesome_app/prepare USE_SOURCE_DIR=~/src/awesome_src V=s # make package/awesome_app/clean V=s • make prepare needs to be run every time • make package/awesome_app/{clean,compile} USE_SOURCE_DIR=~blah doesn't work 12
  • 13. OpenWRT kernel package  Adding configuration options  Add .mk file #vim package/kernel/modules/block.mk define KernelPackage/loop SUBMENU:=$(BLOCK_MENU) TITLE:=Loopback device support KCONFIG:= CONFIG_BLK_DEV_LOOP CONFIG_BLK_DEV_CRYPTOLOOP=n FLES:=$(LINUX_DIR)/drivers/block/loop.ko AUTOLOAD:=$(call AutoLoad,30,loop) endef $(eval $(call KernelPackage,loop))  Announce to build system. # touch package/kernel/linux/Makefile  Add a kernel module that is not part of kernel distribution  Please refer to ‘package/madwifi/Makefile’ 13
  • 14. What’s in the following slides? 1. # make tools/install 2. # make toolchain/install 3. # make target/compile 4. # make package/cleanup 5. # make package/compile 6. # make package/install 7. # make package/preconfig 8. # make target/install 9. # make package/index You can issue them, one by one, in order, so that you can check and debug each step. 14
  • 15. External Toolchain  Compile everything with the target board, you will have a dir named toolchain, called build1  Copy the .config-file from the build1 and make menuconfig. [*] Advanced configuration options (for developers) [*] Use external toolchain Target name: arm-openwrt-linux-uclibcgnueabi (in my case, yours may vary) Toolchain prefix: arm-openwrt-linux-uclibcgnueabi- (mind the dash at the end) Toolchain root: /path/to/toolchain/staging_dir/toolchain-arm_v5te_gcc- linaro_uClibc-0.9.32_eabi 15
  • 16. Alter download procedure  $DL_DIR is the location for download  Through "include/download.mk“  Init in “rules.mk”  To share downloaded packages  Put them in a shared location /opt/…  Check them in download procedure “define Download” in file “download.mk”  MEMO: we can use shell to do this.  Eg . test -e /opt/dl/$(FILE) && ln -s /opt/dl/$(FILE) $(DL_DIR)/$(FILE) || ( $(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$ (DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$ (DownloadMethod/unknown)) ) 16
  • 17. What has been added? dl/ # for downloaded src. build_dir/ # source code location ├── host ├── target-mips_mips32_uClibc-0.9.33.2 └── toolchain-mips_mips32_gcc-4.8.3_uClibc-0.9.33.2 logs/ # for compile logs ├── target ├── toolchain └── tools staging_dir/ # built out binary files. ├── host ├── target-mips_mips32_uClibc-0.9.33.2 └── toolchain-mips_mips32_gcc-4.8.3_uClibc-0.9.33.2 tmp/ 17
  • 18. What’s in the following slides? 1. # make tools/install 2. # make toolchain/install 3. # make target/compile 4. # make package/cleanup 5. # make package/compile 6. # make package/install 7. # make package/preconfig 8. # make target/install 9. # make package/index You can issue them, one by one, in order, so that you can check and debug each step. 18
  • 19. Add our own BSP in target  The makefile in target will go into each subdir.  Create a dir <BSP> of yours in the target dir.  Create a Makefile contains the following target. all, download, prepare, compile, install, clean  This also apply to the general ruls  Eg # make target/<BSP>/prepare 19