Michael Opdenacker Linux Tiny Linux-Tiny - The diet must go on Michael Opdenacker Free Electrons

Slides:



Advertisements
Similar presentations
FatMax Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5.
Advertisements

Internet of Things with Intel Edison GPIO on Edison
Upgrading Software CIT 1100 Chapter4.
The Branching Storyboard Chapter 4.3 in Sketching the User Interface: The Workbook Image from:
Internet of Things with Intel Edison Presentation Paul Guermonprez Intel Software
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
N. XXX Prof. O. Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
SM3121 Software Technology Mark Green School of Creative Media.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Chapter-4 Windows 2000 Professional Win2K Professional provides a very usable interface and was designed for use in the desktop PC. Microsoft server system.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CELF Contract Work Update on CELF Projects Tim Bird - CELF AG Chair.
© 2012 The McGraw-Hill Companies, Inc. All rights reserved. 1 Third Edition Chapter 5 Windows XP Professional McGraw-Hill.
Internet of Things with Intel Edison Compiling and running Pierre Collet Intel Software.
Installation Overview Lab#2 1Hanin Abdulrahman. Installing Ubuntu Linux is the process of copying operating system files from a CD, DVD, or USB flash.
Writing macros and programs for Voyager cataloging Kathryn Lybarger ELUNA 2013 May 3, #ELUNA2013.
CELF Project and Conference Information Tim Bird CELF Architecture Group Chair.
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
Implementation of Embedded OS
Chapter 25 – Configuration Management 1Chapter 25 Configuration management.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Free Electrons Introduction.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Introduction to Git Thomas.
| © 2007 LenovoLenovo Confidential Use WinDBG Tool to Analyze BSOD —— Lenovo Service Support Training.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Embedded Linux system development.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The GRUB bootloader Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Free Electrons Linux kernel.
Embedded Linux Wiki BOF. eLinux Wiki 2 Embedded Linux Wiki BOF Ottawa Linux Symposium June 2007 © 2007 Michael Opdenacker
Harvesting Free Windows CPU Cycles for Linux Applications using Sandboxing Rasmus Andersen Dept. of Computer Science, University of Copenhagen, Denmark.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Scratchbox The Scratchbox.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Block filesystems Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com SSH Thomas Petazzoni Free.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Embedded Linux Training System.
1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com ELC 2009 System Size BOF Michael.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Block filesystems Michael.
Installing Windows 7 Lesson 2.
GNU and Linux.
The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons
bitcurator-access-webtools Quick Start Guide
Development Environment
Ottawa Linux Symposium 2007
© 2002, Cisco Systems, Inc. All rights reserved.
Discovering Computers 2012: Chapter 8
CELF Embedded BOF - Ottawa - July 2008
Using USB gadget drivers
smem: understanding memory usage
UBUNTU INSTALLATION
Porting U-boot Michael Opdenacker Free Electrons
Chapter 12: File System Implementation
5.0 : Windows Operating System
The blob bootloader Thomas Petazzoni Free Electrons
Penguin Weight Watchers
Embedded Linux Conference - April 2009
Get Oracle 8i Running on Your Linux Server Straight Away!
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
OPS235: Week 1 Installing Linux ( Lab1: Investigations 1-4)
Chapter 2: The Linux System Part 1
IS3440 Linux Security Unit 7 Securing the Linux Kernel
Memory Management Overview
OPS235: Week 1 Installing Linux ( Lab1: Investigations 1-4)
Git CS Fall 2018.
Have you seen this screen?
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
Presentation transcript:

Michael Opdenacker Linux Tiny Linux-Tiny - The diet must go on Michael Opdenacker Free Electrons

Michael Opdenacker Who I am Michael Opdenacker ● The founder of Free Electrons, a company supporting organizations and individuals using FOSS in embedded systems. ● Author of free embedded Linux training materials( pages): ● Interested in CELF projects, in particular size and boot time issues. ● The new maintainer of Linux Tiny.

Michael Opdenacker Linux kernel size evolution Size of the Linux kernel from to ● Tested on a minimalist PC emulated by Qemu. ● Kernels only configured with the below features: – Support for ELF binaries – IDE disk support – ext2 file system ● Each of these kernels boots successfully!

Michael Opdenacker Right to copy Attribution – ShareAlike 2.5 You are free to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: © Copyright 2007 Free Electrons Document sources, updates and translations: electrons.com/articles/linux-tinyhttp://free- electrons.com/articles/linux-tiny Corrections, suggestions, contributions and translations are welcome!

Michael Opdenacker Expansion of our universe

Michael Opdenacker Why does it grow? ● Because the Universe grows ● More features ● Support for more use cases ● Support for legacy situations ● Because it's easier to add than remove code. ● Because there are not enough reviewers for kernel code.

Michael Opdenacker Need for a smaller Linux kernel ● Booting on a floppy disk ;-) Any Windows Vista boot floppies BTW? ● Embedded systems: Linux can run on systems with very little RAM and storage. Every KB counts if it can make Linux fit. ● Because we don't want to force people to use older, smaller kernels. ● To reduce complexity, useful for debugging. ● To reduce compile time.

Michael Opdenacker The Linux Tiny project ● First started by Linus Torvalds in 1996, when he accidentally ran: rm -rf linux-src (a bit too small) ● Continued by Matt Mackall in December, Many patches merged in mainstream. ● Stalled in late 2005 (Linux ) ● Revived in 2007 by Tim Bird: upgraded remaining patches patches from to

Michael Opdenacker Project staff ● Tim Bird (Sony) ● John Cooper (WindRiver) ● Michael Opdenacker (Free Electrons) ● Matt Mackall (Selenic.com) ● The LKML: Deterring people from merging code ;-) ● You! Contributors are most welcome.

