Skip to contentSkip to conversation

SunOS/Solaris Binary Emulation

DISCUSSION Wes Hardin 3 participants 6 messages Dec 6, 2007

lore
Share & tools
lore

Wes Hardin

author
#0 lore raw

I'm interested in trying out the Linux kernel's SunOS and/or Solaris Binary Emulation but I can't find any documentation that is either recent or complete.

I have scads of Ultra60s lying around, so I loaded up Debian 4.0 on it. I choose Debian over Ubuntu in this case because Ubuntu doesn't seem to support SPARCs as desktops, only servers. I want to evaluate how this compares to our Solaris 8 desktops at some point.

manhack:/usr/gnemul/solaris/bin# cat /proc/cpuinfo
cpu             : TI UltraSparc II  (BlackBird)
fpu             : UltraSparc II integrated FPU
prom            : OBP 3.31.0 2001/07/25 20:31
type            : sun4u
ncpus probed    : 2
ncpus active    : 2
D$ parity tl1   : 0
I$ parity tl1   : 0
Cpu0Bogo        : 900.58
Cpu0ClkTck      : 000000001ad33148
Cpu2Bogo        : 900.14
Cpu2ClkTck      : 000000001ad33148
MMU Type        : Spitfire
State:
CPU0:           online
CPU2:           online

It's a pretty basic load. While not too familiar with Debian in general, during the install, I select the Default/Basic load + Desktop component, that is to say not a DNS or mail server or anything else fancy. 817 packages installed.

manhack:/usr/gnemul/solaris/bin# /bin/uname -a
Linux manhack 2.6.18-5-sparc64-smp #1 SMP Wed Oct 3 04:16:38 UTC 2007 sparc64 
GNU/Linux

I've copied some libraries and very basic binaries from a Solaris 8 system, which is also a U60, to /usr/gnemul/solaris/{original path} and loaded the solaris.ko kernel module.

manhack:~# lsmod|grep solaris
solaris                57880  0
manhack:~# modinfo solaris
filename: 
/lib/modules/2.6.18-5-sparc64-smp/kernel/arch/sparc64/solaris/solaris.ko
author:         Jakub Jelinek ([email protected]), Patrik Rak 
([email protected])
description:    Solaris binary emulation module
license:        GPL
vermagic:       2.6.18-5-sparc64-smp SMP mod_unload gcc-4.1
depends:

Now what?

Any attempt to run a Solaris binary results in the following:

manhack:/usr/gnemul/solaris/bin# file ./uname
./uname: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), dynamically 
linked (uses shared libs), stripped
manhack:/usr/gnemul/solaris/bin# ./uname
-bash: ./uname: No such file or directory

I don't know if the Linux ldd is supposed to work on these binaries, but it doesn't:

manhack:/usr/gnemul/solaris/bin# ldd ./uname
/usr/bin/ldd: line 117: ./uname: No such file or directory

Running "/lib/ld-linux.so.2 --list" against the Solaris binary segfaults. I would assume that is bad.

manhack:~# /lib/ld-linux.so.2 --list /usr/gnemul/solaris/bin/uname
Segmentation fault

From the Solaris machine (cds3), I ldd the binary I copied and verify all the
libraries are on the Linux host:

whardin@cds3 / $ cksum /bin/uname
2504107844 6772 /bin/uname
whardin@cds3 / $ ldd /bin/uname

         libc.so.1 =>     /lib/libc.so.1
         libdl.so.1 =>    /lib/libdl.so.1
         /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
manhack:~# cksum /usr/gnemul/solaris/bin/uname
2504107844 6772 /usr/gnemul/solaris/bin/uname
manhack:~# ls /usr/gnemul/solaris/lib 
/usr/gnemul/solaris/usr/platform/SUNW,Ultra-60/lib/
/usr/gnemul/solaris/lib:
ld.so        libc.so.1       libdl.so.1   libmp.so.2   libsecdb.so.1
libcmd.so.1  libcurses.so.1  libgen.so.1  libnsl.so.1

/usr/gnemul/solaris/usr/platform/SUNW,Ultra-60/lib/:
libc_psr.so.1

I'm stumped. I feel like I just missed a simple step somewhere, but haven't a clue what. Anyone have any pointers or troubleshooting advice? I've installed the libc6-dbg package but have no idea how to make use of it.

Signature · 1 line
/* wes hardin */
#1 lore raw
Quoted 7 lines · Wes Hardin
manhack:/usr/gnemul/solaris/bin# file ./uname
./uname: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), dynamically linked
(uses shared libs), stripped
manhack:/usr/gnemul/solaris/bin# ./uname
-bash: ./uname: No such file or directory
Quoted 5 lines

