Pushing The Limits Of Linux On ARM LinuxCon Japan 2015 Andreas Färber afaerber@suse.de
Overview Definition of Linux on ARM Transitioning from Embedded to Servers & Desktops Pushing the limits in general for embedded 2
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 ) To run a standard userspace distribution, e.g. opensuse 4
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 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 6
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 Handled by ARM themselves (except for Mali graphics) New chip vendors 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 Little or no security fixes, no new upstream features Old chips and boards people didn't need Linux on yet 9
Simplest: Board Support Prereq.: SoC (platform and drivers) supported Device Tree (.dts) is used as hardware description Either supplied to firmware (U-Boot), or by firmware (UEFI) ACPI upcoming as alternative hardware description 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 10
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 Compare chip-specific bits to those of one already supported Peek at earlier and later.dtsi files and drivers? (Careful!) Example: Samsung Exynos 5410 11
Expert: New System-on-Chip Support Prereq.: CPU architecture already supported (ARM) Technical Reference Manual really needed Serial console driver to get output Clocksource driver(s) for timers Clock driver Reset driver? Memory controller? Example: STM32 F4 12
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) ARM11 ARM9 ARM7 Cortex-A8 Cortex-A9 Cortex-A15 Cortex-A7 Cortex-A5 Cortex-A57 Cortex-A53 Cortex-A17 Cortex-A12 Cortex-A72 OMAP3xxx BCM2835 14
The Final Frontier (2/2) Cortex-M4 Cortex-M3 Cortex-M1 Cortex-M0 Cortex-M0+ Cortex-M7 EFM32 GG STM32 F4 LPC18xx 15
STM32 F429 Flash Layout Address Size Usage 08000000 16 KB Bootloader 08004000 16 KB Device Tree 08008000 16 KB Kernel 0800c000 16 KB 08010000 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 08120000 128 KB 08140000 128 KB Root filesystem...... 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. Daniel: clk romfs (293.1 / 768 KB) 16
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 Start of xipimage plus 1 for THUMB mode 17
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 Chip needs some external memory interface to enable it 1+ MB of flash Memory-mapped flash allows execution in place, saves RAM Secondary storage needed? SPI, MMC, network, 18
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 8 KB...... OpenOCD 0.9.0 But no working flash driver yet Custom bootloader (1.5 / 8 KB) github.com/afaerber/afboot-fm4 Device Tree (0.8 / 8 KB) Kernel (1070 / 2032 KB) clocksource (WIP) 2 MB of on-chip flash available 20
Infineon XMC4500 Status Address Size Usage 0c000000 16 KB Bootloader 0c004000 16 KB Device Tree 0c008000 Kernel OpenOCD 0.9.0 Flash driver by Jeff Ciesielsky Custom bootloader (2.4 / 16 KB) github.com/afaerber/afboot-xmc4000 Device Tree (3.7 / 16 KB) Kernel (~986.6 / 992 KB) clk, clocksource, reset, pinctrl, serial, sdhci drivers 1 MB of on-chip flash available only 21
Questions?
Join us on #opensuse-arm or opensuse-arm@opensuse.org! 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 rbrown@opensuse.org Design & Inspiration opensuse Design Team http://opensuse.github.io/brandingguidelines/