The Gentoo/FreeBSD project, as its name implies, is an effort to have the whole set of Gentoo components running on top of a FreeBSD base system. This means that, for example, instead of having a Linux kernel and GNU LibC, one will have FreeBSD's kernel and FreeBSD's LibC.

Notes:

This project is still in its infancy. Only try this if you are willing to test and report bugs. Look at section "6.4: Bug Squashing", for the bug-reporting resources.

Since this thread was created, a lot of progress has been made on Gentoo/FreeBSD, mostly the effort of Diego "Flameeyes" Patteno. Thanks to him, a lot of the patched stuff has been moved from the overlay directly into the mainline Portage tree. Good work, flameeyes!

If you have contributions related to freebsd-baselayout, such as new initscripts and configuration files, file a bug and assign it to spb@gentoo.org. Include the file(s) to be contributed as attachment to the bug.

Debates on the merits of Gentoo against FreeBSD go into the flamewar threads in section "6.3: Gentoo vs. FreeBSD Flamewars", not this thread.

FreeBSD is a free (license), Unix-like operating system. Back in 1993 when development of 386BSD stopped, two projects were born: NetBSD, commonly known to run on a huge number of architetures and FreeBSD which focuses mainly on the x86 platform. FreeBSD is renowned for its stability, performance and security, thus being used from small to huge companies all over the world. FreeBSD's current production release version is 5.3, which is also used as the foundation for the Gentoo/FreeBSD project.

2. Similarities and Differences between Linux and FreeBSD

Quote:

Users migrating from Linux to FreeBSD commonly consider the two operating systems "almost the same". In fact, FreeBSD really shares a lot of similarities with Linux distributions in general. Nevertheless, it has some key differences that are worth noting:

Contrary to Linux, which actually only refers to the kernel, FreeBSD is a complete operating system, consisting of a C library, userland tools and much more. This development approach makes the overall system very consistent.

Contrary to the Linux kernel, FreeBSD development is not led by one person, but instead managed by a small group of people called the "Core Team".

Besides that, FreeBSD also has some technical differences which set it apart from Linux.

Dynamically linked executables are not linked against libdl, like in Linux + glibc systems. Instead they are linked against libc.

FreeBSD doesn't have an official tool for kernel compilation, thus you'll have to resolve feature dependecies on your own.

FreeBSD uses UFS/UFS-2 as its filesystems and has no support for e.g. ReiserFS.

Since we are going to perform a Minimal installation of FreeBSD, we will only need the 5.3-RELEASE-i386-bootonly.iso image. This is a 20MB liveCD ISO that will let us download the base FreeBSD system from the Internet.

Boot the CD and the FreeBSD installation program (sysinstall) will start automatically.

For the exact installation steps, we refer you to the excellent FreeBSD Installation Handbook. You may find it as good as Gentoo's. Only important installation choices are mentioned below.

Notes:

If you plan on dual booting Gentoo, it's recommend to leave grub installed and do not install FreeBSD's boot loader. While it may be possible to boot Linux with FreeBSD's boot loader, we've never heard of anyone doing it successfully.

A suggestion to dual-boot using FreeBSD's bootloader comes from petrasl. I have not tested this.

petrasl wrote:

There is a way to help the FreeBSD boot loader to boot to linux : you only need to install from the Linux distibution lilo or grub on the boot sector of the Linux partition (e.g. /dev/hda2). Now FreeBSD boot loader will load lilo or grub and then - one of those boot loader - will boot linux as we know.

The example for booting FreeBSD partitions in /boot/grub/grub.conf.example does not work. This is because FreeBSD versions 5.1 and above use UFS2, which grub does not support, as the default filesystem. Therefore we need to use grub's chainloader feature to boot the FreeBSD loader.

The section you need to add into grub.conf will look like this:

Code:

title=FreeBSD 5.3
root (hd0,1)
chainloader (hd0,1)+1

The above assumes FreeBSD is installed in /dev/ad0s3, which is /dev/hda3 in Linux.

At the "Choose Distributions" screen, select "Minimal" to install only the base distribution.

Once the installation is complete, convert it into a Gentoo/FreeBSD system.

Now, edit make.conf. However, please read the following advice and warning first.

Note: We will use vim as our editor. Those who want something similar to nano can use ee instead.

Code:

# vi /etc/make.conf

