The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: clemc@ccc.com (Clem Cole)
Subject: [TUHS] Porting 2.11 BSD
Date: Sat, 21 Nov 2015 09:39:46 -0500	[thread overview]
Message-ID: <CAC20D2OeRdxZqZt1EMa5hy+hx_iK1AqRZr+YCroQRDWh1g0egw@mail.gmail.com> (raw)
In-Reply-To: <1448114587.9367.39.camel@papa2>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4444 bytes --]

Hellwig made some great tips.

Two other thoughts..

1.) Make sure you understand the low level interrupt mechanism and how
interrupts are turned into real C proceedure calls and back again.   This
is traditionally handled in the *.s file - which in the case of BSD is spit
out by Sam's config program.   So you'll eventuall need to rewrite the
proper stuff for your system - although as a step 1, you'll create it by
hand.

2.) A thought might be to walk before you try running.  The MIT guys took
V6 and the Lions book and rewrote it for the x86.   They use it for their
undergrad OS course.   They have excellent materials and have updated the
V6 code for a modern compiler.     A year ago, I answered a Quora question
about learning the kernel this was:
https://www.quora.com/Which-Linux-kernel-versions-source-code-is-better-for-newbie-to-read/answer/Clem-Cole?__snids__=1310704238&__nsrc__=1&__filter__=all


The most relevant part I have cut/pasted here:

 "a modern take on a classic" - the course if being offered this fall at
the URL:   6.828 / Fall 2014 <http://pdos.csail.mit.edu/6.828/2014/xv6.html>

The latest xv6 source is available via
        git clone git://pdos.csail.mit.edu/xv6/xv6.git
<http://git//pdos.csail.mit.edu/xv6/xv6.git>

Tools are can be found at:   6.828 / Fall 2014
<http://pdos.csail.mit.edu/6.828/2014/tools.html>

Using the MIT course or the Lion's text will teach how the kernel works and
how a user program interacts with it.   IMO: Lion's commentary is super and
100% of the source is there to read and ponder.  Please remember that
generations of the best kernel hackers started with this document (although
some of us predate it - but when I saw it I made a copy).

​My point is gett​ing the V6 kernel running on your HW.  The take your
learning from that and try a BSD kernel.   The hardest part of the ports
will be common and the V6 kernel is going to be a lot easier to get
working, because it small and simple.


No you went get networking at all the cool BSD features, but if the idea to
learn how to do it, start small scale as the MythBuster's guys always do ;-)

Clem

On Sat, Nov 21, 2015 at 9:03 AM, Hellwig Geisse <hellwig.geisse at mni.thm.de>
wrote:

> Hi Oliver,
>
> On Sa, 2015-11-21 at 14:00 +0100, Oliver Lehmann wrote:
> > Is there a good "HOWTO" for "first things first" as implementing
> > disklabel seems to require quite some "device work" before the
> > first "hello world" is there - is there something else which
> > should be could be done first and does not require so much to
> > port (the whole disk subsystem on that machine is different
> > from "usual" disk subsystems as it is handled via a PIO)
>
> I don't have an exact HOWTO for porting BSD, but we gathered
> some experience in these things while porting NetBSD to our
> processor ECO32.
>
> First and most important is a working tool-chain (which in case
> of BSD means GCC). You should really know your tools, because
> you will frequently dig deep into them to understand various
> aspects of e.g. linker scripts. We totally underestimated the
> amount of work to be done here.
>
> Then you must decide if you will do cross-development, or if you
> can do it on a running BSD system. Even if so, you will have to
> generate a file system for the target BSD system from which you
> boot your machine. You can do that with the tools included in BSD,
> but they are not running yet. (Btw, byte-order is an especially
> nasty thing in this context.)
>
> Memory management was another area which required a fair amount
> of work. I have no experience with 2.11 BSD, but in case of NetBSD
> the code is divided into at least three layers to obtain a good
> degree of re-usability for different architectures. Alas, the
> documentation was rather poor, and the relevant book ("The Design
> and Implementation of the 4.4 BSD Operating System" by McKusick
> et al.) is a bit outdated.
>
> The project of porting BSD to a yet unsupported machine is
> certainly feasible, and is indeed a valuable experience. But
> don't expect to have it done in only a couple of weeks... :-)
>
> Good luck!
> Hellwig
>
> _______________________________________________
> TUHS mailing list
> TUHS at minnie.tuhs.org
> https://minnie.tuhs.org/mailman/listinfo/tuhs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20151121/e290c0ee/attachment.html>


  reply	other threads:[~2015-11-21 14:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21 13:00 Oliver Lehmann
2015-11-21 13:36 ` Jacob Goense
2015-11-21 14:03 ` Hellwig Geisse
2015-11-21 14:39   ` Clem Cole [this message]
2015-11-22  0:13 ` Random832
2015-11-22  0:27   ` Michael Kerpan
2015-11-22  2:04     ` Jonathan Gevaryahu
2015-11-22  0:30   ` William Pechter
2015-11-22  1:36     ` Oliver Lehmann
2015-11-22  2:13       ` William Pechter
2015-11-23  0:56         ` Nick Downing
2015-11-23  8:05           ` Oliver Lehmann
2015-11-23  8:40             ` Erik E. Fair
2015-11-25  0:09               ` Al Kossow
2015-11-25 10:14                 ` Oliver Lehmann
2015-11-25 11:25                   ` Nick Downing
2015-11-25 11:46                     ` Nick Downing
2015-11-25 11:56                       ` Oliver Lehmann
2015-11-25 12:10                         ` Nick Downing
2015-11-25 11:51                     ` Oliver Lehmann
2015-11-25 12:01                       ` Nick Downing

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=CAC20D2OeRdxZqZt1EMa5hy+hx_iK1AqRZr+YCroQRDWh1g0egw@mail.gmail.com \
    --to=clemc@ccc.com \
    /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).