Building FreeBSD World

From PS3 Developer wiki
Jump to navigation Jump to search

Introduction

  • You can either cross-compile the FreeBSD world on your PC FreeBSD or compile it natively on PS3.
  • Unfortunately, you can not change monitor resolution on PS3 FreeBSD dynamically yet. That means, you have to patch the loader and kernel syscon driver for your monitor resolution.

Fetching Source Code

svn co svn://svn.freebsd.org/base/head /usr/devel

Kernel Patches

Building World

cd /usr/devel/sys/powerpc/conf
mkdir /root/kernels
cp GENERIC64 /root/kernels/PS3
ln -s /root/kernels/PS3
cd ../../..

env MAKEOBJDIRPREFIX=/usr/obj/PS3 make buildworld buildkernel installkernel installworld distribution \
	TARGET=powerpc TARGET_ARCH=powerpc64 KERNCONF=PS3 DESTDIR=/root/PS3

cd /root/PS3
tar cvJf ../freebsd_world.tar.xz .

Rebuilding Loader

cd /usr/devel
env MAKEOBJDIRPREFIX=/usr/obj/PS3 make TARGET=powerpc TARGET_ARCH=powerpc64 buildenv
cd sys/boot
make all install DESTDIR=/root/PS3

Rebuilding Kernel

cd /usr/devel
env MAKEOBJDIRPREFIX=/usr/obj/PS3 make buildkernel installkernel \
	TARGET=powerpc TARGET_ARCH=powerpc64 KERNCONF=PS3 DESTDIR=/root/PS3

Installing World on PS3 HDD

  • Use a PS3 FreeBSD LiveCD

Creating New Filesystem

newfs -U /dev/ps3disk3p3

Extracting World

  • Store your FreeBSD world on a USB drive.
mkdir /tmp/usb
mkdir /tmp/ufs

mount -t msdosfs /dev/da0s1 /tmp/usb
mount -t ufs /dev/da0s1 /tmp/ufs

cd /tmp/ufs
tar xvJf /tmp/usb/freebsd_world.tar.xz

/etc/fstab

/dev/ps3disk3p3         /       ufs     rw      1 1
/dev/ps3disk3p1         none    swap    sw      0 0
proc                    /proc   procfs  rw      0 0

/etc/rc.conf

hostname="freebsd"

ifconfig_glc0="SYNCDHCP"

sshd_enable="YES"

keyrate="fast"
keymap="us.iso"
#keymap="fr.iso"
#keymap="german.iso"
scrnmap="NO"
font8x16="iso15-8x16"
font8x14="iso15-8x14"
font8x8="iso15-8x8"

/etc/kboot.conf

  • My latest petitboot supports mounting UFS2 filesystems. In this case petitboot will add the FreeBSD boot entry automatically. With old petitboot image you have to mount UFS2 filesystem manually and kexec the file loader.ps3
freebsd=/boot/loader.ps3