wsl1(win10)中安装bochs

wsl中安装bochs

1 安装bochs

系统版本是ubuntu20.04 LTS

sudo apt-get install 'bochs*'

2 创建虚拟硬盘

bximage -mode="create" -hd=60M -imgmode="flat" -q hd60M.img

3 写配置文件

vim bochsrc

具体参照bochs的安装和配置

4 windows10安装vcxsrv

官网下载安装即可。安装完成后启动。

参考:win10+WSL+安装VcXsrv Windows X Server

5 wsl中环境变量设置

 export DISPLAY=:0 # in WSL 1
 export LIBGL_ALWAYS_INDIRECT=1

使用bochs

cd your_dir
bochs -f bochsrc

参考:wsl wiki

6 处理报错

======================================================================== Bochs x86 Emulator 2.6.11 Built from SVN snapshot on January 5, 2020 Timestamp: Sun Jan 5 08:36:00 CET 2020 ======================================================================== 00000000000i[ ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins' 00000000000i[ ] BXSHARE not set. using compile time default '/usr/share/bochs' 00000000000i[ ] lt_dlhandle is 0x7fffeea6d830 00000000000i[PLUGIN] loaded plugin libbx_unmapped.so 00000000000i[ ] lt_dlhandle is 0x7fffeea6ee50 00000000000i[PLUGIN] loaded plugin libbx_biosdev.so 00000000000i[ ] lt_dlhandle is 0x7fffeea70650 00000000000i[PLUGIN] loaded plugin libbx_speaker.so 00000000000i[ ] lt_dlhandle is 0x7fffeea723d0 00000000000i[PLUGIN] loaded plugin libbx_extfpuirq.so 00000000000i[ ] lt_dlhandle is 0x7fffeea72ba0 00000000000i[PLUGIN] loaded plugin libbx_parallel.so 00000000000i[ ] lt_dlhandle is 0x7fffeea74800 00000000000i[PLUGIN] loaded plugin libbx_serial.so 00000000000i[ ] lt_dlhandle is 0x7fffeea78c00 00000000000i[PLUGIN] loaded plugin libbx_gameport.so 00000000000i[ ] lt_dlhandle is 0x7fffeea79430 00000000000i[PLUGIN] loaded plugin libbx_iodebug.so 00000000000i[ ] reading configuration from bochsrc 00000000000i[ ] lt_dlhandle is 0x7fffeea79e60 00000000000i[PLUGIN] loaded plugin libbx_x.so 00000000000i[ ] installing x module as the Bochs GUI 00000000000i[ ] using log file bochsout.txt shared memfd open() failed: Function not implemented ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default *** buffer overflow detected ***: terminated Aborted (core dumped)

设置:export LIBGL_ALWAYS_INDIRECT=1 即可
具体可以参考What does LIBGL_ALWAYS_INDIRECT=1 actually do?

原文地址:https://www.cnblogs.com/lyg-blog/p/14641562.html