PS3:FreeBSD
Contents |
FreeBSD OtherOS++
Crossreference: ps3devwiki::FreeBSD OtherOS++
FreeBSD can be run on PS3 Slim models from HDD with OtherOS++.
All the freebsd related files should be available here: http://gitbrew.org/~glevand/ps3/freebsd/
- freebsd
- config
- PS3 // (backup/mirror: PS3 (4.22 KB))
- kernel-1920x1080
- kernel // (backup/mirror: kernel (8.25 MB))
- kernel.symbols // (backup/mirror: kernel.symbols (22.56 MB))
- linker.hints // (backup/mirror: linker.hints (5.38 KB))
- livecd
- ps3_freebsd_livecd.iso // (backup/mirror: ps3_freebsd_livecd.iso (341.51 MB))
- loader
- loader-1920x1080.ps3 // (backup/mirror: loader-1920x1080.ps3 (306.45 KB))
- ps3_world.tar.gz // (backup/mirror: ps3_world.tar.gz (113.92 MB))
- config
Cross-Compiling
You can skip this step and use my precompiled FreeBSD world and kernel: (World: [1]) / (Kernel: 480p[2] 720p[3] 1080p[4]) / (Loader: 480p[5] 720p[6] 1080p[7])
You need a running FreeBSD system to cross-compile your PS3 FreeBSD world and kernel, you don't need a PS3 for that, it may be a different architecture. Once this step is done and you have a running FreeBSD system on your PS3 , you can build FreeBSD world and kernel on PS3 itself.
# svn co svn://svn.freebsd.org/base/head /usr/devel
# 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
When it's finished then you will have a complete FreeBSD world with kernel in directory /root/PS3.
Edited note: "I removed my git repo because there is no need currently. All my patches are officially in HEAD FreeBSD repository. Just use the official SVN repository or GIT mirrors. Here e.g. http://gitorious.org/freebsd"
Rebuilding Loader
If you want to recompile ONLY FreeBSD loader then after you finished compiling FreeBSD world and kernel, do this:
# cd /usr/devel # env MAKEOBJDIRPREFIX=/usr/obj/PS3 make buildenv TARGET=powerpc TARGET_ARCH=powerpc64 # cd sys/boot # make all install DESTDIR=/root/PS3
Rebuilding Kernel
If you want to recompile ONLY FreeBSD kernel then after you finished compiling FreeBSD world and kernel, do this:
# cd /usr/devel
# env MAKEOBJDIRPREFIX=/usr/obj/PS3 make buildkernel installkernel \
TARGET=powerpc TARGET_ARCH=powerpc64 KERNCONF=PS3 DESTDIR=/root/PS3
Installation
To install a FreeBSD world on your PS3, you will need a running Linux system first currently. Once i build a LiveCD for PS3 FreeBSD you won't need that anymore. I used Debian to install my FreeBSD on PS3.
First create UFS2 filesystem for your FreeBSD. I assume that there is already a free partition on the HDD of your PS3.
# apt-get install ufsutils # mkfs.ufs /dev/ps3dd3
Then mount it on Debian and copy your PS3 FreeBSD world to this partition, like this:
# mount -t ufs -o ufstype=ufs2 /dev/ps3dd3 /mnt # cd /mnt # tar xvzf /root/ps3_freebsd_world.tar.gz # cp /root/ps3_freebsd_kernel/kernel /mnt/boot/kernel/ # cp /root/ps3_freebsd_kernel/kernel.symbols /mnt/boot/kernel/ # cd # umount /mnt
Booting
FreeBSD on PS3 is booted by the FreeBSD loader which can be executed by petitboot with kexec. The FreeBSD loader is built during cross-compiling of the FreeBSD world and kernel or you can use my precompiled version. It supports booting of FreeBSD from HDD. My precompiled version boots a FreeBSD kernel from ps3dd3. The HDD partition from which it boots a FreeBSD kernel is hardcoded, if you want to use another HDD partition then you have to change it in the loader and recompile it.
Store your FreeBSD loader on a Linux partition, i stored mine in Debian in /boot directory, and added a new kboot.conf entry on Linux, like this:
# cp /root/loader-1920x1080.ps3 /boot # cat /etc/kboot.conf ... ... ... freebsd_loader_hdd=/boot/loader-1920x1080.ps3 ... ... #
- Latest FreeBSD loaders support booting from CD/DVD, so make sure you don't have any CD inserted into PS3 if you want to boot from HDD. Because the FreeBSD loader will always try to boot from CD first.
/etc/fstab
- Make sure you set root device properly else FreeBSD kernel won't be able to mount it
- You can reuse Linux swap partition on FreeBSD.
/dev/ps3disk3p3 / ufs rw 1 1 /dev/ps3disk3p1 none swap sw 0 0 proc /proc procfs rw 0 0
/boot/loader.conf
- You can tell FreeBSD loader which kernel to load at boot time
autoboot_delay="-1" kernel="/boot/kernel" #kernel="/boot/kernel_test"
/etc/rc.conf
hostname="freebsd-hdd" ifconfig_glc0="SYNCDHCP" # for DHCP
Now you can boot your PS3 FreeBSD. Boot petitboot first and choose FreeBSD loader in CUI.
Once, you have a running PS3 FreeBSD system, you can build FreeBSD world and kernel or compile ports on your PS3 itself.
One of the advantages of FreeBSD on PS3 is write access to the GameOS HDD region and the possibility to create valid GameOS HDD partitions.
Ports
Ports allow us to install many useful programs on your FreeBSD.
Extracting ports:
# cd /root # fetch ftp://ftp7.freebsd.org/pub/FreeBSD/ports/ports-stable/ports.tar.gz # cd /usr # tar xvzf /root/ports.tar.gz
Useful programs you will need first:
- wget
- git
- screen
- sudo
- elinks
Live CD
Compiling World
- Change screen resolution in loader and kernel before compiling
- Change frame buffer size in kernel if needed
# cd /usr
# git clone git://git.gitbrew.org/ps3/ps3freebsd/freebsd.git src
# cd src
# make buildworld buildkernel installkernel installworld distribution TARGET=powerpc TARGET_ARCH=powerpc64 \
KERNCONF=PS3 DESTDIR=/root/ps3_world
Compiling Ports
# cd /root/ps3_world/usr # fetch ftp://ftp7.freebsd.org/pub/FreeBSD/ports/ports-stable/ports.tar.gz # tar xvzf ports.tar.gz
# mount -t devfs devfs /root/ps3_world/dev # cp /etc/resolv.conf /root/ps3_world/etc/ # chroot /root/ps3_world /bin/csh # cd /usr/ports # cd shells/bash # make install clean BATCH=yes
Configuring System
/boot/loader.conf
boot_cdrom="YES" autoboot_delay="-1"
/etc/rc.conf
root_rw_mount="NO" hostname="freebsd-livecd" ifconfig_glc0="SYNCDHCP" keyrate="fast" keymap="us.iso" #keymap="fr.iso" #keymap="german.iso" scrnmap="NO" font8x16="iso15-8x16" font8x14="iso15-8x14" font8x8="iso15-8x8" update_motd="NO" syslogd_enable="NO" newsyslog_enable="NO" cron_enable="NO" hostid_enable="NO" sendmail_enable="NONE" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" cleanvar_enable="NO" crashinfo_enable="NO" virecover_enable="NO"
/etc/fstab
/dev/cd0 / cd9660 ro 0 0
Changing Login Shell
# chroot ps3_world # chsh
Creating ISO Image
- Exit chroot
# umount /root/ps3_world/dev # cd ps3_world # rm -f etc/resolv.conf # mkisofs -R -l -ldots -allow-lowercase -allow-multidot \ -V 'PS3 FreeBSD LiveCD' -volset 'PS3 FreeBSD' -hide boot.catalog \ -o ../freebsd_livecd.iso .
Booting Live CD with OtherOS++
Use CUI or
boot FreeBSD loader from petitboot manually:
# First mount CD if it's not mounted already # kexec -l /mnt/cdrom/boot/loader.ps3 (or loader-720x480.ps3 or loader-1280x720.ps3) # reboot
Installing FreeBSD on HDD from Live CD
installing freebsd 9.0 beta 2 to the hard drive by c4pt
step 1 download and burn the freebsd 9.0 beta 2 iso for ppc64 you can get it from here
step 2 remove all your partitions on your internal drive and make the drive gpt
boot into petitboot
##umount /dev/ps3dd1 ##umount /dev/ps3dd2 ##umount /dev/ps3dd
## using parted will delete any linux partition on ps3dd
##parted /dev/ps3dd
##mklabel GPT
##mkpart ext2 1 158000M (158000M here is 158G on my drive if you have 320G you would enter 320000M)
##p
##q
##umount /dev/sr0 ##mount /dev/sr0 /mnt
##cd /mnt/boot
##ps3-video-mode -2 ##kexec -l loader.ps3
##reboot
when the freebsd dmesg boots you are going to get to a mountroot> prompt this is normal because freebsd is trying to load the cd from acd0 which doesnt exist so we have to tell the mountroot> prompt /dev/cd0 which is our sr0 or cdrom drive with the burned iso on disk
##mountroot>cd9660:/dev/cd0 ro (hit enter here)
this will continue to load the freebsd 9.0 beta 2 disc
once in the installer make sure you only format and partition ps3disk3 this is important you dont want to write to gameos or another partition this guide is assuming you are using ps3dd as your linux or freebsd drive and that you are *NOT* using vflash for ps3vflashh partition the disk and on my setup i am using a 154G root and and 4G swap (you can select auto on ps3disk3 and it should setup a swap and root for you) then select whatever you want to install , base , src , ports, doc this is important if you burned the iso you should have done a slow burn for some reason if any of these things fail the checksum test you need to run the installer again and not select anything that failed in order to continue with the installation for me ports.txz and src.txz failed so i could only select base.txz doc.txz and a couple of others then the install finished properly after installing the .txz's files setup your networking and root and user password eventually you will setup everything in the installer accordingly and you will be presented with a 3 choice options (installer) (livecd)
choose livecd
you should drop to a prompt and type
shutdown -h now
that takes care of the install but now how to boot the install?
reboot the ps3 after shutdown -h now is completely done it should say press a key to reboot when it is done
go into petitboot or telnet to petitboot whatever you want to do
then type
##umount /dev/ps3dd ##umount /dev/ps3dd1
##ps3-video-mode -m 2
##mount -t ufs -o ufstype=ufs2,rw /dev/ps3dd1 /mnt
##cd /mnt/boot ##kexec -l loader.ps3
##reboot
and you should now be in 480p booting the freebsd install from the hard drive
some side notes (the installer will only boot in 480i or 480p that is why we use ps3-video-mode also the loader.ps3 and kernel can be fixed to 1920x1080p
using glevand's loader.ps3 and glevand's kernel, you can still use glevand's freebsd work on the kernel and loader sources once in the freebsd install on
the hard drive it is recommended to setup networking and install ports to /usr/ports in order to boot the from the hard drive you have to run the last 5
commands from the guide or 6 commands if you havent't fixed loader.ps3) also note that /usr/sbin/sysinstall will not install freebsd to the hard drive
since the partition utility does not work with /usr/sbin/sysinstall
##ps3-video-mode -m 2 (sets the screen to 480p for the stock loader.ps3 file)
##umount /dev/ps3dd ##umount /dev/ps3dd1
##mount -t ufs -o ufstype=ufs2,rw /dev/ps3dd1 /mnt
##kexec -l /mnt/boot/loader.ps3
##reboot
Links
FreeBSD Handbook: [8]
FreeBSD AvgLiveCD: [9]
FreeBSD LiveCD: [10]
Gitorious - FreeBSD Wiki: [11]
Setting Up A new FreeBSD System: [12]
