GSoC Project: Making Redox Self-hosting, Status Report 3

By ids1024 on

This is a continuation of status report 1 and status report 2.

Git

Git is now more or less working in Redox. This primarily required fixing a variety of bugs and Posix incompatibilities, primarily in newlib and redoxfs. Newlib wasn’t passing environmental variables on exec; I’ve fixed that although there are still some improvements to make in that area. Redoxfs wasn’t matching Posix for permissions handing on file creation and unlink. There was a small bug in getcwd, and a kernel issue with dup2 as well as cloexec handling. For some reason the default SHA1 implementation in git wasn’t working; I’m not sure why, but overriding it addresses that for now. Redoxfs’s fcntl function was misbehaving, so I fixed that. Newlib defined tv_nsec with the wrong type; that was hard to debug since, given that it was running on a little endian machine and happened to start as zero, it seemed to behave correctly in tests.

It seems to be working fairly well, if you can ignore the warnings about newlib functions that aren’t properly implemented yet.

Building C software

It was already possible to build simple things like Lua under Redox (since I ported gcc, make, and dash), but more complex software has some issues. I am currently struggling with getting autotools based builds to work on Redox (warning: trying to read and understand a ./configure script may cause mental illness). I’ve gotten a configure to run and generate a Makefile; the build doesn’t complete successfully yet though. I’ve been working with GNU binutils specifically, but it should apply equally to other software using autotools.

I’ve ported gawk and sed to Redox, as well as GNU grep. Autotools uses a #! with a space, for some reason. I also addressed a few issues in dash.

I’ve implemented dirname, added a '-f' argument to rm, and fixed directory support. I added fcntl to newlib, and added a -v argument and -c argument to grep. I also added octal support to tr. Cat with a - argument wasn’t working due to an arg-parser issue.

I added uname to the sys scheme, and a uname utility to coreutils.

I’ve been using expr from uutils (a Rust implementation of coreutils), since Redox’s coreutils doesn’t provide that currently. Redox should use uutils utilities for that and more; I’ve patched chmod from uutils to run on Redox, and submitted a PR upstream. I intend to look into making Redox use portions of uutils by default where suitable.

I’ve looked into porting Perl (which would be needed to run autotools itself). Perl is awkward to cross compile though, and there are still some issues, so that isn’t available yet. Perl requires ssh access a target machine to cross-compile (yes, really); but luckily a project called perl-cross provides an alternate build system to address that. That much seems to work, but some other things need to be fixed.

Upstreaming

I’ve upstreamed Redox support to filetime and tar-rs, which are used in cargo and generally useful (redox’s tar command uses tar-rs). Cmake-rs required a small fix to target Redox.

Other libc functions

I’ve implemented getpwnam and getpwid, as well as utime, utimes, and futimes().