Search:  
Gentoo Wiki

HOWTO_Gentoo/FreeBSD

Contents

Introduction

Im writing this because the official Handbook [1] is a little out of date, and because it does not describe some FreeBSD specific things. The aim of this document is to provide an easy installation guide. Especially when there are differences to Gentoo/Linux.

Installation Media

The gentoo-freebsd project does not have its own installation media (Yet). Thanks to FreeSBIE we can use their livecd. Use bittorrent to get your own FreeSBIE here: [2]

Now boot FreeSBIE, and login as root.

Network

IP Address

like in linux you can use

ifconfig

to view and change your ip address.

Rather than numbering network devices sequentially (eth0, eth1, etc.), FreeBSD uses the driver name followed by a number. Driver names are two or three characters (xl, ed, ex, etc.).

Example: to change the ip for ed0 to 192.168.0.156 use

ifconfig ed0 192.168.0.156

Gateway

To set your default gateway use

route

Example: to use 192.168.0.1 as default gateway use

route add default 192.168.0.1
Note: In linux you would use
route add default gw 192.168.0.1 

Nameserver

add your nameservers ip to: /etc/resolv.conf Example: to use 192.168.0.1 as your nameserver use

echo "nameserver 192.168.0.1" > /etc/resolv.conf

Test

Try ping gentoo.org

ping www.gentoo.org

Preparing Disc

General information

Now this is realy different from Linux, so Im trying to give you some background. Like in Linux your harddisc can hold multiple partitions, but they are called slices in FreeBSD. Each slice can hold multiple partitions'

Drive Numbering

As with network interfaces, FreeBSD uses the driver name as the device name. ATA/IDE hard drives usually start with "ad" (ad0, ad1, etc) while SCSI drives start with "sd".

Your first hard drive is: ad0
The first slice on it is: ad0s1
The partition for "/" on it is: ad0s1a
The partition for "swap" on it is: ad0s1b

Creating your Disk layout

I spend hours trying to figure out how to do this with fdisk, disklabel and newfs, so if you know how to use them please change this.

Create Slices

Use

sysinstall diskPartitionEditor diskPartitionWrite

to setup your Slices.
Remember that we need only one Slice.
Use "q" to exit the editor. Now you are asked for a Boot manager, select none because we will make this step later.

Create Mountpoint

mkdir /root/gentoo

Create Partitions

Use

sysinstall diskLabelEditor diskLabelCommit

to setup your partitions
Create a swap partition and a FS partition with mountpoint "/root/gentoo"

Install

Change to directory /root

cd /root

Stage

Download

get a stage tarball from your favorite gentoo mirror Example:

wget http://gentoo.osuosl.org/experimental/x86/freebsd/stages/gentoo-freebsd-6.1-stage-20060509.tar.bz2

Extract

Change dir to /root/gentoo

cd gentoo

Use tar to extract the stage here Example:

tar -jxvpf ../gentoo-freebsd-6.1-stage-20060509.tar.bz2

Portage

Download

get a portage snapshot from you favorite mirror Example:

wget http://gentoo.osuosl.org/snapshots/portage-latest.tar.bz2

Extract

Use tar to extract the snapshot to usr

tar -xvjf portage-latest.tar.bz2 -C usr

Chroot

Now our system is ready, and we can chroot into it. But first we mount devfs and copy the nameserver information.

mount -t devfs none /root/gentoo/dev/
cp /etc/resolv.conf /root/gentoo/etc/

Now we chroot

chroot /root/gentoo/ /bin/bash
source /etc/profile

there's a bug in stage 20060509 so use

pwd_mkdb /etc/master.passwd

to fix it

Home Sweet Home :-)

Configure System

First we have to create the /etc/make.profile softlink which should point to /usr/portage/profiles/default-bsd/fbsd/6.1/x86

ln -s /usr/portage/profiles/default-bsd/fbsd/6.1/x86 /etc/make.profile

Now we edit /etc/make.conf

nano /etc/make.conf
CHOST="i686-gentoo-freebsd6.1"
ACCEPT_KEYWORDS="x86-fbsd"
FEATURES="-sandbox collision-protect"

Kernel

emerge

It't time to get the FreeBSD kernel

emerge freebsd-sources

This takes some time

config

Compiling a FreeBSD kernel is different than compiling a kernel for a Linux system. We change to /usr/src/sys/i386/conf

cd /usr/src/sys/i386/conf

and copy GENERIC to /root/KERNEL

cp GENERIC /root/KERNEL

now we make a softlink back to our working directory.

ln -s /root/KERNEL ./

and we edit KERNEL

nano KERNEL

We are now Configuring the our kernel. Don't panic, you don't have to change anything here it should work fine with default settings. But you can if you like. Here is some Help: [3]

compile

cp GENERIC.hints /boot/device.hints
config KERNEL
cd ../compile/KERNEL/
make depend && make && make install

fstab

Now we add our filesystem informations to /etc/fstab

nano /etc/fstab

Example:

/dev/ad0s1a             /               ufs             rw              1 1
/dev/ad0s1b             none            swap            sw              0 0
/dev/acd0               /mnt/cdrom      cd9660          ro,noauto       0 0

Final Config

Network

Edit /etc/conf.d/net to fit it to your network

nano /etc/conf.d/net

Example:

config_lnc0=( "192.168.0.156/24" )
routes_lnc0=( "default via 192.168.0.1" )

Add Network to default runlevel:
Example:

ln -s /etc/init.d/net.lo0 /etc/init.d/net.lnc0
rc-update add net.lnc0 default

Hostname

nano /etc/conf.d/hostname

Example:

HOSTNAME="myhostname"

Keyboard layout

nano /etc/conf.d/syscons

look into /usr/share/syscons/keymaps for possible layouts
Example:

KEYMAP="german.iso"

Root password

passwd

Bootloader

leave the chroot

exit
fdisk -B -b /root/gentoo/boot/boot0 /dev/ad0

fdisk will ask 2 questions, answer with y.
Enter the chroot again

chroot /root/gentoo /bin/bash
disklabel -B /dev/ad0s1

Reboot

leave the chroot

exit

Reboot your system

init 6
Retrieved from "http://www.gentoo-wiki.info/HOWTO_Gentoo/FreeBSD"

Last modified: Tue, 02 Sep 2008 23:27:00 +0000 Hits: 12,441