On 2020-08-28 10:12, David Brownlee wrote: > On Fri, 28 Aug 2020 at 01:10, Dan Plassche <dplass...@gmail.com> wrote:
>> >> DESCRIPTION >> The COMPAT_NOMID kernel option provides compatibility with BSDi 1-3 > > Could s/provides/includes/ as NOMID handles other older binaries Thanks for catching that issue in the wording. I made the change below. >> BSD/OS 2.0+ binaries also require an ldconfig(8) configuration or a sym- >> bolic link pointing to the /emul/bsdos/shlib directory to run outside of >> a chroot. > > It might be nice to provide a little more clarity on this - possibly > something like: > > Standard BSD/OS 2.0+ binaries require static shared libraries. These > would typically be installed in /emul/bsdos/shlib under NetBSD, and > access can be provided by one of: > 1. A symlink from /shlib to /emul/bsdos/shlib > 2. ldconfig(8) [[configuration details here :)]] > 3. Setup /emul/bsdos suitable for chroot > I've updated the text to add the details of the steps involved for options 1 and 3. The ldconfig setup is a bit more geared towards special use cases and affects all a.out library lookups on NetBSD, so I'm not sure we should add the details to the manpage. For BSD/316 1.x there are no shared library lookups at runtime. On BSD/OS 2+ the static shared library images under /shlib are not recognized by ldconfig as entries for ld.so.hints (only the directory will get added as a search path if you try). However, you could rebuild the userland or any critical applications from source to use the traditional archive libraries under /emul/bsdos/lib and /emul/bsdos/usr/lib and change the default library path. In that case, you would add /emul/bsdos/lib and /emul/bsdos/usr/lib to /etc/ldconfig.so.conf and run ldconfig to update /var/run/ld.so.hints, but all a.out library lookups on NetBSD would be affected, which is not ideal. > Unrelated thought - if the handling of BSDI's binaries from > netbsd32_exec_aout.c::netbsd32_exec_aout_nomid was broken out into a > new bsdos_exec it could setup struct emul to default to the > /emul/bsdos in the same way as compat_linux and similar, plus give a > genuine COMPAT_BSDOS define :-p Yes, then the library path could use the shadow structure under /emul/aout or possibly entries underneath /emul/bsdos as an enhancement. Here's a new copy of the manual page with the changes under the DESCRIPTION: compat_bsdos(8) NetBSD System Manager's Manual compat_bsdos(8) NAME compat_bsdos -- binary compatibility for BSDi releases DESCRIPTION The COMPAT_NOMID kernel option includes compatibility with BSDi 1-3 a.out(5) binaries on NetBSD/i386 and NetBSD/amd64. The option is enabled by default in the GENERIC kernel on i386, but needs to be set along with EXEC_AOUT on amd64. Null memory protection must be disabled with the sysctl(7) option vm.user_va0_disable set to 0 for the binaries to run successfully. BSD/OS 2.0+ binaries also require access to static shared libraries under /shlib. On NetBSD the shared libraries are normally installed under /emul/bsdos/shlib and access can be provided by one of the following methods: - A symlink from /shlib to /emul/bsdos/shlib. - Running the binaries under a shell in a chroot with the com- mand chroot /emul/bsdos/shlib /bin/sh. BSD/OS 4.0 switched to an ELF binary executable format that does not run under the compatibility layers currently available on NetBSD. SEE ALSO options(4), a.out(5), elf(5), sysctl(7), compat_netbsd32(8) HISTORY BSD/OS (BSD/386) 1.0-1.1 was derived from 4.3BSD-Reno code in the Net/2 release. BSD/OS 2.0 was based on 4.4BSD-Lite, but introduced new static shared libraries compiled into binary objects under /shlib. The build system included the shlicc command with the -Bstatic flag that allowed reverting to the standard library archive format. OpenBSD 2.2-4.7 included a different compatability implementation under the COMPAT_BSDOS kernel option. BUGS BSD/OS compatibility was broken on NetBSD 5-6. BSD/OS added SPARC support with release 3.0, but the binaries are incor- rectly recognized and fail as sunos executables on NetBSD/sparc and NetBSD/sparc64. NetBSD 9.0 August 27, 2020 NetBSD 9.0 Source: .\" .\" .\" Copyright (c) 2008 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Dan Plassche. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd August 27, 2020 .Dt compat_bsdos 8 amd64,i386,sparc,sparc64 .Os .Sh NAME .Nm compat_bsdos .Nd binary compatibility for BSDi releases .Sh DESCRIPTION .Pp The .Cd COMPAT_NOMID kernel option includes compatibility with BSDi 1-3 .Xr a.out 5 binaries on .Tn Nx Ns /i386 and .Tn Nx Ns /amd64 . The option is enabled by default in the .Li GENERIC kernel on .Em i386 , but needs to be set along with .Cd EXEC_AOUT on .Em amd64 . .Pp Null memory protection must be disabled with the .Xr sysctl 7 option .Va vm.user_va0_disable set to .Li 0 for the binaries to run successfully. .Pp .Bsx 2.0+ binaries also require access to static shared libraries under .Pa /shlib . On .Nx the shared libraries are normally installed under .Pa /emul/bsdos/shlib and access can be provided by one of the following methods: .Pp .Bl -dash -offset -indent .It A symlink from .Pa /shlib to .Pa /emul/bsdos/shlib . .\" .It .\" Rebuilding the userland from source .\" and changing the default library .\" format and path from .\" .Pa /emul/bsdos/shlib .\" to .\" .Pa /emul/bsdos/lib . .\" by adding .\" .Pa /emul/bsdos/lib .\" to .\" .Pa /etc/ld.so.conf .\" and running .\" .Ic ldconfig .\" to regenerate .\" .Pa /var/run/ld.so.hints . .It Running the binaries under a shell in a .Ic chroot with the command .Ic chroot "/emul/bsdos/shlib /bin/sh" . .El .Pp .Bsx 4.0 switched to an ELF binary executable format that does not run under the compatibility layers currently available on .Nx . .Sh SEE ALSO .Xr options 4 , .Xr a.out 5 , .Xr elf 5 , .Xr sysctl 7 , .Xr compat_netbsd32 8 .Sh HISTORY .Pp .Tn Bsx "(BSD/386)" 1.0-1.1 was derived from .Bx 4.3 Reno code in the .Tn Net/2 release. .Pp .Bsx 2.0 was based on .Bx 4.4 Lite , but introduced new static shared libraries compiled into binary objects under .Pa /shlib . The build system included the .Li shlicc command with the .Fl Bstatic flag that allowed reverting to the standard library archive format. .Pp .Ox 2.2-4.7 included a different compatability implementation under the .Li COMPAT_BSDOS kernel option. .Sh BUGS .Pp .Bsx compatibility was broken on .Nx 5-6. .Pp .Bsx added .Tn SPARC support with release 3.0, but the binaries are incorrectly recognized and fail as .Li sunos executables on .Tn Nx Ns /sparc and .Tn Nx Ns /sparc64 .