一. 安装桌面的前期准备
若之前为配置DNS文件,需要修改/etc/resolv.conf:
nameserver 8.8.8.8
nameserver 180.76.76.76
为了方便后续的安装包在chroot环境中下载,需要安装wget-1.19.4:
./configure --prefix=/usr \
--sysconfdir=/etc \
--with-ssl=openssl &&
make&&make install
还需要相应的证书才能够使用wget,安装推荐的make-ca-0.7:
install -vdm755 /etc/ssl/local &&
wget http://www.cacert.org/certs/root.crt &&
wget http://www.cacert.org/certs/class3.crt &&
openssl x509 -in root.crt -text -fingerprint -setalias "CAcert Class 1 root" \
-addtrust serverAuth -addtrust emailProtection -addtrust codeSigning \
> /etc/ssl/local/CAcert_Class_1_root.pem &&
openssl x509 -in class3.crt -text -fingerprint -setalias "CAcert Class 3 root" \
-addtrust serverAuth -addtrust emailProtection -addtrust codeSigning \
> /etc/ssl/local/CAcert_Class_3_root.pem
Ps:这一部分的命令需要在宿主环境下相应的make-ca目录下进行(wget在chroot下还无法使用)
安装:make install
还需要下载并更新证书仓库,执行命令:/usr/sbin/make-ca -g
此时使用wget可能会遇到问题:
Connecting to github.com|13.250.177.223|:443... connected.
ERROR: cannot verify github.com's certificate, issued by ‘CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
Unable to locally verify the issuer's authority.
To connect to github.com insecurely, use `--no-check-certificate'
解决方法,执行:
wget --no-check-certificate https://github.com/curl/curl/raw/master/lib/mk-ca-bundle.pl
perl mk-ca-bundle.pl && rm certdata.txt
mkdir -p ~/.ssl/ && mv ca-bundle.crt mk-ca-bundle.pl ~/.ssl
echo "ca_certificate = ~/.ssl/ca-bundle.crt" >> ~/.wgetrc
此时可以顺利在chroot环境下使用wget命令下载文件;
二. 安装X Window System环境(BLFS8.2 第24章)
提醒:桌面的安装的依赖关系极其错综复杂,各个包的相关依赖请自行参照BLFS8.2进行安装
首先要设置X Window环境安装需要的环境变量,将安装目录设置为/usr:
cat > /etc/profile.d/xorg.sh << EOF
XORG_PREFIX=/usr
XORG_CONFIG="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static"
export XORG_PREFIX XORG_CONFIG
EOF
chmod 644 /etc/profile.d/xorg.sh
注意:有很多包的安装过程中可能会出现使用32位架构和未知CPU架构的问题,若遇到需要在configure配置的时候添加:–with-abi=64 --target=mips64r2
安装util-macros-1.19.1;
./configure $XORG_CONFIG
make install
安装Xorg Protocol Headers,依赖util-macros-1.19.1:
需要先建立需要下载文件的列表md5:
cat > proto-7.md5 << "EOF"
1a05fb01fa1d5198894c931cf925c025 bigreqsproto-1.1.2.tar.bz2
98482f65ba1e74a08bf5b056a4031ef0 compositeproto-0.4.2.tar.bz2
998e5904764b82642cc63d97b4ba9e95 damageproto-1.2.1.tar.bz2
4ee175bbd44d05c34d43bb129be5098a dmxproto-2.3.1.tar.bz2
b2721d5d24c04d9980a0c6540cb5396a dri2proto-2.8.tar.bz2
a3d2cbe60a9ca1bf3aea6c93c817fee3 dri3proto-1.0.tar.bz2
e7431ab84d37b2678af71e29355e101d fixesproto-5.0.tar.bz2
36934d00b00555eaacde9f091f392f97 fontsproto-2.1.3.tar.bz2
5565f1b0facf4a59c2778229c1f70d10 glproto-1.4.17.tar.bz2
b290a463af7def483e6e190de460f31a inputproto-2.3.2.tar.bz2
94afc90c1f7bef4a27fdd59ece39c878 kbproto-1.0.7.tar.bz2
92f9dda9c870d78a1d93f366bcb0e6cd presentproto-1.1.tar.bz2
a46765c8dcacb7114c821baf0df1e797 randrproto-1.5.0.tar.bz2
1b4e5dede5ea51906f1530ca1e21d216 recordproto-1.14.2.tar.bz2
a914ccc1de66ddeb4b611c6b0686e274 renderproto-0.11.1.tar.bz2
cfdb57dae221b71b2703f8e2980eaaf4 resourceproto-1.2.0.tar.bz2
edd8a73775e8ece1d69515dd17767bfb scrnsaverproto-1.2.2.tar.bz2
fe86de8ea3eb53b5a8f52956c5cd3174 videoproto-2.3.3.tar.bz2
5f4847c78e41b801982c8a5e06365b24 xcmiscproto-1.2.2.tar.bz2
70c90f313b4b0851758ef77b95019584 xextproto-7.3.0.tar.bz2
120e226ede5a4687b25dd357cc9b8efe xf86bigfontproto-1.2.0.tar.bz2
a036dc2fcbf052ec10621fd48b68dbb1 xf86dgaproto-2.1.tar.bz2
1d716d0dac3b664e5ee20c69d34bc10e xf86driproto-2.1.1.tar.bz2
e793ecefeaecfeabd1aed6a01095174e xf86vidmodeproto-2.3.1.tar.bz2
9959fe0bfb22a0e7260433b8d199590a xineramaproto-1.2.1.tar.bz2
16791f7ca8c51a20608af11702e51083 xproto-7.0.31.tar.bz2
EOF
创建下载目录并下载proto文件群:
mkdir proto &&
cd proto &&
grep -v '^#' ../proto-7.md5 | awk '{print $2}' | wget -i- -c \
-B https://www.x.org/pub/individual/proto/ &&
md5sum -c ../proto-7.md5
执行命令安装:
bash -e //用来保证安装过程中若出错就跳出
for package in $(grep -v '^#' ../proto-7.md5 | awk '{print $2}')
do
packagedir=${package%.tar.bz2}
tar -xf $package
pushd $packagedir
./configure $XORG_CONFIG
as_root make install
popd
rm -rf $packagedir
done
安装libXau-1.0.8,依赖Xorg Protocol Headers:
./configure $XORG_CONFIG &&
make&&make install
安装libXdmcp-1.1.2,依赖Xorg Protocol Headers:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-proto-1.12,需要下载相应的patch:
patch -Np1 -i ../xcb-proto-1.12-schema-1.patch
patch -Np1 -i ../xcb-proto-1.12-python3-1.patch
./configure $XORG_CONFIG
make install
安装libxcb-1.12,需要下载patch:
patch -Np1 -i ../libxcb-1.12-python3-1.patch
sed -i "s/pthread-stubs//" configure &&
./configure $XORG_CONFIG \
--enable-xinput \
--without-doxygen \
--docdir='${datadir}'/doc/libxcb-1.12 &&
make&&make install
安装Xorg Libraries,依赖Fontconfig-2.12.6和libxcb-1.12,自行按照BLFS8.2安装依赖;建立Xorg库文件的下载列表:
cat > lib-7.md5 << "EOF"
c5ba432dd1514d858053ffe9f4737dd8 xtrans-1.3.5.tar.bz2
0f618db70c4054ca67cee0cc156a4255 libX11-1.6.5.tar.bz2
52df7c4c1f0badd9f82ab124fb32eb97 libXext-1.3.3.tar.bz2
d79d9fe2aa55eb0f69b1a4351e1368f7 libFS-1.0.7.tar.bz2
addfb1e897ca8079531669c7c7711726 libICE-1.0.9.tar.bz2
499a7773c65aba513609fe651853c5f3 libSM-1.2.2.tar.bz2
7a773b16165e39e938650bcc9027c1d5 libXScrnSaver-1.2.2.tar.bz2
8f5b5576fbabba29a05f3ca2226f74d3 libXt-1.1.5.tar.bz2
41d92ab627dfa06568076043f3e089e4 libXmu-1.1.2.tar.bz2
20f4627672edb2bd06a749f11aa97302 libXpm-3.5.12.tar.bz2
e5e06eb14a608b58746bdd1c0bd7b8e3 libXaw-1.0.13.tar.bz2
07e01e046a0215574f36a3aacb148be0 libXfixes-5.0.3.tar.bz2
f7a218dcbf6f0848599c6c36fc65c51a libXcomposite-0.4.4.tar.bz2
802179a76bded0b658f4e9ec5e1830a4 libXrender-0.9.10.tar.bz2
58fe3514e1e7135cf364101e714d1a14 libXcursor-1.1.15.tar.bz2
0cf292de2a9fa2e9a939aefde68fd34f libXdamage-1.1.4.tar.bz2
0920924c3a9ebc1265517bdd2f9fde50 libfontenc-1.1.3.tar.bz2
b7ca87dfafeb5205b28a1e91ac3efe85 libXfont2-2.0.3.tar.bz2
331b3a2a3a1a78b5b44cfbd43f86fcfe libXft-2.3.2.tar.bz2
1f0f2719c020655a60aee334ddd26d67 libXi-1.7.9.tar.bz2
9336dc46ae3bf5f81c247f7131461efd libXinerama-1.1.3.tar.bz2
28e486f1d491b757173dd85ba34ee884 libXrandr-1.5.1.tar.bz2
5d6d443d1abc8e1f6fc1c57fb27729bb libXres-1.2.0.tar.bz2
ef8c2c1d16a00bd95b9fdcef63b8a2ca libXtst-1.2.3.tar.bz2
210b6ef30dda2256d54763136faa37b9 libXv-1.0.11.tar.bz2
4cbe1c1def7a5e1b0ed5fce8e512f4c6 libXvMC-1.0.10.tar.bz2
d7dd9b9df336b7dd4028b6b56542ff2c libXxf86dga-1.1.4.tar.bz2
298b8fff82df17304dfdb5fe4066fe3a libXxf86vm-1.1.4.tar.bz2
ba983eba5a9f05d152a0725b8e863151 libdmx-1.1.3.tar.bz2
8f436e151d5106a9cfaa71857a066d33 libpciaccess-0.14.tar.bz2
4a4cfeaf24dab1b991903455d6d7d404 libxkbfile-1.0.9.tar.bz2
66662e76899112c0f99e22f2fc775a7e libxshmfence-1.2.tar.bz2
EOF
建立下载目录lib并进行下载:
mkdir lib &&
cd lib &&
grep -v '^#' ../lib-7.md5 | awk '{print $2}' | wget -i- -c \
-B https://www.x.org/pub/individual/lib/ &&
md5sum -c ../lib-7.md5
执行命令安装:
grep -A9 summary *make_check.log
bashfor package in $(grep -v '^#' ../lib-7.md5 | awk '{print $2}')
do
packagedir=${package%.tar.bz2}
tar -xf $package
pushd $packagedir
case $packagedir in
libxshmfence* )
./configure $XORG_CONFIG CFLAGS="$CFLAGS -D_GNU_SOURCE"
;;
libICE* )
./configure $XORG_CONFIG ICE_LIBS=-lpthread
;;
libXfont2-[0-9]* )
./configure $XORG_CONFIG --disable-devel-docs
;;
libXt-[0-9]* )
./configure $XORG_CONFIG \
--with-appdefaultdir=/etc/X11/app-defaults
;;
* )
./configure $XORG_CONFIG
;;
esac
make
#make check 2>&1 | tee ../$packagedir-make_check.log
as_root make install
popd
rm -rf $packagedir
as_root /sbin/ldconfig
done -e
配置xorg库:
ln -sv $XORG_PREFIX/lib/X11 /usr/lib/X11 &&
ln -sv $XORG_PREFIX/include/X11 /usr/include/X11
安装xcb-util-0.4.0,依赖libxcb-1.12:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-util-image-0.4.0,依赖xcb-util-0.4.0:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-util-keysyms-0.4.0,依赖libxcb-1.12:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-util-renderutil-0.3.9,依赖libxcb-1.12:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-util-wm-0.4.1,依赖libxcb-1.12:
./configure $XORG_CONFIG &&
make&&make install
安装xcb-util-cursor-0.1.3,依赖libxcb-1.12:
./configure $XORG_CONFIG &&
make&&make install
安装Mesa-17.3.4,依赖:Xorg Libraries, libdrm-2.4.89, Mako-1.0.4, and Python-2.7.14
需要注意的是Mesa3D库中的驱动安装依赖于LLVM,去到recommend下的LLVM-5.0.1进行安装,安装方法见BLFS;还推荐安装libvdpau(也在blfs mesa部分的recommend中),提供硬件加速,提高图像渲染能力;
设置需要安装的驱动,因为loongson3A3000使用的是AMD/ATI的显卡,安装AMD和ATI系的显卡即可:GLL_DRV="r600,radeonsi"
同时需要修改configure,在configure文件下查找“i915”,将case语句中的powerpc修改为mips,对应的驱动删掉swrast;(这是因为我们不需要除AMD/ATI系的dri)
配置安装:
./configure CFLAGS='-O2' CXXFLAGS='-O2' LDFLAGS=-lLLVM \
--prefix=$XORG_PREFIX \
--sysconfdir=/etc \
--enable-texture-float \
--enable-osmesa \
--enable-xa \
--enable-glx-tls \
--with-platforms="drm,x11,wayland" \
--with-gallium-drivers=$GLL_DRV \
--enable-llvm \
--enable-vdpau \&&
unset GLL_DRV &&
make&&make install
安装过程中可能遇到问题:
make[4]: Entering directory '/blfs/mesa-17.3.4/src/egl'
CCLD libEGL.la
./.libs/libEGL_common.a(egl_dri2.o): In function `dri2_query_wayland_buffer_wl':
egl_dri2.c:(.text+0x1138): undefined reference to `wayland_drm_buffer_get'
egl_dri2.c:(.text+0x1154): undefined reference to `wayland_drm_buffer_get'
./.libs/libEGL_common.a(egl_dri2.o): In function `dri2_unbind_wayland_display_wl':
egl_dri2.c:(.text+0x14f8): undefined reference to `wayland_drm_uninit'
egl_dri2.c:(.text+0x14fc): undefined reference to `wayland_drm_uninit'
./.libs/libEGL_common.a(egl_dri2.o): In function `dri2_bind_wayland_display_wl':
egl_dri2.c:(.text+0x15e8): undefined reference to `wayland_drm_init'
egl_dri2.c:(.text+0x15f8): undefined reference to `wayland_drm_init'
./.libs/libEGL_common.a(egl_dri2.o): In function `dri2_initialize':
egl_dri2.c:(.text+0x2518): undefined reference to `dri2_initialize_wayland'
egl_dri2.c:(.text+0x251c): undefined reference to `dri2_initialize_wayland'
./.libs/libEGL_common.a(egl_dri2.o): In function `dri2_display_destroy':
egl_dri2.c:(.text+0x3e88): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3e8c): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3e9c): undefined reference to `wl_proxy_marshal'
egl_dri2.c:(.text+0x3ea4): undefined reference to `wl_proxy_marshal'
egl_dri2.c:(.text+0x3eac): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3eb0): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3ec0): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3ec4): undefined reference to `wl_proxy_destroy'
egl_dri2.c:(.text+0x3ed4): undefined reference to `wl_proxy_destroy'
./.libs/libEGL_common.a(egl_dri2.o):egl_dri2.c:(.text+0x3ed8): more undefined references to `wl_proxy_destroy' follow
是wayland的安装有问题(见BLFS),重新安装即可;
安装xbitmaps-1.1.1,依赖util-macros-1.19.1:
./configure $XORG_CONFIG
make install
安装Xorg Application,依赖:libpng-1.6.34, Mesa-17.3.4, xbitmaps-1.1.1, and xcb-util-0.4.0:
创建Xorg Application的下载md5列表:
cat > app-7.md5 << "EOF"
25dab02f8e40d5b71ce29a07dc901b8c iceauth-1.0.7.tar.bz2
c4a3664e08e5a47c120ff9263ee2f20c luit-1.1.1.tar.bz2
18c429148c96c2079edda922a2b67632 mkfontdir-1.0.7.tar.bz2
9bdd6ebfa62b1bbd474906ac86a40fd8 mkfontscale-1.1.2.tar.bz2
e475167a892b589da23edf8edf8c942d sessreg-1.1.1.tar.bz2
2c47a1b8e268df73963c4eb2316b1a89 setxkbmap-1.3.1.tar.bz2
3a93d9f0859de5d8b65a68a125d48f6a smproxy-1.0.6.tar.bz2
f0b24e4d8beb622a419e8431e1c03cd7 x11perf-1.6.0.tar.bz2
f3f76cb10f69b571c43893ea6a634aa4 xauth-1.0.10.tar.bz2
0066f23f69ca3ef62dcaeb74a87fdc48 xbacklight-1.2.1.tar.bz2
9956d751ea3ae4538c3ebd07f70736a0 xcmsdb-1.0.5.tar.bz2
b58a87e6cd7145c70346adad551dba48 xcursorgen-1.0.6.tar.bz2
8809037bd48599af55dad81c508b6b39 xdpyinfo-1.3.2.tar.bz2
fceddaeb08e32e027d12a71490665866 xdriinfo-1.0.5.tar.bz2
249bdde90f01c0d861af52dc8fec379e xev-1.2.2.tar.bz2
90b4305157c2b966d5180e2ee61262be xgamma-1.0.6.tar.bz2
f5d490738b148cb7f2fe760f40f92516 xhost-1.0.7.tar.bz2
6a889412eff2e3c1c6bb19146f6fe84c xinput-1.6.2.tar.bz2
cc22b232bc78a303371983e1b48794ab xkbcomp-1.4.0.tar.bz2
c747faf1f78f5a5962419f8bdd066501 xkbevd-1.1.4.tar.bz2
502b14843f610af977dffc6cbf2102d5 xkbutils-1.0.4.tar.bz2
0ae6bc2a8d3af68e9c76b1a6ca5f7a78 xkill-1.0.4.tar.bz2
5dcb6e6c4b28c8d7aeb45257f5a72a7d xlsatoms-1.1.2.tar.bz2
9fbf6b174a5138a61738a42e707ad8f5 xlsclients-1.1.3.tar.bz2
2dd5ae46fa18abc9331bc26250a25005 xmessage-1.0.4.tar.bz2
723f02d3a5f98450554556205f0a9497 xmodmap-1.0.9.tar.bz2
6101f04731ffd40803df80eca274ec4b xpr-1.0.4.tar.bz2
fae3d2fda07684027a643ca783d595cc xprop-1.2.2.tar.bz2
ebffac98021b8f1dc71da0c1918e9b57 xrandr-1.5.0.tar.bz2
b54c7e3e53b4f332d41ed435433fbda0 xrdb-1.1.0.tar.bz2
a896382bc53ef3e149eaf9b13bc81d42 xrefresh-1.0.5.tar.bz2
dcd227388b57487d543cab2fd7a602d7 xset-1.2.3.tar.bz2
7211b31ec70631829ebae9460999aa0b xsetroot-1.1.1.tar.bz2
558360176b718dee3c39bc0648c0d10c xvinfo-1.1.3.tar.bz2
6b5d48464c5f366e91efd08b62b12d94 xwd-1.0.6.tar.bz2
b777bafb674555e48fd8437618270931 xwininfo-1.1.3.tar.bz2
3025b152b4f13fdffd0c46d0be587be6 xwud-1.0.4.tar.bz2
EOF
建立目录,进行下载:
mkdir app &&
cd app &&
grep -v '^#' ../app-7.md5 | awk '{print $2}' | wget -i- -c \
-B https://www.x.org/pub/individual/app/ &&
md5sum -c ../app-7.md5
安装集合:
bash -e
for package in $(grep -v '^#' ../app-7.md5 | awk '{print $2}')
do
packagedir=${package%.tar.bz2}
tar -xf $package
pushd $packagedir
case $packagedir in
luit-[0-9]* )
sed -i -e "/D_XOPEN/s/5/6/" configure
;;
esac
./configure $XORG_CONFIG
make
as_root make install
popd
rm -rf $packagedir
done
安装xcursor-themes-1.0.4,依赖Xorg Application:
./configure $XORG_CONFIG &&
make&&make install
安装Xorg Fonts,依赖xcursor-themes-1.0.4:
建立font字体的下载列表:
cat > font-7.md5 << "EOF"
23756dab809f9ec5011bb27fb2c3c7d6 font-util-1.3.1.tar.bz2
0f2d6546d514c5cc4ecf78a60657a5c1 encodings-1.0.4.tar.bz2
6d25f64796fef34b53b439c2e9efa562 font-alias-1.0.3.tar.bz2
fcf24554c348df3c689b91596d7f9971 font-adobe-utopia-type1-1.0.4.tar.bz2
e8ca58ea0d3726b94fe9f2c17344be60 font-bh-ttf-1.0.3.tar.bz2
53ed9a42388b7ebb689bdfc374f96a22 font-bh-type1-1.0.3.tar.bz2
bfb2593d2102585f45daa960f43cb3c4 font-ibm-type1-1.0.3.tar.bz2
6306c808f7d7e7d660dfb3859f9091d2 font-misc-ethiopic-1.0.3.tar.bz2
3eeb3fb44690b477d510bbd8f86cf5aa font-xfree86-type1-1.0.4.tar.bz2
EOF
建立目录并下载:
mkdir font &&
cd font &&
grep -v '^#' ../font-7.md5 | awk '{print $2}' | wget -i- -c \
-B https://www.x.org/pub/individual/font/ &&
md5sum -c ../font-7.md5
安装:
bash -e
for package in $(grep -v '^#' ../font-7.md5 | awk '{print $2}')
do
packagedir=${package%.tar.bz2}
tar -xf $package
pushd $packagedir
./configure $XORG_CONFIG
make
as_root make install
popd
as_root rm -rf $packagedir
done
创建必要链接:
install -v -d -m755 /usr/share/fonts &&
ln -svfn $XORG_PREFIX/share/fonts/X11/OTF /usr/share/fonts/X11-OTF &&
ln -svfn $XORG_PREFIX/share/fonts/X11/TTF /usr/share/fonts/X11-TTF
安装XKeyboardConfig-2.23.1,依赖Xorg Libraries:
./configure $XORG_CONFIG --with-xkb-rules-symlink=xorg &&
make&&make install
安装Xorg-Server-1.19.6,依赖:Pixman-0.34.0, and at runtime: Xorg Fonts and xkeyboard-config-2.23.1
配置编译:
./configure $XORG_CONFIG \
--enable-glamor \
--enable-install-setuid \
--enable-suid-wrapper \
--disable-systemd-logind \
--with-xkb-output=/var/lib/xkb &&
make
安装并配置:
make install &&
mkdir -pv /etc/X11/xorg.conf.d &&
cat >> /etc/sysconfig/createfiles << "EOF"
/tmp/.ICE-unix dir 1777 root root
/tmp/.X11-unix dir 1777 root root
EOF
安装Xorg Drivers,需要安装的驱动如下:
(1)libevdev-1.5.8,提供一些外设驱动的常用函数
(2)Xorg Evdev Driver-2.10.5,提供keyboard,mouse等的驱动
(3)Xorg AMDGPU Driver-1.4.0,提供AMD显卡的驱动
(4)Xorg ATI Driver-7.10.0,提供ATI显卡的驱动
(5)Xorg Fbdev Driver-0.4.4,为帧缓冲设备提供视频驱动
安装twm-1.0.9,依赖Xorg-Server-1.19.6:
sed -i -e '/^rcdir =/s,^\(rcdir = \).*,\1/etc/X11/app-defaults,' src/Makefile.in &&
./configure $XORG_CONFIG &&
make&&make install
安装xterm-331,依赖Xorg Application:
sed -i '/v0/{n;s/new:/new:kb=^?:/}' termcap &&
printf '\tkbs=\\177,\n' >> terminfo &&
TERMINFO=/usr/share/terminfo \
./configure $XORG_CONFIG \
--with-app-defaults=/etc/X11/app-defaults &&
make
安装:
make install &&
make install-ti
配置xterm:
cat >> /etc/X11/app-defaults/XTerm << "EOF"
*VT100*locale: true
*VT100*faceName: Monospace
*VT100*faceSize: 10
*backarrowKeyIsErase: true
*ptyInitialErase: true
EOF
安装xclock-1.0.7,依赖Xorg Libraries:
./configure $XORG_CONFIG &&
make&&make install
安装xinit-1.3.4,依赖Xorg Libraries:
sed -e '/$serverargs $vtarg/ s/serverargs/: #&/' \
-i startx.cpp
./configure $XORG_CONFIG --with-xinitdir=/etc/X11/app-defaults &&
make
make install &&
ldconfig
到此若一切顺利,即完成了X window 环境的配置,在lfs操作系统下执行startx即可进入最简单的图形化界面;若出现问题,可能需要:
(1) 添加/etc/os-release文件
cat > /etc/os-release << "EOF"
NAME="Linux From Scratch"
VERSION="8.2 "
ID=lfs
PRETTY_NAME="Linux From Scratch 8.2"
EOF
可以自定义
(2) 检查/etc/inittab文件是否出现问题
(3) 编译的时候添加参数:–target=mips64r2,-with-abi=63
三. 安装X 库
安装ATK-2.26.1,依赖Glib-2.54.3:
mkdir build &&
cd build &&
meson --prefix=/usr &&
ninja&& ninja install
安装Atkmm-2.24.2,依赖:ATK-2.26.1 and GLibmm-2.54.1
sed -e '/^libdocdir =/ s/$(book_name)/atkmm-2.24.2/' \
-i doc/Makefile.in
./configure --prefix=/usr &&
make&&make install
安装at-spi2-core-2.26.2,依赖dbus-1.12.4, GLib-2.54.3, and Xorg Libraries:
./configure --prefix=/usr \
--sysconfdir=/etc &&
make&&make install
安装at-spi2-atk-2.26.1,依赖:at-spi2-core-2.26.2 and ATK-2.26.1
./configure --prefix=/usr &&
make&&make install
安装Cairo-1.14.12,依赖:libpng-1.6.34 and Pixman-0.34.0
./configure --prefix=/usr \
--disable-static \
--enable-tee &&
make&&make install
安装Cairomm-1.12.2,依赖:Cairo-1.14.12 and libsigc+±2.10.0:
sed -e '/^libdocdir =/ s/$(book_name)/cairomm-1.12.2/' \
-i docs/Makefile.in
./configure --prefix=/usr &&
make&&make install
安装Cogl-1.22.2,依赖:Cairo-1.14.12, gdk-pixbuf-2.36.11, GLU-9.0.0, Mesa-17.3.4, and Pango-1.40.14
sed -i 's/^#if COGL/#ifdef COGL/' cogl/winsys/cogl-winsys-egl.c &&
./configure --prefix=/usr --enable-gles1 --enable-gles2 &&
make&&make install
安装Clutter-1.26.2,依赖:ATK-2.26.1, Cogl-1.22.2, and JSON-GLib-1.4.2
./configure --prefix=/usr --sysconfdir=/etc --enable-egl-backend &&
make&& make install
跳到GTK±2.24.32的安装,依赖:ATK-2.26.1, gdk-pixbuf-2.36.11 and Pango-1.40.14
sed -e 's#l \(gtk-.*\).sgml#& -o \1#' \
-i docs/{faq,tutorial}/Makefile.in &&
./configure --prefix=/usr --sysconfdir=/etc &&
make
安装GTK±3.22.28,依赖:at-spi2-atk-2.26.1, gdk-pixbuf-2.36.11, libepoxy-1.4.3, Pango-1.40.14, and six-1.11.0
./configure --prefix=/usr \
--sysconfdir=/etc \
--enable-broadway-backend \
--enable-x11-backend \
--enable-wayland-backend &&
make&&make install
安装显示管理器lightdm-1.24.0,依赖:GTK±3.22.28, libgcrypt-1.8.2, Linux-PAM-1.3.0, and PCRE-8.41
添加lightdm的daeom进程用户:
groupadd -g 65 lightdm &&
useradd -c "Lightdm Daemon" \
-d /var/lib/lightdm \
-u 65 -g lightdm \
-s /bin/false lightdm
安装:
ITSTOOL=/bin/true \
./configure \
--prefix=/usr \
--libexecdir=/usr/lib/lightdm \
--localstatedir=/var \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--disable-static \
--disable-tests \
--with-greeter-user=lightdm \
--with-greeter-session=lightdm-gtk-greeter \
--docdir=/usr/share/doc/lightdm-1.24.0 &&
make
make install &&
sed '\@/bin/sh@a\
\
. /etc/profile' tests/src/lightdm-session > /usr/bin/lightdm-session &&
chmod a+x /usr/bin/lightdm-session &&
rm -rf /etc/init &&
install -v -dm755 -o lightdm -g lightdm /var/lib/lightdm &&
install -v -dm755 -o lightdm -g lightdm /var/lib/lightdm-data &&
install -v -dm755 -o lightdm -g lightdm /var/cache/lightdm &&
install -v -dm770 -o lightdm -g lightdm /var/log/lightdm
继续安装lightdm的greeter:
tar -xf ../lightdm-gtk-greeter-2.0.3.tar.gz &&
cd lightdm-gtk-greeter-2.0.3 &&
OUR_CFLAGS="-Wno-declaration-after-statement \
-Wno-error=deprecated-declarations" &&
CFLAGS="$CFLAGS $OUR_CFLAGS" \
HAVE_EXO_CSOURCE=yes \
./configure \
--prefix=/usr \
--libexecdir=/usr/lib/lightdm \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--with-libxklavier \
--enable-kill-on-sigterm \
--disable-libido \
--disable-libindicator \
--disable-static \
--docdir=/usr/share/doc/lightdm-gtk-greeter-2.0.3 &&
make&&make install
安装greeter的时候可能遇到问题:
greeterbackground.c:1637:38: error: cast increases required alignment of target type [-Werror=cast-align]
Pixmap xrootpmap = *((Pixmap *) data_root);
^
greeterbackground.c:1638:41: error: cast increases required alignment of target type [-Werror=cast-align]
Pixmap esetrootpmap = *((Pixmap *) data_esetroot);
将目录下的Makefile修改,删掉Werro=cast-align的相关内容,在greeter目录下的src做相同操作;即可,成功安装lightdm
希望开机的时候就是lightdm的图形化登录界面,需要下载:blfs-bootscripts-20180105(见BLFS8.2),进入解压目录,执行:make install-lightdm;还需要将开机的runlevel由3设置到5:
cp -v /etc/inittab{,-orig} &&
sed -i '/initdefault/ s/3/5/' /etc/inittab
安装窗口管理器Fluxbox-1.3.7,依赖X Window System:
./configure --prefix=/usr &&
make&& make install
四. 安装轻量级桌面LXDE
安装lxmenu-data-0.15,无依赖,安装:
./configure --prefix=/usr --sysconfdir=/etc &&
make&&make install
安装libfm-extra-1.2.5,依赖GLib-2.54.3:
./configure --prefix=/usr \
--sysconfdir=/etc \
--with-extra-only \
--with-gtk=no \
--disable-static &&
make&&make install
安装menu-cache-1.1.0,依赖libfm-extra-1.2.5:
./configure --prefix=/usr \
--disable-static &&
make&&make install
安装libfm-1.2.5,依赖GTK±2.24.32 and menu-cache-1.1.0:
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static &&
make&&make install
安装PCManFM-1.2.5,依赖libfm-1.2.5:
./configure --prefix=/usr --sysconfdir=/etc &&
make&&make install
安装LXPanel-0.9.3,依赖keybinder-0.3.0, libwnck-2.30.7, lxmenu-data-0.1.5 and menu-cache-1.1.0:
在安装依赖keybinder-0.3.0可能会遇到问题:
CC _keybinder_la-_keybindermodule.lo
/usr/bin/pygtk-codegen-2.0: line 7: /dev/stderr: No such file or directory
/usr/bin/pygtk-codegen-2.0: line 8: /dev/stderr: No such file or directory
Traceback (most recent call last):
File "/usr/share/pygobject/2.0/codegen/codegen.py", line 1722, in <module>
sys.exit(main(sys.argv))
File "/usr/share/pygobject/2.0/codegen/codegen.py", line 1680, in main
p.startParsing()
File "/usr/share/pygobject/2.0/codegen/scmexpr.py", line 113, in startParsing
for statement in statements:
File "/usr/share/pygobject/2.0/codegen/scmexpr.py", line 27, in parse
fp = open(filename, 'r')
IOError: [Errno 2] No such file or directory: '/usr/share/pygtk/2.0/defs/gtk-types.defs'
因为在安装pygtk的时候还需要pycairo和gtk+2才能安装是gtk.unixprint模块,因此需要回到pygtk重新安装;
安装LXAppearance-0.6.3,依赖GTK±2.24.32:
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static \
--enable-dbus &&
make&&make install
安装LXSession-0.5.3,依赖:dbus-glib-0.110, libunique-1.1.6, lsb_release-1.4 (runtime for lxde-logout so it does not crash), Polkit-0.113+git_2919920+js38, and Vala-0.38.8
在安装依赖关系中的mozjs的时候,可能会遇到问题:
checking Python environment is Mozilla virtualenv... Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/blfs/mozjs-38.0.0/python/mozbuild/mozbuild/base.py", line 17, in <module>
from mach.mixin.process import ProcessExecutionMixin
File "/blfs/mozjs-38.0.0/python/mach/mach/mixin/process.py", line 29, in <module>
raise Exception('Could not detect environment shell!')
Exception: Could not detect environment shell!
configure: error: Python environment does not appear to be sane.
原因是缺少了SHELL环境变量,这个大家应该都知道SHELL环境变量是作为当前系统中默认使用的shell脚本所在地址的,一般sh也是指向bash,执行:export SHELL=/bin/bash
make的时候可能遇到问题:
/blfs/mozjs-38.0.0/js/src/jit/Registers.h:24:3: error: #error "Unknown architecture!"
# error "Unknown architecture!"
/blfs/mozjs-38.0.0/js/src/jit/Registers.h:25:3: error: #error "Unknown architecture!"
./../dist/include/js/Value.h: At global scope:
../../dist/include/js/Utility.h:53:42: error: static assertion failed: JS_STATIC_ASSERT
#define JS_STATIC_ASSERT(cond) static_assert(cond, "JS_STATIC_ASSERT")
^
../../dist/include/js/Value.h:358:1: note: in expansion of macro ‘JS_STATIC_ASSERT’
JS_STATIC_ASSERT(sizeof(jsval_layout) == 8);
^~~~~~~~~~~~~~~~
../../dist/include/js/Value.h: In member function ‘void JS::Value::staticAssertions()’:
../../dist/include/js/Utility.h:53:42: error: static assertion failed: JS_STATIC_ASSERT
#define JS_STATIC_ASSERT(cond) static_assert(cond, "JS_STATIC_ASSERT")
具体分析见博客:
在mips64el下,mozjs会错误地识别js的布局值jsval_layout32。在Value.h头文件中,使用静态断言对系统的编译环境进行判断,识别jsval_layout值出错。
解决方法:
在js目录下修改configure.in中的case语句,修改JS_NUNBOX32为JS_PUNBOX64,让在编译过程中识别64位的jsval_layout.
同时还需要在配置选项中添加:--target=mips64r2
安装完相关依赖之后,再安装Lxsession:
./configure --prefix=/usr --disable-man &&
make&&make install
安装lxde-common-0.99.2,依赖:lxde-icon-theme-0.5.1, LXPanel-0.9.3, LXSession-0.5.3, openbox-3.6.1 (runtime), and PCManFM-1.2.5
./configure --prefix=/usr --sysconfdir=/etc &&
make&&make install
若一切顺利,自此就已成功安装LXDE桌面,但是还有一些小问题需要解决:
(1)普通用户无法直接登录图形化界面,需要使用下述语句才能够创建能登陆图形化界面的用户:useradd -s /bin/bash -d /home/dslab -m dslab
(2)网卡问题,需要修改/etc/sysconfig/ifconfig.eth0文件(推荐在/etc/udev/rules.d/目录下创建70-persistent-net.rules文件);但是开机的时候需要花费很长的时间来检查网卡,原因可能是缺失一个驱动补丁:机器无法找到/lib/firmware下的rtl_nic/rtl8168e-3.fw补丁;去到http://anduin.linuxfromscratch.org/BLFS/linux-firmware/rtl_nic/ 下载即可;
(3)dbus问题,进程间无法建立通信,同样需要在blfs-bootscript下安装dbus的开机daemon
(4)需要安装ConsoleKit,因为需要命令 ck-launch-session命令来启动lxde
(5)lightdm进程报出数个WARNING:
**Failed to get list of logind seats:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkown:The name org.freedesktop.login1 was not provided by any .service files
**Error getting user list from org.freedesktop.Accounts:GDBus.Error:org.freedesktop.DBus.Error.ServiceUnkown:The name org.freedesktop.Accounts was not provided by any .service files
**assertion 'G_IS_OBJECT(object)' failed
这些WARNING并不影响整个OS的使用,仅再lightdm图形化登录界面启动时出现,通过在grub.cfg文件中添加rhgb quiet选项即可不再在OS启动时输出信息;
在使用固态硬盘的情况下,整个OS的开机时间在10秒左右;