From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13309 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Clark Newsgroups: gmane.linux.lib.musl.general Subject: Re: Porting to RISC-V Date: Sun, 23 Sep 2018 16:41:51 +1200 Message-ID: <9F25CA30-65B4-454D-9589-22E3D791380C@mac.com> References: <20180502193732.GZ1392@brightrain.aerifal.cx> <20180502194533.GB1392@brightrain.aerifal.cx> <20180923004558.GD17995@brightrain.aerifal.cx> <20180923024735.GG17995@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-F31F9447-2B9D-4CFB-9085-5E69C4579848 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1537677606 11397 195.159.176.226 (23 Sep 2018 04:40:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Sep 2018 04:40:06 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13325-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 23 06:40:02 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1g3wBe-0002rI-1L for gllmg-musl@m.gmane.org; Sun, 23 Sep 2018 06:40:02 +0200 Original-Received: (qmail 10038 invoked by uid 550); 23 Sep 2018 04:42:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 10011 invoked from network); 23 Sep 2018 04:42:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1537677717; bh=DFsXff8yL6UC1iyAq40iXZrf45Ec5VF2LCxbh5jeE44=; h=From:Content-type:MIME-version:Date:Subject:Message-id:To; b=nz4RJ+6zFOnGsBFI604c8lHJIxyELy5DLCni7s7scQd4mNWjFuzqmElhIPh9Ixm9K rv7eFF3wPQD+bH5B/DZJ79LZAPEWjfHRP+DoROZpSLYPICFT/bME7MLUANvetRHlco Q7g2CKx7zPZiaOR4WEtpcoXeGZds4eFJd71P3FwQK9wORP3zY1aRGphOy0J8xHr5hD zVTnXe5MrLtdAehb6QHWwweY5PTlim3a6kdBoQ447aAMzNQEf35BZ3qI+H7T/aYT0y VRkMlHq1tXm1dlxtjaXsHZfbh2D2boA/O7yl+zSTwAuBYbm+rJldHF84cID9G6EgBx tMbsMn003Md1A== X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809230051 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-23_03:,, signatures=0 In-reply-to: <20180923024735.GG17995@brightrain.aerifal.cx> X-Mailer: iPhone Mail (15G77) Xref: news.gmane.org gmane.linux.lib.musl.general:13309 Archived-At: --Apple-Mail-F31F9447-2B9D-4CFB-9085-5E69C4579848 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>> Ping. >>>=20 >>> I was hoping to get this merged in 1.1.20, which didn't happen despite >>> it getting delayed for a long time. Is there a chance of it happening >>> soon for 1.1.21? >>=20 >> Yes. I can bump the priority for this. >>=20 >> There hopefully should not be that much more to do on the port to >> get it in shape for upstream. Sorry there have been a lot of things >> going on so this has fallen through the cracks. >>=20 >> There is still the ELF TLS bug, which shouldn=E2=80=99t be hard to fix, b= ut >> we could always mark the port experimental. If it=E2=80=99s in tree; then= >> more folk may be interested in fixing bugs. The code also needs some >> review. >=20 > I don't want to merge something with known bugs like this, but I'm > happy to participate in fixing it if I know what the issue is and have > a candidate submission that supposedly works modulo the bug to be > fixed. My understanding is that gcc and qemu stuff is upstream now so > it should be simple to me to build and test. Is this correct? Okay. We=E2=80=99ll fix the bugs. Yes, there are now several ways to get RIS= C-V Linux booting in QEMU. There are riscv cross tools and riscv qemu binaries in Debian Sid. I think i= t is possible to debootstrap riscv64. Indeed the Debian RISC-V builders are r= unning QEMU. I also have a bootstrap script for a musl riscv gcc 8.1 compiler here: https://github.com/michaeljclark/musl-riscv-toolchain You can build the gcc toolchain for comparison: https://github.com/riscv/riscv-gnu-toolchain There are links to several Linux images (Fedora, Debian) and build instructi= ons for Linux kernel and bbl on the RISC-V QEMU wiki: - https://github.com/riscv/riscv-qemu/wiki Alternatively you can clone SiFive=E2=80=99s freedom-u-sdk and type =E2=80=9C= make qemu=E2=80=9D to get a riscv64 buildroot image booting up in QEMU. This= same root image and kernel runs on the HiFive Unleashed Board: https://github.com/sifive/freedom-u-sdk Also, Fabrice Belliard has a buildroot port that has recipes for both riscv3= 2 and riscv64: https://bellard.org/tinyemu/ Normally the kernel is packaged as a payload inside of =E2=80=9Cbbl=E2=80=9D= , the Berkeley Boot Loader. However, we now support separate kernel and firm= ware using the latest bbl, the RISC-V QEMU and =E2=80=9Cvirt=E2=80=9D machin= e in QEMU from the riscv-qemu repository (this feature is not upstream yet) a= nd linux 4.19-rc5 kernel. This is mostly useful if you are recompiling the k= ernel. We have the -bios, -kernel, -initrd and -append options working: https://github.com/riscv/riscv-qemu e.g. $ qemu-system-riscv64 -nographic -machine virt -bios bbl -kernel vmlinux -in= itrd initramfs.gz -append rdinit=3D/bin/busybox The wiki link above and the freedom-u-sdk have docs and Makefile recipes for= attaching VirtIO drives and networking devices. >> We moved the port to riscv-musl in the RISC-V GitHub organisation >> [1]. We need to rebase and squash the tree and write a commit >> message containing the contributors list. >>=20 >> The RISC-V rv32 port isn=E2=80=99t in glibc yet and it may be subject to >> change. I need to get a riscv32 Linux kernel running in QEMU so we >> can do testing against glibc... I=E2=80=99ll have to chat to Palmer about= >> riscv32, see if there are any ABI issues we need to be aware of. We >> can spend some time this week... >=20 > Great! No worries. It=E2=80=99ll be nice to get the port upstream... Cheers, Michael= --Apple-Mail-F31F9447-2B9D-4CFB-9085-5E69C4579848 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Ping.

