OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | #planetgemini chat on matrix.org | #gemini-pda chat on Freenode | #zaurus and #alarmz chat on Freenode | ELSI (coming soon) | Ibiblio


Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> Porting Programs In Port Tree Via Nfs@mac Os X, a mini walkthrough (plz comment!)
post Aug 13 2007, 06:14 PM
Post #1

Group: Members
Posts: 1,998
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882

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). cool.gif

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! wink.gif

Alright, here we go.


On the Mac (OS X 10.4) side

#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' patch
B. 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:

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!)

Good! Now NFS is ready to run on your Mac. Let's switch to your Zaurus.

On the Zaurus side

#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 group
usermod -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/sudoers
(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.conf
A. /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:

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.html
All 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

-- 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? rolleyes.gif

Comments and questions are most welcome! I will surely incorporate useful points into the walkthrough.
Go to the top of the page
+Quote Post
post Aug 13 2007, 08:03 PM
Post #2

Group: Members
Posts: 2,803
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686

edit /etc/hosts and add

x.x.x.x server1

where x.x.x.x is the ip address of the server with the nfs shares
Go to the top of the page
+Quote Post
post Aug 13 2007, 08:15 PM
Post #3

Group: Members
Posts: 1,998
Joined: 16-April 04
From: the Netherlands && /dev/null
Member No.: 2,882

Great. Thanks, Meanie. Will try that soon.
This piece seems missing in gen2's page. It would be better if this is included. smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 24th June 2018 - 07:11 AM