Tuesday, May 14, 2013

ATI card switch between radeon and fglrx driver when boot time using systemd script under linux

It's true that the open source driver has been improved very quickly recently.
But if you can't make sure which is better,I suggest you to use both one.
My card is HD4250 , monitor is LG E1908, system is Gentoo.
Sometimes radeon can't display as 1440x900,but fglrx never failed.
fglrx also has a higher performance.But radeon is safer and  easier to use.
There is my scripts. I learn this from gentoo wiki.
I use two kernel.One is 3.9.0 without drm driver called kernel.
One is 3.10-rc1 with latest radeon driver called kernel-git.

Add  After=x11.service  to kdm.service

Create /etc/X11/radeon.conf and /etc/X11/fglrx.conf .

/etc/systemd/system/x11.service

[Unit]
Description=Xserver
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/local/sbin/x11.sh

[Install]
WantedBy=multi-user.target


/usr/local/sbin/x11.sh

#!/bin/sh

if   `dmesg | grep -q kernel-git`; then
        eselect opengl set xorg-x11
        ln -sf /etc/X11/radeon.conf /etc/X11/xorg.conf
else
        eselect opengl set ati
        ln -sf /etc/X11/fglrx.conf /etc/X11/xorg.conf
fi

Sunday, February 17, 2013

my make.conf

# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
#CFLAGS="-O2 -pipe"
#CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
#CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
#USE="mmx sse sse2"
#CC="clang"
#CXX="clang++"
#CXX="clang++ -stdlib=libc++"
CFLAGS="-flto -march=native -O2 -pipe -fomit-frame-pointer -w"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
ACCEPT_KEYWORDS="~amd64"
PKGDIR="/usr/packages"
MAKEOPTS="-j3"
DISTDIR="/usr/distfiles"
PORTAGE_TMPDIR=/tmp
GRUB_PLATFORMS="pc"
ACCEPT_LICENSE="*"
FEATURES="parallel-fetch clean-logs  metadata-transfer  sandbox fail-clean"   #ccache metadata-transfer
#CCACHE_SIZE="15G"
INPUT_DEVICES="evdev keyboard mouse "
VIDEO_CARDS="r600 r700 radeon"
PORTDIR_OVERLAY="/gentoo/linux/ebuild"
LINGUAS="en_US zh_CN "
PYTHON_TARGETS="python2_7    python3_3 "
DRACUT_MODULES="plymouth btrfs systemd"
QEMU_USER_TARGETS="i386  x86_64"
QEMU_SOFTMMU_TARGETS="i386 x86_64"
source /usr/overplay/make.conf
#FETCHCOMMAND="/usr/bin/aria2c -j 8  -t 5   -d  \${DISTDIR}  -o  \${FILE} \${URI}"
#RESUMECOMMAND="${FETCHCOMMAND}"
FETCHCOMMAND="/usr/bin/axel -a -n 8  -o \${DISTDIR}/\${FILE} \${URI}"
RESUMECOMMAND="${FETCHCOMMAND}"
GENTOO_MIRRORS="
http://mirrors.163.com/gentoo
rsync://mirrors.tds.net/gentoo"
SYNC="rsync://rsync26.us.gentoo.org/gentoo-portage"
#SYNC="rsync://mirrors.ustc.edu.cn/gentoo-portage/"
USE_PYTHON="2.7 3.3"
USE="dbus cups alsa -bluetooth consolekit systemd -openrc \
#display
X gles gles2 egl wayland opengl fbcon vaapi vdpau -opencl  \
#cpu
mmx mmx2 sse sse2 ssse3 3dnow 3dnowext mmxext threads  custom-cflags  \
#font
fontconfig xft -cleartype truetype cjk nls unicode lcdfilter \
#destkop
gtk gtk2 gtk3 qt3support kde kde4 qt qt4 icu -gnome -webkit \
#video
vlc gstreamer x264  real direct2d directfb xvmc bluray ffmpeg mpeg  rtmp \
#audio
mp3 midi jack faac timidity lash -pulseaudio \
#image
jpeg mng png imlib jpeg2k gif tiff "