Pushing the limits of Linux on ARM
Transcription
Pushing the limits of Linux on ARM
Pushing The Limits Of Linux On ARM LinuxCon Japan 2015 Andreas Färber [email protected] Overview 2 • Definition of “Linux on ARM” • Transitioning from Embedded to Servers & Desktops • Pushing the limits ‒ in general ‒ for embedded Linux On ARM Quick Introduction • • • Architecture by ARM Ltd. / ARM Holdings plc (UK) ‒ ARM7, ARM9 used in embedded devices “for ages” ‒ ARMv7 with Cortex-A8, etc. also popular with hobbyists ‒ ARMv8 offers 64-bit AArch64 mode, attractive for servers Development boards (for ARMv7) abundant ‒ Reminder: Android is based on the Linux kernel, but ‒ Too often unofficial “downstream” kernel forks are used Goal: Get support for ARM boards into the official kernel.org Linux tree (“mainline” or “upstream”) ‒ 4 To run a standard userspace distribution, e.g. openSUSE From Embedded And Mobile To Desktop And Servers From Embedded To Desktop & Servers • • Traditionally used in resource-constrained devices ‒ Cross-built with configuration optimized for target device ‒ Device drivers built into kernel (e.g., exynos_defconfig) Multi-platform support allows to build support for multiple chip platforms into a single kernel ‒ ‒ 6 Allows for generic kernel with most drivers as modules ‒ Less tested, some build failures caught via randconfig ‒ Occasional runtime failures only found when testing on device! Requires such devices to be supported by one kernel source The openSUSE Kernel linux.git linux-stable.git openSUSE:Factory:ARM openSUSE:Factory kernel.git Kernel:stable kernel-source.git Kernel:HEAD 7 Pushing The Limits Where Are Limits Being Pushed? • New ARM IP ‒ • New chip vendors ‒ • Handled by ARM themselves (except for Mali graphics) Linaro can help ARM licensees get started properly New chips, new boards ‒ Vendors often distribute a Board Support Package (BSP) including Linux kernel but don't submit their patches ‒ • 9 Little or no security fixes, no new upstream features Old chips and boards people didn't need Linux on yet Simplest: Board Support • Prereq.: SoC (platform and drivers) supported • Device Tree (.dts) is used as hardware description ‒ • ACPI upcoming as alternative hardware description ‒ • 10 Either supplied to firmware (U-Boot), or by firmware (UEFI) Supplied by firmware (UEFI) No .dts file for your board? Then add it yourself! ‒ Peek at downstream .dts and/or similar upstream .dts files ‒ Read schematics, if available; fallback: trial-and-error ‒ Examples: exynos5250-spring.dts, zynq-parallella.dts Advanced: System-On-Chip Support • Prereq.: SoC family already supported • .dtsi file will reference at least one new driver • Technical Reference Manual or vendor tree needed • 11 ‒ Compare chip-specific bits to those of one already supported ‒ Peek at earlier and later .dtsi files and drivers? (Careful!) Example: Samsung Exynos 5410 Expert: New System-on-Chip Support • Prereq.: CPU architecture already supported (ARM) • Technical Reference Manual really needed • 12 ‒ Serial console driver – to get output ‒ Clocksource driver(s) – for timers ‒ Clock driver ‒ Reset driver? ‒ Memory controller? Example: STM32 F4 “Some things have to be done just because they are possible. Not because they make sense.” - SUSE Hackweek T-Shirt 13 The Final Frontier (1/2) Cortex-A72 Cortex-A57 Cortex-A17 Cortex-A53 Cortex-A9 Cortex-A8 ARM11 ARM9 ARM7 Cortex-A12 Cortex-A7 Cortex-A5 OMAP3xxx BCM2835 … 14 Cortex-A15 … The Final Frontier (2/2) Cortex-M7 Cortex-M4 Cortex-M3 Cortex-M1 Cortex-M0 EFM32 GG LPC18xx 15 Cortex-M0+ STM32 F4 STM32 F429 – Flash Layout Address Size 08000000 16 KB Bootloader 08004000 16 KB Device Tree 08008000 16 KB Kernel 0800c000 16 KB 08010000 64 KB 08020000 128 KB 08040000 128 KB 08060000 128 KB 08080000 128 KB 080a0000 128 KB 080c0000 128 KB 080e0000 128 KB 08100000 16 KB 08104000 16 KB 08108000 16 KB 0810c000 16 KB 08110000 64 KB 08120000 128 KB 08140000 128 KB ... 16 ... Usage • Custom bootloader (1.6 / 16 KB) ‒ github.com/afaerber/afboot-stm32 ‒ Compare: U-Boot ~75 KB / 128 KB • Device Tree (2.9 / 16 KB) • Kernel (1235.5 / 1248 KB) ‒ Execute-in-place (XIP) image ‒ Me: clk, clocksource, serial, fbdev ‒ Maxime: clocksource, reset, serial, pinc. ‒ Root filesystem • Daniel: clk romfs (293.1 / 768 KB) Bootloader tasks on ARMv7-M • Usually runs from flash, using SRAM • Initializes clocks • Configures pins • Sets up serial port (for debug output) • Sets up memory controller for SDRAM or PSRAM • If necessary, takes timers out of reset • Jumps to the kernel entry point ‒ 17 Start of xipImage plus 1 for THUMB mode Summary • ARMv7-A chips usually well supported these days ‒ But boards not always! • ARMv7-M chips often not supported by vendors • What ARMv7-M boards may be able to run Linux: ‒ 4+ MB of SDRAM/PSRAM ‒ ‒ 1+ MB of flash ‒ ‒ Memory-mapped flash allows execution in place, saves RAM Secondary storage needed? ‒ 18 Chip needs some external memory interface to enable it SPI, MMC, network, … One More Thing … Spansion FM4 – Status Address Size Usage 00000000 8 KB Bootloader 00002000 8 KB Device Tree 00004000 8 KB Kernel • ‒ 8 KB 32 KB 64 KB • 64 KB 64 KB 64 KB 64 KB Device Tree (0.8 / 8 KB) • Kernel (1070 / 2032 KB) 64 KB ‒ 64 KB 64 KB 64 KB 64 KB 64 KB 8 KB ... 20 ... github.com/afaerber/afboot-fm4 • 64 KB 64 KB But no working flash driver yet Custom bootloader (1.5 / 8 KB) ‒ 64 KB 64 KB OpenOCD 0.9.0 • clocksource (WIP) 2 MB of on-chip flash available Infineon XMC4500 – Status Address Size Usage 0c000000 16 KB Bootloader 0c004000 16 KB Device Tree 0c008000 • OpenOCD 0.9.0 ‒ Kernel • Custom bootloader (2.4 / 16 KB) ‒ github.com/afaerber/afboot-xmc4000 • Device Tree (3.7 / 16 KB) • Kernel (~986.6 / 992 KB) ‒ • 21 Flash driver by Jeff Ciesielsky clk, clocksource, reset, pinctrl, serial, sdhci drivers 1 MB of on-chip flash available only Questions? Join us on #opensuse-arm or [email protected]! en.opensuse.org/Portal:ARM Thank you. Have a Lot of Fun, and Join Us At: www.opensuse.org 24 License This slide deck is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license. It can be shared and adapted for any purpose (even commercially) as long as Attribution is given and any derivative work is distributed under the same license. Details can be found at https://creativecommons.org/licenses/by-sa/4.0/ General Disclaimer This document is not to be construed as a promise by any participating organisation to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. openSUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for openSUSE products remains at the sole discretion of openSUSE. Further, openSUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All openSUSE marks referenced in this presentation are trademarks or registered trademarks of SUSE LLC, in the United States and other countries. All third-party trademarks are the property of their respective owners. Credits Template Richard Brown [email protected] Design & Inspiration openSUSE Design Team http://opensuse.github.io/brandingguidelines/