星期一, 12月 12, 2005
Linux: binfmt_misc
在Linux環境中, 可以支援額外的執行檔格式.
這種功能就是由 binfmt_misc 模組所提供的
先載入模組 modprobe binfmt_misc
如果要系統可以直接執行windows 的.exe 檔,則執行下面這命令
echo ':Wine:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
這樣便可以對系統註冊此格式
每個欄位用 : (冒號)隔開
格式為: :name:type:offset:magic:mask:interpreter:
那如何清除已經註冊的格式呢?
echo -1 > /proc/sys/fs/binfmt_misc/status
如何停止使用此模組呢(非移除)?
echo 0 > /proc/sys/fs/binfmt_misc/status
如何由停止狀態啟動此模組呢?
echo 1 > /proc/sys/fs/binfmt_misc/status
我在我的Mandriva 上面寫了一個啟動script檔 /etc/init.d/binfmt_misc
#!/bin/sh
#
# Startup script for binfmt_misc
#
# description: Linux binfmt_misc script
# See how we were called.
case "$1" in
start)
echo "Starting binfmt_misc: "
if [ ! -e /proc/sys/fs/binfmt_misc ]; then
/sbin/modprobe binfmt_misc
fi
echo 1 > /proc/sys/fs/binfmt_misc/status
if [ -e /proc/sys/fs/binfmt_misc ]; then
echo ':Wine:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
echo ':Java:M::\xca\xfe\xba\xbe::/usr/local/bin/javawrapper:' > /proc/sys/fs/binfmt_misc/register
#echo ':HTML:E::html::/usr/local/java/bin/appletviewer:' > /proc/sys/fs/binfmt_misc/register
#echo ':Applet:M::
這種功能就是由 binfmt_misc 模組所提供的
先載入模組 modprobe binfmt_misc
如果要系統可以直接執行windows 的.exe 檔,則執行下面這命令
echo ':Wine:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
這樣便可以對系統註冊此格式
欄位順序 | 名稱 | 意義 |
1 | Name | 產生在 “/proc/sys/fs/binfmt_misc” 目錄下的檔案名稱,用來識別所支援的執行檔環境 |
2 | Type | M 表示透過比對檔頭來辨認執行檔 E 表示透過延伸的副檔名來辨認執行檔 |
3 | Offset | 用來標示比對檔頭資料所偏移的位置,通常為0,表示由檔頭的起始位置開始比對 |
4 | Magic | 所要比對的檔頭資料或是副檔名的名稱 |
5 | Mask | 可以用來mask部分比對字串的位元,通常不使用 |
6 | Interpreter | 指向我們所要採用的載入器,而我們使用的執行檔會成為這個載入器的第一個變數 |
每個欄位用 : (冒號)隔開
格式為: :name:type:offset:magic:mask:interpreter:
那如何清除已經註冊的格式呢?
echo -1 > /proc/sys/fs/binfmt_misc/status
如何停止使用此模組呢(非移除)?
echo 0 > /proc/sys/fs/binfmt_misc/status
如何由停止狀態啟動此模組呢?
echo 1 > /proc/sys/fs/binfmt_misc/status
我在我的Mandriva 上面寫了一個啟動script檔 /etc/init.d/binfmt_misc
#!/bin/sh
#
# Startup script for binfmt_misc
#
# description: Linux binfmt_misc script
# See how we were called.
case "$1" in
start)
echo "Starting binfmt_misc: "
if [ ! -e /proc/sys/fs/binfmt_misc ]; then
/sbin/modprobe binfmt_misc
fi
echo 1 > /proc/sys/fs/binfmt_misc/status
if [ -e /proc/sys/fs/binfmt_misc ]; then
echo ':Wine:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
echo ':Java:M::\xca\xfe\xba\xbe::/usr/local/bin/javawrapper:' > /proc/sys/fs/binfmt_misc/register
#echo ':HTML:E::html::/usr/local/java/bin/appletviewer:' > /proc/sys/fs/binfmt_misc/register
#echo ':Applet:M::
關於我自己
- 名稱: Triple-H
- 位置: 台中市, 台灣省
對於資訊科技抱有相當大的熱情,專長是VLSI CAD、C++、Embedded Linux、網路標準 最近在深入研究 Linux 夢想把任意平台的程式在任意平台執行 目前任職於網路設備公司 專職的嵌入式系統軟體工程師
å å主é¡
- ASP .NET 2.0 心得
- 當兵心得
- 優良錯誤報告
- Linux: binfmt_misc
- 胡思亂想
- LINUX: 電視卡
- M$ serial number
- LINUX : VMWARE 5.5 setup
- LINUX: Wine 0.9.2 字型設定
- Linux: Nvidia TwinView
ç¸éé£çµ
- [DOS] DOSBox
- [DOS] DOSEMU
- [MULTI] QEMU
- The bintrans Dynamic Binary Translator
- Valgrind Home
- Leslie Donaldson's EM 86 Page
- PearPC - PowerPC Architecture Emulator
- bochs: The Open Source IA-32 Emulation Project (Home Page)
- Minde
- Computer Laboratory - Xen virtual machine monitor
- MicroLib: Welcome
- SkyEye - Open Source Simulator
- The Computer History Simulation Project
- The Hercules System/370, ESA/390, and z/Architecture Emulator
- DAPHNE Home
- x.mame.net
- Advance Projects - News
- Final Burn for Linux
- Pacifi3D - The Pacman emulator in 3D
- RAINE Arcade Emulator
- NeoCD/SDL - The crossplatform Neogeo CD Emulator
- emuhype
- CASMSIM: HP Classic Calculator Microassembler and Simulator
- The HP-45 Microcode Simulator
- nsim: HP-41CV Microcode-Level Simulator
- TI 85 Emulator for Unix/Linux
- The Official TI92 Emulator "Tiger":s Homepage
- Xe - Multi System Emulator
- Palm Handhelds, Smartphones, Palm Pilot PDA, Free Software Programs
- CheeseTronic - Electronic Music/Audio Tools
- UAE - The UAE Amiga Emulator
- Arnold/Linux
- CPC++ - The Amstrad CPC emulator
- http://www.cpc-emu.org/
- Amstrad CPC emulator for UNIX
- JOYCE for UNIX
- ZXCC homepage
- GDE homepage
- QDAE homepage
- Running CP/M-86 under DOSEMU
- KEGS - An Apple IIgs emulator
- Atari800
- The Atari++ HomePage
- Hatari
- STonX Homepage
- Steem Engine
- Home of the YAPE emulator
- The Official Frodo Home Page
- The VICE Emulator
- The Hercules System/370, ESA/390, and z/Architecture Emulator
- The Official Basilisk II Home Page
- Basilisk II JIT [Gwenole Beauchesne Wiki]
- Mini vMac - a miniature Macintosh emulator
- Mac-on-Linux
- The Official SheepShaver Home Page
- The Official ShapeShifter Home Page
- Vincent's MSX Software
- bochs: The Open Source IA-32 Emulation Project (Home Page)
- PC-8801 Emulator for X - QUASI88 -
- Manuke Station : Project X88000
- The vmips Project
- Japanese Computer Emulation Centre
- Neko Project II
- Welcome to A.N.'s page
- T98-Next
- Fuse - the Free Unix Spectrum Emulator
- FBZX, the Spectrum emulator for FrameBuffer
- Glukalka ZX Spectrum Emulator Home Page
- Erik's Spectrum Pages - XZX-Pro
- Kios Website
- UQLX Home Page
- QLAY - SINCLAIR QL EMULATOR for Windows95, DOS and LINUX
- xtrs: TRS-80 Model I/III/4 Emulator for Unix
- Emul5 - The Thomson MO5 emulator
- Virtual X68000 - Emulating X68000 by Free Software
- Virtual X68000 - Emulating X68000 by Free Software
- Handy Lynx Emulator Homepage
- g n u b o y
- http://membres.lycos.fr/frogus/gngb/
- SDLEmu - The home of SDL emulator ports
- SDLEmu - The home of SDL emulator ports
- SDLEmu - The home of SDL emulator ports
- MEKA Homepage
- Linux ports of RAINE, c2emu, SMS Plus
- NiH: NeoPop-SDL
- VisualBoyAdvance Homepage
- Virtual Jaguar
- Gcube - GameCube Emulator
- DGen/SDL
- Bliss - Bliss
- MEKA Homepage
- jzIntv: Portable Intellivision Emulator
- Gngeo: a NeoGeo emulator for Linux
- RockNES
- NEStra
- SharpNES - sharpnes
- TuxNES
- MasterGear: Portable SEGA MasterSystem/GameGear Emulator
- Mupen64
- O2EM Odyssey2 & Videopac+ Emulator
- Welcome to the official ePSXe website
- PCSX
- PCSX2 - The PlayStation 2 Emulator
- Yabause
- ZSNES Home Page - News
- Snes9X.COM
- Zeograd's lair - www.zeograd.com
- Atari800
- Virtual 2600 Home Page
- Stella: "A multi-platform Atari 2600 VCS emulator"
- SourceForge.jp: Project Info - POEMS/Pokemun
- SHARP MZ-800 Emulator Pages
- EmuZ-2500 - MZ-2500 Emulator for Win32
- Virtual X68000 - Emulating X68000 by Free Software
- gavare.se: Gavare's eXperimental Emulator
- Wine HQ
- Manuke Station : Project X88000
- SHARP MZ-800 Emulator Pages
- IBM 709/7090/7094
- 7094 Emulator
- http://www.oldskool.org/pc/flopper/
- Plex86 Virtual Machine - Summary [Savannah]
- Legacy IBM PC Emulator - Downloads [Shinelife]
- VMware, Inc.
- PCE - IBM PC Emulator
- The Assembler
- emu486
- The bintrans Dynamic Binary Translator