I was hoping to get this merged in 1.1.20, which didn= 't happen despite
it getting delayed for a long time. Is t= here a chance of it happening
soon for 1.1.21?
<= /blockquote>

Yes. I can bump the priority for this.<= /span>

There hopefully should not be that much m= ore to do on the port to
get it in shape for upstream. Sorry there have been a lot of things
going on so this has fall= en through the cracks.

There is still the= ELF TLS bug, which shouldn=E2=80=99t be hard to fix, but
we could always mark the port experimen= tal. If it=E2=80=99s in tree; then
more folk may be interested in fixing bugs. The code also needs= some
review.<= br>

I don't want to merge something with k= nown bugs like this, but I'm
happy to participate in fixing i= t if I know what the issue is and have
a candidate submissio= n that supposedly works modulo the bug to be
fixed. My under= standing is that gcc and qemu stuff is upstream now so
it sh= ould be simple to me to build and test. Is this correct?

Okay. We=E2=80=99ll fix the bugs. Yes, there are now= several ways to get RISC-V Linux booting in QEMU.

= There are riscv cross tools and riscv qemu binaries in Debian Sid.  I t= hink it is possible to debootstrap riscv64. Indeed the Debian RISC-V builder= s are running QEMU.

I also have a bootstrap script f= or a musl riscv gcc 8.1 compiler here:


You can build t= he gcc toolchain for comparison:


There are links to several Linux images= (Fedora, Debian) and build instructions for Linux kernel and bbl on the RIS= C-V QEMU wiki:


Alternatively you can clone SiFive=E2=80=99s freedom-u-sdk= and type =E2=80=9Cmake qemu=E2=80=9D to get a riscv64 buildroot image booti= ng up in QEMU. This same root image and kernel runs on the HiFive Unleashed B= oard:


= Also, Fabrice Belliard has a buildroot port that has recipes for both riscv3= 2 and riscv64:


Normally the k= ernel is packaged as a payload inside of =E2=80=9Cbbl=E2=80=9D, the Berkeley= Boot Loader. However, we now support separate kernel and firmware using the= latest bbl, the RISC-V QEMU and =E2=80=9Cvirt=E2=80=9D machine in QEMU from= the riscv-qemu repository (this feature is not upstream yet) and linux 4.19= -rc5 kernel. This is mostly useful if you are recompiling the kernel. We hav= e the -bios, -kernel, -initrd and -append options working:


e.g.

$= qemu-system-riscv64 -nographic -machine virt -bios bbl -kernel vmlinux -ini= trd initramfs.gz -append rdinit=3D/bin/busybox

The w= iki link above and the freedom-u-sdk have docs and Makefile recipes for atta= ching VirtIO drives and networking devices.

We moved the port to riscv-musl in t= he RISC-V GitHub organisation
[1]. We need to rebase and squash the tree and write a commit
message containing the con= tributors list.

The RISC-V rv32 port isn=E2= =80=99t in glibc yet and it may be subject to
change. I need to get a riscv32 Linux kernel runnin= g in QEMU so we
can d= o testing against glibc... I=E2=80=99ll have to chat to Palmer about<= br>
riscv32, see if there are an= y ABI issues we need to be aware of. We
can spend some time this week...
<= span>
Great!

No worrie= s. It=E2=80=99ll be nice to get the port upstream...

Cheers,
Michael
= --Apple-Mail-F31F9447-2B9D-4CFB-9085-5E69C4579848--