所需工具:安卓運行Windows系統安裝包(安裝包在文章最后,關注后可見,也可私信留言)適用系統:安卓用戶給大家分享一個好玩的!教大家如何在安卓手機上安裝Windows系統!
首先在PC端解壓小編給的鏡像文件,這里有Windows7、Windows xp、Windows 98鏡像文件,隨意選擇一個,將其剪切。然后依次打開“安卓虛擬機”→“SDL”,將剪切的鏡像文件粘貼到此處。
再打開.txt文本,修改一些參數,但不是所有的機型都建議修改。比如我們這里修改兆字節,手機運行內存為2G以上的筒子們可將其更改為1024M,手機內存不足2G的就使用512M。
CPU:cunt=1代表CPU核數,小編這里是單核,ips=9000000指的是手機CPU赫茲,我們這里默認不修改。
然后將 SDL 這個文件夾所有的內容添加到手機管理中,再將.Apk文件安裝在手機上。安裝好以后,在手機上打開文件管理就能看見SDL這個文件夾。
在手機上打開 BOCHS 這款安卓模擬器,這時候我們就能直接在手機上運行 Windows模擬器了!首次運行的話可能時間會比較長,小編用了8分鐘,我相信你們肯定比我快
!
自制操作系統第一步,就是搭建模擬環境,方便調試和運行。Bochs是一個x86硬件平臺的開源模擬器。可以模擬各種硬件配置,包括CPU、內存、硬盤、顯示器、以太網、BIOS等常見硬件以及整個PC平臺,以下是bochs-2.6.8在Centos 7.9環境下的安裝過程。
一次性安裝好所需依賴,避免后續報錯處理。
yum install gtk2 gtk2-devel libXt \
libXt-devel libXpm libXpm-devel SDL SDL-devel \
libXrandr-devel.x86_64 xorg-x11-server-devel \
glibc-headers gcc-c++ SDL SDL-devel
下載bochs源碼并解壓
# 下載資源頁: https://sourceforge.net/projects/bochs/files/bochs/2.6.8/
# 下載源碼
wget "https://sourceforge.net/projects/bochs/files/bochs/2.6.8/bochs-2.6.8.tar.gz"
# 解壓文件
tar -zxvf bochs-2.6.8.tar.gz
打開bochs-2.6.8目錄下隱藏文件 .bochsrc,可以定制軟件配置。一般使用默認配置,以下是一些關鍵參數,可以根據自己需要進行調整。
#相當于設置BIOS的啟動項,此處為軟盤啟動。
boot:floppy
# 表示設置插入軟盤的類型為容量1.44 MB的軟盤,軟盤鏡像文件的文件名為boot.img,狀態是已經插入,寫保護開關置于關閉狀態。
floppya:type=1_44,1_44="boot.img", status=inserted,write_protected=0
# cpu配置
cpu: model=core2_penryn_t9600, count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def"
cpu: cpuid_limit_winnt=0
#cpuid配置
cpuid: x86_64=1, mmx=1, sep=1, simd=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
cpuid: family=6, model=0x1a, stepping=5
# 設置可用物理內存容量,以MB為單位,目前Bochs軟件可用的內存上限是2048 MB
megs:2048
# 關閉聲卡驅動,如果是ECS環境,沒有安裝聲卡模塊,可以關閉這個配置
# sound: driver=default, waveout=/dev/dsp. wavein=, midiout=
進入安裝目錄,完成bonchs配置。如果配置過程中出現報錯,可以參考 五、異常處理 模塊解決。
cd bochs-2.6.8
./configure --with-x11 --with-wx --enable-debugger --enable-disasm \
--enable-all-optimizations --enable-readline --enable-long-phy-address \
--enable-ltdl-install --enable-idle-hack --enable-plugins --enable-a20-pin \
--enable-x86-64 --enable-smp --enable-cpu-level=6 --enable-large-ramfile \
--enable-repeat-speedups --enable-fast-function-calls --enable-handlers-chaining \
--enable-trace-linking --enable-configurable-msrs --enable-show-ips --enable-cpp \
--enable-debugger-gui --enable-iodebug --enable-logging --enable-assert-checks \
--enable-fpu --enable-vmx=2 --enable-svm --enable-3dnow --enable-alignment-check \
--enable-monitor-mwait --enable-avx --enable-evex --enable-x86-debugger \
--enable-pci --enable-usb --enable-voodoo
執行編譯安裝,等待安裝結束。如果安裝過程中出現報錯,常見的報錯信息,也可以參考 五、異常處理 模塊解決。
make install
在安裝目錄執行 ./bochs 命令,出現以下結果,即為安裝成功。
[root@centos7.9 bochs-2.6.8]# ./bochs
# 正常輸出如下:======================================================================== Bochs x86 Emulator 2.6.8
Built from SVN snapshot on May 3, 2015
Compiled on Mar 23 2024 at 22:27:20========================================================================00000000000i[ ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/local/lib/bochs/plugins'
00000000000i[ ] BXSHARE not set. using compile time default '/usr/local/share/bochs'
00000000000i[ ] lt_dlhandle is 0x1878fb0
00000000000i[PLUGIN] loaded plugin libbx_unmapped.so
00000000000i[ ] lt_dlhandle is 0x1879a80
00000000000i[PLUGIN] loaded plugin libbx_biosdev.so
00000000000i[ ] lt_dlhandle is 0x187a430
00000000000i[PLUGIN] loaded plugin libbx_speaker.so
00000000000i[ ] lt_dlhandle is 0x187b290
00000000000i[PLUGIN] loaded plugin libbx_extfpuirq.so
00000000000i[ ] lt_dlhandle is 0x187bb00
00000000000i[PLUGIN] loaded plugin libbx_parallel.so
00000000000i[ ] lt_dlhandle is 0x187d6e0
00000000000i[PLUGIN] loaded plugin libbx_serial.so
00000000000i[ ] lt_dlhandle is 0x18819d0
00000000000i[PLUGIN] loaded plugin libbx_iodebug.so
00000000000i[ ] reading configuration from .bochsrc
00000000000e[ ] .bochsrc:714: ataX-master/slave CHS set to 0/0/0 - autodetection enabled
00000000000e[ ] .bochsrc:918: invalid choice 'sound' parameter 'mode'
00000000000e[PCSPK ] .bochsrc:918: unknown parameter for speaker ignored.
------------------------------
Bochs Configuration: Main Menu
------------------------------
This is the Bochs Configuration Interface, where you can describe the
machine that you want to simulate. Bochs has already searched for a
configuration file (typically called bochsrc.txt) and loaded it if it
could be found. When you are satisfied with the configuration, go
ahead and start the simulation.
You can also start bochs with the -q option to skip these menus.
1. Restore factory default configuration
2. Read options from...
3. Edit options
4. Save options to...
5. Restore the Bochs state from...
6. Begin simulation
7. Quit now
Please choose one: [6]
配置好環境變量,后續在系統即可直接使用,而不需要進入安裝目錄運行。
vim ~/.bash_profile
export BXSHARE=/usr/local/share/bochs
source ~/.bash_profile
configure: error: in `/root/os_demo/bochs-2.6.2':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
# 解決方案: 安裝 gcc-c++
yum install gcc-c++
x.cpp:37:22: fatal error: X11/Xlib.h: No such file or directory
或者
x.cpp:42:35: fatal error: X11/extensions/Xrandr.h: No such file or directory
# 解決方案: 安裝 libX* 相關組件
yum install libX*
make: *** 沒有規則可以創建“misc/bximage.o”需要的目標“misc/bximage.cc”。 停止。
# 解決方案:缺少對應 .cc 文件, 復制以下 .cpp文件為 .cc 后綴文件即可
cp misc/bximage.cpp misc/bximage.cc
cp iodev/hdimage/hdimage.cpp iodev/hdimage/hdimage.cc
cp iodev/hdimage/vmware3.cpp iodev/hdimage/vmware3.cc
cp iodev/hdimage/vmware4.cpp iodev/hdimage/vmware4.cc
cp iodev/hdimage/vpc-img.cpp iodev/hdimage/vpc-img.cc
cp iodev/hdimage/vbox.cpp iodev/hdimage/vbox.cc
.bochsrc:907: Bochs is not compiled with lowlevel sound support
# 解決方案:缺少聲音相關設備支持,打開 .bochsrc 文件,注釋sound相關配置,再重新編譯
vim .bochsrc
# sound: driver=default, waveout=/dev/dsp. wavein=, midiout=
至此,已經安裝好bochs模擬軟件啦,待后續開發調試使用。