OpenBSD Journal

BSD from scratch?

Contributed by jose on from the do-it-yourself dept.

anonymous writes:
"I've failed finding the BSD equivalent of 'Linux From Scratch'. A 'BSD From Scratch' e-mail with two replies is archived in MARC; both replies knew not what the person was asking.

So I Ask; does 'BSD From Scratch' exist, if not, what sources would you recommend?"

There are a few projects that kind of do this, but they're usually pared down BSD systems for embedded systems (ie floppy based routers). However, has anyone had a chance to describe how to roll your own BSD system? There are so many free software projects which replace key things (compilers, authentication systems, C libraries) that it should be possible. Anyone done this?

(Comments are closed)


  1. By Anonymous Coward () on

    My question would be, "Why do you want to build it from scratch?" I've noticed in the BSD world everything is modular with very little dependency. Want to have IPF instead of PF in OpenBSD? It's not that much work to replace it.

    Want to change libc to glibc... I suppose you could, but why? Not to take away from the glibc people, but the BSD libc works just fine and is more free to me.

    I've noticed this about linux. Find something cool and reimplement it ad nausium. The "Free Software" excuse only works until there is a "Free Software" version. Then the job of programmers should be to improve the version that exists. BSD does this. Yes, there are occasionally times when things get ripped out entirely to be replaced with different code, but it's for a good reason. (GEOM in FreeBSD is a good example of this.) The gradual evolution results in a more stable system and better though out changes. (At least when there is going to be gigantic changes the people usually mention that they'd like to improve something and ask if anyone has any ideas.)

    Revolutions are great... every once in a while, but they get tiresome when you're trying to keep up. Evolutions work much better. Don't replace entire portions for no good reason. Think it through. Want something to do that doesn't require all that much programming knowledge? Rework OpenBSD's src directory so that it is even more modular. Make everything a package that can be updated periodically via something like portupgrade. That way when a new gcc comes out it's like it is on Redhat or Debian. That's about the only revolution I want right now.

    1. By Anonymous Coward () on

      > I've noticed in the BSD world everything is modular with very little dependency.
      > Want to have IPF instead of PF in OpenBSD? It's not that much work to replace it.

      Mmm... You are somewhat mistaken here. It's kind of opposite - BSD parts are much more integrated together and depend on each other than in Linux.

      > Make everything a package that can be updated periodically via something like portupgrade.
      > That way when a new gcc comes out it's like it is on Redhat or Debian.

      Wow, dude... You can not just swap gcc like this...

      1. By Anonymous Coward () on

        First... Adding IPF back in would consist of adding back the ipf userland utils, a few files in the kernel-land and the glue to make it stick. The glue would be the messy part.

        In an ideal world you should be able to swap gcc for a newer version. Of course there is the problem with compatibility between libraries compiled with different versions of gcc (ABI differences in other words), but hasn't the c ABI stayed pretty much the same? I remember when gcc 3 came out. c++ ABI compatibility went out the window.

        Seriously, I'd like to see an easier way to upgrade an existing system. Packages exists and I think it could be a really easy way to do it. I come from the Solaris version of Reality, where patches for updates are basically packages. Should the BSD community get something like this, it would definitely help. Hell, Apple has something similar for MacOSX. It's about time something like this became a reality. I've been monkeying around with the idea for a while and I've got a little code chucked at the idea. But my job doesn't involve coding (or even computers), so the code has been slow going. I'll put up the code when the idea gels more into code form.

      2. By RC () on

        > Wow, dude... You can not just swap gcc like this...

        Quite right... but why is that? (you think)

        Well, it's because INSANE ammounts of human effort is going into Linux. Most every program is designed to compile on Linux without problems, lest you are attacked by hordes of 15-year-olds, and Stallman.

        Meanwhile, you can make a program that needs extensive modifications to work on OpenBSD, and people will be using it for years, possibly before you even hear that it won't compile without work.

        I just thought I'd throw it out there. There are dozens of Linux companies, all contributing cash and software into the project, and although it has some features the BSDs don't, in every other respect, the BSDs are far better--just try loading a few Linux kernel modules. :-)

      3. By mirabile () mirabile@bsdcow.net on mailto:mirabile@bsdcow.net

        My custom OpenBSD variant (1.2 Meg diff to the
        main repo, including djb ports, IPv6 apache, etc.)
        uses egcc (gcc-3.2.1-propolice) as the system compiler
        and just in this minutes survived another make build
        to bring it up-to-date.

        I release snapshots on occasions, even.

        1. By Matt Van Mater () on

          I was just playing around with djbdns the other day and wondered why they aren't in ports. I know they used to be, I can only assume its because of licensing reasons.

          I can understand the licensing crap with the base OS, but I don't think something with optional functionality should apply. Maybe they should do something like make it available for download but not include it on the release cd.

          Can you post a link to your djb ports so I can take a look at them?

          1. By Whatever. () on

            Since the license for djb-stuff says (you should
            read it first, and ask later) "if it doesn't install
            where I want, you can't redistribute". Since djb
            wants it to make directories under / (and not
            under /usr/local) the ports-part is out of the
            question.

            As always, when something goes out of OpenBSD, it's
            not because Theo wants to be a prick, it's really
            because he follows the authors license. When you
            see that djb and darren reed makes fuss about their
            programs/code go out, you realise who the pricks are.
            It IS that simple.

            1. By Matt Van Mater () on

              Don't get me wrong I understand the licensing issues involved, each guy thinks he's doing the right thing and is sticking with their principles. Its just too bad the kids can't play nice and find a compromise.

          2. By Anonymous Coward () on

            This should peek your interest:
            http://marc.theaimsgroup.com/?t=99867604400001&r=6&w=2

            1. By Matt () on

              thanks, thats an interesting thread I hadn't read yet.

              1. By Anonymous Coward () on


                That thread was a nightmare... One of the biggest flame wars on misc@ I can remember.

            2. By Anonymous Coward () on

              That's "pique" not "peek" or "peak"

          3. By Lars Hansson () lars@unet.net.ph on mailto:lars@unet.net.ph

            Please, not this again. They're not in the official ports and this is not going to change in the foreseeable future. Make your own ports,use someone else's ports or whatever you feel like. If you like the software (I do) you'll use it regardless of ports.
            But please dont bring this discussion up again.

    2. By Anonymous Coward () on

      Right on!!! BSDphiles have good heads on their shoulders.

  2. By Acheron () acheron@sympatico.ca on mailto:acheron@sympatico.ca

    BSD from scratch? This is about the most senseless thing I have seen in a while, and it shows the person in question really does not comprehend what he/she is asking.

    First of all, what are the components of an O/S? Besides the various utilities and such, which can be selected, compiled, and packaged as necessary, you need the kernel. While Linux-from-scratch works because it shares a common codebase, the BSD world is completely different.

    BSD projects more closely combine work in userland with that of the kernel, it is a much close-knit development model. So, the idea of a generic 'BSD" system is actually senseless. You can fork off of any of the BSD systems you want, as some of them have actually forked off of each other, but the idea of a 'roll-your-own' bsd is not as simple as the poster thinks.

    1. By Anonymous Coward () on

      " the idea of a 'roll-your-own' bsd is not as simple as the poster thinks."

      THE reason to document the process?

  3. By fluffy bunnie () grifter@fuckmicrosoft.com on mailto:grifter@fuckmicrosoft.com

    i am going to have to agree with these guys, this is nonsense. one of the many reasons i switched to using *bsd instead of linux, is because of the silly amount of linux distro's. I hope this never happens to bsd... I think FreeBSD OpenBSD and NetBSD are perfect, people should help support these groups, and not roll their own.

    I mean what more can you ask for, you want robust webservers, mail servers dns etc, or something of the sort, HRMMM order me a FreeBSD! you want BSD on your toaster? toilet? tv? sneakers? windmills? watch? HRM order me NetBSD! You want to be so anal about security that you trust not even your own grandmother by DNA match, HRMMM order me OpenBSD. What else is there? am I missing something?

    Also note each and all of these can be used for all of the tasks mentioned i'm sure, i just labeled them as I use them for my own needs.

    1. By Anonymous Coward () on

      If the BSD projects were making some serious mistakes, there would be 20 different distros of FreeBSD, and 10 unique distros each of NetBSD and OpenBSD. But there aren't.

    2. By Noob () on

      This is the exact reason why I also switch from using Linux to BSD. You post so matched what I felt about this issue, I have nothing more to say ;-)

  4. By RC () on

    As everyone has said, this is a ridiculous question.

    Want OpenBSD from Scratch?

    cd /usr/src && make

    Done and done.

    1. By Anonymous Coward () on

      You forgot the kernel :-)

  5. By Jeffrey () on

    ... if for no other reason than as a learning tool.

    I did it for a while when I wanted to poke my brain and
    see what it could do ;)

    Frankly, I would not do LFS (Linux-From-Scratch) again.
    Time is too valuable. Plus, I'll never use Linux again.
    Why would I..? There is OpenBSD and NetBSD, both of
    which are perfect.

    Upgrades with LFS (or any Linux system)..? Not nearly
    as simple and painless as doing a `make build'..
    The BSDs are the only way to go for me.

    1. By Anonymous Coward () on

      agreed!

    2. By Nicolai () on

      Upgrades with LFS (or any Linux system)..? Not nearly as simple and painless as doing a `make build'..
      Yes, apt-get update && apt-get upgrade is much more complicated and painful..

      1. By Anonymous Coward () on

        apt-get install a-life-and-a-brain

      2. By Anonymous Coward () on

        With debian it's more like:

        apt-get lots-of-junk-i-don't-need-but-let's-get-it-anyway
        apt-get and-now-let's-install-this-shit-on-my-poor-1g-disk-too
        apt-get ask-me-all-kind-of-setup-questions-about-services-i-don't-want-and-enable-them-anyway-even-though-they-are-broken-and-giant-security-holes
        And then: ERROR: no more space left for the important stuff

        Whereas with OpenBSD, you just boot from ONE (and nog six *yuck*) boot disk, and install only a consistent, no-bullshit-whistles-and-bells base system, which you can extend later on. Besides, I don't see the difference in difficulty between apt-get and pkg_add to install packages..., except that apt-get kept on freaking out when I'm low on diskspace.

        1. By anonymous () on

          > which you can extend later

          With what? With nothing?

          Then please make my DVB card working for *viewing* TV and I want to fax through my ISDN card, please. Where are the Capi drivers?

          BSDs are really sweet, but I have no drivers for something special. So I'll be pleasant to a lot of stupid people at the Linux world and will be able to use something special.

          In the BSD world, I have only a small (but very good) community *AND* less drivers.

          Sorry, that lost my hopes for BSD... and sucks a little bit! Linux looks like a building site, but you can build towers or a camping. It's on your own how good you make house...

          And be happy that Linux exist. Where are the BSD world now?
          Installing 1000 systems with only one 1.44mb-disk because disk two is in progress...

          1. By Anonymous Coward () on

            Linux has more features for special stuff. All this can sometimes be fun, but most of the time it just makes the whole thing unnecessary bloated.
            If you want support for every (i386) device there is, heck, why not use windows? Windows supports everything, though you have to make a rather big security/stability sacrifice.
            I would say that Linux is somewhere in between windows and *BSD: Linux supports more devices than BSD (and less than windows), but Linux also has more security/stability problems than *BSD imho.
            You can't have everything at once (too bad), so choose whatever OS best suits your needs :)

            1. By currently_without_nickname () on

              i use linux on my multimedia station with lots of special hardware, however, i have experienced troubles in older hardware with linux (EISA etc.) My AHA-1744 scsi controller did not work, freebsd and openbsd worked very fine.
              btw: if you want to have a bsd-like linux, take a look at www.rocklinux.org ... i think its very nice.

        2. By Andrew () andrew@fabbro.org on mailto:andrew@fabbro.org

          Well...*sort* of a base system. I frankly wish OpenBSD was a little more pared down. Do I need UUCP?

          1. By Marina Brown () marina@nospam.surferz.net on mailto:marina@nospam.surferz.net

            UUCP ?

            Well, i personally think that UUCP will make
            a BIG comeback in the years to come.

            Study TCP/IP and apply it to a network between
            the earth and MARS ;-).

            UUCP will be the way to go !

            ...Though, you should note that it WAS removed
            in one of the more recent releases and put in the
            ports.

            Hmmm... , though /usr/libexec/uucpd is still there.


            Marina Brown

    3. By Anonymous Coward () on

      > ... if for no other reason than as a learning tool.

      I was also looking into this as a learning tool. But the FreeBSD site recommends you read all the Makefiles.

      http://www.freebsd.org/doc/en_US.ISO8859-1/articles/fbsd-from-scratch/why.html

      "My goal is to provide an automated and complete installation, not explaining all the gory details that go on under the hood when making the world. In case you want to explore FreeBSD at this level of detail, start looking at /usr/src/Makefile and follow the actions of a make buildworld."

      Probably the less detailed approach in this case is to be well acquainted with the FreeBSD Handbook.

  6. By Anonymous Coward () on

    BSD does not have a "Unified Kernel".. Where different Linux distributions typically operate off a similar (if not identical) stock kernel, the BSD's have branched off in this area.

    "BSD From Scratch" would mean you grabbing a 4.4 BSD kernel and building what you want on top of it. Otherwise do a CVS checkout and learn about make release.

    1. By Anonymous Coward () on

      Finally, someone who addresses the question.

      1. By Anonymous Coward () on

        Yep, I ate lots of smarties when I was a kid

  7. By Anonymous Coward () on

    Get 4.4BSD-Lite and MACH 3.0 source, mix together and stir. Have fun and let us know how it goes.

    Or go play with xMACH. ( http://smokeping.planetmirror.com/pub/xmach/ )

    Or, get OpenBSD source, make, move files around to a CD or another system, configure and boot. How's that.

    Or, Get 386BSD code, and make it run.

    Or get Darwin from Apple and try to make it work on your system.

    Get the picture...

    1. By Anonymous Coward () on

      ... or read release(8): Making your own release of OpenBSD

    2. By Anonymous Coward () on

      xmach! barf ...

      whatever did happen to it?

  8. By Anonymous Coward () on

    Do what you want with it! Will it pull the world
    into a downward spiral of devolution? Hardly!
    Have fun!

  9. By mnemonic () mnemonic at mail dot be on mailto:mnemonic at mail dot be

    If you want to build a "BSD from scratch" you should read (modify) the Makefiles and sort what is in /usr/obj and after, read the release(8) manpage.

  10. By Anonymous Coward () on http://www.microbsd.net

    Just swing over to MicroBSDs site and look at what they have been up to. A hardened minimized OpenBSD fork, with code from Net/FreeBSD merged back in. Looks like they are attempting to unify the BSD world into a small flexible distribution while integrated the finest features from all BSDs into one. They are also assing alot of ACL security COde the even OpenBSD doesnt have yet. A bit cutting egde.

    1. By Anonymous Coward () on

      running sed on the OpenBSD src tree and applying every patch from outside sources under the sun does not make MircoBSD cutting edge in the least.

  11. By Anonymous Coward () on http://www.microbsd.net

    Just swing over to MicroBSDs site and look at what they have been up to. A hardened minimized OpenBSD fork, with code from Net/FreeBSD merged back in. Looks like they are attempting to unify the BSD world into a small flexible distribution while integrated the finest features from all BSDs into one. They are also adding alot of ACL security Code the even OpenBSD doesnt have yet. A bit cutting egde.

  12. By Anonymous Coward () on

    "So I Ask; does 'BSD From Scratch' exist, if not, what sources would you recommend?"

    A simple question, yet only 14% of the comments so far address it with a relevant reply. Shame, shame...

    1. By Anonymous Coward () on

      no, it does not. did i win?

      1. By Anonymous Coward () on

        you answered half the question.

  13. By John Kennedy () on

    I've done UNIX froms scratch in a linux environment in the sense that I rolled and maintained my own personal/work distro for 3+ years. As an educational exercise, it is excellent. It is a huge time committment to do it for real and do it properly.

    One of the reasons I'm working with OpenBSD now is that I didn't want the huge time-suck anymore and I was looking for a project that was security motivated (above and beyond just "secure").

    If you do it from scratch, you will be reinventing the wheel a lot. Once you achieve a certain critical mass, it will be hard to do a good job relative to other projects with more people.

    If you get too detailed, you're also going to discover the modular joys of chicken-&-egg dependencies. X needs TCL/TK to compile, TCL/TK needs X is one thing won't even come close to everything you would see.

    Again, as an educational experience, go for it. You'll probably find it is more product to join in on a collaberative project that suits your needs and help them out to everyone's mutual benefit.

  14. By Anonymous Peon () on

    ...is that it's very friendly about cross-compiling, building small, personalized releases, and so forth.

    To do "BSD from scratch" in any useful fashion, you need to work backwards- take a full install, cut it down to exactly what you need (again, I'm positing that NetBSD makes this easiest, by virtue of their design goals; it's doable with Open and Free, but NetBSD makes the best training wheel for it), and add/build appropriate packages to put on top.

  15. By Lars Hansson () lars@unet.net.ph on mailto:lars@unet.net.ph

    "BSD from scratch" is what you get when you compile from the sources. Really.
    The reason there's LFS is that Linux has a different distribution model. There are a multitude of distributions that does the same thing, only slightly different.
    With BSD you always get it from scratch, so to speak. There are no (or at least very, very few) different distributions so the need isn't there.

  16. By zam4ever () on http://www.freebsd.org

    As I know you can do a customized picoBSD from the FreeBSD source code. So, here, the BSD From Scratch will apply... Take a look around and start digging the code..

    cheers

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]