COMPAT_HPUX(8)

NAME
compat_hpux - setup procedure for running HP-UX binaries

DESCRIPTION
NetBSD supports running HP-UX binaries. This applies only to m68k systems (such as hp300 systems). Most programs should work, such as Matlab 4.2c and the HP-UX X11R5 server. Programs that will not work are fairly uncommon, and often involve very low level hardware access.

The HP-UX compatibility feature is active for kernels compiled with the COMPAT_HPUX and COMPAT_M68K4K options enabled. HP-UX for m68k uses 4 KB page sizes, and NetBSD for all m68k platforms now use 8 KB page sizes.

A lot of programs are dynamically linked. This means that you will need the HP-UX shared libraries that the program depends on. Also, you will need to create a “shadow root” directory for HP-UX binaries on your NetBSD system. This directory is named /emul/hpux. Any file operations done by HP-UX programs run under NetBSD will look in this directory first. So, if a HP-UX program opens, for example, /etc/passwd, NetBSD will first try to open /emul/hpux/etc/passwd, and if that does not exist open the ‘real’ /etc/passwd file. It is recommended that you install HP-UX packages that include configuration files etc. under /emul/hpux, to avoid naming conflicts with possible NetBSD counterparts. Shared libraries should also be installed in the shadow tree.

Generally, you will need to look for the shared libraries that HP-UX binaries depend on only the first few times that you install a HP-UX program on your NetBSD system. After a while, you will have a sufficient set of HP-UX shared libraries on your system to be able to run newly imported HP-UX binaries without any extra work.

  Setting up shared libraries
How to get to know which shared libraries HP-UX binaries need, and where to get them? Basically, there are 2 possibilities (when following these instructions: you will need to be root on your NetBSD system to do the necessary installation steps).

1.  You must have login access to an HP-UX system. These instructions apply to HP-UX 9.10 (the latest version of HP-UX available for m68k-based systems), although the instructions should be similar for earlier versions of HP-UX. By far, the easiest method is to copy the essential files locally to your NetBSD system.

    Use tar, or a similar utility to collect the following files:
    All files in the /usr/lib directory ending in .sl. There should be about 46 files and two soft links.
    All files in the /lib directory ending in .sl. There should be 5 files.

    Now, you need to copy these files to your NetBSD system, and extract them into /emul/hpux, for example, you should end up with the following files:
    /emul/hpux/lib/dld.sl
    /emul/hpux/lib/libc.sl
    /emul/hpux/lib/libm.sl
    /emul/hpux/lib/libM.sl
    /emul/hpux/lib/libcurses.sl
    And a whole bunch of files in /emul/hpux/usr/lib.
    Overall, HP-UX 9.10 has about 10 MB of shared libraries that you will have ended up copying to your system.

2.  You have access to an HP-UX system with its entire root drive exported via NFS. In this case, you simply mount the entire HP-UX system under /emul/hpux. For example, on your NetBSD system, you might mount it as:
        mount_nfs hpux-host.test.net:/ /emul/hpux

  Setting up X11R5
If you want to run the HP-UX X11R5 server instead of the X server that comes with NetBSD, you will need to grab a few additional files:
/usr/bin/X11/X
/usr/lib/grmd
The shared libraries in /usr/lib/X11R5
/usr/lib/Motif1.2/libXm.sl
All the subdirectories and files in /usr/lib/X11/fonts
All the files in /usr/lib/X11/nls/Xhp
All the files in /usr/lib/X11/extensions
/usr/lib/X11/XHPKeymaps
/usr/lib/X11/XHPmodmap
/usr/lib/X11/XPCmodmap
/usr/lib/X11/XKeysymDB
/usr/lib/X11/Xconsoles
/usr/lib/X11/X0screens
/usr/lib/X11/X0devices
/usr/lib/X11/X0pointerkeys
/usr/lib/X11/rgb.txt
/usr/lib/X11/rgb.dir
/usr/lib/X11/rgb.pag

You'll also need to perform a few configuration steps:

1.  Get and extract the xbase.tgz set for your version of NetBSD to provide the X11R6 clients you'll be using with your new X server.

2.  Create the following directory for the X server to deposit its socket files in:
        mkdir -p /usr/spool/sockets/X11
        chmod 777 /usr/spool/sockets/X11

3.  Add the following lines to your /etc/rc.local to create the necessary directories for the X server to deposit its files in, when your system boots:
        mkdir /tmp/.X11-unix
        chmod 777 /tmp/.X11-unix
        ln -s /usr/spool/sockets/X11/0 /tmp/.X11-unix/X0

4.  To allow the X server to beep, you need to link some device names together:
        ln -s /dev/hil0 /dev/rhil

5.  You may also want to link your X server to a more convenient location, such as:
        ln -s /emul/hpux/usr/bin/X /usr/X11R6/bin/X

SEE ALSO
http://www.NetBSD.org/Ports/hp300/faq.html#x11 http://www.blobulent.com/hp300/X11

BUGS
See PR kern/6042 on why you must create directories for sockets outside of the /emul/hpux directory tree when running the HP-UX X server.

You may not be able to run the X server on multiple framebuffers, even though both the X server and NetBSD support them.