Bug 41543 - [patch] [request] easier wine/w23 support
Summary: [patch] [request] easier wine/w23 support
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-11 12:50 UTC by Jukka A. Ukkonen
Modified: 2016-03-24 06:38 UTC (History)
3 users (show)

See Also:


Attachments
file.shar (7.41 KB, text/plain)
2002-08-11 12:50 UTC, Jukka A. Ukkonen
no flags Details
ImgActWine.sh (7.49 KB, application/x-sh)
2002-08-17 20:06 UTC, spam-me-senseless
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jukka A. Ukkonen 2002-08-11 12:50:02 UTC
	It seemed like a good idea to allow FreeBSD to recognize
	ms-windows binaries on the fly and start wine as an interpreter
	for such binaries, if it is installed on the system.
	All it takes is adding one more very simple imgact function
	exec_wine_imgact() to the kernel.
	This is very much in analogy to how the kernel handles
	"#!" at the beginning of scripts.
	The actual benefit is lowering very much the threshold for
	windows users to start using FreeBSD instead.

Fix: The following shar bundle contains my initial version of
	exec_wine_imgact() and an include file describing the header
	parts of a windows binary. To make it obvious that this is
	just an extension I put the header to <compat/windos.h>.
	You are welcome to choose otherwise.

	Due to my systems have always had a tendency to quickly
	become somewhat modified I have no idea how well this will
	fit in any vanilla FreeBSD system, but the need for changes
	should be relatively minor. And in any case, it is the idea
	that counts.
How-To-Repeat: 
	No bug or problem, just an extension.
Comment 1 spam-me-senseless 2002-08-17 20:06:13 UTC
	Attached is a better version of the same theme. My original
	version used a compiled in constant name for the emulator.
	This of course is not appropriate, because some systems might
	prefer to use other windows support software than wine.
	The new version makes the name of the used emulator program
	a sysctl adjustable kernel MIB variable (kern.w32emu).
	The new version also fixes some other minor inconveniences
	which were present in the initial version.

	This extension requires the HW architecture being defined as
	a preprocessor macro (i386, etc) while compiling the kernel.
	It tries to check whether the binary could be run on this HW
	platform.

-- 
	Cheers,
		// jau
.---  ..-  -.-  -.-  .-    .-  .-.-.-    ..-  -.-  -.-  ---  -.  .  -.
  /    Jukka A. Ukkonen,                            Mawit Ltd, Finland
 /__   M.Sc. (sw-eng & cs)
   /   Internet: jau(a)iki.fi
  /                                           (Phone) +358-500-606-671
 v

+ + + + My opinions are mine and mine alone, not my employers. + + + +
Comment 2 Johan Karlsson freebsd_committer freebsd_triage 2002-08-23 17:16:53 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-emulation

Over to emulation to decide its fate.
Comment 3 Johan Karlsson freebsd_committer freebsd_triage 2002-08-25 03:11:08 UTC
Responsible Changed
From-To: freebsd-emulation->emulation

Use short names for mailing list to make searches    
using the web query form work with the shown responsible. 

This also makes open PRs show up in the summery mail.
Comment 4 David Naylor freebsd_committer freebsd_triage 2016-03-20 18:00:32 UTC
Given that no-one has looked at this bug in over 14 years I would like to close this bug as "overcome by events".  Any objections?
Comment 5 Jan Beich freebsd_committer freebsd_triage 2016-03-20 19:05:06 UTC
Would binmissctl(8) help? It's already used by poudriere + qemu-user-static to run build tools as a kind of slow cross-compilation.

  $ chmod +x foo.exe

  $ ./foo.exe
  zsh: exec format error: ./foo.exe

  $ hd -n20 foo.exe
  00000000  4d 5a 90 00 03 00 00 00  04 00 00 00 ff ff 00 00  |MZ..............|
  00000010  b8 00 00 00                                       |....|
  00000014

  $ binmiscctl add wine32 --interpreter /usr/local/bin32/wine \
     --magic "\x4d\x5a\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00\xff\xff\x00\x00\xb8\x00\x00\x00" \
     --mask  "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \
     --size 20 --set-enabled

  $ ./foo.exe
  fixme:winediag:start_process Wine Staging 1.9.4 is a testing version containing experimental patches.
  fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org.
  fixme:ntdll:__syscall_NtCreateNamedPipeFile Message mode not supported, falling back to byte mode.
  load: 0.16  cmd: wine 3685 [piperd] 7.64r 0.05u 0.10s 0% 11496k
Comment 6 David Naylor freebsd_committer freebsd_triage 2016-03-24 06:38:16 UTC
Added description based on comment 5 to:
 - https://wiki.freebsd.org/i386-Wine
 - https://wiki.freebsd.org/Wine

The functionality as originally intended can be achieved through the binmiscctl(8) utility.  

@gerald: any benefit of providing this functionality in a port that then runs during launch (i.e. rc.d)?

@jbeich: thank you for the explaining binmiscctl(8), I've used it before with Poudriere to create arm packages, but never realized it was more generic than that.  :-D