9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Raspberry Pi image
Date: Wed, 19 Feb 2014 16:25:58 +0530	[thread overview]
Message-ID: <CAA6Yd9UjM=qAA=tCwSFWjMks6TPZLtBNFMeGCuVYUq2AhhLo+g@mail.gmail.com> (raw)
In-Reply-To: <b9fac8b65035ff2db2291ac08d30b0fc@hamnavoe.com>

On Wed, Feb 19, 2014 at 3:30 PM, Richard Miller <9fans@hamnavoe.com> wrote:
>> I'd be curious to know the methodology for producing this port as well.
>
> OS porting is something of a black art.  I've been doing it for a while
> (http://www.usenix.org/legacy/publications/library/proceedings/usenix98/invited_talks/miller.ps)
> and it's not getting any easier.  Hardware vendors used to provide
> meticulously accurate reference manuals describing device behaviour at a
> register level, along with a programming manual explaining the sequence of
> operations required for standard procedures like device initialisation and
> error recovery.  Too often nowadays the best you'll get is a sketchy and
> inaccurate datasheet, and at worst the datasheet will be a "trade secret"
> and the only option is to reverse engineer many thousand lines of badly
> written linux driver.
>
> For the Raspberry Pi port, excellent documentation was available at least
> for the arm cpu.  Plan 9 kernels already existed for armv5 and armv7
> architectures, so I was mostly able to interpolate between the two to
> produce the low-level assembly parts of the kernel for the Pi's armv6.
> Hardware floating support for the kernel had already been done at the Labs
> for the teg2, and vfp code generation for the 5l linker was straightforward
> to add, using arm manuals.
>
> The rest of the work was creating device drivers, some easily adapted from
> other Plan 9 instances (eg uart and lcd display), some written from scratch
> using Broadcom's BCM2835 datasheet (eg sd/mmc).  By far the hardest driver
> was for the usb host adapter, which on the Pi is very non-standard and has
> no officially available documentation.  I couldn't face the prospect of
> digesting the linux driver (which is huge, unreadable, and at the time was
> known not to work reliably).  Luckily a web search turned up datasheets
> for some apparently very similar devices, which I was able to work from.
> Even so, writing and debugging the usb driver accounted for most of the time
> and effort of the whole project.

Many thanks for the great writeup.


--
  Ramakrishnan



  parent reply	other threads:[~2014-02-19 10:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 10:23 Ramakrishnan Muthukrishnan
2014-02-18 10:29 ` Richard Miller
2014-02-18 11:56   ` Ramakrishnan Muthukrishnan
2014-02-18 20:18   ` Grant R. Mather
2014-02-18 21:05     ` Richard Miller
2014-02-18 22:25       ` Yoann Padioleau
2014-02-19  0:13         ` Shane Morris
2014-02-19  0:19           ` Jacob Todd
2014-02-19 10:00           ` Richard Miller
2014-02-19 10:14             ` Shane Morris
2014-02-20  1:24               ` erik quanstrom
2014-02-20 15:47               ` Steven Stallion
2014-02-20 15:55                 ` erik quanstrom
2014-02-20 15:57                 ` David du Colombier
2014-02-20 15:57                 ` Charles Forsyth
2014-02-19 10:55             ` Ramakrishnan Muthukrishnan [this message]
2014-02-19  9:05         ` Richard Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA6Yd9UjM=qAA=tCwSFWjMks6TPZLtBNFMeGCuVYUq2AhhLo+g@mail.gmail.com' \
    --to=vu3rdd@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).