FreeBSD 8.0 Setup

From PlugWiki
Jump to: navigation, search

Contents

A step-by-step tutorial on installing FreeBSD/ARM onto USB Disk

One possible method of preparing an USB Stick for booting FreeBSD will be shown here.

The scenario is the following:

* an computer running FreeBSD
* FreeBSD 8.0 full source code is installed in /usr/src
* one USB Stick (minimum 512 MB capacity)
* 60 minutes for the build process to complete
* root user logged in

Building the Userland

build# cd /usr/src
build# make -j 8 buildworld TARGET_ARCH=arm

This command will build the userland part of FreeBSD. For details see: [1] and [2]

Building the Kernel

The release comes with a kernel configuration file is /usr/src/sys/arm/conf/SHEEVAPLUG . You should make copy and customize it for local boot, eg. adding msdosfs support, in this document, we'll refer to the copy as SHEEVAPLUG_COPY. One working kernel configuration is available at the wiki download section([3]).

This is the step when you should apply patches to the kernel. There are known problems with patches, see: [4]

build# cd /usr/src
build# make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG_COPY

Partition your USB Disk

Connect your USB Stick, and check its present, device name with:

build# tail /var/log/messages

In the following "da0" will be used as the device name.

First step is to erase all partitioning info on the disk. (THIS WILL ERASE ALL YOUR DATA!)

build# gpart destroy da0

Create the standard IBM partition table, add one small slice for the kernel and cover the rest with a second slice. Create one BSD label on the second slice, this will hold the whole root file system.

build# gpart create -s MBR da0
build# gpart add -s 32M -t freebsd da0
build# gpart add -t freebsd da0
build# bsdlabel -w /dev/da0s2

Now create the filesystems:

build# newfs_msdos /dev/da0s1
build# newfs -n da0s2a

Install kernel

build# mount -t msdosfs /dev/da0s1 /mnt
build# cp /usr/obj/arm/usr/src/sys/SHEEVAPLUG_COPY/kernel.bin /mnt
build# umount /mnt

Install userland

build# csh
build# cd /usr/src
build# mount /dev/da0s2a /mnt
build# setenv DESTDIR /mnt
build# make installworld TARGET_ARCH=arm
build# make distrib-dirs TARGET_ARCH=arm
build# make distribution TARGET_ARCH=arm

After the "world" is installed we still do not unmount the device as we will prepare some config files.

Create basic configuration

From the previous step we have the ARM root file system mounted on /mnt.

Setup /etc/rc.conf

build# echo 'hostname="sheeva"' > /mnt/etc/rc.conf
build# echo 'ifconfig_mge0="DHCP"'>> /mnt/etc/rc.conf
build# echo 'sshd_enable="YES"' >> /mnt/etc/rc.conf
build# echo 'ipv6_enable="YES"'>> /mnt/etc/rc.conf

Setup /etc/fstab

build# echo '# Device                Mountpoint      FStype  Options         Dump    Pass#' > /mnt/etc/fstab
build# echo '/dev/da0s2             /               ufs     rw,noclusterr,noclusterw              0       0' >> /mnt/etc/fstab

Finish

Now we have prepared everything, we are ready to unmount the target filesystem.

build# umount /mnt


Setup U-Boot to boot FreeBSD

First take note of your existing uboot bootcmd environment variable using and placing it somewhere safe

Marvell>>printenv bootcmd

and placing it somewhere safe, then change the boot command:

setenv bootcmd 'usb start;fatload usb 0:1 900000 kernel.bin;go 900000'
saveenv
Personal tools