Embedded Linux training: switch to the IGEPv2 board

Since early 2009, our training sessions have been using the USB-A9263 board from Calao Systems as the hardware platform for the practical labs. However, this AT91-based platform was getting older, and we therefore started the process of switching our training sessions to a new hardware platform, the IGEPv2 board from ISEE.

IGEPv2 board
IGEPv2 board

The IGEPv2 platform is very similar to the popular BeagleBoard and BeagleBoard-XM platforms, and has the following technical characteristics :

  • TI DM3730, which is the latest OMAP3 processor from Texas Instruments, clocked at 1 Ghz, and including a DSP for signal processing, an IVA block for audio/video decoding and the PowerVR SGX for 3D/OpenGL. This processor offers far more possibilities than the AT91 one, especially for multimedia applications.
  • 512 MB of RAM and 512 MB of OneNAND flash.
  • Integrated Ethernet connector, Wifi and Bluetooth connectivity.
  • One USB OTG port and one USB host port.
  • A microSD connector.
  • A DVI-D connector (HDMI), stereo input and ouput
  • RS232 connector
  • Multiple expansion ports to access LCD, camera, I2C, SPI, JTAG, etc. signals

Compared to the BeagleBoard-XM, this board has the following advantages:

  • it has a OneNAND Flash device, which allows us to demonstrate and practice the usage of MTD and Linux flash-specific filesystems such as JFFS2 and UBIFS in our training sessions. Even though block-based storage such as SD and eMMC is more and more popular in consumer-electronic devices, usage of raw NAND flash is still very common in industrial applications, and we therefore wanted to keep presenting those devices and their usage in embedded Linux
  • ISEE, the company manufacturing the IGEPv2, is located in Spain, which makes it easier for us to regularly order boards from them, since we are also located in Europe
  • the board provides Bluetooth and Wifi connectivity, which is nice

We have already given two sessions of our Embedded Linux system development training with the IGEPv2, and all our future sessions of this training will use this hardware platform, so the participants will benefit from a more modern platform, with far more capabilities than our previous AT91-based training hardware. This is also the board we are now giving to the participants to our public training sessions, so those participants come back home with a very nice and powerful platform which allows countless experiments around embedded Linux. Note that we also intend to port our Embedded Linux kernel and driver development training session to the IGEPv2 platform in the near future.

ELC 2011 videos

The Embedded Linux Conference 2011 took place between April, 11th and April, 13th in its now usual place, the Kabuki hotel in San Francisco, California. It was the first edition organized since the merge of the CE Linux Forum into the Linux Foundation. During three days, three parallel tracks of talks and BoFs about technical topics around embedded Linux : kernel support, power management, build systems, file systems, real-time, and more.

As usual, part of the Bootlin team was at this Embedded Linux Conference, in order to keep up with the latest developments from the embedded Linux community. Gregory Clement (left on the picture), Maxime Ripard (right on the picture) and myself (center on the picture) were present, and we recorded all talks of the conference. And just a little bit more than one month later, we are ready to announce that all videos are now available online, in 1080p high-definition, and in a lower 450p resolution, encoded with the new VP8 codec.

Bootlin at ELC 2011
Bootlin at ELC 2011. From left to right: Gregory Clement, Thomas Petazzoni and Maxime Ripard.

Amongst all the conferences below, each of us have selected the three ones we thought were the most interesting ones (note that the top three for each us is necessarily composed of distinct talks, as none of us have seen the same talks since we had to record talks from three different sessions in parallel) :

  • For Gregory Clement, the top three is: Yoshiya Hirase talk about Faster Resume For More Energy Savings on MeeGo, Arnd Bergmann talk about Optimizations For Cheap Flash Media (which follows Arnd article on the same topic in LWN) and a set of three related talks about the video infrastructure in the Linux kernel, that Gregory recommends to watch in this order: Media Controller Framework (MCF) For OMAP2+ Display Subsystem (Sumit Semwal), Video4linux: Progress, New videobuf2 Framework and the Future (Hans Verkuil) and Bringing up HDMI Display for OMAP4 Panda Board – Design, Challenges and Lessons Learned (Mythri pk).
  • For Maxime Ripard, the top three is: John Stultz talk about Android for servers, Mike Anderson talks about ARM NEON and GPU programming, Wolfram Sang talk about Helping the process
  • For myself, the top three is: Jesse Barker talks about the ARM Graphics ecosystem which gives a nice overview of the state of this topic, Hai Shalom talk about PCD (which is an original and interesting replacement for init), Dave Stewart talk about The Yocto Project and its Application Development Toolkit (because it gives details on how Yocto is supposed to be used for application development, a topic I’m interested in as a Buildroot developer)

