How I got linux emulation to work for AMD64 on RC1

Francois Tigeot ftigeot at wolfpond.org
Wed Oct 27 11:16:51 PDT 2004


On Wed, Oct 27, 2004 at 10:24:56AM -0600, Greg Lewis wrote:
> On Wed, Oct 27, 2004 at 12:17:34AM +0200, Lars Tunkrans wrote:
> > This is a step by step guide to get linux emulation to run
> > on AMD64 5.3-RC1 using the standard emulators/linux_base port.
> 
> Well, it will get you Linux/ia32 emulation, not Linux/amd64 emulation.
> 
> [...]
> 
> > 5.) Patch  /usr/ports/emulators/linux_base/Makefile with
> >     Francois Tigeot's patch.
> > 
> >     Put the patch below  in /usr/ports/emulators/linux_base/patchfile
> >     run:
> > 
> >     # patch -p0 < patchfile
> > 
> > ---------------<snip>------------------
> > --- Makefile.orig    Wed Oct  6 15:13:33 2004
> > +++ Makefile    Wed Oct  6 16:05:51 2004
> > @@ -110,6 +110,9 @@
> >  RPM=            LC_ALL=C rpm
> >  RPMFLAGS=        --root ${LINUXBASE} --dbpath ${DBPATH} --nodeps \
> >              --replacepkgs --ignoreos --ignorearch
> > +.if (${ARCH} == "amd64")
> > +RPMFLAGS+=    --noscripts
> > +.endif
> 
> This explains why you need to run ldconfig later on.  Essentially, judging
> from this and the brandelf lines in the ldconfig step the kernel doesn't
> automatically recognise the executables as Linux executables.  Is that the
> only reason for turning scripts off or are there bigger problems with the
> pre/post install scripts?
> 
> This is a hack at best and potentially results in the port not quite being
> configured correctly, depending on what the scripts actually do (most do
> little, from memory, although quite a few run ldconfig, so this may be ok).
> A more complete fix would either have the executables recognised as Linux
> executables automatically (and remove the --noscripts flag) or execute
> all the scripts in the post-install phase of the port after the brandelf
> operations.

Yes, this is a hack.

Some scripts from the glibc-2.2.4-33 rpm fail to install when run on an
amd64 machine. I have no idea why.
The scripts fail even if kern.elf32.fallback_brand is set prior to their
execution.

The above mentionned patch was just created in 5 minutes and is far from
optimal.

-- 
Francois Tigeot


More information about the freebsd-ports mailing list