HOWTO Make a kernel on playstation3
From Gentoo Linux Wiki
This howto decribes how to compile build and install a ps3-sources kernel on a playstation3. Two methods are shown below one uses kboot the other uses the kernel directly.
Contents |
[edit] Fetching a new kernel
The ps3 uses a kernel with kexec to act as a boot loader also known as kboot. This guide does not yet cover petitboot.
| Code: Fetching the correct overlay (requires layman installed and configured) |
emerge layman echo "source /usr/portage/local/layman/make.conf" >> /etc/make.conf layman -f layman -a cell |
| Code: Fetching the kernel source |
echo "sys-kernel/ps3-sources ~ppc64" >> /etc/portage/package.keywords emerge ps3-sources |
Selecting the kernel
| Code: Manually selecting the right kernel |
cd /usr/src ln -sf linux-2.6.24-ps3 linux |
| Code: Automatically selecting the right kernel |
kernel-config list (listing) kernel-config set <nr of kernel you want to work on> |
[edit] Configuring the new kernel
We then want to make shure we have the neccesary settings to get a running kernel on the ps3
| Code: Making default configuration for ps3 |
cd /usr/src/linux make ps3_defconfig |
Adding the Bootloader arguments directly into your kernel We then want to make shure we have the neccesary settings to get a running kernel on the ps3
| Code: Making default configuration for ps3 |
cd /usr/src/linux make menuconfig |
Pick one of the following arguments for the video option:
- 480i = ps3fb:mode:1
- 576i = ps3fb:mode:6
- 720p = ps3fb:mode:3
- 1080i = ps3fb:mode:4
- 1080p = ps3fb:mode:5
And add it to the default bootloader arguments:
| Linux Kernel Configuration: Adding the bootloader kernel arguments |
Kernel options ---> [*] Default bootloader kernel arguments (root=/dev/ps3da1 rw video=ps3fb:mode:3) Initial kernel command string |
| Code: Compiling your kernel |
cd /usr/src/linux make make modules_install |
[edit] Copying your new kernel
If we plan on testing the kernel or to use it using kboot we need to copy it to its right location
| Code: Making default configuration for ps3 |
cp /usr/src/linux/vmlinux /boot/linux-2.6.24-ps3 |
[edit] Fixing fstab
Edit your /etc/fstab to reflect the new devices
| File: /etc/fstab |
# /etc/fstab: static file system information. # # noatime turns off atimes for increased performance (atimes normally aren't # needed; notail increases performance of ReiserFS (at the expense of storage # efficiency). It's safe to drop the noatime options if you want and to # switch between notail / tail freely. # # The root filesystem should have a pass number of either 0 or 1. # All other filesystems should have a pass number of 0 or greater than 1. # # See the manpage fstab(5) for more information. # # <fs> <mountpoint> <type> <opts> <dump/pass> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. #/dev/BOOT /boot ext2 noauto,noatime 1 2 /dev/ps3da1 / ext3 noatime 0 1 /dev/ps3da2 none swap sw 0 0 /dev/sr0 /mnt/cdrom audo noauto,ro 0 0 /dev/sdc1 /mnt/memstick auto noauto 0 0 /dev/sdd1 /mnt/sd auto noauto 0 0 #/dev/fd0 /mnt/floppy auto noauto 0 0 # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory (shm_open, shm_unlink). # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will # use almost no memory if not populated with files) shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 none /spu spufs defaults 0 0 |
[edit] Fixing kboot.conf
This step is not needed if you are booting directly off the ps3flash however the author recomends that you test your kernel parameters before continuing to that step one way of doing that is to directly kick off your kernel from kboot without any extra flags.
| File: File Title |
# The following is an example kboot configuration file. Edit it # to suit your needs before attempting to reboot your system or # you may be unable to boot the new install. # default: the default kernel label to boot should the user not make # a selection. default=gentoo # timeout: number of seconds to wait for user input before the default # kernel label is booted. timeout=30 # The format from this point on is within a kernel label. At a minimum, # you must pass the kernel and root device. The syntax is as follows: # # label='device:<path_to_kernel> initrd=device:<path_to_initrd> kernel_options' # # You should also pass the video options as well. An example of video # options are as follows: # # 480i = ps3fb:mode:1 # 576i = ps3fb:mode:6 # 720p = ps3fb:mode:3 # 1080i = ps3fb:mode:4 # 1080p = ps3fb:mode:5 # # You can review all possible video modes using the ps3videomode application # provided by the ps3pfutils package. i.e. ps3videomode -v will display # possibilities. # The following is an example kernel label. Edit as needed. gentoo='ps3sda1:/boot/kernel initrd=ps3da1:/boot/initrd root=/dev/ram0 real_root=/dev/ps3da1 init=/linuxrc video=ps3fb:mode:8 rhgb' #example git kernel w/o any extra flags gentoo_new='ps3da1:/boot/linux-2.6.24-ps3 rw root=/dev/ps3da1 video=ps3fb:mode:3' |
| FIXME: Needs to also include how to fix the initrd stuff |
[edit] Installing the kernel directly into the ps3 flash device
| Code: Flashing your kernel into the flash drive |
ps3-flash-util -oz -d /dev/ps3flash -w /usr/src/linux/arch/powerpc/boot/otheros.bld reboot |
