Golang bootstraping Living on the tip Jakub Čajka Presented by Software Engineer Red Hat Inc. Slides are under CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/
Today's Topics Introduction Architectures supported by Golang Golang bootstrap Short Break Let's bootstrap :)
Jakub Čajka Golang maitainer in RHEL co-maintainer in Fedora
Red Hat Inc. and Golang
Golang at Red Hat
Golang in RHEL Available from RHEL - optional channel only on RHEL-7 Not supported But still receives critical security bug fixes
Architectures supported by Golang
X86_64 and (i)386 Most common architecture these days X86_64(amd64) is now using new SSA compiler Linux, Darwin, Win, Plan9, *BSD* You know where to get the HW and for how much ;) Supported by Fedora
Arm Getting more common AArch64(arm64) armv6 and newer(arm) Lots of different boards and servers(AArch64), price starting in tenths of dollars for boards going to thousands for servers Pine64, RaspPis, BananaPis, Odroids,... APM servers, AMD Seattle,... Supported by Fedora
Arm Image http://i0.wp.com/www.pine64.com/wp-content/uploads/2015/02/pine64layoutt.jpg?resize=1500%2C600&ssl=1
PowerPC Ppc64, ppc64le (big and little endian) No external linker and cgo for big endian Power6 and up(Power7+ and up with go1.7) Cheapest used power Macs(hundreds of $$) New servers/WS several thousands of dollars Talos board cheapest ppc64(le) board/WS http://reng.io/1 Tyans, IBMs,… Supported by Fedora
PowerPC Image: http://media.zones.com/images/static/power-system-s812l-s822l-prodtile.jpg
MIPS Several ABI, endianness, bit combinations Improved support with go1.7 Switches,… and two dev boards from Imagination tech Ci 20, Ci 40 Not yet an official architecture supported by Fedora mtoman(from Imagination) is working on Fedora port
MIPS Image https://community.imgtec.com/wp-content/uploads/sites/2/2016/02/creator-ci20-specs-web.jpg
S390X Big “old” IBM mainframe Added in go1.7(to be relased this summer) Hundreds thousands dollars, few full racks of space I plan bootstrap in F25 release cycle
S390X Imagehttps://en.wikipedia.org/wiki/IBM_zEnterprise_System#/media/File:System_z_Frames.JPG By Agiorgio under CC BY-SA 4.0
Sparc 32 and 64 bit Not sure about status of the port Not a part of Fedora
Gcc-go Gcc frontend Should work on most architectures as gcc, with some limitations(go stdlib,...) GCC-4 go1.3 GCC-5 go1.4 GCC-6 go1.6
Golang bootstrap
Why? Test your project with upcoming changes/features or use them right away Help upstream to catch bugs early Better bug reports, help upstream with bug triage Hack on golang :)
Build GOOS and GOARCH needs to be set 2 Stages Build small bootstrap compiler By already built compiler present on system pointed by GOROOT_BOOTSTRAP, might be cross-compiled “bootstrap toolset” Build full compiler using the bootstrap compiler
PowerPC VMs Thanks to OpenPower Hub in Brno Run by FIT VUT, IBM and Red Hat Inc. You can read more about compute resources for your opensource/academic projects at http://fit- rhlab.rhcloud.com/powerlinux-openpower- development-hosting/
Details P8 little endian KVM VMs 2VCPU 2GBRAM ~20GBDISK Public key to jcajka@fedoraproject.org In ~1week will be deleted
Break
Bootstrap!!!
Setup Go compiler on your system (go1.4+) Where? go env Check out the go source code Git clone https://go.googlesource.com/go Github is just a mirror :)
Lets build the tip cd src GOOS=linux GOARCH=amd64 GOROOT_BOOTSTRAP=”...” ./all.bash To use as a system compiler add the go bin on your path and make sure that GOROOT is set properly(optional)
Cross-build cd src GOOS=linux GOARCH=ppc64le GOROOT_BOOTSTRAP=”...” ./bootstrap.bash Now we have tar with bootstrap compiler Put it on the target system
Bootstrap the trarget tar -xf go-*-bootstrap.tbz git clone https://go.googlesource.com/go cd src GOOS=linux GOARCH=ppc64le GOROOT_BOOTSTRAP=”path to untared folder”./all.bash Put the resulting binary on the PATH
Questions? jcajka@fedoraproject.org Contact: Slides are under CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/