LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   *BSD from scratch? (https://www.linuxquestions.org/questions/%2Absd-17/%2Absd-from-scratch-528303/)

Vitalie Ciubotaru 02-12-2007 07:52 PM

*BSD from scratch?
 
My question is rather non-trivial, since none asked anything even slightly similar.

There is an interesting Linux project called Linux From Scratch (LFS) - building one's own Linux "distribution" entirely from source code. Besides educational purposes, it allows for maximal optimization possible for the given hardware. More than that their site has instructions for building linux from other OSes [including *BSD].
I wonder if anything like this is possible for BSD. I understand that BSD and Linux differ in that the former is divided into a "base system" and "add-ons" while the latter is a conglomerate of packages from different systems [well, that's basically all I know about BSD], but it is still an open source system, right? This means I can [potentially] compile it all from source code.
1. Are there any projects focussed on building [or cross-building] BSD from source? My google searches didn't yield anything. Maybe I don't know what to search...
2. Is there anybody who tried to do something like this? I mean not just compiling binaries on Linux to be run on BSD, but compiling an entire OS.
3. My questions may sound ridiculos due to lack of knowledge in a particular area. If they are, is there a good reference on the internal structure of BSD [something that distinguishes BSD from Linux - operating system, not the kernel], on cross-building between BSD and Linux, or ...?
Thanks in advance!

Vitalie CIUBOTARU

vermaden 02-12-2007 07:59 PM

check this:
http://freebsd.org/doc/en_US.ISO8859...d-from-scratch

frob23 02-12-2007 10:03 PM

1)
Uhm, the BSD projects themselves are focused on being able to build the system from source. In fact, many BSD users (myself included) build it from source routinely. Since all of the base system is maintained by the project, this is undeniably simplified from the steps you need to do on Linux. As the system (take NetBSD for example) is much, much smaller, you don't gain much at all by trying to strip the base down. Still, it's possible and people do it with ease (for embedded platforms).

So, the very structure of the system makes the need for a project to do it unnecessary. BSD from scratch is the default starting point. And it's so easy that it can be managed with very few commands and patience.

2)
Like I said above... the projects exist in this state by default. Someone trying to do it again would only make it harder... since it can't get much easier (on NetBSD it's done with one command -- well repeated a couple times but still it's the same basic command you just control the steps).

3)
Read the documentation for the projects. Each project answers this question very well in their own documentation. But I've pretty much said it above. You just need the specific steps for each project. In particular, check out NetBSD as they have turned the question your asking into a fine art. You can build the entire system from source on any OS which provides standard POSIX utilities... this includes Linux, Solaris, Irix, or even in cygwin on Windows... all with the same ease as on a native NetBSD system. The entire build procedure is cleaned up and standardized. In fact, you can build a sparc distribution of NetBSD on an i386 Windows machine without any more thought than typing the command.

Edit: I have a feeling you'll end up disappointed with how easy this is. It's trivial to do it... so it's not like you "accomplished" a Herculean task when you do it. Most of your time will be spent watching code compile and wondering, "It can't possibly be this easy... could it?!"

Vitalie Ciubotaru 02-19-2007 03:09 PM

Thank you guys,

I followed your advices and there's indeed a lot of things I was wrong about. I even managed to cross-compile NetBSD. Now I'm trying to make it work - the kernel gets loaded (I'm using GRUB), it finds the partition (after I tell it), finds "/sbin/init" and stops since there's nothing "init" is supposed to load...
It looks like BSDs are differ from each other much more, than different Linux distros, right?
They even use different partition types and filesystems. BTW, which uses which - I put my NetBSD on ext2fs and it seems to be fine. I read something about UFS, FFS, UFS2(?) but didn't understand too much.
How does one create a native NetBSD filesystem from within Linux?

frob23 02-21-2007 08:25 PM

I've replied to this on the other site (bsdforums) but I'll repeat it here. The problem is most likely that the kernel has no way of finding the root partition. If you understand the boot process you know that it has no way of knowing this information. You really should have a proper NetBSD partition. Luckily, you can build pretty much all the tools you need (including an installation kernel you can boot just like you're doing) and install from inside it. Just don't format the partition you have the sets on.


All times are GMT -5. The time now is 01:25 AM.