Advice: Insert the SYNC and GENTOO_MIRRORS variables, and set these to your preferred servers. If you have changed the overlay directory from the one suggested, adjust the PORTDIR_OVERLAY variable to point to your actual overlay directory. You can also change the FETCHCOMMAND and RESUMECOMMAND to use wget (included in the Gentoo/FreeBSD snapshot) as the downloader. In that case, refer to /etc/make.conf.example for the correct settings of these variables.

Warning: Setting PORT_LOGDIR is known to cause emerge to freeze. Also, do not change the CFLAGS, CXXFLAGS, USE and FEATURES variables, unless you really know what you are doing. Gentoo/FreeBSD is still not very stable, and even fairly conservative settings, other than what is already preset, can cause problems.

When you're done with editing make.conf, download the latest Portage snapshot. The latest snapshot as of this post is portage-20050422.tar.bz2, so we will use that as our example.

Edit /etc/portage/package.mask to mask out packages which are in the overlay, but have newer versions in the Portage tree. If you do not do this, the versions of these packages that are patched to work on Gentoo/FreeBSD will not be emerged.

Code:

# vi /etc/portage/package.mask

Note: Again, many, many thanks go to flameeyes for making this package.mask smaller and smaller with each CVS commit. Some day, it will totally disappear.

If there are any errors, try to ignore the offending package and continue, as most of these are known bugs as listed in section "5. Known Issues".

Code:

# emerge --resume --skipfirst

It is advisable to repeat emerge -e system at least 2 more times, and finally run emerge -e world to make sure that everything is properly built.

When finished with emerge, we will have to update our configuration files. The preferred way to do this is to use dispatch-conf.

Edit /etc/dispatch-conf.conf to your own preferences. After that, create the /etc/config-archive directory and run dispatch-conf.

Warning: BSD diff seems to use somewhat different options compared to GNU diff, and this breaks the look-merge and toggle-merge functions in dispatch-conf. Your only usable options, when prompted, will be to either replace the old config file with the new one, or reject the new file and keep the old one. If anyone can figure out how to make BSD diff work with dispatch-conf, please PM me and this paragraph will be amended accordingly.

Configure the Gentoo initscripts as described in section "4. Configuring Gentoo/FreeBSD".

Lastly, reboot to see the full effect of the new baselayout.

Code:

# shutdown -r now

4. Configuring Gentoo/FreeBSD

4.1: Network

Note: This paragraph assumes a ethernet + DHCP configuration. Initscripts for other types of internet connections are on the way. For now, non-ethernet users should use the normal FreeBSD initscripts in /etc/rc.d to start their network link.

Create the file /etc/conf.d/net and edit it as necessary. The format is exactly the same as the /etc/conf.d/net file in Gentoo Linux.

Code:

# vi /etc/conf.d/net

My /etc/conf.d/net:
(Note the whitespace around "dhcp".)

Code:

ifconfig_rl0=( "dhcp" )

After that, comment out the ifconfig_rl0 line in /etc/rc.conf, as it will clash with your setting in /etc/conf.d/net, causing the net.rl0 initscript to fail.

Read the /etc/init.d/syscons initscript to find out what variables it sets. Then copy the corresponding variables from /etc/rc.conf into /etc/conf.d/syscons, and comment out those in /etc/rc.conf. In /etc/conf.d/syscons, change all the variable names added into UPPERCASE.

Note: If you have contributions related to freebsd-baselayout, such as new initscripts and configuration files, file a bug and assign it to spb@gentoo.org. Include the file(s) to be contributed as attachment to the bug.

Join us in #gentoo-bsd on irc.freenode.net

Last edited by kimchi_sg on Sun Sep 04, 2005 9:03 am; edited 29 times in total

I'm sorry... I'm all for porting stuff and making it work with other things, but why Gentoo on FreeBSD? That's like replacing Explorer on Windows XP with Finder from MacOS X. I could see getting portage running under FreeBSD, to compliment ports, actually... no I couldn't. It is an interesting topic, I'll give you that._________________JeffWalter

Whats wrong with freebsd ports/pkg system? I cant see any good reason to switch to portage._________________"Yes, I know Linux runs faster, but they can do that because they have thrown out the weight of the airbag, collision frame and safety belt." —Poul-Henning Kamp

