ibm linux technology center · 2011. 2. 10. · early boot code zimage compression library...

Post on 31-Mar-2021

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

c© 2010 IBM Corporation

IBM Linux Technology Center

Porting Linux to a new architecture, done right

Arnd Bergmann

Porting Linux to a new architecture, done right

Overview

1 Status of new architecture ports2 Typical approaches to new architectures3 Lessons Learned

2 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

About me

s390 architecture 2002-2005PowerPC/Cell architecture 2005-now32/64 bit syscall emulationMaintaining include/asm-genericReviewing new architecturesLearning about ARM

3 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Recently merged architectures

2.6.13 2.6.19 2.6.22 2.6.28 2.6.30 2.6.32 2.6.36

100000

1000000

10000000

100000000

tile

s*core

microblaze

mn10300

blackfin

avr32

xtensa

arm

4 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Upcoming architectures

nios IIlm32UniCoreOpenRISCc64xMMIXnameless 48-bit architecturenameless DSP architecture

5 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

What makes architecture ports so hard?

Typical approaches to new architectures

6 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #1: English

Homes of the current architecture maintainers

7 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestandingILP32/LP64 GNU

C

99 with static annotationsand enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestandingILP32/LP64

GNU C99

with static annotationsand enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestandingILP32/LP64

GNU C99 with static annotations

and enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestanding

ILP32/LP64 GNU C99 with static annotations

and enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented

freestandingILP32/LP64 GNU C99 with static annotations

and enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically

object-oriented freestandingILP32/LP64 GNU C99 with static annotations

and enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestandingILP32/LP64 GNU C99 with static annotations

and enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Language barrier #2: C

pragmatically object-oriented freestandingILP32/LP64 GNU C99 with static annotationsand enforced coding style

8 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric Multiprocessing

Noncoherent I/OOut-of-order I/OMemory management unitsMultiple ABIsMultiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/O

Out-of-order I/OMemory management unitsMultiple ABIsMultiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/O

Memory management unitsMultiple ABIsMultiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/OMemory management units

Multiple ABIsMultiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/OMemory management unitsMultiple ABIs

Multiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/OMemory management unitsMultiple ABIsMultiple ISAs

Multiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/OMemory management unitsMultiple ABIsMultiple ISAsMultiple platforms

Timekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Architectural challenges

Symmetric MultiprocessingNoncoherent I/OOut-of-order I/OMemory management unitsMultiple ABIsMultiple ISAsMultiple platformsTimekeeping

9 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Where to start

Copy from x86

Copy from ARMCopy from TileDo not copy at all!

10 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Where to start

Copy from x86

Copy from ARM

Copy from TileDo not copy at all!

10 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Where to start

Copy from x86Copy from ARM

Copy from Tile

Do not copy at all!

10 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Where to start

Copy from x86Copy from ARMCopy from Tile

Do not copy at all!

10 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Generic header files

42 versions of struct stat?

One minimal syscall list!Cover all the simple implementations

11 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Generic header files

42 versions of struct stat?One minimal syscall list!

Cover all the simple implementations

11 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Generic header files

42 versions of struct stat?One minimal syscall list!Cover all the simple implementations

11 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Generic Architecture template

Early Boot codezImage compressionLibrary functionsdevice treeTrap handlingSignal handlingptracepci

12 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

User space: runtime

glibc/eglibcuClibcklibc

13 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

User space: distro

Full distributionDebian, Fedora, OpenSUSE, Ubuntu, Gentoo, ...

Embedded distributionbuildrootyoctoemdebian

Busybox initramfs

14 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

User space: distro

Full distributionDebian, Fedora, OpenSUSE, Ubuntu, Gentoo, ...

Embedded distributionbuildrootyoctoemdebian

Busybox initramfs

14 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

User space: distro

Full distributionDebian, Fedora, OpenSUSE, Ubuntu, Gentoo, ...

Embedded distributionbuildrootyoctoemdebian

Busybox initramfs

14 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lessons Learned

15 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #1

Start small

16 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #2

Generalize existing code for your special case

17 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #3

Understand the development process

18 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #4

Follow the upstream kernel

19 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #5

Debug your system with qemu with gdb

20 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #6

Simplify drivers using virtio and hvc

21 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #7

Describe SoC in a flattened device tree

22 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #8

Clean up after sparse and checkpatch

23 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #9

Run lockdep enabled kernels

24 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Lesson #10

Become a git master

25 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Legal Statement

This work represents the view of the author and does not necessarilyrepresent the view of IBM.IBM, IBM (logo), e-business (logo), pSeries, e (logo) server, andxSeries are trademarks or registered trademarks of InternationalBusiness Machines Corporation in the United States and/or othercountries.Linux is a registered trademark of Linus Torvalds.Other company, product, and service names may be trademarks orservice marks of others.

26 / 27 Arnd Bergmann c© 2010 IBM Corporation

Porting Linux to a new architecture, done right

Questions?

27 / 27 Arnd Bergmann c© 2010 IBM Corporation

top related