|
Message-ID: <20140719222628.GA19901@chokladfabriken.org> Date: Sun, 20 Jul 2014 01:26:29 +0300 From: Stefan Kristiansson <stefan.kristiansson@...nalahti.fi> To: musl@...ts.openwall.com Subject: How to build a musl toolchain for or1k 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.