The following is how I build in the port tree via a NFS server created on my MacBook (10.4.10) and mounted on my Zaurus SL-C3200@OpenBSD 4.2 beta (GENERIC #158).
The process looks a bit involving indeed, but you will be fine if you take each small step carefully.
I am doing this in a slightly differently way from
http://www.planetofidiots.com/zaurus/#ports . I will raise some questions at the end.
But hang on. Why bother? Well, three considerations:
-- Building things on NFS shares is supposed to be faster than doing so on the microdrive on Z
-- Less heat is generated because the building jobs are done on a remote server (= my Macbook)
-- My personal reason: i cannot afford to let the precious internal SanDisk Extreme III 16GB CF wear out too soon because of extensive writing during make!
Alright, here we go.
************
[span style=\'font-size:14pt;line-height:100%\']On the Mac (OS X 10.4) side [/span]
#1. Create a new directory for shares to be exported. Let's say /share/zaurus
/usr. Then create a subdirectory
obj/ under it. (More on this. Read on.)
#2. Set up an NFS server by following the instructions at
http://www.behanna.org/osx/nfs/howto1.html up to Step 3.
This basically comes in two parts:
A. applying
Chris' patchB. configuring the NFS server and shares using Mac OS X's
NetInfo application (a really neat program though seldom mentioned to ordinary users).
For instance, I use only /share/zaurus
/usr/ports and /share/zaurus
/usr/obj as the share directories (or technically called "shares").
The ports/ directory is where the port tree lives (of course).
The obj/ directory is the "workspace" where things got built. (See 15 for how to get it working)
#3. Download the ports tarball from OpenBSD snapshots:
ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/zaurus/ #4. Extract ports.tar.gz to /share/zaurus/usr
tar xvf ports.tar.gz -C /share/zaurus/usr
#5. Make sure you have restarted NFS to enable the new settings to take effect:
sudo SystemStarter restart NFS
showmount -e
#6. Find out the
UID and
GID of your Mac user account:
id YOUR_USER_NAME
For example,
id XYZ
uid=502(XYZ) gid=502(XYZ) groups=502(XYZ), 80(admin)
(Why? The NFS client, i.e. your Zaurus, has to use an account matching the UID and GID in order to access the NFS shares.)
#7. Find out
your Mac IP address (e.g. use ifconfig).
(This is to tell your Zaurus where the server is ... of course!)
[span style=\'font-size:14pt;line-height:100%\']
Good![/span] Now NFS is ready to run on your Mac. Let's switch to your Zaurus.
[span style=\'font-size:14pt;line-height:100%\']On the Zaurus side [/span]
#8. Log in as
root.
#9. Add a
new group with the same GID as the Mac user
groupadd 502
#10. Add a
new user with the same GID and UID as the Mac user
useradd -g 502 -u 502 XYZ
#11. Add the new user to
the wheel groupusermod -G wheel XYZ
(Members in the wheel group have root privilege through using the sudo command).
#12. Grant this new user with the necessary root privilege by
editing /etc/sudoersvisudo
(visudo has automatic syntax-checking.
DON'T edit /etc/sudoers using something else! You are on your own if the file gets messed up.)
Uncomment this line (i.e. take away the initial pound "#" sign)
#%wheel ALL=(ALL) ALL
Save and exit. Now the new user on Z has enough permission to build stuff on the NFS server.
#13. Log out the root account and
log in as the newly created user.
#14. Mount the NFS shares on the server (Mac)
sudo mount_nfs -o soft,intr YOUR_MAC_IP_ADDRESS:/share/zaurus/usr/ports /usr/ports
sudo mount_nfs -o soft,intr YOUR_MAC_IP_ADDRESS:/share/zaurus/usr/obj /usr/obj
(Two options are being used here: "soft" helps performance, "intr" lets you stop in the middle by pressing Ctrl-C)
(You can make sure that NFS is properly mounted by using showmount -a in your Mac's terminal)
#15. Finetune in
/etc/mk.confA. /usr/obj as the designated workspace:
-- The main advantage of moving all stuff created during building to /usr/obj is that you can simply delete whatever you want directory in this directory, without invoking make clean and the like or messing up the /usr/ports (sub-)directories over time.
-- Do it this way:
Use an editor to open /etc/mk.conf (create one if it's not yet present in the system).
Write down this line:
WRKOBJDIR=/usr/obj
B. Optimization (improves overall performance of the builds):
-- It seems to me the ports system ignores the architecture optimization flags I pass in .profile or the shell configuration files (.cshrc/.kshrc/.bash_profile), although the flags work if I build things outside of the port tree. These options, I believe, are important especially to a handheld device like Zaurus with low hardware specs compared to full-blown PCs/laptops.
-- This is how this can be done:
Add these two lines in /etc/mk.conf
CFLAGS+=-mcpu=xscale -mtune=xscale
CXXFLAGS+=-mcpu=xscale -mtune=xscale
Save and exit (no need to reboot/restart). Now your system will start building Zaurus-optimized ports without further tweaking!
#16. Now you can start building your favorite ports by running something like
sudo make BUILD=yes REPORT_PROBLEM=true SUBDIRLIST=/usr/ports/mypackages.txt install package
(Assuming you have your desired ports to build specified in mypackages.txt, this command will install your ports AND package the ports for backup and sharing. Very handy, right?)
(You need to use sudo because make requires root permission to do many operations. You may also want to use visudo to extend the time limit by changing the value of timeout, for instance,
# Timeout options
Defaults timestamp_timeout=99999
See this nice how-to for batch porting:
http://www.planetofidiots.com/zaurus/#ports#17. Handy references
Where to find a specific port in the port tree? Either use find /usr/ports -name NAME_OF_PORT or use
http://ports.openbsd.nu/ More on ports and packages:
http://www.openbsd.org/ports.html,
http://www.openbsd.org/faq/faq15.htmlAll the technical ins and outs:
http://www.openbsd.org/cgi-bin/man.cgi?que...386&format=html************
A question:
According to
http://www.planetofidiots.com/zaurus/#ports, the /etc/fstab on Z has these lines for NFS server:
server1:/share/zaurus/bu /mnt/bu nfs rw,noauto,soft 0 0
server1:/share/zaurus/usr/obj /usr/obj nfs rw,noauto,soft 0 0
server1:/share/zaurus/usr/ports /usr/ports nfs rw,noauto,soft 0 0
server1:/share/zaurus/usr/src /usr/src nfs rw,noauto,soft 0 0
server1:/share/zaurus/usr/XF4 /usr/XF4 nfs rw,noauto,soft 0 0
But:
-- I don't quite understand how this works as the NFS is specified not to mount automatically. Still if I mount manually "server1" is not recognized either. I need to specify the full IP address of my NFS server (= my MacBook) instead of "server1". In fact I can mount the NFS shares without specifying them in /etc/fstab on Z. Any hint?
Comments and questions are most welcome! I will surely incorporate useful points into the walkthrough.