Ok, here i will start porting NetBSD to PS3 OtherOS++.
It would be cool to have another BSD on PS3.
Special thanks to Makoto Fujiwara and Tsubai Masanari for porting NetBSD to PS3.
Any help is welcome. Come on BSD fans, let us run NetBSD on PS3.
It is still work in progress and i'm not able to run NetBSD on PS3 yet.
Obtaining Source Code
# cd /usr
# export CVS_RSH="ssh"
# export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
# cvs checkout -A -P src
# ftp ftp://nandra.segv.jp/pub/NetBSD/ps3/ps3-111111.tar.gz
Building the Toolchain
I must say the toolchain is really super done.
Linux really sucks in comparison with NetBSD or FreeBSD regarding toolchain and cross-compiling.
# cd /usr/src
# mv sys/arch/powerpc ~
# tar xvzf ps3-111111.tar.gz
# patch -p0 < build.sh.patch
# patch -p0 < elf_machdep.h.patch
# mkdir /usr/obj
# cd tools
# sh ./mkheaderlist.sh
# cd ..
# ./build.sh -m ps3 -a powerpc64 tools
===> Tools built to /usr/src/obj/tooldir.NetBSD-5.1-amd64
===> build.sh ended: Sat Jan 7 15:34:30 CET 2012
===> Summary of results:
build.sh command: ./build.sh -m ps3 -a powerpc64 tools
build.sh started: Sat Jan 7 15:23:22 CET 2012
NetBSD version: 5.99.59
Build platform: NetBSD 5.1 amd64
No $TOOLDIR/bin/nbmake, needs building.
TOOLDIR path: /usr/src/obj/tooldir.NetBSD-5.1-amd64
DESTDIR path: /usr/src/obj/destdir.ps3
RELEASEDIR path: /usr/src/obj/releasedir
Updated makewrapper: /usr/src/obj/tooldir.NetBSD-5.1-amd64/bin/nbmake-ps3
Tools built to /usr/src/obj/tooldir.NetBSD-5.1-amd64
build.sh ended: Sat Jan 7 15:34:30 CET 2012
Modify Tsubai Masanari's source code to use current powerpc infrastructure of NetBSD else no chance that NetBSD will accept our port.
Tsubai Masanari's source code uses powerpc64 arch which is NOT present in NetBSD source. Everything is in powerpc arch.
Currently, NetBSD supports 64bit PowerPC arch only in 64bit bridge mode, that means 32bit kernel and user-space.
64bit bridge mode won't work on CELL cpu. It is not supported.
Stay tuned for more PS3 Hacks and PS3 CFW news, follow us on Twitter and be sure to drop by the PS3 Hacks and PS3 Custom Firmware Forums for the latest PlayStation 3 scene updates and homebrew releases!
Following up on his previous work, today PlayStation 3 developer glevand has made available a Linux Cold Boot 3.55 Custom Firmware (CFW) OtherOS++ for PS3 Slim users via Gitbrew that loads into Petitboot with a single button press.
To quote: Hmm, it would be really nice to cold boot Linux on SLIM. The problem is this. On SLIM we patch GameOS loader and add the OtherOS++ support.
The OtherOS++ loader reads Petitboot from VFLASH and loads it in case the OtherOS flag is set. But at cold boot we cannot access VFLASH immediately, that doesn't work, i tried even to implement retries with sleep calls, no chance.
And today i took a look at GuestOS loader in LPAR1 process 9 (LV1 3.15) and noticed the following interesting thing. It doesn't matter on old OtherOS if we want to cold boot OtherOS or GameOS, GameOS is loaded always at cold boot first.
Maybe it works the following way. GameOS is always loaded first and then it checks OtherOS flag, if it is set then it reboots again and OtherOS is loaded. And because it is a warm boot now, OtherOS can read VFLASH successfully on NOR FATs.
Update: The theory is not quite right. It is true that initial GuestOS loader loads GameOS at cold boot first. It creates LPAR2, loads LV2 image into memory of LPAR2 but LPAR2 ist not executed immediately.
After loading GameOS, the initial Guest OS loader waits until FLASH is ready and then checks the boot GuestOS id, and if it's NOT equal to the id of GameOS then LPAR2 is detructed. When process 9 receives the LPAR2 shutdown signal, then it loads the boot GuestOS and executes it.
Hmm, maybe found a solution which could allow us to cold boot linux. There is a device in LPAR1, /dev/sd_detector. It allows processes in LPAR1 to get storage events like VFLASH is ready and others. We could use it in OtherOS++ loader and wait for this event.
On Linux, storage events are processed by storage notifier thread, see here: lxr.free-electrons.com/source/arch/powerpc/platforms/ ps3/device-init.c#L701
Found a possible solution but i need someone with a HW flasher so we could test it first without bricks. Get in touch with me if you want to help getting cold boot working.
YAY Got cold boot working on PS3 Slim My theory was right, i patched the initial GOS loader in process 9 of LPAR1 and it works now. I can cold boot my petitboot with just pressing power button once.
Yay, i'm even able to cold boot my Linux with the PS button on my PS3 controller. I added the new option --patch-lv1-otheros-plus-plus-cold-boot-fix to patch_lv1.tcl
I tested it with OFW but you could try it with CFW too i guess. I used OFW 3.55 and it worked on Linux.