标签:try build 计算 open link 64位 gconf static 时区
六、构建LFS系统1.准备虚拟内核文件系统
1)创建将挂载文件系统的目录:
mkdir -pv $LFS/{dev,proc,sys,run}
2)创建设备节点:
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
3)安装和填充/开发:
mount -v --bind /dev $LFS/dev
4)挂载虚拟内核文件系统:
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
5)创建shm目录
if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
2.进入Chroot环境
chroot "$LFS" /tools/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1=‘(lfs chroot) \u:\w\$ ‘ \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h
3.创建目录
mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -v /usr/libexec
mkdir -pv /usr/{,local/}share/man/man{1..8}
case $(uname -m) in
x86_64) mkdir -v /lib64 ;;
esac
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}
4.创建基本文件和符号链接
ln -sv /tools/bin/{bash,cat,dd,echo,ln,pwd,rm,stty} /bin
ln -sv /tools/bin/{env,install,perl} /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib
for lib in blkid lzma mount uuid
do
ln -sv /tools/lib/lib$lib.so* /usr/lib
done
ln -svf /tools/include/blkid /usr/include
ln -svf /tools/include/libmount /usr/include
ln -svf /tools/include/uuid /usr/include
install -vdm755 /usr/lib/pkgconfig
for pc in blkid mount uuid
do
sed ‘s@tools@usr@g‘ /tools/lib/pkgconfig/${pc}.pc \
/usr/lib/pkgconfig/${pc}.pc
done
ln -sv bash /bin/sh
ln -sv /proc/self/mounts /etc/mtab
5.创建passwd文件:
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
systemd-journal:x:23:
input:x:24:
mail:x:34:
nogroup:x:99:
users:x:999:
EOF
6.去掉提示符的I have no name提示及创建日志文件:
exec /tools/bin/bash --login +h
touch /var/log/{btmp,lastlog,faillog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog
chmod -v 600 /var/log/btmp
cd /sources
7.Linux-4.18.5 API内核头文件
tar xvf linux-4.18.5.tar.xz
cd linux-4.18.5
make mrproper
make INSTALL_HDR_PATH=dest headers_install
find dest/include ( -name .install -o -name ..install.cmd ) -delete
cp -rv dest/include/* /usr/include
cd ..
rm -rf linux-4.18.5
8.Man-pages-4.16
tar xvf man-pages-4.16.tar.xz
cd man-pages-4.16
make install
cd ..
rm -rf man-pages-4.16
9.glibc-2.28
tar xvf glibc-2.28.tar.xz
cd glibc-2.28
patch -Np1 -i ../glibc-2.28-fhs-1.patch
ln -sfv /tools/lib/gcc /usr/lib
为x86_64,创建动态加载程序正常运行所需的兼容性符号链接:
case $(uname -m) in
i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/8.2.0/include
ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3
;;
x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include
ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64
ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
;;
esac
rm -f /usr/include/limits.h
mkdir -v build
cd build
CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=3.2 \
--enable-stack-protector=strong \
libc_cv_slibdir=/lib
unset GCC_INCDIR
make && make check
touch /etc/ld.so.conf
sed ‘/test-installation/s@$(PERL)@echo not running@‘ -i ../Makefile
make install
cp -v ../nscd/nscd.conf /etc/nscd.conf
mkdir -pv /var/cache/nscd
mkdir -pv /usr/lib/locale
make localedata/install-locales
创建nsswitch.conf文件:
cat > /etc/nsswitch.conf << "EOF"
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
EOF
添加时区数据:
tar -xf ../../tzdata2018e.tar.gz
ZONEINFO=/usr/share/zoneinfo
mkdir -pv $ZONEINFO/{posix,right}
for tz in etcetera southamerica northamerica europe africa antarctica \
asia australasia backward pacificnew systemv; do
zic -L /dev/null -d $ZONEINFO -y "sh yearistype.sh" ${tz}
zic -L /dev/null -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
done
cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
zic -d $ZONEINFO -p America/New_York
unset ZONEINFO
确定本地时区:
tzselect //回答(4、9、1、1)
cp -v /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
创建ld.so.conf文件:
cat > /etc/ld.so.conf << "EOF"
/usr/local/lib
/opt/lib
EOF
cat >> /etc/ld.so.conf << "EOF"
include /etc/ld.so.conf.d/*.conf
EOF
mkdir -pv /etc/ld.so.conf.d
cd ../..
rm -rf glibc-2.28
10.调整工具链
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld
gcc -dumpspecs | sed -e ‘s@/tools@@g‘ \
-e ‘/*startfile_prefix_spec:/{n;s@.@/usr/lib/ @}‘ \
-e ‘/*cpp:/{n;s@$@ -isystem /usr/include@}‘ > \dirname $(gcc --print-libgcc-file-name)
/specs
echo ‘int main(){}‘ > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ‘: /lib‘
64位输出:
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
32位输出:
[Requesting program interpreter: /lib/ld-linux.so.2]
确保设置使用正确的启动文件运行:
grep -o ‘/usr/lib./crt[1in].succeeded‘ dummy.log
输出:
/usr/lib/../lib/crt1.o succeeded
/usr/lib/../lib/crti.o succeeded
/usr/lib/../lib/crtn.o succeeded
是否正在搜索正确的头文件运行:
grep -B1 ‘^ /usr/include‘ dummy.log
输出:
#include <...> search starts here:
/usr/include
新链接器是否正确的搜索路径运行:
grep ‘SEARCH./usr/lib‘ dummy.log |sed ‘s|; |\n|g‘
输出:
SEARCH_DIR("=/tools/x86_64-pc-linux-gnu/lib64")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("=/tools/x86_64-pc-linux-gnu/lib");
使用正确的libc运行:
grep "/lib.*/libc.so.6 " dummy.log
输出:
attempt to open /lib/libc.so.6 succeeded
GCC使用正确的动态链接器运行:
grep found dummy.log
输出:
found ld-linux-x86-64.so.2 at /lib/ld-linux-x86-64.so.2
rm -v dummy.c a.out dummy.log
11.zlib-1.2.11
tar xvf zlib-1.2.11.tar.xz
cd zlib-1.2.11
./configure --prefix=/usr
make && make check
make install
mv -v /usr/lib/libz.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
cd ..
rm -rf zlib-1.2.11
12.file-5.34
tar xvf file-5.34.tar.gz
cd file-5.34
./configure --prefix=/usr
make && make check
make install
cd ..
rm -rf file-5.34
13.Readline-7.0
tar xvf readline-7.0.tar.gz
cd readline-7.0
sed -i ‘/MV.old/d‘ Makefile.in
sed -i ‘/{OLDSUFF}/c:‘ support/shlib-install
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/readline-7.0
make SHLIB_LIBS="-L/tools/lib -lncursesw"
make SHLIB_LIBS="-L/tools/lib -lncurses" install
mv -v /usr/lib/lib{readline,history}.so. /lib
chmod -v u+w /lib/lib{readline,history}.so.
ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so
ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so
install -v -m644 doc/.{ps,pdf,html,dvi} /usr/share/doc/readline-7.0
cd ..
rm -rf readline-7.0
14.M4-1.4.18
tar xvf m4-1.4.18.tar.xz
cd m4-1.4.18
sed -i ‘s/IO_ftrylockfile/IO_EOF_SEEN/‘ lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/usr
make && make check
make install
cd ..
rm -rf m4-1.4.18
15.BC-1.07.1
tar xvf bc-1.07.1.tar.gz
cd bc-1.07.1
cat > bc/fix-libmath_h << "EOF"
#! /bin/bash
sed -e ‘1 s/^/{"/‘ \
-e ‘s/$/",/‘ \
-e ‘2,$ s/^/"/‘ \
-e ‘$ d‘ \
-i libmath.h
sed -e ‘$ s/$/0}/‘ \
-i libmath.h
EOF
ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6
ln -sfv libncurses.so.6 /usr/lib/libncurses.so
sed -i -e ‘/flex/s/as_fn_error/: ;; # &/‘ configure
./configure --prefix=/usr \
--with-readline \
--mandir=/usr/share/man \
--infodir=/usr/share/info
make
echo "quit" | ./bc/bc -l Test/checklib.b
make install
cd ..
rm -rf bc-1.07.1
16.Binutils-2.31.1
tar xvf binutils-2.31.1.tar.xz
cd binutils-2.31.1
mkdir -v build
cd build
../configure --prefix=/usr \
--enable-gold \
--enable-ld=default \
--enable-plugins \
--enable-shared \
--disable-werror \
--enable-64-bit-bfd \
--with-system-zlib
make tooldir=/usr
make -k check
make tooldir=/usr install
cd ../..
rm -rf binutils-2.31.1
17.GMP-6.1.2
make && make html
make check 2>&1 | tee gmp-check-log
确保测试套件中的190个测试都通过:
awk ‘/# PASS:/{total+=$3} ; END{print total}‘ gmp-check-log
以上命令会输出如下结果:
make install && make install-html
cd ..
rm -rf gmp-6.1.2
18.MPFR-4.0.1
tar xvf mpfr-4.0.1.tar.xz
cd mpfr-4.0.1
./configure --prefix=/usr \
--disable-static \
--enable-thread-safe \
--docdir=/usr/share/doc/mpfr-4.0.1
make
make html && make check
make install && make install-html
cd ..
rm -rf mpfr-4.0.1
19.MPC-1.1.0
tar xvf mpc-1.1.0.tar.gz
cd mpc-1.1.0
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/mpc-1.1.0
make
make html && make check
make install && make install-html
cd ..
rm -rf mpc-1.1.0
20.shadow-4.6
tar xvf shadow-4.6.tar.xz
cd shadow-4.6
sed -i ‘s/groups$(EXEEXT) //‘ src/Makefile.in
find man -name Makefile.in -exec sed -i ‘s/groups.1 / /‘ {} \;
find man -name Makefile.in -exec sed -i ‘s/getspnam.3 / /‘ {} \;
find man -name Makefile.in -exec sed -i ‘s/passwd.5 / /‘ {} \;
sed -i -e ‘s@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@‘ \
-e ‘s@/var/spool/mail@/var/mail@‘ etc/login.defs
sed -i ‘s/1000/999/‘ etc/useradd
./configure --sysconfdir=/etc --with-group-name-max-length=32
make && make install
mv -v /usr/bin/passwd /bin
配置shadow:
启用密码:
pwconv
启用组密码:
grpconv
设置root密码:
passwd root
cd ..
rm -rf shadow-4.6
21.GCC-8.2.0
tar xvf gcc-8.2.0.tar.xz
cd gcc-8.2.0
x86_64上构建LFS:
case $(uname -m) in
x86_64)
sed -e ‘/m64=/s/lib64/lib/‘ \
-i.orig gcc/config/i386/t-linux64
;;
esac
rm -f /usr/lib/gcc
mkdir -v build
cd build
SED=sed \
../configure --prefix=/usr \
--enable-languages=c,c++ \
--disable-multilib \
--disable-bootstrap \
--disable-libmpx \
--with-system-zlib
make
ulimit -s 32768
rm ../gcc/testsuite/g++.dg/pr83239.C
chown -Rv nobody .
su nobody -s /bin/bash -c "PATH=$PATH make -k check"
../contrib/test_summary
make install
ln -sv ../usr/bin/cpp /lib
ln -sv gcc /usr/bin/cc
install -v -dm755 /usr/lib/bfd-plugins
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/8.2.0/liblto_plugin.so \
/usr/lib/bfd-plugins/
测试最终工具链:
echo ‘int main(){}‘ > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ‘: /lib‘
输出结果:
grep -o ‘/usr/lib./crt[1in].succeeded‘ dummy.log
输出结果:
grep -B4 ‘^ /usr/include‘ dummy.log
输出结果:
grep ‘SEARCH./usr/lib‘ dummy.log |sed ‘s|; |\n|g‘
64位系统输出结果:
grep "/lib./libc.so.6 " dummy.log
输出结果:
grep found dummy.log
输出结果:
mkdir -pv /usr/share/gdb/auto-load/usr/lib
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
cd ../..
rm -rf gcc-8.2.0
22.bzip2-1.0.6
tar xvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch
sed -i ‘s@(ln -s -f )$(PREFIX)/bin/@\1@‘ Makefile
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
make -f Makefile-libbz2_so
make clean
make && make PREFIX=/usr install
cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
rm -v /usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 /bin/bunzip2
ln -sv bzip2 /bin/bzcat
cd ..
rm -rf bzip2-1.0.6
23.pkg-config-0.29.2
tar xvf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --prefix=/usr \
--with-internal-glib \
--disable-host-tool \
--docdir=/usr/share/doc/pkg-config-0.29.2
make && make check
make install
cd ..
rm -rf pkg-config-0.29.2
24.ncurses-6.1
tar xvf ncurses-6.1.tar.gz
cd ncurses-6.1
sed -i ‘/LIBTOOL_INSTALL/d‘ c++/Makefile.in
./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec
make && make install
mv -v /usr/lib/libncursesw.so.6 /lib
ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so
for lib in ncurses form panel menu ; do
rm -vf /usr/lib/lib${lib}.so
echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
done
rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
mkdir -v /usr/share/doc/ncurses-6.1
cp -v -R doc/ /usr/share/doc/ncurses-6.1
make distclean
./configure --prefix=/usr \
--with-shared \
--without-normal \
--without-debug \
--without-cxx-binding \
--with-abi-version=5
make sources libs
cp -av lib/lib.so.5 /usr/lib
cd ..
rm -rf ncurses-6.1
tar xvf attr-2.4.48.tar.gz
cd attr-2.4.48
./configure --prefix=/usr \
--bindir=/bin \
--disable-static \
--sysconfdir=/etc \
--docdir=/usr/share/doc/attr-2.4.48
make && make check
make install
mv -v /usr/lib/libattr.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so
cd ..
rm -rf attr-2.4.48
tar xvf acl-2.2.53.tar.gz
cd acl-2.2.53
./configure --prefix=/usr \
--bindir=/bin \
--disable-static \
--libexecdir=/usr/lib \
--docdir=/usr/share/doc/acl-2.2.53
make && make install
mv -v /usr/lib/libacl.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so
cd ..
rm -rf acl-2.2.53
27.libcap-2.25
tar xvf libcap-2.25.tar.xz
cd libcap-2.25
sed -i ‘/install.STALIBNAME/d‘ libcap/Makefile
make
make RAISE_SETFCAP=no lib=lib prefix=/usr install
chmod -v 755 /usr/lib/libcap.so
mv -v /usr/lib/libcap.so. /lib
ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so
cd ..
rm -rf libcap-2.25
tar xvf sed-4.5.tar.xz
cd sed-4.5
sed -i ‘s/usr/tools/‘ build-aux/help2man
sed -i ‘s/testsuite.panic-tests.sh//‘ Makefile.in
./configure --prefix=/usr --bindir=/bin
make && make html && make check
make install
install -d -m755 /usr/share/doc/sed-4.5
install -m644 doc/sed.html /usr/share/doc/sed-4.5
cd ..
rm -rf sed-4.5
tar xvf psmisc-23.1.tar.xz
cd psmisc-23.1
./configure --prefix=/usr
make && make install
mv -v /usr/bin/fuser /bin
mv -v /usr/bin/killall /bin
cd ..
rm -rf psmisc-23.1
tar xvf iana-etc-2.30.tar.bz2
cd iana-etc-2.30
make && make install
cd ..
rm -rf iana-etc-2.30
tar xvf bison-3.0.5.tar.xz
cd bison-3.0.5
./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.0.5
make && make install
cd ..
rm -rf bison-3.0.5
tar xvf flex-2.6.4.tar.gz
cd flex-2.6.4
sed -i "/math.h/a #include <malloc.h>" src/flexdef.h
HELP2MAN=/tools/bin/true \
./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.6.4
make && make check
make install
ln -sv flex /usr/bin/lex
cd ..
rm -rf flex-2.6.4
tar xvf grep-3.1.tar.xz
cd grep-3.1
./configure --prefix=/usr --bindir=/bin
make && make -k check
make install
cd ..
rm -rf grep-3.1
tar xvf bash-4.4.18.tar.gz
cd bash-4.4.18
./configure --prefix=/usr \
--docdir=/usr/share/doc/bash-4.4.18 \
--without-bash-malloc \
--with-installed-readline
make
chown -Rv nobody .
su nobody -s /bin/bash -c "PATH=$PATH make tests"
make install
mv -vf /usr/bin/bash /bin
exec /bin/bash --login +h
cd ..
rm -rf bash-4.4.18
tar xvf libtool-2.4.6.tar.xz
cd libtool-2.4.6
./configure --prefix=/usr
make && make -j8 check //我是4个核心,所以写-j8,根据你的实际情况改一下,测试会有错误。不用管它,继续安装。错误如下:
make install
cd ..
rm -rf libtool-2.4.6
tar xvf gdbm-1.17.tar.gz
cd gdbm-1.17
./configure --prefix=/usr \
--disable-static \
--enable-libgdbm-compat
make && make check
make install
cd ..
rm -rf gdbm-1.17
tar xvf gperf-3.1.tar.gz
cd gperf-3.1
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1
make && make -j1 check
make install
cd ..
rm -rf gperf-3.1
tar xvf expat-2.2.6.tar.bz2
cd expat-2.2.6
sed -i ‘s|usr/bin/env |bin/|‘ run.sh.in
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/expat-2.2.6
make && make check
make install
install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.2.6
cd ..
rm -rf expat-2.2.6
tar xvf inetutils-1.9.4.tar.xz
cd inetutils-1.9.4
./configure --prefix=/usr \
--localstatedir=/var \
--disable-logger \
--disable-whois \
--disable-rcp \
--disable-rexec \
--disable-rlogin \
--disable-rsh \
--disable-servers
make && make check
make install
mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin
mv -v /usr/bin/ifconfig /sbin
cd ..
rm -rf inetutils-1.9.4
40.Perl-5.28.0
tar xvf perl-5.28.0.tar.xz
cd perl-5.28.0
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
export BUILD_ZLIB=False
export BUILD_BZIP2=0
sh Configure -des -Dprefix=/usr \
-Dvendorprefix=/usr \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dpager="/usr/bin/less -isR" \
-Duseshrplib \
-Dusethreads
make && make -k test
make install
unset BUILD_ZLIB BUILD_BZIP2
cd ..
rm -rf perl-5.28.0
41.XML::Parser-2.44
tar xvf XML-Parser-2.44.tar.gz
cd XML-Parser-2.44
perl Makefile.PL \
make && make test
make install
cd ..
rm -rf XML-Parser-2.44
42.Intltool-0.51.0
tar xvf intltool-0.51.0.tar.gz
cd intltool-0.51.0
sed -i ‘s:\\${:\\$\{:‘ intltool-update.in
./configure --prefix=/usr
make && make check
make install
install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
cd ..
rm -rf intltool-0.51.0
tar xvf autoconf-2.69.tar.xz
cd autoconf-2.69
./configure --prefix=/usr
make
make check
make install
cd ..
rm -rf autoconf-2.69
tar xvf automake-1.16.1.tar.xz
cd automake-1.16.1
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.1
make
make -j4 check
make install
cd ..
rm -rf automake-1.16.1
45.XZ-5.2.4
tar xvf xz-5.2.4.tar.xz
cd xz-5.2.4
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/xz-5.2.4
make && make check
make install
mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin
mv -v /usr/lib/liblzma.so.* /lib
ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so
cd ..
rm -rf xz-5.2.4
46.KMOD-25
tar xvf kmod-25.tar.xz
cd kmod-25
./configure --prefix=/usr \
--bindir=/bin \
--sysconfdir=/etc \
--with-rootlibdir=/lib \
--with-xz \
--with-zlib
make && make install
for target in depmod insmod lsmod modinfo modprobe rmmod; do
ln -sfv ../bin/kmod /sbin/$target
done
ln -sfv kmod /bin/lsmod
cd ..
rm -rf kmod-25
47.Gettext-0.19.8.1
tar xvf gettext-0.19.8.1.tar.xz
cd gettext-0.19.8.1
sed -i ‘/^TESTS =/d‘ gettext-runtime/tests/Makefile.in &&
sed -i ‘s/test-lock..EXEEXT.//‘ gettext-tools/gnulib-tests/Makefile.in
sed -e ‘/AppData/{N;N;p;s/.appdata./.metainfo./}‘ \
-i gettext-tools/its/appdata.loc
./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/gettext-0.19.8.1
make && make check
make install
chmod -v 0755 /usr/lib/preloadable_libintl.so
cd ..
rm -rf gettext-0.19.8.1
48.Libelf-0.173
tar xvf elfutils-0.173.tar.bz2
cd elfutils-0.173
./configure --prefix=/usr
make && make check
make -C libelf install
install -vm644 config/libelf.pc /usr/lib/pkgconfig
cd ..
rm -rf elfutils-0.173
49.Libffi-3.2.1
tar xvf libffi-3.2.1.tar.gz
cd libffi-3.2.1
sed -e ‘/^includesdir/ s/$(libdir).$/$(includedir)/‘ \
-i include/Makefile.in
sed -e ‘/^includedir/ s/=.$/=@includedir@/‘ \
-e ‘s/^Cflags: -I${includedir}/Cflags:/‘ \
-i libffi.pc.in
./configure --prefix=/usr --disable-static --with-gcc-arch=native
make && make check
make install
cd ..
rm -rf libffi-3.2.1
50.OpenSSL 1.1.0i
tar xvf openssl-1.1.0i.tar.gz
cd openssl-1.1.0i
./config --prefix=/usr \
--openssldir=/etc/ssl \
--libdir=lib \
shared \
zlib-dynamic
make && make test
sed -i ‘/INSTALL_LIBS/s/libcrypto.a libssl.a//‘ Makefile
make MANSUFFIX=ssl install
mv -v /usr/share/doc/openssl /usr/share/doc/openssl-1.1.0i
cp -vfr doc/* /usr/share/doc/openssl-1.1.0i
cd ..
rm -rf openssl-1.1.0i
51.Python-3.7.0
tar xvf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure --prefix=/usr \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-ensurepip=yes
make && make install
chmod -v 755 /usr/lib/libpython3.7m.so
chmod -v 755 /usr/lib/libpython3.so
install -v -dm755 /usr/share/doc/python-3.7.0/html
tar --strip-components=1 \
--no-same-owner \
--no-same-permissions \
-C /usr/share/doc/python-3.7.0/html \
-xvf ../python-3.7.0-docs-html.tar.bz2
cd ..
rm -rf Python-3.7.0
52.Ninja-1.8.2
tar xvf ninja-1.8.2.tar.gz
cd ninja-1.8.2
export NINJAJOBS=4
patch -Np1 -i ../ninja-1.8.2-add_NINJAJOBS_var-1.patch
python3 configure.py --bootstrap
python3 configure.py
./ninja ninja_test
./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
install -vm755 ninja /usr/bin/
install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja
install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
cd ..
rm -rf ninja-1.8.2
53.Meson-0.47.1
tar xvf meson-0.47.1.tar.gz
cd meson-0.47.1
python3 setup.py build
python3 setup.py install --root=dest
cp -rv dest/* /
cd ..
rm -rf meson-0.47.1
54.procps-NG-3.3.15
tar xvf procps-ng-3.3.15.tar.xz
cd procps-ng-3.3.15
./configure --prefix=/usr \
--exec-prefix= \
--libdir=/usr/lib \
--docdir=/usr/share/doc/procps-ng-3.3.15 \
--disable-static \
--disable-kill
make
sed -i -r ‘s|(pmap_initname)\\$|\1|‘ testsuite/pmap.test/pmap.exp
sed -i ‘/set tty/d‘ testsuite/pkill.test/pkill.exp
rm testsuite/pgrep.test/pgrep.exp
make check
make install
mv -v /usr/lib/libprocps.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so
cd ..
rm -rf procps-ng-3.3.15
55.e2fsprogs-1.44.3
tar xvf e2fsprogs-1.44.3.tar.gz
cd e2fsprogs-1.44.3
mkdir -v build
cd build
../configure --prefix=/usr \
--bindir=/bin \
--with-root-prefix="" \
--enable-elf-shlibs \
--disable-libblkid \
--disable-libuuid \
--disable-uuidd \
--disable-fsck
make
ln -sfv /tools/lib/lib{blk,uu}id.so.1 lib
make LD_LIBRARY_PATH=/tools/lib check
make install
make install-libs
chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
gunzip -v /usr/share/info/libext2fs.info.gz
install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
install -v -m644 doc/com_err.info /usr/share/info
install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
cd ../..
rm -rf e2fsprogs-1.44.3
56.Coreutils-8.30
tar xvf coreutils-8.30.tar.xz
cd coreutils-8.30
patch -Np1 -i ../coreutils-8.30-i18n-1.patch
sed -i ‘/test.lock/s/^/#/‘ gnulib-tests/gnulib.mk
autoreconf -fiv
FORCE_UNSAFE_CONFIGURE=1 ./configure \
--prefix=/usr \
--enable-no-install-program=kill,uptime
FORCE_UNSAFE_CONFIGURE=1 make
make NON_ROOT_USERNAME=nobody check-root
echo "dummy:x:1000:nobody" >> /etc/group
chown -Rv nobody .
su nobody -s /bin/bash \
-c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
sed -i ‘/dummy/d‘ /etc/group
make install
mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
mv -v /usr/bin/chroot /usr/sbin
mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8
mv -v /usr/bin/{head,sleep,nice} /bin
cd ..
rm -rf coreutils-8.30
57.check-0.12.0
tar xvf check-0.12.0.tar.gz
cd check-0.12.0
./configure --prefix=/usr
make && make check
make install
sed -i ‘1 s/tools/usr/‘ /usr/bin/checkmk
cd ..
rm -rf check-0.12.0
58.diffutils-3.6
tar xvf diffutils-3.6.tar.xz
cd diffutils-3.6
./configure --prefix=/usr
make && make check
make install
cd ..
rm -rf diffutils-3.6
59.GAWK-4.2.1
tar xvf gawk-4.2.1.tar.xz
cd gawk-4.2.1
sed -i ‘s/extras//‘ Makefile.in
./configure --prefix=/usr
make && make check
make install
mkdir -v /usr/share/doc/gawk-4.2.1
cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.2.1
cd ..
rm -rf gawk-4.2.1
60.findutils-4.6.0
tar xvf findutils-4.6.0.tar.gz
cd findutils-4.6.0
sed -i ‘s/test-lock..EXEEXT.//‘ tests/Makefile.in
sed -i ‘s/IO_ftrylockfile/IO_EOF_SEEN/‘ gl/lib/*.c
sed -i ‘/unistd/a #include <sys/sysmacros.h>‘ gl/lib/mountlist.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h
./configure --prefix=/usr --localstatedir=/var/lib/locate
make && make check
make install
mv -v /usr/bin/find /bin
sed -i ‘s|find:=${BINDIR}|find:=/bin|‘ /usr/bin/updatedb
cd ..
rm -rf findutils-4.6.0
61.Groff-1.22.3
tar xvf groff-1.22.3.tar.gz
cd groff-1.22.3
PAGE=A4 ./configure --prefix=/usr
make -j1
make install
cd ..
rm -rf groff-1.22.3
62.GRUB-2.02
tar xvf grub-2.02.tar.xz
cd grub-2.02
./configure --prefix=/usr \
--sbindir=/sbin \
--sysconfdir=/etc \
--disable-efiemu \
--disable-werror
make && make install
cd ..
rm -rf grub-2.02
63.Less-530
tar xvf less-530.tar.gz
cd less-530
./configure --prefix=/usr --sysconfdir=/etc
make && make install
cd ..
rm -rf less-530
64.gzip 1.9
tar xvf gzip-1.9.tar.xz
cd gzip-1.9
sed -i ‘s/IO_ftrylockfile/IO_EOF_SEEN/‘ lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/usr
make && make check
make install
mv -v /usr/bin/gzip /bin
cd ..
rm -rf gzip-1.9
65.IPRoute2-4.18.0
tar xvf iproute2-4.18.0.tar.xz
cd iproute2-4.18.0
sed -i /ARPD/d Makefile
rm -fv man/man8/arpd.8
sed -i ‘s/.m_ipt.o//‘ tc/Makefile
make
make DOCDIR=/usr/share/doc/iproute2-4.18.0 install
cd ..
rm -rf iproute2-4.18.0
66.KBD-2.0.4
tar xvf kbd-2.0.4.tar.xz
cd kbd-2.0.4
patch -Np1 -i ../kbd-2.0.4-backspace-1.patch
sed -i ‘s/(RESIZECONS_PROGS=)yes/\1no/g‘ configure
sed -i ‘s/resizecons.8 //‘ docs/man/man8/Makefile.in
PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr --disable-vlock
make && make check
make install
mkdir -v /usr/share/doc/kbd-2.0.4
cp -R -v docs/doc/* /usr/share/doc/kbd-2.0.4
cd ..
rm -rf kbd-2.0.4
67.Libpipeline-1.5.0
tar xvf libpipeline-1.5.0.tar.gz
cd libpipeline-1.5.0
./configure --prefix=/usr
make && make check
make install
cd ..
rm -rf libpipeline-1.5.0
68.Make-4.2.1
tar xvf make-4.2.1.tar.bz2
cd make-4.2.1
sed -i ‘211,217 d; 219,229 d; 232 d‘ glob/glob.c
./configure --prefix=/usr
make
make PERL5LIB=$PWD/tests/ check
make install
cd ..
rm -rf make-4.2.1
69.Patch-2.7.6
tar xvf patch-2.7.6.tar.xz
cd patch-2.7.6
./configure --prefix=/usr
make && make check
make install
cd ..
rm -rf cd patch-2.7.6
70.Sysklogd-1.5.1
tar xvf sysklogd-1.5.1.tar.gz
cd sysklogd-1.5.1
sed -i ‘/Error loading kernel symbols/{n;n;d}‘ ksym_mod.c
sed -i ‘s/union wait/int/‘ syslogd.c
make
make BINDIR=/sbin install
创建syslog.conf文件:
cat > /etc/syslog.conf << "EOF"
auth,authpriv. -/var/log/auth.log
.;auth,authpriv.none -/var/log/sys.log
daemon. -/var/log/daemon.log
kern. -/var/log/kern.log
mail. -/var/log/mail.log
user. -/var/log/user.log
.emerg *
EOF
cd ..
rm -rf sysklogd-1.5.1
71.sysvinit-2.90
tar xvf sysvinit-2.90.tar.xz
cd sysvinit-2.90
patch -Np1 -i ../sysvinit-2.90-consolidated-1.patch
make -C src
make -C src install
cd ..
rm -rf sysvinit-2.90
72.Eudev-3.2.5
tar xvf eudev-3.2.5.tar.gz
cd eudev-3.2.5
cat > config.cache << "EOF"
HAVE_BLKID=1
BLKID_LIBS="-lblkid"
BLKID_CFLAGS="-I/tools/include"
EOF
./configure --prefix=/usr \
--bindir=/sbin \
--sbindir=/sbin \
--libdir=/usr/lib \
--sysconfdir=/etc \
--libexecdir=/lib \
--with-rootprefix= \
--with-rootlibdir=/lib \
--enable-manpages \
--disable-static \
--config-cache
LIBRARY_PATH=/tools/lib make
mkdir -pv /lib/udev/rules.d
mkdir -pv /etc/udev/rules.d
make LD_LIBRARY_PATH=/tools/lib check
make LD_LIBRARY_PATH=/tools/lib install
tar -xvf ../udev-lfs-20171102.tar.bz2
make -f udev-lfs-20171102/Makefile.lfs install
LD_LIBRARY_PATH=/tools/lib udevadm hwdb --update
cd ..
rm -rf eudev-3.2.5
73.UTIL-Linux的2.32.1
tar xvf util-linux-2.32.1.tar.xz
cd util-linux-2.32.1
mkdir -pv /var/lib/hwclock
rm -vf /usr/include/{blkid,libmount,uuid}
./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--docdir=/usr/share/doc/util-linux-2.32.1 \
--disable-chfn-chsh \
--disable-login \
--disable-nologin \
--disable-su \
--disable-setpriv \
--disable-runuser \
--disable-pylibmount \
--disable-static \
--without-python \
--without-systemd \
--without-systemdsystemunitdir
make
chown -Rv nobody .
su nobody -s /bin/bash -c "PATH=$PATH make -k check"
make install
cd ..
rm -rf util-linux-2.32.1
74.Man-DB-2.8.4
tar xvf man-db-2.8.4.tar.xz
cd man-db-2.8.4
./configure --prefix=/usr \
--docdir=/usr/share/doc/man-db-2.8.4 \
--sysconfdir=/etc \
--disable-setuid \
--enable-cache-owner=bin \
--with-browser=/usr/bin/lynx \
--with-vgrind=/usr/bin/vgrind \
--with-grap=/usr/bin/grap \
--with-systemdtmpfilesdir=
make && make check
make install
cd ..
rm -rf man-db-2.8.4
76.tar-1.30
tar xvf tar-1.30.tar.xz
cd tar-1.30
FORCE_UNSAFE_CONFIGURE=1 \
./configure --prefix=/usr \
--bindir=/bin
make && make check
make install
make -C doc install-html docdir=/usr/share/doc/tar-1.30
cd ..
rm -rf tar-1.30
77.Texinfo-6.5
tar xvf texinfo-6.5.tar.xz
cd texinfo-6.5
sed -i ‘5481,5485 s/({/(\{/‘ tp/Texinfo/Parser.pm
./configure --prefix=/usr --disable-static
make && make check
make install
make TEXMF=/usr/share/texmf install-tex
pushd /usr/share/info
rm -v dir
for f in *
do install-info $f dir 2>/dev/null
done
popd
cd ..
rm -rf texinfo-6.5
77.VIM-8.1
tar xvf vim-8.1.tar.bz2
cd vim81
echo ‘#define SYS_VIMRC_FILE "/etc/vimrc"‘ >> src/feature.h
./configure --prefix=/usr
make
LANG=en_US.UTF-8 make -j1 test &> vim-test.log
上面的命令完成后会停止。
make install
ln -sv vim /usr/bin/vi
for L in /usr/share/man/{,*/}man1/vim.1; do
ln -sv vim.1 $(dirname $L)/vi.1
done
ln -sv ../vim/vim81/doc /usr/share/doc/vim-8.1
配置Vim:
cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc
" Ensure defaults are set before customizing settings, not after
source $VIMRUNTIME/defaults.vim
let skip_defaults_vim=1
set nocompatible
set backspace=2
set mouse=
syntax on
if (&term == "xterm") || (&term == "putty")
set background=dark
endif
" End /etc/vimrc
EOF
cd ..
rm -rf vim81
79.清理系统
rm -rf /tmp/
使用更新的chroot命令重新进入chroot环境:
logout
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" \
PS1=‘(lfs chroot) \u:\w\$ ‘ \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
继续清理:
rm -f /usr/lib/lib{bfd,opcodes}.a
rm -f /usr/lib/libbz2.a
rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a
rm -f /usr/lib/libltdl.a
rm -f /usr/lib/libfl.a
rm -f /usr/lib/libz.a
find /usr/lib /usr/libexec -name \.la -delete
七、系统配置
1.LFS-启动脚本LFS-Bootscripts:
cd $LFS/sources
tar xvf lfs-bootscripts-20180820.tar.bz2
cd lfs-bootscripts-20180820
make install
cd ..
rm -rf lfs-bootscripts-20180820
2.创建网络接口配置文件:
bash /lib/udev/init-net-rules.sh
首先用以下命令找到你网卡的名字:
cat /etc/udev/rules.d/70-persistent-net.rules
结果显示如下:
图中:NAME=”enp0s3”就是你的网卡名,将其记下来。
为enp0s3创建静态IP地址文件:
cd /etc/sysconfig/
vi ifconfig.enp0s3
在文件中输入:
ONBOOT=yes
IFACE=enp0s3 //网卡名字
SERVICE=ipv4-static
IP=192.168.3.252 //网卡IP地地
GATEWAY=192.168.3.1 //网关
PREFIX=24
BROADCAST=192.168.3.255 //广播地址
以上文件根据自己实际情况调整。
3.创建/etc/resolv.conf文件
vi /etc/resolv.conf
#domain <Your Domain Name> //设置域名,如果有的话
nameserver 118.118.118.1 //设置DNS服务器IP地址。根据实际调整。
#nameserver <IP address nameserver> //如果有第二个DNS服务器在这里设置。
以上文件根据自己实际调整。
4.配置系统主机名
echo "<lfs>" > /etc/hostname
5.创建hosts文件:
cat > /etc/hosts << "EOF"
127.0.0.1 localhost
EOF
6.System V Bootscript配置
cat > /etc/inittab << "EOF"
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc S
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty --noclear tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
EOF
7.配置系统时钟clock
cat > /etc/sysconfig/clock << "EOF"
UTC=1
CLOCKPARAMS=
EOF
8.Bash Shell启动文件
运行以下命令获取Glibc支持的所有语言环境的列表:
locale -a
看有没有zh_CN.gb18030:
如果没有就添加:localedef -i zh_CN -f GB18030 zh_CN.GB18030
有的话继续向下执行:
LC_ALL=zh_CN.gb18030 locale charmap
进行测试:
运行:
LC_ALL=zh_CN.gb18030 locale language
结果:
Chinese
运行:
LC_ALL=zh_CN.gb18030 locale charmap
结果:
GB18030
运行:
LC_ALL=zh_CN.gb18030 locale int_curr_symbol
结果:
CNY
运行:
LC_ALL=zh_CN.gb18030 locale int_prefix
结果:
86
创建/etc/profil文件:
cat > /etc/profile << "EOF"
export LANG=zh_CN.gb18030
EOF
创建/ etc / inputrc文件:
cat > /etc/inputrc << "EOF"
set horizontal-scroll-mode Off
set meta-flag On
set input-meta On
set convert-meta Off
set output-meta On
set bell-style none
"\eOd": backward-word
"\eOc": forward-word
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\eOH": beginning-of-line
"\eOF": end-of-line
"\e[H": beginning-of-line
"\e[F": end-of-line
EOF
创建/etc/shells文件:
cat > /etc/shells << "EOF"
/bin/sh
/bin/bash
EOF
9.创建/etc/ fsta文件:
cat > /etc/fstab << "EOF"
/dev/sda3 / ext4 defaults 1 1
/dev/sda2 swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
EOF
10.安装内核:
cd $LFS/sources
tar xvf linux-4.18.5.tar.xz
cd linux-4.18.5
make mrproper
make defconfig
make menuconfig
确保以下选项正确设置:
make
make modules_install
cp -iv arch/x86/boot/bzImage /boot/vmlinuz-4.18.5-lfs-8.3
cp -iv System.map /boot/System.map-4.18.5
cp -iv .config /boot/config-4.18.5
install -d /usr/share/doc/linux-4.18.5
cp -r Documentation/* /usr/share/doc/linux-4.18.5
install -v -m755 -d /etc/modprobe.d
cat > /etc/modprobe.d/usb.conf << "EOF"
install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
EOF
cd ..
chown -R 0:0 linux-4.18.5
install -v -m755 -d /etc/modprobe.d
cat > /etc/modprobe.d/usb.conf << "EOF"
install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
EOF
11.设置GRUB引导:
GRUB文件安装到/boot/grub并设置引导跟踪:
grub-install /dev/sda
创建GRUB配置文件:
cat > /boot/grub/grub.cfg << "EOF"
set default=0
set timeout=5
insmod ext4
set root=(hd0,3)
menuentry "GNU/Linux, Linux 4.18.5-lfs-8.3" {
linux /boot/vmlinuz-4.18.5-lfs-8.3 root=/dev/sda3 ro
}
EOF
echo 8.3 > /etc/lfs-release
cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="8.3"
DISTRIB_CODENAME="<your name here>"
DISTRIB_DESCRIPTION="Linux From Scratch"
EOF
12.重新启动系统:
logout
umount -v $LFS/dev/pts
umount -v $LFS/dev
umount -v $LFS/run
umount -v $LFS/proc
umount -v $LFS/sys
umount -v $LFS
取出光盘,重新启动计算机:
shutdown -r now
13.重新启动后的界面:
至此,LFS 8.3系统就完成了。
标签:try build 计算 open link 64位 gconf static 时区
原文地址:http://blog.51cto.com/9828355/2330682