forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ps2 linux with nfs root

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
citronalco



Joined: 19 Apr 2008
Posts: 29

PostPosted: Sat Apr 17, 2010 8:35 am    Post subject: ps2 linux with nfs root Reply with quote

As the previous thread subject ("ps2 linux on usb memory") does not really fit I started a new topic.

I own a slim PS2. Due to the missing hard drive and the slow usb 1.1 I try to use NFS for the root filesystem.

With Mega Man's excellent Kernelloader I'm able to start a linux kernel that mounts a NFS root filesystem. Setting PS2's ip address and the nfs mount are done with standard kernel parameters, there's no need for a initrd.

The slim PS2 has some issues with udp, so I had to patch Mega Man's kernel to allow root nfs mounts using tcp.
(I didn't create the patch, it was a kernel commit for 2.4.20, see http://osdir.com/ml/kernel.commits.2-4/2002-10/msg00097.html)

You can download the kernel binary, the patch, the .config and the kernel parameters I am using from here: ftp://patriciawindt.dyndns.org/ps2/

I know it would be better to use NBD instead of NFS. NFS is a Unix/Linux thing whereas there are NBD servers implementations written i.e. in Java.
Does anyone know of a kernel patch for 2.4. kernels allowing NBD root?

EDIT: I downloaded deba5er's ps2linux_loop.7z from http://www.ps2.nuclearfall.com, unpacked it, copied the image's content to my NFS share, edited fstab and mtab to reflect my nfs root device and it booted straight into X11. Didn't set up swap yet, so there is nearly no free ram left. NFS speed is around 17 MBit/s, so it's definitely faster than usb 1.1.

EDIT: For swap in deba5er's linux a swap image file can be used. Save the following script as /etc/init.d/loopswap.sh and make it executable:

Code:

#! /bin/sh
if [ ! -e /swap.img ]; then
    echo -n "Creating swapfile (this can take some time)... "
    dd if=/dev/zero of=/swap.img bs=1M count=128 && mkswap /swap.img && echo "done"
fi
echo "Mounting swapfile"
losetup /dev/loop0 /swap.img && swapon /dev/loop0


Then make some links:
Code:

cd /etc/rc0.d
ln -s ../init.d/loopwap.sh S50loopswap.sh
cp S50loopswap.sh ../rc1.d
cp S50loopswap.sh ../rc2.d
cp S50loopswap.sh ../rc3.d
cp S50loopswap.sh ../rc4.d
cp S50loopswap.sh ../rc5.d
cp S50loopswap.sh ../rcS.d


Now at the next boot a 128 MByte swapfile will be created and reused on every following boot, you don't have to wait one time for swap file creation.
Back to top
View user's profile Send private message
citronalco



Joined: 19 Apr 2008
Posts: 29

PostPosted: Thu Apr 29, 2010 8:43 am    Post subject: Reply with quote

During the last days I configured the Blackrhino base install to boot from NFS without any (major) flaws. The archive is available here: ftp://patriciawindt.dyndns.org/ps2/blackrhino-base-nfs.tar.bz2

Some brief (and probably incomplete) instructions:
Prerequisites:
You're able to run Mega Man's kernelloader on your PS2 and you have a Linux/Unix machine able to do NFS exports.


1. Download blackrhino-base-nfs.tar.bz2 from the link above, extract it and create a NFS export. You have to use the options rw and no_root_squash.

Example: If you're in a 192.168.3.* network and you've extracted blackrhino-base-nfs.tar.bz2 to /path/ps2root then the line in /etc/exports should look like this:
Code:

/path/ps2root   192.168.3.0/255.255.255.0(rw,no_root_squash,async,no_subtree_check)

Then run "exportfs -a" to activate the new NFS export.

2. Download the kernel (ftp://patriciawindt.dyndns.org/ps2/vmlinux.gz) and put it somewhere where kernelloader can reach it (usb thumb drive, memory card, whatever).

3. Start kernelloader, select the downloaded vmlinux.gz as VMLINUX. Then edit the kernel parameters. Type in the following (read on first):
Code:
ip=192.168.3.109:192.168.3.1:192.168.3.1:255.255.0::eth0 root=/dev/nfs rw nfsroot=192.168.3.1:/path/ps2root,nfsvers=3,tcp

Replace 192.168.3.109 with the desired ip address of your PS2 and replace every 192.168.3.1 with the ip address of your NFS server.. And replace /path/ps2root with the path to the extracted blackrhino-base-nfs.tar.bz2.

4. Boot current config.
The first time you're booting the system it takes a few moments to create a 128 MByte swap file, don't panic.

5. Log in as root. There's no root password.

I've added a ssh server to the Blackrhino base install, so you don't have to kneel in front of your TV all the time and installed vim instead of nvi because nvi didn't work at all.
Have fun. Feel free to ask questions. If you find any problems with this setup please tell me. If you want to say thank you please create a patch for gcc that allows linux 2.6 compilation for the r5900 :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group