qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Runnig solaris binary(32 bit) on linux(64 bit)
@ 2023-02-16  9:00 ginu samuel
  2023-02-16 14:36 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: ginu samuel @ 2023-02-16  9:00 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

Hi,
    I have a requirement to run a Solaris binary ( 32 bit ) on linux (64
bit).

Since some of the sources for the binary are not available, recompilation
on linux is not possible.

So we are trying to run on linux using QEMU

the uname output on solaris box is -
#uname -sip
SunOS sparc sun4v

the uname output on linux box is -
#uname -siop
Linux x86_64 x86_64 GNU/Linux

Following are the questions:
1. Is the user mode emulation (of QEMU) the right way to do this?

2. If yes, what would be actual command to do this. The Linux User space
emulator ( https://www.qemu.org/docs/master/user/main.html) gives the
command :

qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B
offset] [-R size] program [arguments...]

Is there a suitable command for 64 bit linux to run the program ?

3.  Is this the package to install for RHEL as given in documentation?


   -

   RHEL/CentOS: yum install qemu-kvm


4. Does the program require Super user privileges to run?

Regards,
Ginu

[-- Attachment #2: Type: text/html, Size: 6056 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16  9:00 Runnig solaris binary(32 bit) on linux(64 bit) ginu samuel
@ 2023-02-16 14:36 ` Peter Maydell
  2023-02-16 19:02   ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2023-02-16 14:36 UTC (permalink / raw)
  To: ginu samuel; +Cc: qemu-devel

On Thu, 16 Feb 2023 at 14:30, ginu samuel <samuel.ginu2010@gmail.com> wrote:
>
> Hi,
>     I have a requirement to run a Solaris binary ( 32 bit ) on linux (64 bit).
>
> Since some of the sources for the binary are not available, recompilation on linux is not possible.
>
> So we are trying to run on linux using QEMU

> Following are the questions:
> 1. Is the user mode emulation (of QEMU) the right way to do this?

No. QEMU's user-only mode only supports running Linux processes
on a Linux host; it can't run binaries for any other OS like Solaris.

To run a Solaris binary you would need to boot a guest Solaris
on an emulated QEMU system (effectively, like a slow VM), and
then run the binary you want to run inside that VM.

Running QEMU doesn't need root privileges.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16 14:36 ` Peter Maydell
@ 2023-02-16 19:02   ` David Woodhouse
  2023-02-16 19:29     ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2023-02-16 19:02 UTC (permalink / raw)
  To: Peter Maydell, ginu samuel; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

On Thu, 2023-02-16 at 14:36 +0000, Peter Maydell wrote:
> On Thu, 16 Feb 2023 at 14:30, ginu samuel <samuel.ginu2010@gmail.com>
> wrote:
> > 
> > Hi,
> >     I have a requirement to run a Solaris binary ( 32 bit ) on
> > linux (64 bit).
> > 
> > Since some of the sources for the binary are not available,
> > recompilation on linux is not possible.
> > 
> > So we are trying to run on linux using QEMU
> 
> > Following are the questions:
> > 1. Is the user mode emulation (of QEMU) the right way to do this?
> 
> No. QEMU's user-only mode only supports running Linux processes
> on a Linux host; it can't run binaries for any other OS like Solaris.
> 
> To run a Solaris binary you would need to boot a guest Solaris
> on an emulated QEMU system (effectively, like a slow VM), and
> then run the binary you want to run inside that VM.

Well... we used to be able to run Solaris and similar x86 binaries on
Linux, with the iBCS patches in the kernel, which became
https://linux-abi.sourceforge.net/

It wouldn't be beyond the wit of man to extend qemu-user to support the
similar personality variations for SCO/Solaris/etc. using that as a
guide. 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16 19:02   ` David Woodhouse
@ 2023-02-16 19:29     ` Richard Henderson
  2023-02-16 19:39       ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2023-02-16 19:29 UTC (permalink / raw)
  To: David Woodhouse, Peter Maydell, ginu samuel; +Cc: qemu-devel

On 2/16/23 09:02, David Woodhouse wrote:
> It wouldn't be beyond the wit of man to extend qemu-user to support the
> similar personality variations for SCO/Solaris/etc. using that as a
> guide.

Not beyond wit but perhaps beyond patience.

It would certainly be possible to emulate the "easy middle" of one POSIX guest on a 
different POSIX host.  But the dusty corners are going to get in the way, where we 
currently rely on guest and host having identical semantics, and pass the system call 
through to the host.

It's a big job.


r~


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16 19:29     ` Richard Henderson
@ 2023-02-16 19:39       ` David Woodhouse
  2023-02-17 15:31         ` Peter Maydell
  2023-02-17 16:04         ` Warner Losh
  0 siblings, 2 replies; 8+ messages in thread
From: David Woodhouse @ 2023-02-16 19:39 UTC (permalink / raw)
  To: Richard Henderson, Peter Maydell, ginu samuel; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On Thu, 2023-02-16 at 09:29 -1000, Richard Henderson wrote:
> On 2/16/23 09:02, David Woodhouse wrote:
> > It wouldn't be beyond the wit of man to extend qemu-user to support the
> > similar personality variations for SCO/Solaris/etc. using that as a
> > guide.
> 
> Not beyond wit but perhaps beyond patience.
> 
> It would certainly be possible to emulate the "easy middle" of one POSIX guest on a 
> different POSIX host.  But the dusty corners are going to get in the way, where we 
> currently rely on guest and host having identical semantics, and pass the system call 
> through to the host.
> 
> It's a big job.

True, but the existing iBCS / linux-abi kernel patches should highlight
a lot of those dusty corners.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16 19:39       ` David Woodhouse
@ 2023-02-17 15:31         ` Peter Maydell
  2023-02-17 16:04         ` Warner Losh
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2023-02-17 15:31 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Richard Henderson, ginu samuel, qemu-devel

On Thu, 16 Feb 2023 at 19:39, David Woodhouse <dwmw2@infradead.org> wrote:
>
> On Thu, 2023-02-16 at 09:29 -1000, Richard Henderson wrote:
> > On 2/16/23 09:02, David Woodhouse wrote:
> > > It wouldn't be beyond the wit of man to extend qemu-user to support the
> > > similar personality variations for SCO/Solaris/etc. using that as a
> > > guide.
> >
> > Not beyond wit but perhaps beyond patience.
> >
> > It would certainly be possible to emulate the "easy middle" of one POSIX guest on a
> > different POSIX host.  But the dusty corners are going to get in the way, where we
> > currently rely on guest and host having identical semantics, and pass the system call
> > through to the host.
> >
> > It's a big job.
>
> True, but the existing iBCS / linux-abi kernel patches should highlight
> a lot of those dusty corners.

linux-user is pretty low on maintenance effort as it is; I
just don't think there's any likelihood of anybody with the
time and interest in doing Solaris-on-Linux emulation showing
up to do the work, especially given that our user-mode infra pretty
heavily assumes same-host-same-guest-OS.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-16 19:39       ` David Woodhouse
  2023-02-17 15:31         ` Peter Maydell
@ 2023-02-17 16:04         ` Warner Losh
  2023-02-18  2:40           ` ginu samuel
  1 sibling, 1 reply; 8+ messages in thread
From: Warner Losh @ 2023-02-17 16:04 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Richard Henderson, Peter Maydell, ginu samuel, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3190 bytes --]

