This paper would try to teach you how to build the graphic system on rk3288 EVB board with Ubuntu 14.04 operate system.
Two things we need to do in this paper:
- Build our own XServer, this would help to set up the base display system.
- Replace the Mali libraries, this would help to take use of the GPU module.
Compile XServer on Ubuntu
1. Download related package
Xorg include lots of package, such as armsoc and xserver. And most of those package would need lots of others library support, like xserver would need libxcb. So first step we need to download all the packages we need.
# /bin/bash
# You could download this script by below link:
# https://github.com/yakir-Yang/scripts/blob/master/xorg-build.sh
XORG_REPOS="\
git://git.freedesktop.org/git/xorg/util/macros \
git://anongit.freedesktop.org/xorg/proto/xineramaproto \
git://anongit.freedesktop.org/xorg/proto/xproto \
git://anongit.freedesktop.org/xorg/proto/presentproto \
git://anongit.freedesktop.org/xorg/lib/libXdmcp \
git://anongit.freedesktop.org/xorg/app/xkbcomp \
git://git.freedesktop.org/git/xorg/proto/x11proto \
git://git.freedesktop.org/git/xorg/proto/damageproto \
git://git.freedesktop.org/git/xorg/proto/xextproto \
git://git.freedesktop.org/git/xorg/proto/fontsproto \
git://git.freedesktop.org/git/xorg/proto/videoproto \
git://git.freedesktop.org/git/xorg/proto/renderproto \
git://git.freedesktop.org/git/xorg/proto/inputproto \
git://git.freedesktop.org/git/xorg/proto/xf86vidmodeproto \
git://git.freedesktop.org/git/xorg/proto/xf86dgaproto \
git://git.freedesktop.org/git/xorg/proto/xf86driproto \
git://git.freedesktop.org/git/xorg/proto/xcmiscproto \
git://git.freedesktop.org/git/xorg/proto/scrnsaverproto \
git://git.freedesktop.org/git/xorg/proto/bigreqsproto \
git://git.freedesktop.org/git/xorg/proto/resourceproto \
git://git.freedesktop.org/git/xorg/proto/compositeproto \
git://git.freedesktop.org/git/xorg/proto/fixesproto \
git://git.freedesktop.org/git/xorg/proto/evieproto \
git://git.freedesktop.org/git/xorg/proto/kbproto \
git://git.code.sf.net/p/libpng/code \
git://git.sv.nongnu.org/freetype/freetype2.git \
git://anongit.freedesktop.org/xorg/lib/libXau \
git://git.freedesktop.org/git/xorg/lib/libxtrans \
git://git.freedesktop.org/git/xorg/lib/libX11 \
git://git.freedesktop.org/git/xorg/lib/libXext \
git://git.freedesktop.org/git/xorg/lib/libxkbfile \
git://git.freedesktop.org/git/xorg/lib/libfontenc \
git://git.freedesktop.org/git/xorg/lib/libXfont \
git://git.freedesktop.org/git/xorg/lib/libXfixes \
git://git.freedesktop.org/git/xorg/lib/libXdamage \
git://git.freedesktop.org/git/xorg/lib/libXv \
git://git.freedesktop.org/git/xorg/lib/libXvMC \
git://git.freedesktop.org/git/xorg/lib/libXxf86vm \
git://git.freedesktop.org/git/xorg/lib/libXinerama \
git://git.freedesktop.org/git/xorg/proto/dri2proto \
git://git.freedesktop.org/git/xorg/proto/glproto \
git://git.freedesktop.org/git/xorg/lib/libpciaccess \
git://git.freedesktop.org/git/pixman \
git://git.freedesktop.org/git/xcb/proto \
git://git.freedesktop.org/git/xcb/pthread-stubs \
git://git.freedesktop.org/git/xcb/libxcb \
git://git.freedesktop.org/git/xorg/proto/randrproto \
git://git.freedesktop.org/git/mesa/drm \
git://git.freedesktop.org/git/mesa/mesa \
git://git.freedesktop.org/git/xorg/xserver \
git://anongit.freedesktop.org/xorg/driver/xf86-input-evdev \
git://git.freedesktop.org/git/xorg/driver/xf86-input-mouse \
git://git.freedesktop.org/git/xorg/driver/xf86-input-keyboard \
git://git.freedesktop.org/git/xorg/driver/xf86-input-synaptics \
git://git.freedesktop.org/git/xorg/driver/xf86-video-intel \
https://github.com/dottedmag/libsha1.git \
https://github.com/madler/zlib.git \
https://github.com/mmind/xf86-video-armsoc.git"
download()
{
sudo apt-get update
sudo apt-get install git --reinstall
sudo apt-get install libcurl3-gnutls --reinstall
sudo apt-get install libtool --reinstall
sudo pat-get install libxfont-dev
sudo apt-get install libevdev-dev
sudo apt-get install libmtdev-dev
#
# Clone the source code of xorg by defined repos,
# and if repo already have been download, then
# just update it.
#
for repo in $XORG_REPOS; do
echo "======> Git cloning $repo"
git clone $repo
done
# Correct the directory name of libpng
mv code libpng;
}
case "$1" in
download)
download
;;
esac
2. Compile the xorg packages
- Compiled the marcos, create the aclocal enviroment.
# /bin/bash
export DEST="/"
export PREFIX="$DEST/usr"
export PKG_CONFIG=pkg-config
export CC=arm-linux-gnueabihf-gcc
export MAKE="make -j4"
export CFLAGS="-I"$PREFIX"/include -I"$PREFIX"/include/freetype2/"
export LDFLAGS="-L"$PREFIX"/lib -Wl,-rpath-link,$PREFIX/lib"
export PKG_CONFIG_PATH=""$PREFIX"/lib/pkgconfig:$PREFIX/share/pkgconfig"
export ACLOCAL="aclocal -I"$PREFIX"/share/aclocal"
export DESTDIR=
compiled_macros()
{
cd macros
./autogen.sh --host=arm-linux --prefix="$PREFIX"
make -j4 || exit 1
make install || exit 1
cd ..
echo xorg_cv_malloc0_returns_null=yes > arm-linux.cache
}
case "$1" in
download)
download
;;
compiled)
sudo stop lightdm
compiled_macros
sudo start lightdm
;;
esac
- Compiled the freetype2 libraries separately, cause we need to enable the png and zlib future support for it.
compiled_freetype2()
{
# Compiled zlib source code
cd zlib
./configure --prefix="$PREFIX"
make || exit 1
make install || exit 1
cd ..
# Compiled libpng source code
cd libpng;
./autogen.sh
./configure --host=arm-linux --prefix="$PREFIX"
make || exit 1
make install || exit 1
cd ..
# Compile freetype2 with zlib and png support
cd freetype2
./autogen.sh
./configure --host=arm-linux --with-png=yes --with-zlib=yes --prefix=$PREFIX
make || exit 1
make install || exit 1
cd ..
}
case "$1" in
download)
download
;;
compiled)
sudo stop lightdm
compiled_macros
compiled_freetype2
sudo start lightdm
;;
esac
- Compiled the left related libraries.
modules="\
libsha1 \
xproto \
fontsproto \
x11proto \
xextproto \
videoproto \
renderproto \
inputproto \
damageproto \
xf86vidmodeproto \
xf86dgaproto \
xf86driproto \
xcmiscproto \
scrnsaverproto \
bigreqsproto \
resourceproto \
compositeproto \
resourceproto \
evieproto \
kbproto \
fixesproto \
libxtrans \
proto \
pthread-stubs \
libXau \
libxcb \
libX11 \
libXext \
libxkbfile \
libfontenc \
libXfont \
libXv \
libXvMC \
libXxf86vm \
xineramaproto \
libXinerama \
libXfixes \
libXdamage \
dri2proto \
glproto \
libpciaccess \
pixman \
presentproto \
libXdmcp \
randrproto"
compiled_xorg_modules()
{
for module in $modules; do
cd $module
echo ======================
echo configuring $module
echo ======================
./autogen.sh --prefix="$PREFIX" --host=arm-linux --cache-file=../arm-linux.cache || exit 1
if [ $? -ne 0 ]; then
echo "Failed to configure $i."
exit
fi
make -j4 || exit 1
make install || exit 1
cd ..
done
}
case "$1" in
download)
download
;;
compiled)
sudo stop lightdm
compiled_macros
compiled_freetype2
compiled_xorg_modules
sudo start lightdm
;;
esac
- Compiled the important XServer package, before we start to compiled the XServer, we need to checkout the some package branch to the special version we want.
For example, if we want to build the XServer 1.12.4
Checkout the xfont to versioncd libXfont;
git branch -a;
git checkout libXfont-1.5.1 -b libXfont-1.5.1;
cd -
Checkout the xserver to versioncd xserver;
git tag | grep 1.12.4
git checkout xorg-server-1.12.4 -b xorg-server-1.12.4
cd -
Checkout the armosc to rokchip branchcd xf86-video-armsoc;
git branch -a;
git checkout remotes/origin/devel/rockchip -b rockchip;
cd -;
After declare the build version, then we could start to compiled the main XServer module.
spec_modules="\
evdev \
mouse \
keyboard"
compiled_xserver()
{
# build drm
echo ======================
echo building drm
echo ======================
cd drm
./autogen.sh --prefix="$PREFIX" --disable-cairo-tests --host=arm-linux
make -j4 || exit 1
make install || exit 1
cd ..
#build xserver
echo ======================
echo building xserver
echo ======================
cd xserver
./autogen.sh --prefix="$PREFIX" --host=arm-linux --enable-dri2 --disable-aiglx --disable-glx --disable-dri --disable-record --with-sha1=libsha1 --disable-xnest
if [ $? -ne 0 ]; then
echo "Failed to configure X server."
exit
fi
make -j4 || exit 1
make install || exit 1
cd ..
# build special modules
for module in spec_modules; do
cd $module
echo ======================
echo configuring $module
echo ======================
./autogen.sh --prefix="$PREFIX" --host=arm-linux || exit 1
make -j4 || exit 1
make install || exit 1
cd ..
done
# build armsoc
echo ======================
echo building armsoc
echo ======================
cd xf86-video-armsoc
./autogen.sh --host=arm-linux --with-driver=rockchip
make -j4 || exit 1
make install || exit 1
cd ..
case "$1" in
download)
download
;;
compiled)
sudo stop lightdm
compiled_macros
compiled_freetype2
compiled_xorg_modules
compiled_xserver
sudo start lightdm
;;
*)
echo "Usage: $0 donwload | compiled"
exit 3
esac
3. Configure the XServer
For now you have build the whole XServer packages on Ubuntu system, the last things for lighting your monitor is configuring the XServer. XServer have provided the xorg.config interfaces, we just need to write the write the configure file to ensure that XServer would use Rockchip DRM driver. We have provided therk32.conf file, you just need to place them into /etc/X11/xorg.conf.d/
directly (if it does not exist, then just create it).
# Filename: rk32.conf
# Path: /etc/X11/xorg.conf.d/rk32.conf
Section "Device"
Identifier "Mali FBDEV"
Driver "armsoc"
Option "fbdev" "/dev/fb0"
Option "Fimg2DExa" "false"
Option "DRI2" "true"
Option "DRI2_PAGE_FLIP" "false"
Option "DRI2_WAIT_VSYNC" "true"
# Option "Fimg2DExaSolid" "false"
# Option "Fimg2DExaCopy" "false"
# Option "Fimg2DExaComposite" "false"
Option "SWcursorLCD" "false"
# Option "Debug" "true"
EndSection
Section "Screen"
Identifier "DefaultScreen"
Device "Mali FBDEV"
DefaultDepth 24
EndSection
Kindliness remind:
You could download the xorg-build.sh script on githubs