I don't know if the Linux ldd is supposed to work on these binaries, but it doesn't:

manhack:/usr/gnemul/solaris/bin# ldd ./uname
/usr/bin/ldd: line 117: ./uname: No such file or directory

I suppose you need the Solaris libraries too, including dynamic linker. See output of readelf -d uname.

author
#2 lore raw
In reply to Wes Hardin

assuming I'm reading the output of readelf correctly, the only shared library mentioned is libc.so.1

manhack:/usr/gnemul/solaris# readelf -d bin/uname

Dynamic section at offset 0x14b8 contains 22 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.1]

which is already copied over.

manhack:/usr/gnemul/solaris# ls lib/libc.so.1
lib/libc.so.1

Checksums match:

manhack:/usr/gnemul/solaris# cksum lib/libc.so.1
1414919188 1158072 lib/libc.so.1

whardin@cds3 / $ cksum /lib/libc.so.1
1414919188 1158072 /lib/libc.so.1

--
/* wes hardin */

Quoted 19 lines · Jan Engelhardt
Quoted 11 lines · Wes Hardin
manhack:/usr/gnemul/solaris/bin# file ./uname
./uname: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), dynamically linked
(uses shared libs), stripped
manhack:/usr/gnemul/solaris/bin# ./uname
-bash: ./uname: No such file or directory

I don't know if the Linux ldd is supposed to work on these binaries, but it doesn't:

manhack:/usr/gnemul/solaris/bin# ldd ./uname
/usr/bin/ldd: line 117: ./uname: No such file or directory

I suppose you need the Solaris libraries too, including dynamic linker. See output of readelf -d uname.
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Wes Hardin
Quoted 5 lines · Jan Engelhardt
Quoted 2 lines
manhack:/usr/gnemul/solaris/bin# ldd ./uname
/usr/bin/ldd: line 117: ./uname: No such file or directory

I suppose you need the Solaris libraries too, including dynamic linker. See output of readelf -d uname.

I tend to agree. All SunOS and Solaris binaries, libraries and devicefiles are by default expected to exist in /usr/gnemul/sunos and/or /usr/gnemul/solaris.

I've scribbled a few things on this topic some time ago, which should have become a sort of faq/howto at that time. You can find this on http://www.krul.cc/~pkrul/docs/solemu/

HTH

Pieter

author
#4 lore raw
In reply to Wes Hardin

Pieter,
yours was one of the pages I was looking at. I just overlooked the
suggestion to copy all the libraries and binaries as I have limited diskspace right now.

I was pointed to a tarball of an old RedHat package called solemul, apparently from the days when they supported SPARC.

This package includes a skeleton for /usr/gnemeul/solaris (including /dev) and a list of files needed from Solaris. Using this basic file list, Solaris's uname now executes it seems, but dies with "Illegal Instruction". This seems to be par for any Solaris binary I try.

So I bit the bullet, increased my LVM volume and copied the entire /usr/lib and /usr/bin from Solaris to my Linux machine. No change.

So far I've copied /usr/lib, /usr/bin, /sbin, /usr/sbin, /usr/platform from Solaris. Anything else?

I guess I should mention that I'm copying from Solaris 8, if I haven't already. Is Solaris 8 too new? I think I have a Solaris 7 and a few Solaris 2.6 machines left.

Quoted 15 lines · Pieter D.J. Krul
Quoted 4 lines · Jan Engelhardt
Quoted 2 lines
manhack:/usr/gnemul/solaris/bin# ldd ./uname
/usr/bin/ldd: line 117: ./uname: No such file or directory

I suppose you need the Solaris libraries too, including dynamic linker. See output of readelf -d uname.

I tend to agree. All SunOS and Solaris binaries, libraries and devicefiles are by default expected to exist in /usr/gnemul/sunos and/or /usr/gnemul/solaris.

I've scribbled a few things on this topic some time ago, which should have become a sort of faq/howto at that time. You can find this on http://www.krul.cc/~pkrul/docs/solemu/

HTH

Pieter

Signature · 1 line
/* wes hardin */
#5 lore raw
In reply to Wes Hardin
Quoted 11 lines · Wes Hardin

assuming I'm reading the output of readelf correctly, the only shared library mentioned is libc.so.1

manhack:/usr/gnemul/solaris# readelf -d bin/uname

Dynamic section at offset 0x14b8 contains 22 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.1]

which is already copied over.

Hm, perhaps ld.so (which should definitely exist on any ELF system) is not listed by readelf, but I guess it's needed anyway.