Building OpenBSD "make world" with /usr/src read-only

The setup is the following:

The idea is to build a new userland for OpenBSD 3.6/sparc and clearly I haven't got enough space to do so directly on the SparcStation 5.

Note: using a union mount would do the trick but it seems to be broken on OpenBSD 3.6 (loads of file errors).

Preliminary steps

  1. Export /usr/src from the Ultra 5 read-only via NFS, this is trivally done by adding a suitable line in /etc/exports and then setting up NFS services
    (if you don't know how to do this then you really shouldn't be rebuilding userland).
  2. Export some suitable free space from the Ultra 5 read-write again via NFS.
  3. On the SparcStation 5 mount /usr/src and the free space onto /usr/obj.

The meaty bits

If you now go into /usr/src and type make obj it won't work. This is because make obj needs to write symlinks into pretty much each directory under /usr/src.

Don't panic!

The work-around is trivial: on the NFS server go into /usr/src and type make obj which will place the suitable symlinks into most, but not all, the required directories.
What is missing?
Simple, the Ultra 5 (in my case) is a sparc64, the SparcStation 5 is a sparc which means that the files which are architecture specific will not have their obj symlinks made.

To solve this simply visit /usr/src/sys/arch/sparc/stand and in each subdirectory make a symlink into the /usr/obj hierarchy.
Here is some example output:

merlino:/usr/src/sys/arch/sparc/stand# find . -name obj -ls 
66078    0 lrwxr-xr-x    1 root     wsrc           38 Apr 27 16:01 ./binstall/obj -> /usr/obj/sys/arch/sparc/stand/binstall 
88566    0 lrwxr-xr-x    1 root     wsrc           34 Apr 27 17:08 ./boot/obj -> /usr/obj/sys/arch/sparc/stand/boot 
90907    0 lrwxr-xr-x    1 root     wsrc           36 Apr 27 17:08 ./bootxx/obj -> /usr/obj/sys/arch/sparc/stand/bootxx 
90911    0 lrwxr-xr-x    1 root     wsrc           36 Apr 27 17:08 ./common/obj -> /usr/obj/sys/arch/sparc/stand/common 
69371    0 lrwxr-xr-x    1 root     wsrc           41 Mar 16 15:34 ./installboot/obj -> /usr/obj/sys/arch/sparc/stand/installboot 
90913    0 lrwxr-xr-x    1 root     wsrc           37 Apr 27 17:08 ./libkern/obj -> /usr/obj/sys/arch/sparc/stand/libkern 
90914    0 lrwxr-xr-x    1 root     wsrc           35 Apr 27 17:08 ./libsa/obj -> /usr/obj/sys/arch/sparc/stand/libsa 
91102    0 lrwxr-xr-x    1 root     wsrc           34 Apr 27 17:08 ./libz/obj -> /usr/obj/sys/arch/sparc/stand/libz
    
At which point you can go back to the SparcStation 5 and happily make obj followed by make build.

Note for the impatient: it will take a long time for the make build to terminate.

[An owl sitting on a line]

Last modified 03/05/2005
©Arrigo Triulzi

[Valid HTML 4.01!]