It is also worth noting that this Embedded Linux Conference was co-located with the first edition of the Android Builders Summit, for which we will soon publish videos as well. The next embedded Linux conference will take place in Europe, in Prague from October 26th to 28th, co-located with the first edition of LinuxCon Europe and just after the Kernel Summit. Prague will really be full of Linux developers during this end of October, it’s time to book this week on your agenda as well !

Creative commonsIn agreement with the speakers, these videos are released under the terms of the Creative Commons Attribution-ShareAlike 3.0 license.

Finally, the list of all videos of Embedded Linux Conference 2011, along with their corresponding slides :

Tim BirdVideo capture
Sony Network Entertainment
Welcome Keynote
Video (10 minutes):
full HD (131M), 450×800 (43M)

Dirk Hohndel, Richard PurdieVideo capture
Intel, Linux Foundation
The Yocto Project
Video (35 minutes):
full HD (458M), 450×800 (140M)

Keshava MunegowdaVideo capture
Texas Instruments
Power Fail Safe FAT File Systems
Slides
Video (48 minutes):
full HD (693M), 450×800 (203M)

Frank RowandVideo capture
Sony
Identifying embedded real-time issues: I-cache and locks
Slides
Video (46 minutes):
full HD (471M), 450×800 (147M)

Bruno Cardoso LopesVideo capture
University of Campinas
LLVM, Clang and Embedded Linux Systems
Slides
Video (50 minutes):
full HD (593M), 450×800 (164M)

Steven RostedtVideo capture
RedHat
Kernel Shark Tutorial
Video (49 minutes):
full HD (743M), 450×800 (215M)

Kang DongwookVideo capture
ETRI
Snapshoot Booting on Embedded Linux
Slides
Video (33 minutes):
full HD (284M), 450×800 (95M)

Khem RajVideo capture
State of OpenEmbedded Internal Toolchain and SDKs
Slides
Video (41 minutes):
full HD (289M), 450×800 (119M)

David RuslingVideo capture
Linaro
Linaro: a year of change
Slides
Video (50 minutes):
full HD (529M), 450×800 (173M)

Hai ShalomVideo capture
Atheros
Control, recover and debug your embedded product with PCD
Slides
Video (50 minutes):
full HD (470M), 450×800 (160M)

Gene SallyVideo capture
Zigbee Networking and Linux
Video (53 minutes):
full HD (262M), 450×800 (139M)

Xi WangVideo capture
Broadcom
Solving real-time scheduling problems with RT_PREEMPT and deadline-based scheduler
Slides
Video (43 minutes):
full HD (422M), 450×800 (141M)

Mike AndersonVideo capture
The PTR Group
ARM Neon instruction set and why you should care
Slides
Video (53 minutes):
full HD (527M), 450×800 (169M)

Darren HartVideo capture
Intel
Yocto Project: Practical Kernel Development Tutorial
Video (52 minutes):
full HD (551M), 450×800 (196M)

Arnd BergmannVideo capture
IBM
Optimizations for cheap flash media
Slides
Video (49 minutes):
full HD (482M), 450×800 (160M)

Wolfram SangVideo capture
Pengutronix
Developer’s diary: helping the process
Slides
Video (39 minutes):
full HD (315M), 450×800 (112M)

Rajesh LalVideo capture
Nokia
Fun with QML and Javascript
Slides
Video (39 minutes):
full HD (250M), 450×800 (108M)

Thomas GleixnerVideo capture
Linutronix
RT-Preempt: what’s the state and why there is no roadmap
Slides
Video (46 minutes):
full HD (447M), 450×800 (149M)

Jason KridnerVideo capture
Texas Instruments
High-level web interface to low-level I/O on the BeagleBoard
Slides
Video (36 minutes):
full HD (370M), 450×800 (115M)

Arnd BergmannVideo capture
IBM
Becoming part of the Linux kernel community
Slides
Video (34 minutes):
full HD (376M), 450×800 (126M)

