embedded linux conference europe 2012 · 2012. 11. 8. · slide 1 - © pengutronix - - 08.11.2012...
TRANSCRIPT
![Page 1: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/1.jpg)
Slide 1 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Sascha Hauer <[email protected]>
Embedded Linux Conference Europe 2012
![Page 2: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/2.jpg)
Slide 2 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Agenda
● Tour through barebox● Devicetree● Multiplatform Bootloader● barebox live demo
![Page 3: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/3.jpg)
Slide 3 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Tour through barebox
● Basic hardware initialization (SDRAM, clocks)● Startup● User Interface● Start operating system● Update● Initial hardware bringup
![Page 4: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/4.jpg)
Slide 4 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
What does a bootloader need?
Motivation - A bootloader should:● be configurable● be scriptable● have a maintainable codebase● have a driver model● have real filesystem support● not require people to know memory layout of a
board● be able to see every type of device as a file● be able to start itself second stage
![Page 5: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/5.jpg)
Slide 5 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
barebox
Busybox – The swiss army knife of embedded Linux
Barebox – The swiss army knife for bare metal
![Page 6: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/6.jpg)
Slide 6 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
barebox
barebox● Started as U-Boot-v2 in July 2007 as a fork of U-Boot-
1.2.0● Renamed to barebox in December 2009● Evolves with ~140 commits / month● - 92 boards● - 8 architectures: ARM, Blackfin, Mips, Nios2, Openrisc,
sandbox, X86
![Page 7: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/7.jpg)
Slide 7 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Kconfig
From basic SRAM config to full blown barebox – withouttouching code
![Page 8: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/8.jpg)
Slide 8 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Lowlevel init
● Setup the minimum requirements for barebox, not more
● Usually this means setting up SDRAM● Ideally this would be the only board specific code● Often written in assembly● Barebox allows to write this code in C● Optionally reset vector is under board control
![Page 9: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/9.jpg)
Slide 9 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Initcalls / driver model
● Barebox starts up using initcalls● Board / SoC code registers devices● Drivers probe based on devices found● Heavily inspired by Linux Kernel driver model
![Page 10: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/10.jpg)
Slide 10 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
User interface
Autoboot based on● Informations from the SoC● Console● Menu● Input devices● LEDs
![Page 11: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/11.jpg)
Slide 11 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Menu support
● The menu can be instantiated from C or the commandline
● Allows executing arbitrary commands / scripts from menu items
shell for experts, menu for convenience and occasional user
![Page 12: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/12.jpg)
Slide 12 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Loading Kernel
From:● TFTP, NFS● (SPI) NOR flash, NAND flash● SD/MMC● UART● USB Mass Storage● FAT● UBI
All accessible as files
![Page 13: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/13.jpg)
Slide 13 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Starting Kernel
barebox has a single boot command supporting● zImages● uImages● barebox images● devicetrees● initrd files
![Page 14: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/14.jpg)
Slide 14 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Booting: fast
● ARM needs the MMU for datachaches, so barebox has generic MMU support for ARM
● The block layer has a LRU caching mechanism● Autoboot timeout 0 still allows interruption
![Page 15: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/15.jpg)
Slide 15 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Updating
Update strategies are project specific
Scripting
'cp' command
Building blocks for a project specific update conept
![Page 16: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/16.jpg)
Slide 16 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Hardware bringup
md
mw
Memcpy, memset, memcmp
magicvar
iomem
devinfo
clk_dump
gpio_*
filetype
Tab completion
timeclk_*
![Page 17: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/17.jpg)
Slide 17 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
barebox in 128Kb
● Freescale i.MX51 babbage- Networking support with tftp, dhcp, ping and dns- MMC/SD read/write support- FAT read/write support- Stack unwinding- Kallsyms- Almost full command set
● Phytec i.MX27 pcm038- Networking support with tftp, nfs, dhcp, ping and dns- CFI NOR flash support- NAND flash support- Stack unwinding- Almost full command set
![Page 18: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/18.jpg)
Slide 18 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
barebox in 128Kb
● TI OMAP3 BeagleBoard- Networking support with tftp, ping dhcp, dns- USB support- USB network adapter support- NAND support- MMC/SD support- FAT read/write support- Almost full command set
● TI OMAP3 BeagleBoard xload config (33k)- NAND support (ro)- MMC/SD (ro)- FAT support- Noninteractive build
![Page 19: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/19.jpg)
Slide 19 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree support
● Unlike PC hardware SoCs are not discoverable
Before the devicetree migration the hardware description was in C-Code inside the Kernel. That's what barebox still does
● Using devicetrees allows separation of the hardware description from the code
● Using devicetrees is becoming the standard way to start the kernel on ARM, PowerPC and other architectures
![Page 20: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/20.jpg)
Slide 20 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree
The devicetree has to be written for every new board anyway
-Let's use it for barebox aswell
![Page 21: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/21.jpg)
Slide 21 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree
Binary blob (dtb)
![Page 22: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/22.jpg)
Slide 22 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree
Unflatten tree
![Page 23: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/23.jpg)
Slide 23 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree
Board specific code
Common code
now
with devicetree
startup code
devicetree
![Page 24: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/24.jpg)
Slide 24 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Devicetree
● Separate code from board data● Make binaries more universally usable● By using devicetrees we can reuse the same Kernel
binary for different hardware variants
![Page 25: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/25.jpg)
Slide 25 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Towards a multiarch bootloader
Board specific code
Common code
now
with devicetree
multiarch
startup code
devicetree
![Page 26: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/26.jpg)
Slide 26 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Multiplatform
multiarch
Barebox update handler
Boot device
![Page 27: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/27.jpg)
Slide 27 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Multiplatform (replace barebox with kernel)
Common code
startup code
devicetree
Linux
![Page 28: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/28.jpg)
Slide 28 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Livedemo
Now for the demo...
![Page 29: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/29.jpg)
Slide 29 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Thank you very much
website: http://www.barebox.org
IRC: #barebox
Project Mailing List: http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer <[email protected]>
![Page 30: Embedded Linux Conference Europe 2012 · 2012. 11. 8. · Slide 1 - © Pengutronix - - 08.11.2012 Sascha Hauer Embedded Linux Conference Europe 2012](https://reader035.vdocument.in/reader035/viewer/2022081620/61065609b29531714115c330/html5/thumbnails/30.jpg)
Slide 30 - © Pengutronix - http://www.pengutronix.de - 08.11.2012
Automount support
● Allows to automatically detect and mount devices when first accessed
● Allows to probe devices only when they are neededFirst, add automountpoint:# automount /mnt/tftp 'ifup eth0 && \ mount -t tftp \ $eth0.serverip /mnt/tftp'
Then, simply access files, barebox will mount in the background:# cp /mnt/tftp/zImage /zImage