ps2 nohdd "howto"
patryk@pakl.net
Patryk Laurent
Last Updated:  20020726 19:40EDT
Version 1.00

How to boot your PS2 from just DVD1 and a Memory Card
-----------------------------------------------------

These instructions were based largely on the Loopback Root HOWTO.  
Consult that document for more details.  Information on how to 
configure the RTE/bootloader was gleaned from the xRhino project's XML 
file on the ps2rte.  Lastly, tricks like MAKEDEV std are due to the 
brilliant folks on irc.openprojects.net#ps2linux.  


0. Notes
1. Create the image
2. Create the Filesystem and Compress
3. Configure the RTE Booter to boot the image
4. And...

Changes
-------
20020726 19:40EDT -- Added note about simple inittab, and the need to
			MAKEDEV console (Thanks to 
			eratosthenes@users.playstation2-linux.com)
20020725 17:48EDT -- Corrected occurence of init2.img back to initrd.img


0. Notes
--------
To boot and do anything useful, you need glibc (or alternatively, 
uClibc, but I never got busybox to compile successfully.)  Now, notice:

-rwxr-xr-x    1 root     root      7860856 Oct 30  2001 /lib/libc-2.2.2.so

Yes, my friends, 8 megs for libc.  If you ever get busybox compiled (or 
cross-compiled) under ps2linux, please e-mail patryk@pakl.net (me). =)  
 How on earth do you fit 8 megs + extra stuff onto a memory card?  
Luckily, you can compress the initrd image and the loader will 
decompress it for you automatically.


1. Create the Image
-------------------

(Note: I used 16384, but you can certainly use just as much as you 
need.  Remember that 16384 = 16MB of your 32MB of ram!)

mkdir /root/initrd
dd if=/dev/zero of=initrd.img bs=1k count=16384
mke2fs -i 16384 -b 1024 -m 5 -F -v initrd.img 
mount initrd.img /root/initrd -t ext2 -o loop
cd initrd

2. Create the Filesystem and Compress
-------------------------------------

Copy MAKEDEV into dev on your filesystem (/root/initrd/dev/)
Run:  ./MAKEDEV std to create the standard device files.
Run:  ./MAKEDEV console after this to create the console devices.
Create a linuxrc file in your filesystem's root with something like:

#!/bin/sh
/bin/sh

Now, you need to remember to create a trimmed down initttab file to put in
your /etc/ directory:

id:1:initdefault:
si::sysinit:/bin/sh

Here's a listing of the files I included:

./bin:
total 859
-rwxr-xr-x    1 root     root       113304 Jul 18 21:21 ash
-rwxr-xr-x    1 root     root        78088 Jul 18 23:16 ls
-rwsr-xr-x    1 root     root        79624 Jul 18 21:21 mount
lrwxrwxrwx    1 root     root            3 Jul 18 21:23 sh -> ash
-rwxr-xr-x    1 root     root       599432 Jul 22 20:41 vi
./dev:
total 28
-rwxr-xr-x    1 root     root        26689 Jul 18 23:16 MAKEDEV
		.....
[./MAKEDEV std creates the necessary device files]
		.....

./etc:
total 16
-rw-r--r--    1 root     root          643 Jul 18 23:37 inittab
-rw-r--r--    1 root     root        13870 Jul 18 21:21 ld.so.cache

./lib:
total 9645
-rwxr-xr-x    1 root     root       607432 Jul 18 21:22 ld-2.2.2.so
lrwxrwxrwx    1 root     root           16 Jul 22 20:42 ld.so.1 -> 
/lib/ld-2.2.2.so
-rwxr-xr-x    1 root     root      7860856 Jul 18 21:22 libc-2.2.2.so
lrwxrwxrwx    1 root     root           13 Jul 18 23:25 libc.so.6 -> libc-2.2.2.so
-rwxr-xr-x    1 root     root       983551 Jul 22 20:40 libpthread-0.9.so
lrwxrwxrwx    1 root     root           22 Jul 22 20:42 libpthread.so.0 -> /lib/libpthread-0.9.so
-rwxr-xr-x    1 root     root       360644 Jul 22 20:43 librt.so.1
lrwxrwxrwx    1 root     root           24 Jul 22 20:42 libtermcap.so.2 -> /lib/libtermcap.so.2.0.8
-rwxr-xr-x    1 root     root        16156 Jul 22 20:41 libtermcap.so.2.0.8

./sbin:
total 45
-rwxr-xr-x    1 root     root        44292 Jul 18 23:23 init



When done (and after you have added your game binary or whatever you 
require), compress the filesystem:

gzip -c -9 initrd.img > initrdgz.img

3. Configure the RTE Booter to boot the image
---------------------------------------------

Finally,

mount /mnt/mc00
cp initrdgz.img /mnt/mc00
cd /mnt/mc00
Edit p2lboot.cnf to add this line:
"InitRD"        vmlinux initrdgz.img    203 /dev/ram "ramdisk_size=16384" Bootstrapping InitRD

It's important here that ramdisk_size match the size of your disk, 
otherwise you will get lots of I/O errors when the kernel writes beyond 
the end of the ramdisk with your image.


4. And.....
------------

Voila!  After the system boots, hit enter once if you don't see your 
prompt.  Enjoy!

Needs:   use a smaller kernel, and use a small libc!