On Thu, Feb 16, 2023 at 12:40 PM David Woodhouse <dwmw2@infradead.org>
wrote:

> On Thu, 2023-02-16 at 09:29 -1000, Richard Henderson wrote:
> > On 2/16/23 09:02, David Woodhouse wrote:
> > > It wouldn't be beyond the wit of man to extend qemu-user to support the
> > > similar personality variations for SCO/Solaris/etc. using that as a
> > > guide.
> >
> > Not beyond wit but perhaps beyond patience.
> >
> > It would certainly be possible to emulate the "easy middle" of one POSIX
> guest on a
> > different POSIX host.  But the dusty corners are going to get in the
> way, where we
> > currently rely on guest and host having identical semantics, and pass
> the system call
> > through to the host.
> >
> > It's a big job.
>
> True, but the existing iBCS / linux-abi kernel patches should highlight
> a lot of those dusty corners.
>

So one thing to understand, the iBCS is a separate ABI. This means that
you'd
have to rewrite everything from the syscall dispatch on down. Even if this
were
relevant, it would be a huge job.

A lot would depend on how much of Solaris is used. Solaris is ELF, which is
good
(it would be even worse if it were SunOS 4, then it's a.out and a whole lot
of other
complication that's more of a bsd-user thing). However, as others have
pointed
out, linux-user assumes a linux kernel. While one can run linux-user on
FreeBSD
with its Linux ABI implementation, even that's quite limited in what it can
do (I
needed to do this for some kexec support I was adding to FreeBSD boot loader
that ran as a Linux binary). I had to make tweaks to FreeBSD's emulation
to make it work, and that was for a binary that used only 10 system calls,
no
threads, no signals, nothing "messy" and apart from some extensions to
64-bits,
nothing that wasn't in 7th Edition Unix.

And there's also a number of special filesystems, IIRC, on Solaris that are
used
like linux's /sys and /proc filesystems, but with different details. And a
million other
details. Knowing the details isn't enough, assuming you could know them from
cribbing from existing code. You have to actually go implement the details
and
that would be a very tedious job. Even if you kept it to a subset that your
program
uses...

I started on a Venix emulator (ancient Unix V7 port to 8088/8086 micros I
cut my
teeth on), and even that was daunting. Now, with 3 years of bsd-user
hacking and
upstreaming under my belt, it would be easier, but there's a *HUGE*
learning curve
to understand the CPU, its exception model, how system calls are handled,
how
memory is mapped, etc. And the 'assume we're on linux' is definitely
leveraged
for memory mapping in the existing linux-user code if you were to copy it
all
as a starting point.

When people say it's a big job, they are underselling it somewhat. It would
be
a big job for the maintainers of linux-user who have all the context and
know
where the gotchas are. For anybody else, learning everything you need to
know itself is a big job.

Your best bet is qemu-sparc-system + Solaris install.

Warner

P.S. Sorry to go into partial rant mode, but 4 years ago when I started
helping
the folks working with bsd-user, I thought how hard could it be... now I
know...

[-- Attachment #2: Type: text/html, Size: 4867 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Runnig solaris binary(32 bit) on linux(64 bit)
  2023-02-17 16:04         ` Warner Losh
@ 2023-02-18  2:40           ` ginu samuel
  0 siblings, 0 replies; 8+ messages in thread
From: ginu samuel @ 2023-02-18  2:40 UTC (permalink / raw)
  To: Warner Losh; +Cc: David Woodhouse, Richard Henderson, Peter Maydell, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3719 bytes --]

Thanks to everyone.

 Ok , so I need to run QEMU in Full System Emulation mode to run the
Solaris binary.
 Is the *qemu-kvm* , the only package required to be installed ( on RHEL
machine) to launch QEMU or there are some packages also.
 Also I would need the Solars OS image, right?

Regards,
Ginu



On Fri, 17 Feb 2023 at 21:34, Warner Losh <imp@bsdimp.com> wrote:

>
>
> On Thu, Feb 16, 2023 at 12:40 PM David Woodhouse <dwmw2@infradead.org>
> wrote:
>
>> On Thu, 2023-02-16 at 09:29 -1000, Richard Henderson wrote:
>> > On 2/16/23 09:02, David Woodhouse wrote:
>> > > It wouldn't be beyond the wit of man to extend qemu-user to support
>> the
>> > > similar personality variations for SCO/Solaris/etc. using that as a
>> > > guide.
>> >
>> > Not beyond wit but perhaps beyond patience.
>> >
>> > It would certainly be possible to emulate the "easy middle" of one
>> POSIX guest on a
>> > different POSIX host.  But the dusty corners are going to get in the
>> way, where we
>> > currently rely on guest and host having identical semantics, and pass
>> the system call
>> > through to the host.
>> >
>> > It's a big job.
>>
>> True, but the existing iBCS / linux-abi kernel patches should highlight
>> a lot of those dusty corners.
>>
>
> So one thing to understand, the iBCS is a separate ABI. This means that
> you'd
> have to rewrite everything from the syscall dispatch on down. Even if this
> were
> relevant, it would be a huge job.
>
> A lot would depend on how much of Solaris is used. Solaris is ELF, which
> is good
> (it would be even worse if it were SunOS 4, then it's a.out and a whole
> lot of other
> complication that's more of a bsd-user thing). However, as others have
> pointed
> out, linux-user assumes a linux kernel. While one can run linux-user on
> FreeBSD
> with its Linux ABI implementation, even that's quite limited in what it
> can do (I
> needed to do this for some kexec support I was adding to FreeBSD boot
> loader
> that ran as a Linux binary). I had to make tweaks to FreeBSD's emulation
> to make it work, and that was for a binary that used only 10 system calls,
> no
> threads, no signals, nothing "messy" and apart from some extensions to
> 64-bits,
> nothing that wasn't in 7th Edition Unix.
>
> And there's also a number of special filesystems, IIRC, on Solaris that
> are used
> like linux's /sys and /proc filesystems, but with different details. And a
> million other
> details. Knowing the details isn't enough, assuming you could know them
> from
> cribbing from existing code. You have to actually go implement the details
> and
> that would be a very tedious job. Even if you kept it to a subset that
> your program
> uses...
>
> I started on a Venix emulator (ancient Unix V7 port to 8088/8086 micros I
> cut my
> teeth on), and even that was daunting. Now, with 3 years of bsd-user
> hacking and
> upstreaming under my belt, it would be easier, but there's a *HUGE*
> learning curve
> to understand the CPU, its exception model, how system calls are handled,
> how
> memory is mapped, etc. And the 'assume we're on linux' is definitely
> leveraged
> for memory mapping in the existing linux-user code if you were to copy it
> all
> as a starting point.
>
> When people say it's a big job, they are underselling it somewhat. It
> would be
> a big job for the maintainers of linux-user who have all the context and
> know
> where the gotchas are. For anybody else, learning everything you need to
> know itself is a big job.
>
> Your best bet is qemu-sparc-system + Solaris install.
>
> Warner
>
> P.S. Sorry to go into partial rant mode, but 4 years ago when I started
> helping
> the folks working with bsd-user, I thought how hard could it be... now I
> know...
>

[-- Attachment #2: Type: text/html, Size: 6519 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-02-18  2:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16  9:00 Runnig solaris binary(32 bit) on linux(64 bit) ginu samuel
2023-02-16 14:36 ` Peter Maydell
2023-02-16 19:02   ` David Woodhouse
2023-02-16 19:29     ` Richard Henderson
2023-02-16 19:39       ` David Woodhouse
2023-02-17 15:31         ` Peter Maydell
2023-02-17 16:04         ` Warner Losh
2023-02-18  2:40           ` ginu samuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).