Paul MundtVideo capture
Renesas
Working with hardIRQs: life beyond static IRQ assignments
Slides
Video (36 minutes):
full HD (330M), 450×800 (113M)

Amit KucheriaVideo capture
Linaro
Powerdebugging inside Linaro
Slides
Video (46 minutes):
full HD (309M), 450×800 (136M)

Mike AndersonVideo capture
The PTR Group
High-performance computing using GPUs
Slides
Video (57 minutes):
full HD (615M), 450×800 (185M)

Paul LarsonVideo capture
Canonical
Linaro automated validation on ARM
Video (51 minutes):
full HD (581M), 450×800 (184M)

Dave StewartVideo capture
Intel
The Yocto project and its application development toolkit (ADT) – The answer to effective embedded application development
Video (42 minutes):
full HD (362M), 450×800 (139M)

Damian Hobson Garcia, Katusya Matsubara, Takanari Hayama, Hisao MunakataVideo capture
Igel
Integrating a Hardware Video Codec into Android Stagefright using OpenMAX IL
Slides
Video (55 minutes):
full HD (564M), 450×800 (177M)

Koen KooiVideo capture
Texas Instruments
Integrating OpenEmbedded and Yocto
Slides
Video (52 minutes):
full HD (465M), 450×800 (159M)

Mark GrossVideo capture
Intel
How to power tune a device running on a Linux kernel for better suspend battery life
Slides
Video (49 minutes):
full HD (273M), 450×800 (129M)

Remi LorriauxVideo capture
Adeneo Embedded
Real-time audio on embedded devices
Slides
Video (44 minutes):
full HD (437M), 450×800 (138M)

Magnus DammVideo capture
Runtime PM: upstream I/O device power management
Slides
Video (53 minutes):
full HD (486M), 450×800 (164M)

Jesse BarkerVideo capture
Linaro
Linux graphics meets the ARM ecosystem
Slides
Video (50 minutes):
full HD (329M), 450×800 (147M)

David AndersVideo capture
Texas Instruments
Board bringup: open-source hardware and software tools
Slides
Video (38 minutes):
full HD (376M), 450×800 (118M)

John WilliamsVideo capture
PetaLogix
Dynamic co-simulation of FPGA-based systems on chip
Slides
Video (57 minutes):
full HD (567M), 450×800 (198M)

Summit SemwalVideo capture
Texas Instruments
Media Controller Framework (MCF) for OMAP2+ display subsystem
Slides
Video (49 minutes):
full HD (518M), 450×800 (155M)

John StultzVideo capture
IBM
Android for servers?
Slides
Video (37 minutes):
full HD (425M), 450×800 (137M)

Anand GadiyarVideo capture
Texas Instruments
Tools and techniques for debugging embedded systems
Slides
Video (30 minutes):
full HD (139M), 450×800 (81M)

Hans VerkuilVideo capture
Cisco
Video4linux: progress, new videobuf2 framework and the future
Slides
Video (56 minutes):
full HD (534M), 450×800 (171M)

Yoshiya HiraseVideo capture
Nokia
Faster resume for more energy saving on MeeGo
Slides
Video (58 minutes):
full HD (727M), 450×800 (218M)

Jake EdgeVideo capture
Linux Weekly News
What embedded Linux developers should know about IPv6
Slides
Video (46 minutes):
full HD (266M), 450×800 (122M)

Grégoire GentilVideo capture
Always Innovating
Hot multi-OS switch: how to run Ubuntu, ChromiumOS, Android at the same time on an embedded device
Video (61 minutes):
full HD (515M), 450×800 (174M)

Xi WangVideo capture
Broadcom
Controlling memory footpring at all layers: Linux kernel, applications, libraries and toolchain
Slides
Video (38 minutes):
full HD (511M), 450×800 (152M)

Tom Zanussi, Saul WoldVideo capture
Building custom embedded images with Yocto
Slides
Video (49 minutes):
full HD (500M), 450×800 (173M)

Philip BalisterVideo capture
Open SDR
A high performance interface between the OMAP3 and a FPGA
Slides
Video (51 minutes):
full HD (347M), 450×800 (149M)

Jean PihetVideo capture
NewOldBits.com
The evolution of tracing and profiling for power management and accelerators
Slides
Video (40 minutes):
full HD (428M), 450×800 (133M)

