何久 發表於 2008-9-8 18:48:30

FreeBSD实现3D桌面

<p>这几天晚上闲来无事在琢磨FreeBSD上的3D桌面实现。现搜罗两篇比较仔细的参考文档给大家看看。我尚未动手折腾,因为有一些问题尚且不是很清楚。<br />
<br />
1.&nbsp;实现XGL/GLX,需要的xorg的版本最低是多少?要xorg7以上还是xorg6.9就可以?<br />
2.能够支持的显卡是哪些?我的显卡是Intel865G集成显卡。<br />
<br />
下面这篇很仔细,不过有些地方不是很明白,主要是第8步,有明白的给讲解讲解。有兴趣的可以照做看看。<br />
<br />
AIGLX&nbsp;for&nbsp;FreeBSD(FreeBSD_Release_6.2+AIGLX+Beryl)<br />
<br />
1:&nbsp;<a target="_blank" href="#" class="UBBWordLink">系统</a>的<a target="_blank" href="#" class="UBBWordLink">安装</a><br />
选择最小化<a target="_blank" href="#" class="UBBWordLink">安装</a>,起码这里需要把<a target="_blank" href="#" class="UBBWordLink">网络</a>或键盘配好,其他的可以再去细化。<br />
<br />
2:&nbsp;bash<br />
<br />
root@cnbsd/#cd&nbsp;/usr/ports/shells/bash<br />
root@cnbsd/usr/ports/shells/bash#make&nbsp;install&nbsp;clean<br />
root@cnbsd/usr/ports/shells/bash#ln&nbsp;-s&nbsp;/usr/local/bin/bash&nbsp;/bin/bash<br />
root@cnbsd/usr/ports/shells/bash#chsh&nbsp;-s&nbsp;/usr/local/bin/bash<br />
root@cnbsd/usr/ports/shells/bash#reboot<br />
以后再创建的用户就可以指定shell为bash了。<br />
<br />
<a target="_blank" href="#" class="UBBWordLink">系统</a>装好后注意装好linux_base、perl包、修改fstab显示/proc目录等。也可以在这里修改环境变量,总之根据你自己的爱好来就是了。<br />
<br />
3:&nbsp;axel<br />
<br />
root@cnbsd/#cd&nbsp;/usr/ports/ftp/axel<br />
root@cnbsd/usr/ports/ftp/axel#make&nbsp;install&nbsp;clean<br />
root@cnbsd/usr/ports/ftp/axel#cd&nbsp;/etc<br />
root@cnbsd/etc#make.conf<br />
<br />
加入以下内容:<br />
<i>&quot;</i><br />
FETCH_CMD&nbsp;=&nbsp;axel&nbsp;-a<br />
MASTER_SITE_OVERRIDE=&nbsp;/<br />
ftp://ftp.freebsd.org.cn/pub/FreeBSD/ports/distfiles/&nbsp;\<br />
<i>&quot;</i><br />
<br />
4:&nbsp;fcitx<br />
<br />
wanglong@unixsir/usr/ports/chinese/fcitx$make&nbsp;install&nbsp;clean<br />
<br />
5:git<br />
<br />
root@cnbsd/etc#cd&nbsp;/usr/ports/devel/git<br />
root@cnbsd/usr/ports/devel/git#make&nbsp;install&nbsp;clean<br />
<br />
6:&nbsp;pkg_deinstall<br />
<br />
root@cnbsd/usr/ports/sysutils/portupgrade#cd&nbsp;/usr/ports/sysutils/portupgrade<br />
root@cnbsd/usr/ports/devel/git#cd&nbsp;/usr/ports/sysutils/portupgrade<br />
root@cnbsd/usr/ports/sysutils/portupgrade#make&nbsp;install&nbsp;clean<br />
<br />
7:&nbsp;pkgdb<br />
<br />
root@cnbsd/usr/ports/sysutils/portupgrade#cd&nbsp;/usr/ports/sysutils/pkg_trackinst<br />
root@cnbsd/usr/ports/sysutils/pkg_trackinst#make&nbsp;install&nbsp;clean<br />
<br />
8:&nbsp;checkout&nbsp;the&nbsp;code<br />
<br />
root@cnbsd/usr/ports/sysutils/pkg_trackinst#cd&nbsp;/usr<br />
root@cnbsd/usr#mv&nbsp;ports&nbsp;ports.20070128<br />
root@cnbsd/usr#git&nbsp;clone&nbsp;git://git.geekfire.com/git/ports.git<br />
root@cnbsd/usr#cd&nbsp;ports<br />
root@cnbsd/usr#pkg_info&nbsp;-Ex&nbsp;xorg-&nbsp;|&nbsp;grep&nbsp;-v&nbsp;linux&nbsp;|&nbsp;xargs&nbsp;-n1&nbsp;pkg_create&nbsp;-b<br />
root@cnbsd/usr#pkg_deinstall&nbsp;-fP&nbsp;xorg-\*&nbsp;libdrm-\*&nbsp;dri-\*&nbsp;libGL-\*&nbsp;libGLU-\*&nbsp;libglut-\*&nbsp;nvidia-driver-\*<br />
root@cnbsd/usr#cd&nbsp;/usr/ports/x11/xorg<br />
root@cnbsd/usr/ports/x11/xorg#make&nbsp;all&nbsp;install&nbsp;clean<br />
root@cnbsd/usr/ports/x11/xorg#cd&nbsp;/usr<br />
root@cnbsd/usr#pkgdb&nbsp;-F<br />
root@cnbsd/usr#reboot<br />
root@cnbsd/#Xorg&nbsp;-configure<br />
root@cnbsd/#cp&nbsp;/root/xorg.conf.new&nbsp;/etc/X11/xorg.conf<br />
<br />
增加以下内容到<i>&quot;</i>/etc/X11/xorg.conf<i>&quot;</i>:<br />
<i>&quot;</i><br />
Section&nbsp;<i>&quot;</i>ServerFlags<i>&quot;</i><br />
Option&nbsp;<i>&quot;</i>AIGLX<i>&quot;</i>&nbsp;<i>&quot;</i>on<i>&quot;</i><br />
EndSection<br />
<br />
Section&nbsp;<i>&quot;</i>DRI<i>&quot;</i><br />
Mode&nbsp;0666<br />
EndSection<br />
<br />
<br />
Section&nbsp;<i>&quot;</i>Extensions<i>&quot;</i><br />
Option&nbsp;<i>&quot;</i>Composite<i>&quot;</i>&nbsp;<i>&quot;</i>true<i>&quot;</i><br />
EndSection<br />
<br />
<i>&quot;</i><br />
<br />
另外打开<i>&quot;</i>#Option&nbsp;<i>&quot;</i>Dac6Bit<i>&quot;</i>&nbsp;#&nbsp;[]<i>&quot;</i><br />
改为<i>&quot;</i>Option&nbsp;<i>&quot;</i>DRI<i>&quot;</i>&nbsp;<i>&quot;</i>True<i>&quot;</i><i>&quot;</i><br />
<br />
9:确认3D功能是否打开<br />
<br />
在装xfce4前可以测试下3D功能是否已经打开,这里主要通过<i>&quot;</i>/var/log/Xorg.0.log<i>&quot;</i>来见检查确认(linux下满街都有glxinfo,bsd下ports里连<br />
key也找不到)。<br />
<br />
root@cnbsd/#Xorg&nbsp;-config&nbsp;/etc/X11/xorg.conf<br />
root@cnbsd/#grep&nbsp;rendering&nbsp;/var/log/Xorg.0.log<br />
(II)&nbsp;I810(0):&nbsp;direct&nbsp;rendering:&nbsp;Enabled<br />
root@cnbsd/#<br />
<br />
如能看到是<i>&quot;</i>Enable<i>&quot;</i>就可以稍微放心点了。<i>&quot;</i>disabled<i>&quot;</i>多半是由于<i>&quot;</i>mesa<i>&quot;</i>、<i>&quot;</i>dri<i>&quot;</i>的问题,<i>&quot;</i>dri<i>&quot;</i>和<i>&quot;</i>mesa<i>&quot;</i>关系密切,不过这里还是要具体情况具<br />
体对待,多看日志。<br />
<br />
root@cnbsd/#cd&nbsp;/home<br />
root@cnbsd/home#git&nbsp;clone&nbsp;git://anongit.freedesktop.org/git/mesa/mesa<br />
root@cnbsd/home#chown&nbsp;-R&nbsp;surferwl:surferwl&nbsp;mesal<br />
root@cnbsd/home#su&nbsp;-&nbsp;surferwl<br />
surferwl@cnbsd~$<br />
<br />
平常习惯用<i>&quot;</i>surferwl<i>&quot;</i>这个用户,添加的步骤就省了。<br />
<br />
surferwl@cnbsd~$vi&nbsp;.profile<br />
<br />
增加以下内容:<br />
<br />
<i>&quot;</i><br />
export&nbsp;PKG_CONFIG_PATH=/usr/local/libdata/pkgconfigPKG_CONFIG_PATH<br />
<i>&quot;</i><br />
<br />
保存后退出。<br />
<br />
root@cnbsd/#cd&nbsp;/home/mesa<br />
root@cnbsd/home/mesa#gmake&nbsp;freebsd-dri-x86<br />
root@cnbsd/home/mesa#gmake&nbsp;install<br />
root@cnbsd/home/mesa#ln&nbsp;-s&nbsp;/usr/X11R6/lib/modules/dri&nbsp;/usr/X11R6/lib/dri<br />
<br />
增加以下内容到<i>&quot;</i>/home/surferwl/.profile<i>&quot;</i>:<br />
<i>&quot;</i><br />
export&nbsp;LIBGL_DRIVERS_PATH=<i>&quot;</i>/home/mesa/lib<i>&quot;</i><br />
export&nbsp;LD_PRELOAD=<i>&quot;</i>/home/mesa/lib/libGL.so.1<i>&quot;</i><br />
<i>&quot;</i><br />
<br />
root@cnbsd/#reboot<br />
<br />
再去调试3D功能,心平气和的<a target="_blank" href="#" class="UBBWordLink">操作</a>应该是没有问题的。至于<i>&quot;</i>drm<i>&quot;</i>,是这样解释的:<i>&quot;</i>The&nbsp;DRM&nbsp;is&nbsp;shipped&nbsp;with&nbsp;the&nbsp;kernel,&nbsp;so&nbsp;you&nbsp;shouldn<i>'</i>t&nbsp;need&nbsp;to&nbsp;build&nbsp;it.&nbsp;If&nbsp;you&nbsp;choose&nbsp;to,&nbsp;simply&nbsp;run&nbsp;<i>&quot;</i>make&nbsp;&&&nbsp;make&nbsp;install<i>&quot;</i>&nbsp;from&nbsp;the&nbsp;drm/bsd-core&nbsp;directory.<i>&quot;</i><br />
<br />
若3D搞定后再去install其他的。<br />
<br />
<br />
10:&nbsp;xfce4<br />
<br />
root@cnbsd/usr/ports/x11-wm/xfce4#make&nbsp;install&nbsp;clean<br />
<br />
11:&nbsp;beryl<br />
<br />
root@cnbsd/usr/ports/x11-wm/beryl#make&nbsp;install&nbsp;clean<br />
<br />
12:&nbsp;.xinitrc<br />
surferwl@cnbsd~$&nbsp;echo&nbsp;<i>&quot;</i>exec&nbsp;fcitx&nbsp;-nb&nbsp;&<i>&quot;</i>&nbsp;&gt;&nbsp;.xinitrc<br />
surferwl@cnbsd~$&nbsp;echo&nbsp;<i>&quot;</i>exec&nbsp;beryl-manager&nbsp;&<i>&quot;</i>&nbsp;&gt;&gt;&nbsp;.xinitrc<br />
surferwl@cnbsd~$&nbsp;echo&nbsp;<i>&quot;</i>exec&nbsp;/usr/local/bin/startxfce4<i>&quot;</i>&nbsp;&gt;&gt;&nbsp;.xinitrc<br />
<br />
<br />
接着就去<i>&quot;</i>startx<i>&quot;</i>或再<i>&quot;</i>gdm<i>&quot;</i>吧、再就是去转你的屏幕吧,最好放张女朋友的照片,你这样可以360度的随心所意的转着看,就看你的发挥了!<br />
<br />
<br />
说明:以上的步骤有掺和了不少个人习惯性动作,有多余的步骤,比如切换目录的、使用bash&nbsp;shell等,其实这是个人习惯,自己明白就o了,&gt;对着去画就行;我习惯用<i>&quot;</i>simsun<i>&quot;</i>或<i>&quot;</i>文泉<i>&quot;</i>字体,这里也没有写出来。另外就是还没有仔细检查,可能还有错字情况,但大体思想是这样的。我在使用的过程中还没有发现问题,和平常没有使用AIGLX功能的时侯一样,就是比较<i>&quot;</i>动态<i>&quot;</i>了。&nbsp;<br />
&nbsp;</p>
頁: [1]
查看完整版本: FreeBSD实现3D桌面