public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Portage on {Free,Open}BSD
@ 2003-08-24 18:57 Grant Goodyear
  0 siblings, 0 replies; only message in thread
From: Grant Goodyear @ 2003-08-24 18:57 UTC (permalink / raw
  To: gentoo-dev; +Cc: drobbins


[-- Attachment #1.1: Type: text/plain, Size: 278 bytes --]

Dear all,
  This weekend I put together some tarballs so that people who want to 
play with portage on OpenBSD or FreeBSD can do so quite quickly.  You
can get more info at http://www.gentoo.org/~g2boojum.  Have fun!

-g2boojum-
-- 
Grant Goodyear <g2boojum@gentoo.org>

[-- Attachment #1.2: index.txt --]
[-- Type: text/plain, Size: 8014 bytes --]

==============
Gentoo + \*BSD
==============

I would really like to be able to play with OpenBSD's `PF`_, or 
FreeBSD's `jail`_, but I'm 
rather fond of Gentoo and portage.  Right now anybody wanting to play
with portage on a bsd has a **lot** of work to do before getting started,
since we don't have stage-1 tarballs.  I still don't have a stage-1,
but this text and attendent files comprises a small start along the 
road to generating one.  

.. _PF: http://www.openbsd.com/faq/pf/index.html
.. _jail: http://www.freebsd.org/cgi/man.cgi?query=jail&apropos=0&sektion=0&manpath=FreeBSD+4.8-RELEASE&format=html

This guide has sections for `Gentoo OpenBSD`_ and 
`Gentoo FreeBSD`_.

Gentoo OpenBSD
--------------

Install OpenBSD
...............

The first step is to install `OpenBSD`_.

.. _OpenBSD: http://www.openbsd.com

I downloaded their tiny little boot iso, burned it onto a cd, and 
booted from it to do an ftp install onto a spare hard drive.  (A
spare partition would suffice, as well, and grub will boot an OpenBSD
partition just fine.)  OpenBSD has two separate sources of information
about how to perform an installation: the `FAQ`_ and the i386
`install`_ directory.

.. _FAQ: http://www.openbsd.com/faq/index.html
.. _install: ftp://ftp.openbsd.org/pub/OpenBSD/3.3/i386/INSTALL.i386

If you've never installed a \*BSD before, you might find the 
partitioning/slicing to be a bit confusing.  I wouldn't recommend
using a production hard drive!  If you need to repartition a drive
using OpenBSD's fdisk, you'll really want to do so using 
Cylindar/Head/Sector mode.  My suggestion is, if you can't devote an
entire drive to the installation and you *must* repartition, that
you first take a look at a linux system using OpenBSD's fdisk so
that you can see the pattern.  In general you want a partition
to end on a cylindar boundary (meaning that H and S should be
their respective maximums), and you have to be careful to ensure
that the partitions don't overlap (which is why it's simplest to
work in C/H/S mode).

Once you successfully reboot into your new OpenBSD system, you 
need to add a portage user and group::

	# groupadd -g 250 portage
	# useradd -g 250 -u 250 -s /sbin/nologin -d /var/empty portage

Portage
.......

Since we didn't start from a stage-x tarball, we need a way to 
get portage onto the system.  I've assembled a tarball that contains
portage and necessary dependencies: python, bash, bzip2, rsync, and
GNU versions of make, patch, sed, and tar (all of which have a "g"
prepended so that they don't conflict with the BSD versions)::

	# cd /
	# ftp http://dev.gentoo.org/~g2boojum/obsd/gentoo-obsd.tgz
	# tar xvzf gentoo-obsd.tgz

At this point you should have a modestly functional portage.  Let's see
if it works::

	# emerge info
	# emerge sync

(If "emerge sync" suggests that you need to upgrade portage, you probably
don't want to do it right now.  Some custom tweaks to portage were
necessary, and you'll have to recreate them if you update.)

You'll also want to satisfy the glibc dependency::

	# echo virtual/glibc sys-libs/glibc >> /var/cache/edb/virtuals
	# emerge inject sys-libs/glibc-2.3.2

Now you can play!  Dependencies are a mess, since the OpenBSD base system
provides quite a bit that needs to be properly enumerated.  Portage does
work, however::

	# ebuild /usr/portage/app-editors/nano/nano-1.2.1.ebuild merge
	# nano -w /etc/make.conf

Some files can be found in my obsd_ directory.

.. _obsd: http://dev.gentoo.org/~g2boojum/obsd

Gentoo FreeBSD
--------------

Installing FreeBSD
..................

The first step is to install `FreeBSD`_.

.. _FreeBSD: http://www.freebsd.com

I downloaded their 5.1 disk 1 iso, burned it onto a cd, and 
booted from it to do a "minimal" cd install onto a spare hard drive.  (A
spare partition would suffice, as well, and grub will boot an FreeBSD
partition just fine.)  FreeBSD has adequate installation instructions
in the FreeBSD Handbook_.

.. _Handbook: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html

If you've never installed a \*BSD before, you might find the 
partitioning/slicing to be a bit confusing.  I wouldn't recommend
using a production hard drive!  Fortunately, the FreeBSD fdisk and
bsdlabel tools are fairly intuitive.  I just used fdisk's and 
bsdlabel's defaults.

Once you successfully reboot into your new FreeBSD system, you 
need to add a portage user and group::

	# echo 'portage:*:250:root' >> /etc/group
	# vipw (<-- add portage:*:250:250::0:0:Portage:/nonexistent:/sbin/nologin)

(Note, editing /etc/password will *not* work!  See "man 5 passwd".)

Portage
.......

Since we didn't start from a stage-x tarball, we need a way to 
get portage onto the system.  I've assembled a tarball that contains
portage and necessary dependencies: python, bash, rsync, and
GNU versions of make, patch, sed, and tar (all of which have a "g"
prepended so that they don't conflict with the BSD versions)::

	# cd /
	# ftp http://dev.gentoo.org/~g2boojum/fbsd/gentoo-fbsd.tgz
	# tar xvzf gentoo-fbsd.tgz

At this point you should have a modestly functional portage.  Let's see
if it works::

	# emerge info
	# emerge sync

(If "emerge sync" suggests that you need to upgrade portage, you probably
don't want to do it right now.  Some custom tweaks to portage were
necessary, and you'll have to recreate them if you update.)

You'll also want to satisfy the glibc dependency::

	# echo virtual/glibc sys-libs/glibc >> /var/cache/edb/virtuals
	# emerge inject sys-libs/glibc-2.3.2

Now you can play!  Dependencies are a mess, since the FreeBSD base system
provides quite a bit that needs to be properly enumerated.  Portage does
work, however::

	# ebuild /usr/portage/app-editors/nano/nano-1.2.1.ebuild merge
	# nano -w /etc/make.conf

Some files can be found in my fbsd_ directory.  The "profiles", and 
various portage directories come from the Gentoo-BSD team.

.. _fbsd: http://dev.gentoo.org/~g2boojum/fbsd

Notes
-----

	1. There's a great deal that needs to be done before portage is fully
	functional on the BSDs.  I modified portage.py so that it accepts
	{Open,Free}BSD as a supported ostype (I just copied the relevant stanza
	for Darwin).  I also edited ebuild.sh to use some GNU tools; after the
	"unalias -a" line I added aliases for tar=gtar, patch=gpatch, make=gmake,
	and sed=gsed.  These changes need to be added to portage in a much more
	sane way than I have done so far.

	2. For the moment, we need an openbsd-sources ebuild that downloads the
	OpenBSD sources and provides a boatload of dependencies.  (The long-term
	fix is to break the bsd-sources package into smaller and better controlled
	pieces so that users can pick-and-choose what parts of BSD and GNU
	userland tools and kernels that one wants to use, but one thing at a
	time!)  There is currently a [free]bsd-sources ebuild which can be found
	in my fbsd_ directory.

	3. Using GNU tools for portage is really a hack; we should be able to
	support BSD tools, too.  Also, I've disabled sandbox because it doesn't
	compile on a BSD system.  It shouldn't be hard to port, but the work needs
	to be done.  For more information on proposed portage changes to better
	facilitate the BSDs, see the resources of the `gentoo alt`_ page.

.. _`gentoo alt`: http://www.gentoo.org/proj/en/gentoo-alt/

	4. We need a version of baselayout for the BSD systems.  It should be
	possible to use the BSD init with our scripts, but I don't believe that
	anybody has had the time to work it out just yet.

	5. A great many of our ebuilds will have to be patched to build on the
	BSDs.  (In fact, although the portage dependencies for OpenBSD built
	without difficulty, both gsed and gmake required patches, liberally stolen
	from the FreeBSD ports tree, to compile on FreeBSD.)

Have fun!

-g2boojum-

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-24 19:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-24 18:57 [gentoo-dev] Portage on {Free,Open}BSD Grant Goodyear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox