From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5530 Path: news.gmane.org!not-for-mail From: Stefan Kristiansson Newsgroups: gmane.linux.lib.musl.general Subject: How to build a musl toolchain for or1k Date: Sun, 20 Jul 2014 01:26:29 +0300 Message-ID: <20140719222628.GA19901@chokladfabriken.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1405808842 23205 80.91.229.3 (19 Jul 2014 22:27:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jul 2014 22:27:22 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5535-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 20 00:27:18 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1X8d66-0007ho-IK for gllmg-musl@plane.gmane.org; Sun, 20 Jul 2014 00:27:18 +0200 Original-Received: (qmail 12000 invoked by uid 550); 19 Jul 2014 22:27:18 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11992 invoked from network); 19 Jul 2014 22:27:17 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.0 required=12.0 tests=none autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp.lau.hel.nebula.fi Xref: news.gmane.org gmane.linux.lib.musl.general:5530 Archived-At: Now when or1k support has landed in musl, I thought I'd take the opportunity to give some notes on how to build a toolchain for it (and also, Rich asked me to). Up until now, I've been building the toolchain I've been using 'by hand' without any musl specific patches to gcc, but this isn't really a viable option in the long run. So, instead, I've adopted the musl-cross way of building the toolchain. There's a couple of problems, some of which musl-cross can handle out of the box, and one that it can't. First, although we have upstreamed or1k support to binutils, it was done quite recently, so the support hasn't hit any official release yet. But musl-cross can make use of the binutil snapshots, so not a big deal. Second, there's no or1k support in the Linux kernel headers tarball, so unpatched vanilla headers have to be used. And third, our gcc port isn't upstreamed yet (our biggest issue is rounding up contributors to assign copyright to FSF, but we're working on that). To get around the third issue, I modified musl-cross to fetch gcc from an arbitrary location. I've pushed this modified version together with the necessary changes for or1k and a custom config.sh to this repo: https://github.com/skristiansson/musl-cross So, all that is needed in order to build a or1k-linux-musl toolchain should be to run ./build.sh from that repo. And some notes about emulators and kernel for or1k. There's support in qemu for or1k, but the atomic instructions required for musl has not yet been added to that, but we have a functional simulator (or1ksim) with support for them. git clone -b or1k-master git://github.com/openrisc/or1ksim.git ./configure --target=or1k-elf make && make install Mainline kernel is missing support for a couple of features required by musl (mostly related to the atomic instructions). I've added support for them, but sending out patches for them is yet to be done. In the meantime, they are all present in the smp branch of git://openrisc.net/stefan/linux. git clone -b smp git://openrisc.net/stefan/linux make ARCH=openrisc musl_defconfig make ARCH=openrisc There's an initramfs included in that, so with or1ksim installed, it should be possible to boot with: or1k-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux and then from another terminal telnet localhost 10084 This became pretty lengthy, but if nothing else, now I've got some instructions in a public place to point people to. =P Stefan