gentoo-bionic - elinux.org · gentoo-bionic we can rebuild him. better. stronger. faster....
TRANSCRIPT
![Page 1: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/1.jpg)
Gentoo-BionicWe can Rebuild him. Better. Stronger. Faster.
Christopher Friedt
Embedded Linux Conference, 2013San Francisco, CA
![Page 2: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/2.jpg)
Gentoo-BionicWe can Rebuild him. Better. Stronger. Faster.
http://code.google.com/p/gentoo-bionichttp://gentoo-bionic.blogspot.com
http://gitorious.org/gentoo-bionic/gentoo-bionichttp://www.facebook.com/GentooBionic
https://plus.google.com/113359270067626599390
![Page 3: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/3.jpg)
Why? Where? When? What?
RATIONALE
– BACKGROUND
– LICENSING
– MAINTAINABILITY / COMPLEXITY
– MINIMAL BUT EXTENSIBLE
– SCOPE
– THINK INSIDE THE BOX
– SHORT TERM GOALS
![Page 4: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/4.jpg)
How?
BOOTSTRAP
– LINARO GCC PATCH
– REMOVE ANDROID CRUFT
– ADD A NEW ELIBC IN GENTOO
– ./CONFIGURE; MAKE SENSE
– CROSSDEV WAY OR THE HIGHWAY
– EMERGE WORLD
– WHAT NEXT?
![Page 5: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/5.jpg)
Bionic Larry...
![Page 6: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/6.jpg)
Bionic Larry...
Grazing on 1e-9% of the embedded market since 2010!
![Page 7: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/7.jpg)
Bionic Larry... do not try an milk him
These arenot
udders
![Page 8: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/8.jpg)
Why? Where? When? What?
RATIONALE - HISTORY
● Originally, I wanted to do something to help Google while they were in the middle of the Oracle / Java legal dispute
● I actually wrote Google with my ideas...
● they interviewed me for a couple of positions...
● but otherwise didn't care :-(
... talk to me after the presentation for some tidbits
![Page 9: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/9.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● In spite of the GPLv3 exclusion of “system libraries” from the linking clauses, companies are still terrified to incorporate GPL software into their embedded products
– afraid of being forced to open their codebase● poorly written / insecure code vetted by 3rd parties● leaking intellectual property
![Page 10: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/10.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● How does a company retain IP in a predominantly open-source / GPL universe?
– static / shared linking constitute derived works in many opinions
– most shared library code is not explicitly LGPL
– zero to practically zero static libraries are LGPL
![Page 11: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/11.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● lease embedded devices to customers and charge for usage / data
– no change of ownership / no source sharing req
– limited revenue model
– questionable circumvention of software license
![Page 12: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/12.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● Take chances with FLOSS licenses or reinvent the wheel
– potentially a lot of extra implementation work
– limited domain expertise
– possible license that could change over time
– Could require fork and back-porting new patches
– delaying the inevitable?
![Page 13: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/13.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● base design around newlib
– BSD licenced libc
– retain userspace IP, linking to newlib
– distribute source for the Linux kernel
– optimized? ... not really
![Page 14: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/14.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● I gathered this was fairly common industry opinion after consulting for various companies in industrial radio, embedded imaging, shipping / receiving, automated asset management, etc
BUT...
![Page 15: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/15.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● the Linux kernel is awesome
– the GPLv2 license is working well for it
– no need to “fix” what isn't broken
![Page 16: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/16.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● There might even be some kernel-envy in the rest of the embedded world!
● Linux supports more arch's, chips, platforms, boards than any other OS kernel on the planet!
● It's easy to get ported, and Linux is what clients want driving their embedded platforms
LUCKILY...
![Page 17: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/17.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● The Linux kernelspace / userspace interface is BINARY
● This is what allows arbitrarily licensed userspace software to run on top of the GPLv2 Linux kernel
● Kernel interaction is not “linking” (at runtime or compile-time), it's setting up arguments on the stack and jumping!
● Corollary: libc builds own syscalls using NUMBERS
SOOOO...
![Page 18: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/18.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● Use a BSD-licensed C library and other system libraries on top of the Linux kernel
![Page 19: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/19.jpg)
Why? Where? When? What?
RATIONALE - LICENSING
● Use a BSD-licensed C library and other system libraries on top of the Linux kernel
» USE BIONIC
![Page 20: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/20.jpg)
Why? Where? When? What?
RATIONALE – MAINTAINABILITY / COMPLEXITY
● already hacked the same Bionic C runtime for a couple of different clients a couple of different times
– Just Worked™
– was very slim, but optimized where it counts
– it didn't take a lot of effort
– (to me the effort part was important!)
![Page 21: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/21.jpg)
Why? Where? When? What?
RATIONALE – MAINTAINABILITY / COMPLEXITY
● The Bionic C library is - fairly well organized..
– is documented / commented where merited
– is kept simple (intentionally!)
– has no cryptic autotools or (many) scripts for building
– is easily extensible
– compiles really quickly!
![Page 22: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/22.jpg)
Why? Where? When? What?
RATIONALE – MAINTAINABILITY / COMPLEXITY
● Why reinvent the wheel every time?
– Bionic is BSD licensed, and there was no client-specific IP in it, that I had added.
– Allow others to benefit from it's usage
– And contribute back● No need to reinvent distro's, package managers, etc
![Page 23: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/23.jpg)
Why? Where? When? What?
RATIONALE – MAINTAINABILITY / COMPLEXITY
● I was familiar with Gentoo .ebuild syntax
● Same code could easily be built & packaged for
– Ångström / OpenEmbedded / OpenWRT (.ipk)
– Debian / Ubuntu (.deb)
– Redhat (.rpm)
![Page 24: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/24.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Bionic is small (e.g. for libc.so)
C Library Size (bytes)
glibc 1209672
uClibc 327023
bionic 290912
![Page 25: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/25.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
Adding syscalls?
![Page 26: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/26.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Adding syscalls? - SUPER EASY! Just add them to libc/SYSCALLS.TXT!
● an assembly wrapper is created automagically by
libc/tools/gensyscalls.py● e.g. int pivot_root(const char *, const char *) 117,118,117
● [return type] [syscall name]([parameters]) [arm,x86,mips]
![Page 27: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/27.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
Added syscalls:
![Page 28: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/28.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Missing an ioctl / syscall / struct declaration?
![Page 29: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/29.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Missing an ioctl / syscall / struct declaration?
● ALSO SUPER EASY!
● preprocess the raw header information with
libc/tools/clean_header.py● just remember: no inline functions, no macros, no
comments!
![Page 30: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/30.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
Added headers
![Page 31: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/31.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Adding libc functions?
![Page 32: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/32.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
● Adding libc functions? - SUPER EASY!
– create a test rig outside of libc
– compile your test rig
– test your libc function
– when testing done, add to ${FILESDIR} as a patch!
– files/${PV}/NNNN-yay-i-implemented-a-libcfunc.patch
![Page 33: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/33.jpg)
Why? Where? When? What?
RATIONALE - MINIMAL BUT EXTENSIBLE
Added libc functions
![Page 34: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/34.jpg)
Why? Where? When? What?
RATIONALE - SCOPE
● Is Gentoo-Bionic Gentoo-specific?
– NO!
– Gentoo was used as the initial vehicle for compiling the Bionic C library and toolchain
– Bionic / toolchain could be built for any Linux distro
– build system changes for said distros would be minimal, once autoconf integration is done
![Page 35: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/35.jpg)
Why? Where? When? What?
RATIONALE - SCOPE
● Also not limited to usage on existing distributions
● Rather, it should serve as a starting point, inspiring new and different distributions
![Page 36: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/36.jpg)
Why? Where? When? What?
RATIONALE - SCOPE
● Gentoo just has a really great cross-compiler infrastructure and build system (Portage)
– chost=armv7a-neon-linux-bioniceabi
– chost=i686-pc-linux-bionic
– crossdev --target ${chost}
– ${chost}-emerge bash● all (runtime / build) dependencies included
![Page 37: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/37.jpg)
Why? Where? When? What?
RATIONALE - THINK INSIDE THE BOX
● Recently switched to OS X from Linux for my workstation
(queue Booing from crowd)● The UI (partially) did it for me, but I also liked not feeling
the need to fix things!
● I liked the minimalistic “feel” to the libc, and how things basically always Just Worked™
![Page 38: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/38.jpg)
Why? Where? When? What?
RATIONALE - THINK INSIDE THE BOX
● The graphics stack intrigued me
● Liked the idea of using some (certain) proprietary software packages
● Why can't we have one (or many) “proprietary” Linux variants?
● ... but Mac OS X kind of sucks under the hood
● supported & default FS (global lock?)
![Page 39: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/39.jpg)
Why? Where? When? What?
RATIONALE - (SHORT TERM) GOALS
● Layman(8) overlay
● Upstream (basic) inclusion in Portage
● Downloadable (tiny) VM images
– qemu, VMWare, VirtualBox
– arm (qemu), x86 for VMWare / VirtualBox
![Page 40: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/40.jpg)
Why? Where? When? What?
![Page 41: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/41.jpg)
How?
BOOTSTRAP - LINARO GCC PATCH
● Alexandre Sack's gcc-4.6 patch
– default linker specs with -mandroid
– crt*.o for linking
– /system/bin/linker
– toolchain was no longer tied to android.com
![Page 42: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/42.jpg)
How?
BOOTSTRAP - LINARO GCC PATCH
● why use the /system prefix?
● why use /system/bin/linker?
● not just arm!
● preserve that for -mandroid
● remove the Android cruft for -mbionic
● try to behave like a normal toolchain!
![Page 43: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/43.jpg)
How?
BOOTSTRAP - REMOVE ANDROID CRUFT
● for Bionic to behave like a normal libc
– /etc/passwd, /etc/group, /etc/resolv.conf, ...● Android went through system properties and hard-coded
UID's and GID's
![Page 44: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/44.jpg)
How?
BOOTSTRAP - ADD A NEW LIBC
● Portage changes:
– portage/profiles/desc/elibc.desc
– portage/profiles/embedded/bionic/*
![Page 45: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/45.jpg)
How?
BOOTSTRAP - ./CONFIGURE; MAKE SENSE
● gnuconfig changes:
– config.sub
– config.guess
![Page 46: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/46.jpg)
How?
BOOTSTRAP - CROSSDEV WAY OR THE HIGHWAY
● crossdev changes:
– LPKG=bionic; KPKG=bionic-kernel-headers
– include/site/*bionic* (basically a copy of *uclibc*)
– above files necessary for autoconf functionality● crosscompile_opts_headers-only
● nocxx / cxx
![Page 47: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/47.jpg)
How?
BOOTSTRAP - EMERGE WORLD!
● Although there is/are a/many rigid specifications of what must be in a libc.. thanks to GNU, there is a monotonically increasing list of “expected” features as well.
● emerge busybox, emerge bash, emerge jamvm...
● Keep testing, finding, and reporting bugs, adding features as required
![Page 48: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/48.jpg)
How?
● BOOTSTRAP - EMERGE WORLD!
● Compiled packages (so far)
![Page 49: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/49.jpg)
How?
BOOTSTRAP - WHAT NEXT?
● HELP WANTED!
– pthread_cancel
– glibc-like ld.so behaviour
– optional locale
– self-hosting gcc (clang?)
– [func]_r (thread-safe versions of functions)
– more crypt algos
![Page 50: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/50.jpg)
How?
BOOTSTRAP - WHAT NEXT?
● Beyond bootstrap
– Talk to me after the presentation
– I could go on... seriously!
![Page 51: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/51.jpg)
mäk – A SHORTER / FASTER MAK
● separately installable variant of the Android build system
– non-C language support to be included via extension● like Automake's .am files, mäk's .mk files are declarative
● export MAK_ROOT=/usr/share/mak
● ./configure; make -jN; make -jN install
● non-recursive replacement for Automake = FAST
![Page 52: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/52.jpg)
Gentoo-BionicWe can Rebuild him. Better. Stronger. Faster.
DEMOS
![Page 53: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/53.jpg)
Gentoo-BionicWe can Rebuild him. Better. Stronger. Faster.
Q&A
![Page 54: Gentoo-Bionic - eLinux.org · Gentoo-Bionic We can Rebuild him. Better. Stronger. Faster. Christopher Friedt Embedded Linux Conference, 2013 San Francisco, CA chrisfriedt@gmail.com](https://reader030.vdocuments.mx/reader030/viewer/2022021809/5c3505be09d3f21c298c60c6/html5/thumbnails/54.jpg)
Gentoo-BionicWe can Rebuild him. Better. Stronger. Faster.
THANKS!