logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

2023-08-09-Hello-from-Ares.md (4531B)


  1. ---
  2. title: Hello from Ares!
  3. date: 2023-08-09
  4. ---
  5. I am pleased to be writing today's blog post from a laptop running [Ares OS]. I
  6. am writing into an ed(1) session, on a file on an ext4 filesystem on its hard
  7. drive. That's pretty cool! It seems that a lot of interesting stuff has happened
  8. since I gave that talk on Helios at [FOSDEM] in February.
  9. [Ares OS]: https://ares-os.org
  10. [FOSDEM]: https://spacepub.space/w/wpKXfhqqr7FajEAf4B2Vc2
  11. ![A picture of my ThinkPad while I was editing this blog post](https://l.sr.ht/Rx-V.jpg)
  12. The talk I gave at FOSDEM was no doubt impressive, but it was a bit of a party
  13. trick. The system was running on a Raspberry Pi with one process which included
  14. both the slide deck as a series of raster images baked into the ELF file, as
  15. well as the GPU driver and drawing code necessary to display them, all in one
  16. package. This was quite necessary, as it turns out, given that the very idea of
  17. "processes" was absent from the system at this stage.
  18. Much has changed since that talk. The system I am writing to you from has
  19. support for processes indeed, complete with fork and exec and auxiliary vectors
  20. and threads and so on. If I run "ps" I get the following output:
  21. ```
  22. mercury % ps
  23. 1 /sbin/usrinit dexec /sbin/drv/ext4 block0 childfs 0 fs 0
  24. 2 /etc/driver.d/00-pcibus
  25. 3 /etc/pci.d/class/01/06/ahci
  26. 4 /etc/driver.d/00-ps2kb
  27. 5 /etc/driver.d/99-serial
  28. 6 /etc/driver.d/99-vgacons
  29. 7 /sbin/drv/ext4 block0
  30. 15 ed blog.md
  31. 16 ps
  32. ```
  33. Each of these processes is running in userspace, and some of them are drivers. A
  34. number of drivers now exist for the system, including among the ones you see
  35. here a general-purpose PCI driver, AHCI (SATA), PS/2 keyboard, PC serial, and a
  36. VGA console, not to mention the ext4 driver, based on lwext4 (the first driver
  37. not written in Hare, actually). Not shown here are additional drivers for the
  38. CMOS real-time clock (so Ares knows what time it is, thanks to Stacy Harper), a
  39. virtio9pfs driver (thanks also to Tom Leb for the initial work here), and a few
  40. more besides.
  41. As of this week, a small number of software ports exist. The ext4 driver is
  42. based on lwext4, as I said earlier, which might be considered a port, though it
  43. is designed to be portable. The [rc] shell I have been working on lately has
  44. also been ported, albeit with many features disabled, to Mercury. And, of
  45. course, I did say I was writing this blog post with ed(1) -- I have ported
  46. Michael Forney's [ed implementation] from sbase, with [relatively few] features
  47. disabled as a matter of fact (the "!" command and signals were removed).
  48. [rc]: https://git.sr.ht/~sircmpwn/rc
  49. [ed implementation]: http://git.suckless.org/sbase/file/ed.c.html
  50. [relatively few]: https://git.sr.ht/~sircmpwn/sbase/commit/ee0336bc3b6f55839785427d6184e6f897055e31
  51. This ed port, and lwext4, are based on our C library, designed with drivers and
  52. normal userspace programs in mind, and derived largely from musl libc. This is
  53. coming along rather well -- a few features (signals again come to mind) are not
  54. going to be implemented, but it's been relatively straightforward to get a large
  55. amount of the POSIX/C11 API surface area covered on Ares, and I was pleasantly
  56. surprised at how easy it was to port ed(1).
  57. There's still quite a lot to be done. In the near term, I expect to see the
  58. following:
  59. * A virtual filesystem
  60. * Pipes and more shell features enabled, such as redirects
  61. * More filesystem support (mkdir et al)
  62. * A framebuffer console
  63. * EFI support on x86\_64
  64. * MBR and GPT partitions
  65. This is more of the basics. As these basics unblock other tasks, a few of the
  66. more ambitious projects we might look forward to include:
  67. * Networking support (at least ICMP)
  68. * Audio support
  69. * ACPI support
  70. * Basic USB support
  71. * A service manager (*not* systemd...)
  72. * An installer, perhaps a package manager
  73. * Self-hosting builds
  74. * Dare I say Wayland?
  75. I should also probably do something about that whining fan I'm hearing in the
  76. background right now. Of course, I will also have to do a fresh DOOM port once
  77. the framebuffer situation is improved. There's also still plenty of kernel work
  78. to be done and odds and ends all over the project, but it's in pretty good shape
  79. and I'm having a blast working on it. I think that by now I have answered the
  80. original question, "can an operating system be written in Hare", with a
  81. resounding "yes". Now I'm just having fun with it. Stay tuned!
  82. Now I just have to shut this laptop off. There's no poweroff command yet, so I
  83. suppose I'll just hold down the power button until it stops making noise.