Elizabeth FlanaganVideo capture
Intel
Delivering predictability: the Yocto project autobuilder, automated sanity testing, license collection and build statistics tracking
Slides
Video (48 minutes):
full HD (241M), 450×800 (133M)

Mythri pkVideo capture
Texas Instruments
Bringing up HDMI display for OMAP4 Panda board: design, challenges and lessons learned
Slides
Video (40 minutes):
full HD (363M), 450×800 (122M)

Khem RajVideo capture
Debug/develop uClibc with QEMU
Slides
Video (35 minutes):
full HD (226M), 450×800 (98M)

Gunter Ravi SankarVideo capture
Samsung
What are and how to find a program’s unused DSOs
Slides
Video (49 minutes):
full HD (453M), 450×800 (143M)

Bootlin at the Embedded Linux Conference and Android Builders Summit

In just two weeks from now, the Embedded Linux Conference will start in San Francisco, followed by the Android Builders Summit, at the usual Hotel Kabuki location, where the conference is taking place for the third consecutive year.

Embedded Linux Conference 2011

The program of the Embedded Linux Conference has been announced recently, and as usual, features a wide set of technical embedded Linux talks:

  • Filesystem/storage: Power Fail Safe FAT File System, Optimizations For Cheap Flash Media, from Arnd Bergmann, who has also recently published a very interesting article on the same topic.
  • Power management: Faster Resume For More Energy Savings on MeeGo, Powerdebug(ging): A Linaro Perspective, How to Power Tune a Device Running on a Linux Kernel for Better Suspend Battery Life, The Evolution of Tracing and Profiling for Power Management and Accelerators, Runtime PM: Upstream I/O Device Power Management
  • Real-time: Solving Real-Time Scheduling Problems with RT_PREEMPT and Deadline-Based Scheduler, Real-time Audio on Embedded Devices, Identifying Embedded Real-Time Latency Issues: I-Cache and Locks
  • Build system, with a huge number of Yocto-related talks, but no other build systems represented: State of OpenEmbedded Internal Toolchain and SDKs, Yocto Project: Practical Kernel Development Tutorial, Building Custom Embedded Images with Yocto, The Yocto Project and its Application Development Toolkit (ADT) – The Answer to Effective Embedded Application Development, Yocto Project Community BoFs, Delivering Predictability: The Yocto Project Autobuilder, Automated Sanity Testing, License Collection, and Build Statistics Tracking
  • Multimedia: Fun with QML and JavaScript, Integrating a Hardware Video Codec into Android Stagefright using OpenMAX IL, Media Controller Framework (MCF) For OMAP2+ Display Subsystem, Video4linux: Progress, New videobuf2 Framework and the Media Controller, Bringing up HDMI Display for OMAP4 Panda Board – Design, Challenges and Lessons Learned, Linux Graphics Meets the ARM Ecosystem
  • FPGA: Dynamic Co-simulation of FPGA-based Linux Systems-on-Chip, A High Performance Interface Between the OMAP3 and an FPGA
  • Networking: What Embedded Linux Developers Should Know About IPv6, Zigbee Networking & Linux
  • Debugging: Kernel Shark Tutorial and Tools and Techniques for Debugging Embedded Systems
  • Optimization: Snapshot Booting on Embedded Linux, ARM Neon Instruction Set and Why You Should Care, Controlling Memory Footprint at All Layers: Linux Kernel, Applications, Libraries and Toolchain, High-Performance Computing using GPUs, What Are and How to Find a Program’s Unused DSOs
  • Low-level: Board Bringup: Open Source Hardware and Software Tools, Working with HardIRQs: Life Beyond Static IRQ Assignments, Genie in the Bottle: Linux Drivers for the AM1808 PRU
  • And many other talks on various topics: LLVM, Clang and Embedded Linux Systems, Linaro: A Year of Change, Control, Recover and Debug Your Embedded Product with PCD, Developer’s Diary: Helping the Process, High-Level Web Interface to Low-Level Linux I/O on the Beagleboard, Linaro Automated Validation on ARM, Crowd Sourcing and Protecting the Open Source Community, Android for Servers?, Hot Multi-OS Switch: How to run Ubuntu, ChromiumOS, Android at the Same Time on an Embedded Device.

This edition will be the first one organized since the merge between the CE Linux Forum into the Linux Foundation, and will therefore be a great opportunity to see if this merge had any impact on the technical quality of the conference.