Michael Opdenacker Linux Tiny's goals (1) Improve the mainstream Linux kernel ● Hunt for bloat, or at least resist it. ● Offer tools to find bloat ● Reduce the kernel's memory consumption.

Michael Opdenacker Linux Tiny's goals (2) Remove features not needed in a production or dedicated systems ● Productions systems: no need for core dumps, debugging, console (printk). ● Dedicated systems: just need to support a fix set of programs doing very specific things. Generic systems (PCs, PDAs, smart phones) have to be ready to support any new program or libraries. apt-get install gdb !?

Michael Opdenacker Where we are today A configuration the Linux kernel is comfortable with: ● 4 MB of RAM ● 1.5 MB of storage, including the compressed kernel (< 1 MB) Of course, depends on userspace complexity. A configuration we would like to support: ● 2 MB of RAM ● A compressed kernel as small as 300 KB for simple configurations.

Michael Opdenacker Linux Tiny Reducing the size of a standard kernel

Michael Opdenacker The most powerful tool make allnoconfig ● Selects only but the minimum features. ● Then, add only the features you need. ● Dramatically reduces compile time.

Michael Opdenacker Using Embedded options Screen capture from

Michael Opdenacker Disabling debugging messages One for the biggest space savers ● Removing support for printk() and BUG(): Kernel debugging too late in production systems ;-) ● Raw size reduction: -83 KB in our simple Qemu testcase (2.6.23) ● The bigger your kernel, the greater space savings are.

Michael Opdenacker The SLOB memory allocator ● Created by Matt Mackall ● A replacement for the SLAB memory allocator which is more space efficient, but doesn't scale well. Can be used in small embedded systems when saving a few hundred KB matters. ● Available in the standard kernel. ● Need to see how it compares to SLUB, the new allocator.

Michael Opdenacker Linux figures Still for our Qemu system ● With the default kernel: Raw: 1385 KB, compressed: 583 KB ● With mainstream Linux Tiny switches (including SLOB): Raw: 1155 KB, compressed: 470 KB ● With all Linux Tiny switches, including those not in mainstream yet: Raw: 1106 KB, compressed: 454 KB We can do much better: the compressed kernel size was 320 KB in

Michael Opdenacker Measuring size ● Use the below command: nm --size vmlinux ● Use the scripts/bloat-o-meter script in the kernel to compare 2 kernel versions See

Michael Opdenacker Current status ● Lots of patches still need mainlining! Current number of patches: approx. 40. ● Otherwise, bitrot will quickly make them obsolete again.

Michael Opdenacker Linux Tiny Ongoing projects, ideas and future work

Michael Opdenacker Measuring size reduction Linux Tiny Test Project ● ● Automatically identify the Linux Tiny patches which bring best footprint savings ● Doesn't measure memory consumption savings.

Michael Opdenacker Measure the impact of kernel options ● Ongoing work by John Cooper to automate the size impact of each option of the Linux kernel. More details soon on the project page.

Michael Opdenacker Finding unconditional code find drivers -name Makefile -exec grep -H "obj-y" {} ';' ● Look for suspicious stuff. Findings: ● arch/i386/kernel/Makefile: (-254 B) #obj-y += pcspeaker.o ● arch/i386/kernel/cpu/Makefile: (-16.5 KB) #obj-y += amd.o #obj-y += cyrix.o #obj-y += centaur.o #obj-y += transmeta.o obj-y += intel.o intel_cacheinfo.o addon_cpuid_features.o #obj-y += nexgen.o #obj-y += umc.o

Michael Opdenacker More findings mm/Makefile: obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ page_alloc.o page-writeback.o pdflush.o \ readahead.o swap.o truncate.o vmscan.o \ prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \ $(mmu-y) ● pdflush, readahead, swap : not needed when no storage is available (when you use only an initramfs: a root file system embedded in the kernel image) ● pdflush: not needed when you have only read-only partitions: squashfs, cramfs, read-only mounts.

Michael Opdenacker Looking for complexity? ● How to find complex functions? Static C checkers to detect functions exceeding a given length? -> Opportunity to propose simpler implementations. ● Compressing source code and see which source files are best compressed. -> Opportunity to factor redundant information.

Michael Opdenacker More ideas ● Compile all files at once (David Woodhouse) ● proc filesystem with a reduced fileset. Otherwise, it consumes 130 KB. ● Migration of debugging interfaces to debugfs ● do-printk patch (Tim Bird) Enable printk debugging only on specific files ● Compile only printk messages above a specified severity (Rob Landley)

Michael Opdenacker Things to do To list just a few: ● Propose existing patches to the LKML for merging. Only maintain the ones which stand a change to be merged. ● Offer qemu images to test tiny kernels: i386, arm, ppc, mips, sparc, m68k ● Compare SLOB vs. SLUB. ● Improve Tiny kernel testing

Michael Opdenacker Reasons for contributing ● To help us build a smaller and simpler kernel ● Opportunities to discover and explore many parts of the kernel. ● Interesting to read other people's code and discuss improvements with experienced kernel developers. ● Much easier than investing in expertise in very specific kernel topics.

Michael Opdenacker Quotation One of my most productive days was throwing away 1,000 lines of code. -- Ken Thompson

Michael Opdenacker How to contribute ● When you make a patch or send a suggestion, it's best to copy both the Linux Tiny and Linux Kernel mailing lists. ● We are interested in ideas, experiments, benchmarks... ● Write your ideas on Even tiny contributions are welcome ;-)

Michael Opdenacker References ● Home page: ● Mailing list: ● Other techniques to reduce system size (in userspace too): ● Small system demos: