Xv6, billed as “A Simple Unix-like Teaching Operating System” is popular in CS courses. Here’s a very nice worked example, porting and bringing up this not-as-portable-as-hoped OS onto a novel CPU, as a student project:
There’s even an online emulator of the system, running the port of xv6, with an assembler and editor (as
and vi
of course) as well as some entertainments.
(via here)