openwrt from top to bottom
TRANSCRIPT
![Page 1: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/1.jpg)
OpenwrtAnd some embedded FW building
![Page 2: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/2.jpg)
About me● Anton Lerner● Architect at Sitaro
![Page 3: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/3.jpg)
Agenda● Introduction to OpenWRT● FW & cross compiling basics● OpenWRT FW Memory layout● Building an Openwrt Package
![Page 4: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/4.jpg)
What is Openwrt
● Embedded Firmware● Open source● Linux based● Run mainly on routers● Many apps and tweaks!
![Page 5: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/5.jpg)
Openwrt for the WIN!
$ $$$ !!
![Page 6: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/6.jpg)
Basic image for openwrt
● Busybox● Luci● Command line configuration● Firewall● Opkg - package manager
![Page 7: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/7.jpg)
Short feature presentation
![Page 8: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/8.jpg)
OpenWRTs origins● Linksys WRT54G
![Page 9: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/9.jpg)
Other versions
DD-WRT
Gargoyle
LEDE
Deb-WRT
Tomato Roofnet
![Page 10: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/10.jpg)
Under the hood
Customized Linux kernel for embedded devices
Drivers - Wifi, Lan, chipset specific, generic
Applications - DHCP, DNS, BusyBox, LuCi
![Page 11: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/11.jpg)
Conventional firmware key concepts● Reliable firmware
○ Checksum, custom headers○ Read only filesystem - avoid corruption of data
● Small size○ Flash size is small, we want to get the most of it!
● Filesystem is read only - cannot tweak after the image is built○ NVRAM is used for persistent configuration modifications
FW Header LZMA decompressor Zipped kernel NvramSquash fs chk
![Page 12: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/12.jpg)
Firmware and boot
Boot loader
Unzipped kernel
Drivers Applications
Boot Decompressor
Filesystem
![Page 13: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/13.jpg)
OpenWRT vs conventional FW● Static image● Squashfs + Ram FS
SquashFS - read only FS Temp-fs runtime cfg. NVRAM - persistent config
FW Header LZMA decompressor Zipped kernel NvramSquash fs chk
Kernel
![Page 14: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/14.jpg)
Openwrt FW and flash layout
● Applications can be installed and uninstalled in run time● Fully Writable Filesystem!
○ Copy on write using JFFS2
SquashFS - read only FS - ROM JFFS2 - Writable
Overlay - FSKernel
FW Header
LZMA decompressor Zipped kernel NvramSquash fs chk JFFS2
![Page 15: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/15.jpg)
Copy on write● FS Have /rom for squashFS and /overlay for JFFS2 mounts● / mounted with overlay_fs● Great success!
SquashFS - read only FS - ROM JFFS2 - Writable
Overlay - FSKernel
Write to /etc/antonCopy on write
![Page 16: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/16.jpg)
A lot of vendors, Different Chipsets
![Page 17: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/17.jpg)
OpenWRT 4 all● Openwrt is available on different chipsets
○ Table of hardware
● Each Openwrt version for a specific router contains*○ OpenWRT pre built image○ SDK and cross compiling tools
● Porting packages into router is (relatively) quick and easy
![Page 18: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/18.jpg)
A bit about chipsets
● SoC - system on chip● NICs● Hardware switch
![Page 19: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/19.jpg)
Packages
● Over 3500 apps○ In OPKG repository○ Torrent client○ Adblock○ OpenVPN○ Different network monitoring tools
● We can make our own packages
![Page 20: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/20.jpg)
Building our own package
● Build SDK○ Toolchain + cross-compiler○ OpenWRT makefile framework○ Buildroot
![Page 21: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/21.jpg)
Cross compiling toolchains● A set of compilers and compiling tools ● Custom made for a specific Chipset / Processor● Released with hardware by vendor● Usually supports c/c++● Contains custom libs for libc / libc++ and other utilities
○ Smaller size
![Page 22: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/22.jpg)
OpenWRT build infra
● On top of buildroot● Custom makefile structure● Part of openwrt package build process● Custom keywords for package creation and install
![Page 23: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/23.jpg)
A word about buildroot
● Framework containing scripts and makefiles● Enables to build a linux image from scratch● Used when compiling embedded FW
○ Cross compiling friendly!
● In openwrt, used with scripts that connect to OpenWRT app feeds
![Page 24: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/24.jpg)
Buildroot + OpenWRT makefile infra● Download open source code of included packages● Compile downloaded packages with cross compiler tools● Download and compile dependencies● Compile any custom packages● Build the kernel according to our specifications● Create a rootFS filesystem● Copy package content into rootFS● Zip FS and create loadable image
![Page 25: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/25.jpg)
Demo - Building Package
![Page 26: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/26.jpg)
Build Package- Tutorial Checklist● Check for OpenWRT support!● Choose correct SDK / OpenWRT code branch
○ Download SDK from site or compile one using buildroot
● Create custom makefile● Compile using buildroot + correct cross compiler● Locate Package● Copy to router● Opkg install● Have fun!
![Page 27: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/27.jpg)
OpenWRT platform
● Runs on multiple platforms and architectures● Upgrade your router's capabilities● Excellent research tool● Many flavors, Active communities
![Page 28: OpenWrt From Top to Bottom](https://reader031.vdocument.in/reader031/viewer/2022021815/5a65f5b07f8b9aaf638b6791/html5/thumbnails/28.jpg)
Questions