Create the file /etc/conf.d/net and edit it as necessary. The format is exactly the same as the /etc/conf.d/net file in Gentoo Linux, with one big difference: The network interfaces are named rlX (rl0, rl1, etc), not ethX.

Yeah, no. Network devices in FreeBSD are not named rl*, they're named after the network driver they use, eg. rl, dc, xl, and so on. rl is just one particular driver. See here. Also, is this project going to re-implement the entire rc system on freebsd to use gentoo's init.d system? Or are you mapping /etc/init.d to $PREFIX/etc/rc.d? I can understand using /etc/init.d for added packages, but why things like network configuration? That's set up at install for you automatically, as are a lot of things in /etc/rc.conf - and a lot more simply than /etc/init.d and /etc/conf.d are in gentoo.

Also, i think this project would be better served if it were geared towards DragonFlyBSD, which as of late does not have it's own package manager. This is an ideal chance for portage to move to some place it's actually needed, as opposed to someplace it's mostly not welcome.

Port portage to DragonFly and create yourself a binary package repository that does weekly builds, and you might see DragonFly people embrace this project.

what are the differences between the package management tools available to Freebsd and Portage anyway? I'm interested in trying Freebsd on my laptop and I think it would be helpful to know how Portage differs from Ports in terms of functionality._________________Ware wa mutekinari.
Wa ga kage waza ni kanau mono nashi.
Wa ga ichigeki wa mutekinari.

"First there was nothing, so the lord gave us light. There was still nothing, but at least you could see it."

Create the file /etc/conf.d/net and edit it as necessary. The format is exactly the same as the /etc/conf.d/net file in Gentoo Linux, with one big difference: The network interfaces are named rlX (rl0, rl1, etc), not ethX.

Yeah, no. Network devices in FreeBSD are not named rl*, they're named after the network driver they use, eg. rl, dc, xl, and so on. rl is just one particular driver.

Explainatory blurb removed for the time being.

sp0rk173 wrote:

Also, is this project going to re-implement the entire rc system on freebsd to use gentoo's init.d system? Or are you mapping /etc/init.d to $PREFIX/etc/rc.d? I can understand using /etc/init.d for added packages, but why things like network configuration? That's set up at install for you automatically, as are a lot of things in /etc/rc.conf - and a lot more simply than /etc/init.d and /etc/conf.d are in gentoo.

"Simply" is a very relative term. There are people who will disagree with your assessment.

sp0rk173 wrote:

Also, i think this project would be better served if it were geared towards DragonFlyBSD, which as of late does not have it's own package manager. This is an ideal chance for portage to move to some place it's actually needed, as opposed to someplace it's mostly not welcome.

Port portage to DragonFly and create yourself a binary package repository that does weekly builds, and you might see DragonFly people embrace this project.

The Gentoo/FreeBSD project, as its name implies, is an effort to have the whole set of Gentoo components running on top of a FreeBSD base system. This means that, for example, instead of having a Linux kernel and GNU LibC, one will have FreeBSD's kernel and FreeBSD's LibC.

_________________Murphy's Law of Gentoo installation: If a compile can fail, it will.

wget has multiple vulnerabilities, use fetch instead._________________"Yes, I know Linux runs faster, but they can do that because they have thrown out the weight of the airbag, collision frame and safety belt." —Poul-Henning Kamp

Also, i think this project would be better served if it were geared towards DragonFlyBSD, which as of late does not have it's own package manager. This is an ideal chance for portage to move to some place it's actually needed, as opposed to someplace it's mostly not welcome.

Port portage to DragonFly and create yourself a binary package repository that does weekly builds, and you might see DragonFly people embrace this project.

Most of the work we've done for this is applicable to any of the BSDs, it's just that at the moment FreeBSD provides the best platform for developing on. I've played with it on Dragonfly, but unfortunately it had some major issues with Python, so making Portage run was a bit problematic.

If you plan on dual booting Gentoo, it's recommend to leave grub installed and do not install FreeBSD's boot loader. While it may be possible to boot Linux with FreeBSD's boot loader, we've never heard of anyone doing it successfully.

The FreeBSD boot loader can boot to linux, but normally it doesn't... It can identify the linux partition, but it have no idea what to do : it can't find the "stage one" (/boot/boot1) or something silmilar on the linux partition.

There is a way to help the FreeBSD boot loader to boot to linux : you only need to install from the Linux distibution lilo or grub on the boot sector of the Linux partition (e.g. /dev/hda2). Now FreeBSD boot loader will load lilo or grub and then - one of those boot loader - will boot linux as we know.