My colleagues Maxime Ripard (who joined Bootlin just a week ago) and Gregory Clement as well as myself will be present at the Embedded Linux Conference and the Android Builders Summit, and we will as usual record all talks of both of these conferences and will put them online, as we have done recently for the talks that took place during the Embedded Linux Conference Europe 2010 in Cambridge. Do not hesitate to meet us in San Francisco!

ELC-E 2010 tutorial videos

Videos from the embedded Linux and Android tutorials at ELC-E 2010, by Chris Simmonds

As releasing ELC-E 2010 videos, here are recordings of the embedded Linux and Android tutorials, performed by Chris Simmonds on October 26, 2010.

Chris SimmondsVideo capture
2net
The Embedded Linux Quick Start Guide – Part 1
Slides
Video (52 minutes, 397M)
Chris SimmondsVideo capture
2net
The Embedded Linux Quick Start Guide – Part 2
Slides
Video (79 minutes, 660M)
Chris SimmondsVideo capture
2net
The Embedded Linux Quick Start Guide – Part 3
Slides
Video (67 minutes, 501M)
Chris SimmondsVideo capture
2net
What else can you do with Android? – Part 1
Slides
Video (49 minutes, 432M)
Chris SimmondsVideo capture
2net
What else can you do with Android? – Part 2
Slides
Video (31 minutes, 293M)
Chris SimmondsVideo capture
2net
What else can you do with Android? – Part 3
Slides
Video (59 minutes, 545M)

Linux Kernel Development, third edition

Linux Kernel Development, by Robert Love, 3rd edition

Linux Kernel Development is a book authored by Robert Love, a famous kernel developer. Contrary to the very famous Linux Device Drivers book, Linux Kernel Development is not oriented towards driver development, but instead covers how the core Linux kernel works.

Having this knowledge is not absolutely necessary to write Linux device drivers, but having a good overall understanding of the kernel always help to understand what’s going on in your system, even at the application level. In July this year, the third edition of Linux Kernel Development has been published, which upgrades the book contents to kernel version 2.6.34, a good opportunity to have a new look at the book that Bootlin received a few weeks ago.

After a quick introduction to the kernel sources (configuring, building, organization of the source tree), the book immediately dives into kernel internals:

  • Process management: how the kernel represents processes and their state, how processes are created inside the kernel, how threads are handled, are processes are terminated.
  • Process scheduling: a full chapter dedicated to the Linux kernel process scheduler. The new CFS scheduler is of course covered in great detail, with large portion of commented source code, for those who want to understand the fine details of the scheduler. Topics such as process sleep/wake-up, preemption, real-time scheduling policies are also covered.
  • System calls are then covered: how they are implemented, how parameters are passed from userspace to the kernel, etc. The call path from your user-space application down to the kernel is well explained in this chapter.
  • Kernel data structures: a generic chapter which details the kernel API for linked lists, queues, maps, and binary trees. Those APIs are omni-present inside the kernel, and it’s therefore a good idea to know how they work, both for understand existing code and for writing new code.
  • Interrupts: how interrupts are handled and how one can write an interrupt handler. Unfortunately, the newly introduced threaded interrupt handlers are not covered, but it’s true that their usage is not yet very widespread inside the mainline kernel.
  • Bottom halves and deferring work, a topic closely related to interrupt handling. It covers bottom halves, softirqs, tasklets and workqueues.
  • Kernel synchronization: two chapters are dedicated to this topic. First a chapter detailing why synchronization is needed, what are the sources of concurrency and what should be protected against concurrent access. And then a chapter detailing the mechanisms provided by the kernel to implement proper synchronization: atomic operations, spin locks, reader-writer spin locks, semaphores, reader-writer semaphores, mutexes, completion variables, sequential locks, preemption disabling, ordering and barriers
  • Timers and time management details how the kernel manages time: ticks, jiffies counter, timers, delaying execution of code are covered in this chapter. There are unfortunately no details about the clocksource and clockevents infrastructure, and no details about how timers and high-resolution timers are implemented. Contrary to other chapters that go fairly deep into the implementation details, this one mostly only covers the API to time management rather than the internals.
  • Memory management is the topic of the following chapter: physical memory management with the page allocator and the physical zones, then the kmalloc, vmalloc and SLAB allocators are covered. High-memory mappings, a topic specific to 32 bits architectures having more than a gigabyte of RAM is also covered in detail. The per-cpu interface is also covered, and will help those who want to understand parts of the kernel that have been optimized for scalability on multiple CPUs.
  • The Virtual Filesystem, with its different objects: superblock, inode, dentry and file is covered in good detail.
  • The block layer is then covered, with a description of the role of the bio structure, the request queues, and the I/O schedulers.
  • Then, the book goes back to more details about the internals of memory management: the mm_struct memory descriptor, the virtual memory areas (so called VMAs) and how they relate with the mmap/munmap system calls. The next chapter continues with a detailed description of the page cache implementation.
  • A fairly strange chapter called “Devices and modules” gives some information about kernel modules (how to build them, how to use module parameters, how dependencies are handled), then covers the internal of the device model (kobjects, ktypes, ksets, krefs) and finally sysfs. Just like the chapter covering the device model in the third edition of Linux Device Drivers, I think it totally misses the point. All the kobject, ktypes, ksets and krefs stuff is very low-level plumbing used by the Linux device model, but it is not exactly what the driver developer needs to interact with in the first place. In my opinion, a good description of the device model should rather explain what struct bus_type, struct driver and struct device are, how they are specialized for the different bus types in pci_driver, pci_device, usb_driver, usb_device, platform_driver, platform_device, and how the registration/probing of drivers and devices is done. I’ve recently given a talk about this topic, the video is in French, but the slides are in English.
  • Debugging is then covered: printk of course, but also oopses, debugging-related kernel options, the magic SysRq key, kernel debuggers, etc.
  • A rather generic chapter about Portability is then proposed, and finally a chapter about Patches, Hacking and the community that details the kernel community, the kernel coding style, how to generate and submit patches, etc.

All in all, Linux Kernel Development remains very good reading. I particularly appreciate the writing style of Robert Love, who manages to make a deeply-technical book interesting and easy to read. Of course, there are some topics in the kernel in which I had to dive myself and for which I’d expect to see more details in this book, but giving every possible detail about a huge beast such as the Linux kernel in just 400 pages is not possible!

Videos from FOSDEM 2010

Peter Korsgaard presenting Buildroot in the Cross build systems workshop at FOSDEM 2010

Like every year, the Free and Open Source Developer European Meeting took place early February in Brussels, and Thomas Petazzoni, from Bootlin, attended and recorded a few talks from the embedded session. However, contrary to previous years, I haven’t been able to record all talks from the embedded session, since I attended talks from other sessions which were already being recorded by others.

Gian-Carlo Pascutto presenting Embedded software development best practices at FOSDEM 2010

We also attended talks from the X.org and Coreboot developer roooms : videos for the X.org developer room can be found at http://video.fosdem.org/2010/devrooms/xorg/ and videos for the Coreboot developer room can be found at http://video.fosdem.org/2010/devrooms/coreboot/.

ELC 2010 videos

Videos from the Embedded Linux Conference in San Francisco, April 12-14, 2010.

The 2010 edition of the Embedded Linux Conference was once again a very interesting event. For embedded Linux developers, the Embedded Linux Conference is a perfect place to learn about new technologies, profit from the experience of other developers, and to meet key software developers.

For people who couldn’t attend this conference, and for single core people who didn’t manage to attend two or three talks at the same time, here are the videos that we managed to shoot. As usual, the videos are released with a Creative Commons Attribution – ShareAlike 3.0 license.

We hope it makes you feel like joining the next edition of the conference. If you can’t wait, what about going to ELC Europe in Cambridge (UK) in late October? It has a very interesting program too. Of course, the sessions will also be recorded. I hope to see you there!

ELC Europe 2010 sessions announced

List of sessions and speakers at ELC Europe in Cambridge, UK

Cambridge, UKBeing a member of the organization committee of the Embedded Linux Conference Europe, I get access to fresh news about this yearly conference. The call for presentations is now over and we have just announced the list of sessions.

Note that this list is not the final one yet. Some speakers haven’t confirmed their participation or haven’t sent their biographies yet. There are also two or three speakers added at the last minute who are not listed yet.

The conference will happen in Cambridge, UK, on October 27-28, 2010. Keep an eye on the website (or on our blog). Registration should open in a few days from now, and all practical details will be given then.

See also the agenda of the GStreamer conference which will happen at the same location on the day before.

How to find the root device?