There is a way to help the FreeBSD boot loader to boot to linux : you only need to install from the Linux distibution lilo or grub on the boot sector of the Linux partition (e.g. /dev/hda2). Now FreeBSD boot loader will load lilo or grub and then - one of those boot loader - will boot linux as we know.

OK, I have included this in my bootloader advice, along with the obligatory disclaimer.

Also, spb has requested that all baselayout-related contributions (new initscripts, example configs, etc) be reported in bugzilla and assigned to spb@gentoo.org , I have also updated the post to reflect this. _________________Murphy's Law of Gentoo installation: If a compile can fail, it will.

is fbsd an officially supported arch in Gentoo? I can find some entries with -x86-fbsd etc. in the portage-tree - but no mentioning about it on packages.gentoo.org

I'm looking for a packagesystem to use on FreeBSD servers - and I would like to use Portage - as it's very nice - but an alternative is pkgsrc.org (I have to be realistic - can't run bleeding edge stuff on production servers - even if it is only the packagesystem and not the actual packages .

Would be very cool if all the supported archs was implemented in packages.gentoo.org - so I could search for packages pr. arch etc. too _________________Best regards,

Klavs Klavsen
Denmark

Working with Unix is like wrestling a worthy opponent.
Working with windows is like attacking a small whining child
who is carrying a .38.

is fbsd an officially supported arch in Gentoo? I can find some entries with -x86-fbsd etc. in the portage-tree - but no mentioning about it on packages.gentoo.org

Portage itself is supported on fbsd, at least inasmuch as if it breaks we'll fix it. However, there are still some issues with the packages you need to run it, so the setup as a whole isn't yet. And no, there isn't anything in the tree keyworded for x86-fbsd yet; that will happen once we get the system working and the profile / system ebuilds into the tree.

Ok. Thanks for info. Any ETA on when you the -x86-fbsd arch is hoped to be ready for inclusion in the main tree?
We are moving to FreeBSD 5.4 soon - and will move to the new package system at that time. Perhaps it'll be mature for FreeBSD6 so we can consider it there - it has to beat pkgsrc for me to be able to convince people here _________________Best regards,

Klavs Klavsen
Denmark

Working with Unix is like wrestling a worthy opponent.
Working with windows is like attacking a small whining child
who is carrying a .38.

I have used FreeBSD for 3 years and I loved it :_) however, I prefer to use the portage better than ports.

Because of that, I will test Gentoo/FBSD on my laptop when I had finished my exams, and will try to make an ebuild to cvsup base system to -stable and/or -current. Do you think it is a good idea? Or maybe I should consider another way to collaborate with the proyect?

I am not a skilled programmer however I will learn what is necessary _________________ Unanswered posts

A question: is the point of getting Portage working on a FreeBSD system so that Portage can be used as an easy, familiar CLI to fetching and compiling BSD packages, or is the whole thing set up so that the Linux versions of BSD packages are compiled and installed instead?

e.g. If I run emerge gnome, will I be getting the BSD source code or the Linux source code? Or am I just wrong altogether, and source code is just source code regardless of OS? Basically, I'm wondering if Portage and all the other Gentoo packages are designed to compile BSD programs or Linux programs (and the support those programs need). I know that FreeBSD has its own ports system, but I'm unfamiliar with how it works, or if there's a CLI frontend to it (like Portage or apt), or if it's all just time-consuming ./configure && make commands.

I'm very much interested in trying out Gentoo/FreeBSD; I've used FreeBSD and FreeSBIE a little bit in the past, but I still love my Gentoo. At this point, I'm trying to decide on whether to try out/test/help out the Gentoo/FreeBSD project or the Gentoo/Solaris endeavor.

Or am I just wrong altogether, and source code is just source code regardless of OS?

Sort of true... Gentoo/FreeBSD uses the same portage tree as that of mainstream Gentoo. So does Gentoo for MacOS, afaict.

However, there are bound to be certain differences in the build environments of Linux and FreeBSD. (Don't ask me what differences... ) That means patching may be needed for some programs to compile and / or run on FreeBSD. But ideally, the same source will compile and run on both FreeBSD and Linux without modifications. _________________Murphy's Law of Gentoo installation: If a compile can fail, it will.