How to find which device corresponds to your root filesystem

I recently found something I was looking for for quite a long time. If you use the mount command in Linux, you can see that the root device is not listed like the other mounted filesystems:

/dev/root on / type ext3 (rw)
/dev/mmcblk0p1 on /mmcboot type vfat (rw)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /dev type tmpfs (rw,mode=0755)
...

For the / mount point, you are just told that it corresponds to /dev/root, which is not the real device you are looking for.

Of course, you can look at the kernel command line and see on which initial root filesystem Linux was instructed to boot (root parameter):

$ cat /proc/cmdline
mem=512M console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait

However, this doesn’t mean that what you see is the current root device. Many Linux systems boot on intermediate root filesystems (like initramdisks and initramfs), which are just used to access the final one.

I explored the contents of /proc, but didn’t find any file revealing what the root device is.

Fortunately, I eventually found a command to find the root device:

$ rdev
/dev/mmcblk0p2 /

But how does this work? How could we find such information by ourselves? Use the Source, Luke!

When you ask yourself questions like this one, the best is to look at the BusyBox sources which implement this command. These sources are usually simpler than the ones for the same GNU command.

Here is what BusyBox rdev does… It first runs the stat system call on the / directory. Let’s run the stat command that corresponds to it:

$ stat /
  File: `/'
  Size: 4096      	Blocks: 8          IO Block: 4096   directory
Device: b302h/45826d	Inode: 2           Links: 23
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2010-07-21 22:00:01.000000000 +0200
Modify: 2010-06-13 15:04:37.000000000 +0200
Change: 2010-06-13 15:04:37.000000000 +0200

What’s interesting is the Device field. It means that the device corresponding to / has the major number b3 in hexadecimal (179 in decimal), and minor number 02. Bingo, this corresponds to /dev/mmcblk0p2:

$ ls -l /dev/mmcblk0p2 
brw-rw---- 1 root disk 179, 2 Jan  1  1970 /dev/mmcblk0p2

Therefore, what BusyBox rdev does is walk through /dev and its subdirectories to find a device file matching the major and minor numbers.

This is not a completely generic solution though. On some very simple embedded systems, you don’t even need to create device files for all existing devices. In particular, the device file for the root filesystem doesn’t have to exist. In such a case, rdev wouldn’t be able to find the root device.

A more generic solution could be to walk through /sys/block which enumerates all the block devices present on a system (even if not all of them have an entry in /dev/. This would allow to find the device with the matching major and minor numbers:

$ cat /sys/block/mmcblk0/mmcblk0p1/dev
179:1

Through this example, you can see how useful it can be to study the sources of system commands to understand how the system works. BusyBox sources, implementing simplified versions of GNU utilities, make this even easier.

Linux device drivers architecture talk at Libre Software Meeting

recursive device modelThomas Petazzoni gave a talk on the Linux kernel architecture for device drivers at the Libre Software Meeting in Bordeaux, France. While the talk was given in French, the materials are in English and can therefore benefit a larger audience. The talk seems to have been well-received, especially from people already having a basic Linux kernel development experience. The topics covered are part of our Linux Kernel development training, and are also usually very appreciated from the trainees already having Linux kernel experience.

The idea of the talk is to give an overview of how device drivers fit into the kernel, both to expose their functionality to upper layers (such as a network device driver exposes itself to the kernel network infrastructure) and to detect/access the hardware using the device/driver model, which is quite hard to understand from the source code only.

The talk went through the following sections :

  • First a basic introduction to device drivers: how devices are seen from userspace applications, and how a simple, raw, character driver can be implemented. It allowed to expose the principle of operations and their similarity with methods in object-oriented programming, and the principle of registration to an upper-layer infrastructure
  • Then, an introduction to what I call « kernel frameworks », i.e kernel subsystems that specialize a general device type (i.e character device) into a particular device type (i.e serial port device, framebuffer device, etc.). The talk illustrates this with the framebuffer core and the serial port core.
  • Finally, an explanation about the device model: bus drivers, adapter drivers and device drivers. I started with the example of the USB bus: being a dynamically-enumerated bus, it provides a good illustration of the device model principles. At the end, I explained how the device model works for the devices embedded into a SoC using the platform drivers/devices mechanism

The slides for this talk are no longer available, but their updates are now integrated in our Linux kernel and driver development training materials which are freely available.