转载请标明出处:https://www.cnblogs.com/kelamoyujuzhen/articles/9161515.html

实验环境:

Host:Windows10 + WMWare Workstation14.1.1 build-7528167

LSB Version: :core-4.1-amd64:core-4.1-noarch

Distributor ID: CentOS

Description: CentOS Linux release 7.5.1804 (Core)

Release: 7.5.1804

Codename: Core

LFS:7.10

准备host系统

依赖工具、库

要想构建LFS系统,首先需要一个Linux发行版本事先安装好,可以选择最小化安装。这个事先安装好的Linux(称为 host)提供必要的工具:

eg:编译器(compiler,)、链接器(linker,)、shell等等

借助这些工具构建我们的LFS系统。

为了构建LFS,host需要安装必要的工具。对于LFS 7.10来说,不建议使用小于下面列出版本号的tarball。

Bash-3.2(/bin/sh应该是bash的符号链接 或 硬链接)

This package satisfies an LSB core requirement to provide a Bourne Shell interface to the system.It was chosenover other shell packages because of its common usage and extensive capabilities beyond basic shell functions.

Binutils-2.17 (不建议使用版本号小于2.30的包,因为未被测试)

This package contains a linker, an assembler, and other tools for handling object files. The programs in this package are needed to compile most of the packages in an LFS system and beyond.

Bison-2.3 (/usr/bin/yacc应该是bison的一个链接;也可以链接到一个脚本,这个脚本会执行bison)

This package contains the GNU version of yacc(Yet Another Compiler Compiler) needed to build several other LFS programs.

Bzip2-1.0.4

This package contains programs for compressing and decompressing files.It is required to decompress many LFS packages.

Coreutils-6.9

This package contains a number of essential programs for viewing and manipulating files and directories. These programs are needed for command line file management, and are necessary for the installation procedures of every package in LFS.

Diffutils-2.8.1

This package contains programs that show the differences between files or directories. These programs can be used to create patches, and are also used in many packages' build procedures.

Findutils-4.2.31

This package contains programs to find files in a file system. It is used in many packages' build scripts.

Gawk-4.0.1(/usr/bin/awk应该是gawk的一个链接)

This package contains programs for manipulating text files. It is the GNU version of awk(Aho-Weinberg-
Kernighan). It is used in many other packages' build scripts.

GCC-4.7包括C++编译器(不建议使用版本号大于7.3.0,因为未被测试)

This package is the Gnu Compiler Collection.It contains the C and C++ compilers as well as several others not built by LFS.

Glibc-2.11(不建议使用版本号大于2.27,因为未被测试)

This package contains the main Clibrary.Linux programs would not run without it.

Grep-2.5.1a

This package contains programs for searching through files. These programs are used by most packages' build
scripts.

Gzip-1.3.12

This package contains programs for compressing and decompressing files. It is needed to decompress many
packages in LFS and beyond.

Linux Kernel-2.6.32(编译glibc、udev会用到)

This package is the Operating System. It is the Linux in the GNU/Linux environment

M4-1.4.10

This package contains a general text macro processor useful as a build tool for other programs

Make-3.81

This package contains a program for directing the building of packages. It is required by almost every package in
LFS.

Patch-2.5.4

This package contains a program for modifying or creating files by applying a patch file typically created by the
diff program. It is needed by the build procedure for several LFS packages.

Perl-5.8.8

This package is an interpreter for the runtime language PERL. It is needed for the installation and test suites of
several LFS packages.

Sed-4.1.5

This package allows editing of text without opening it in a text editor. It is also needed by most LFS packages'
configure scripts.

Tar-1.22

This package provides archiving and extraction capabilities of virtually all packages used in LFS.

Texinfo-4.7

This package contains programs for reading, writing, and converting info pages. It is used in the installation
procedures of many LFS packages.

Xz-5.0.0

This package contains programs for compressing and decompressing files. It provides the highest compression
generally available and is useful for decompressing packages in XZ or LZMA format.

执行如下命令,然后运行脚本version-check.sh,根据输出安装必要工具。安装的工具版本号 ≥ 上面最低版本号。

#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
#deal with bash
bash --version | head -n1 | cut -d" " -f2-
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -> $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH #deal with binutils
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- #deal with bison
bison --version | head -n1 #deal with yacc
if [ -h /usr/bin/yacc ]; then
echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
elif [ -x /usr/bin/yacc ]; then
echo yacc is `/usr/bin/yacc --version | head -n1`
else
echo "yacc not found"
fi #deal with bzip2
bzip2 --version >& < /dev/null | head -n1 | cut -d" " -f1,- #deal with coreutils
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 #deal with diff
diff --version | head -n1 #deal with find
find --version | head -n1 #deal with gawk
gawk --version | head -n1 #deal with awk
if [ -h /usr/bin/awk ]; then
echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
elif [ -x /usr/bin/awk ]; then
echo awk is `/usr/bin/awk --version | head -n1`
else
echo "awk not found"
fi #deal with gcc
gcc --version | head -n1 #deal with g++
g++ --version | head -n1 #deal with lss
ldd --version | head -n1 | cut -d" " -f2- # glibc version #deal with grep
grep --version | head -n1 #deal with gzip
gzip --version | head -n1
cat /proc/version #deal with m4
m4 --version | head -n1 #deal with make
make --version | head -n1 #deal with patch
patch --version | head -n1 #deal with perl
echo Perl `perl -V:version` #deal with sed
sed --version | head -n1 #deal with tar
tar --version | head -n1 #deal with makeinfo
makeinfo --version | head -n1 #deal with xz
xz --version | head -n1 #test whether gcc is OK
echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
if [ -x dummy ]
then echo "g++ compilation OK";
else echo "g++ compilation failed"; fi
rm -f dummy.c dummy

我的实验环境下,我是根据脚本提示依次安装所需要的包。当然你也可以使用一条yum命令搞定,如下

yum -y install bash binutils bison bzip2 coreutils diffutils findutils gawk gcc glibc grep gzip kernel m4 make patch perl sed tar texinfo xz gcc-c++ flex

有几个包需要单独说下:

没有g++这个包,需要安装gcc-c++

makeinfo这个包在texinfo包里面。

安装完bison后还要将yacc链接到bison

ln -sv /usr/bin/bison /usr/bin/yacc

安装完以后再次执行包检查脚本输出如下

bash, version 4.2.()-release
/bin/sh -> /usr/bin/bash
Binutils: version 2.25.-.base.el7
bison (GNU Bison) 3.0.
/usr/bin/yacc -> /usr/bin/bison
bzip2, Version 1.0., -Sept-.
Coreutils: 8.22
diff (GNU diffutils) 3.3
find (GNU findutils) 4.5.
GNU Awk 4.0.
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.8. (Red Hat 4.8.-)
g++ (GCC) 4.8. (Red Hat 4.8.-)
(GNU libc) 2.17
grep (GNU grep) 2.20
gzip 1.5
Linux version 3.10.-.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8. (Red Hat 4.8.-) (GCC) ) # SMP Tue Nov :: UTC
m4 (GNU M4) 1.4.
GNU Make 3.82
GNU patch 2.7.
Perl version='5.16.3';
sed (GNU sed) 4.2.
tar (GNU tar) 1.26
makeinfo (GNU texinfo) 5.1
xz (XZ Utils) 5.2.
g++ compilation OK

在检查依赖库

#!/bin/bash
for lib in lib{gmp,mpfr,mpc}.la; do
echo $lib: $(if find /usr/lib* -name $lib|
grep -q $lib;then :;else echo not;fi) found
done
unset lib

我的环境上输出

[root@localhost LFS]# sh library-check.sh
libgmp.la: not found
libmpfr.la: not found
libmpc.la: not found

注:这三个库,要么全都有,要么全都没有。不可以有的有有的没有

创建分区

准备用于安装 LFS 的分区。包括建立分区、为分区设置文件系统,挂载分区。

我单独给LFS一块20G的磁盘,分区安排如下

[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): p Disk /dev/sdb: 21.5 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0xf1aba154 Device Boot Start End Blocks Id System
/dev/sdb1 Linux
/dev/sdb2 Linux swap / Solaris
/dev/sdb3 Linux
[root@localhost ~]# lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb : 20G disk
├─sdb1 : 100M part #用于boot分区
├─sdb2 : 4G part #用于swap分区
└─sdb3 : .9G part #用于root分区

分区格式化

将sdb1和sdb3格式化为ext4文件系统。

mkfs -v -t ext4 /dev/sdb1;mkfs -v -t ext4 /dev/sdb3

设置swap分区,格式化/dev/sdb2为swap格式

[root@localhost ~]# mkswap /dev/sdb2
Setting up swapspace version , size = KiB
no label, UUID=bb9ea40d--4f0c-be3f-dde08974637d

启动swap分区

swapon /dev/sdb2
[root@localhost ~]# swapon -s
Filename Type Size Used Priority
/dev/dm- partition -
/dev/sdb2 partition -

创建环境变量

在构建LFS的过程中,$LFS作为根分区挂载点会多次用到,应该确保在整个构建过程中$LFS都是可用的。

[root@localhost ~]# export LFS=/mnt/lfs
[root@localhost ~]# echo $LFS
/mnt/lfs
[root@localhost ~]# mkdir -pv $LFS
mkdir: created directory ‘/mnt/lfs’

在/root/.bash_profile文家最后添加export LFS=/mnt/lfs,使LFS这个环境变量永久化。最终结果如下

[root@localhost ~]# cat .bash_profile
# .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
export LFS=/mnt/lfs

检查环境变量

[root@localhost ~]# env | grep LFS
LFS=/mnt/lfs

挂载新分区

分区创建好了,文件系统也指定好了。通过为分区指定一个挂载点,来使这个指定文件系统的分区变得可访问。

将sdb3挂载到$LFS变量下,sdb1挂载到$LFS/boot

[root@localhost ~]# mount -v -t ext4 /dev/sdb3 $LFS
mount: /mnt/lfs does not contain SELinux labels.
You just mounted an file system that supports labels which does not
contain labels, onto an SELinux box. It is likely that confined
applications will generate AVC messages and not be allowed access to
this file system. For more details see restorecon() and mount().
mount: /dev/sdb3 mounted on /mnt/lfs.
[root@localhost ~]# mkdir -pv $LFS/boot
mkdir: created directory ‘/mnt/lfs/boot’
[root@localhost ~]# mount -v -t ext4 /dev/sdb1 $LFS/boot
mount: /mnt/lfs/boot does not contain SELinux labels.
You just mounted an file system that supports labels which does not
contain labels, onto an SELinux box. It is likely that confined
applications will generate AVC messages and not be allowed access to
this file system. For more details see restorecon() and mount().
mount: /dev/sdb1 mounted on /mnt/lfs/boot.
[root@localhost ~]# lsblk /dev/sdb -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
├─sdb1 ext4 1bd2b5b6-a818-42f5-bc54-145327b832ab /mnt/lfs/boot
├─sdb2 swap bb9ea40d--4f0c-be3f-dde08974637d [SWAP]
└─sdb3 ext4 7f28d393-1ede-4f33-b97d-f8defe148c2e /mnt/lfs

为确保下次重启后挂载点仍可用,需要编辑/etc/fstab。swap分区不用修改fstab,他连挂载点都没有,怎么修改呢??

[root@localhost ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Fri Oct ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
/dev/mapper/centos-root / xfs defaults
UUID=783b3030-8ead-4ad3-99d9-5ee1403779f0 /boot xfs defaults
/dev/mapper/centos-home /home xfs defaults
/dev/mapper/centos-swap swap swap defaults
/dev/sdb1 /mnt/lfs/boot ext4 defaults
/dev/sdb2 swap swap defaults
/dev/sdb3 /mnt/lfs ext4 defaults

重启检查配置好的Host

[root@localhost ~]# swapon -s
Filename Type Size Used Priority
/dev/sdb2 partition -
/dev/dm- partition -
[root@localhost ~]# mount | grep sdb -i | column -t
/dev/sdb3 on /mnt/lfs type ext4 (rw,relatime,seclabel,data=ordered)
/dev/sdb1 on /mnt/lfs/boot type ext4 (rw,relatime,seclabel,data=ordered)
[root@localhost ~]# env | grep lfs -i
LFS=/mnt/lfs

由于swap分区没有挂载点,因此在mount下看不着。

下载包和补丁

包和补丁存放在$LFS/sources目录下

创建sources目录

mkdir -v $LFS/sources

修改权限(使sources目录仅能被owner和root删除)

[root@localhost ~]# ll $LFS
total
drwxr-xr-x. root root Dec : boot
drwx------. root root Dec : lost+found
drwxr-xr-x. root root Dec : sources
[root@localhost ~]# chmod -v a+wt $LFS/sources
mode of ‘/mnt/lfs/sources’ changed from (rwxr-xr-x) to (rwxrwxrwt)
[root@localhost ~]# ll $LFS
total
drwxr-xr-x. root root Dec : boot
drwx------. root root Dec : lost+found
drwxrwxrwt. root root Dec : sources

下载wget-list文件,这里面包含各种包的链接。千万注意你的LFS版本,http://www.linuxfromscratch.org/lfs/view下面找你对应版本的wget-list文件。由于官方的wget-list部分链接失效,我修改了部分连接

https://download-mirror.savannah.gnu.org/releases/acl/acl-2.2.52.src.tar.gz
https://download-mirror.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz
http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz
http://ftp.gnu.org/gnu/bash/bash-4.3.30.tar.gz
http://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2
http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2
http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz
http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
http://sourceforge.net/projects/check/files/check/0.10.0/check-0.10.0.tar.gz
http://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz
http://dbus.freedesktop.org/releases/dbus/dbus-1.10.10.tar.gz
http://ftp.gnu.org/gnu/dejagnu/dejagnu-1.6.tar.gz
http://ftp.gnu.org/gnu/diffutils/diffutils-3.5.tar.xz
http://dev.gentoo.org/~blueness/eudev/eudev-3.2.tar.gz
http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.43.1/e2fsprogs-1.43.1.tar.gz
http://prdownloads.sourceforge.net/expat/expat-2.2.0.tar.bz2
http://prdownloads.sourceforge.net/expect/expect5.45.tar.gz
ftp://ftp.astron.com/pub/file/file-5.28.tar.gz
http://ftp.gnu.org/gnu/findutils/findutils-4.6.0.tar.gz
https://src.fedoraproject.org/lookaside/pkgs/flex/flex-2.6.1.tar.xz/cd3c86290fc2676a641aefafeb10848a/flex-2.6.1.tar.xz
http://ftp.gnu.org/gnu/gawk/gawk-4.1.3.tar.xz
http://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.bz2
http://ftp.gnu.org/gnu/gdbm/gdbm-1.12.tar.gz
http://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.xz
http://ftp.gnu.org/gnu/glibc/glibc-2.24.tar.xz
http://ftp.gnu.org/gnu/gmp/gmp-6.1.1.tar.xz
http://ftp.gnu.org/gnu/gperf/gperf-3.0.4.tar.gz
http://ftp.gnu.org/gnu/grep/grep-2.25.tar.xz
http://ftp.gnu.org/gnu/groff/groff-1.22.3.tar.gz
http://alpha.gnu.org/gnu/grub/grub-2.02~beta3.tar.xz
http://ftp.gnu.org/gnu/gzip/gzip-1.8.tar.xz
http://anduin.linuxfromscratch.org/LFS/iana-etc-2.30.tar.bz2
http://ftp.gnu.org/gnu/inetutils/inetutils-1.9.4.tar.xz
http://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz
https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-4.7.0.tar.xz
https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.3.tar.xz
https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-23.tar.xz
http://www.greenwoodsoftware.com/less/less-481.tar.gz
http://www.linuxfromscratch.org/lfs/downloads/7.10/lfs-bootscripts-20150222.tar.bz2
https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.25.tar.xz
https://download-mirror.savannah.gnu.org/releases/libpipeline/libpipeline-1.4.1.tar.gz
http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.7.2.tar.xz
http://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.xz
http://ftp.gnu.org/gnu/make/make-4.2.1.tar.bz2
https://download-mirror.savannah.gnu.org/releases/man-db/man-db-2.7.5.tar.xz
https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.07.tar.xz
https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.xz
http://ftp.gnu.org/gnu//ncurses/ncurses-6.0.tar.gz
http://ftp.gnu.org/gnu/patch/patch-2.7.5.tar.xz
http://www.cpan.org/src/5.0/perl-5.24.0.tar.bz2
https://pkg-config.freedesktop.org/releases/pkg-config-0.29.1.tar.gz
http://sourceforge.net/projects/procps-ng/files/Production/procps-ng-3.3.12.tar.xz
http://downloads.sourceforge.net/project/psmisc/psmisc/psmisc-22.21.tar.gz
http://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz
http://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.bz2
http://ftp.lfs-matrix.net/pub/blfs/conglomeration/shadow/shadow-4.2.1.tar.xz
http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.5.1.tar.gz
http://anduin.linuxfromscratch.org/sources/other/systemd/systemd-231.tar.xz
https://download-mirror.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2
http://ftp.gnu.org/gnu/tar/tar-1.29.tar.xz
http://sourceforge.net/projects/tcl/files/Tcl/8.6.6/tcl-core8.6.6-src.tar.gz
http://ftp.gnu.org/gnu/texinfo/texinfo-6.1.tar.xz
http://www.iana.org/time-zones/repository/releases/tzdata2016f.tar.gz
http://anduin.linuxfromscratch.org/LFS/udev-lfs-20140408.tar.bz2
https://www.kernel.org/pub/linux/utils/util-linux/v2.28/util-linux-2.28.1.tar.xz
ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
http://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz
http://tukaani.org/xz/xz-5.2.2.tar.xz
https://zlib.net/fossils/zlib-1.2.8.tar.gz
http://www.linuxfromscratch.org/patches/lfs/7.10/bash-4.3.30-upstream_fixes-3.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/bc-1.06.95-memory_leak-1.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/bzip2-1.0.6-install_docs-1.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/coreutils-8.25-i18n-2.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/glibc-2.24-fhs-1.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/kbd-2.0.3-backspace-1.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/readline-6.3-upstream_fixes-3.patch
http://www.linuxfromscratch.org/patches/lfs/7.10/sysvinit-2.88dsf-consolidated-1.patch

下载包和补丁,比较耗时,有的包可能超时下载不了。下载完毕后共80个包(算上补丁)

wget --input-file=wget-list --continue --directory-prefix=$LFS/sources

准备临时系统环境

创建临时目录

编译LFS过程中会生成很多临时工具,这些工具不会最终成为LFS系统的一部分。为临时工具指定目录$LFS/tools,一方面用完之后可以直接删掉而不会影响系统,另一方面防止临时根据影响系统其他目录。

mkdir -v $LFS/tools

为tools目录创建符号链接

[root@localhost lfs]# ln -sv $LFS/tools /
‘/tools’ -> ‘/mnt/lfs/tools’

添加lfs用户

root用户随便犯个小错误都有可能破坏或摧毁整个系统,因此在编译上文提到的包和补丁时最好使用lfs用户。同时为lfs用户环境做些限制,尽量避免host对其影响。

groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs
命令行选项的意思:
-s /bin/bash 把bash 设置为 lfs 用户的默认 shell。
-g lfs 这个选项将用户lfs 添加到组 lfs 中。
-m 为lfs 用户创建主目录。
-k /dev/null 这个参数通过令输入位置为null设备,防止可能从一个skeleton目录中(默认是/etc/skel )复制文件。
lfs 这是创建的组和用户的实际名称。

为lfs设置密码

passwd lfs

更改sources、tools的属主

chown -v lfs $LFS/tools
chown -v lfs $LFS/sources

如果想要切换到lfs用户可使用命令。su -除了切换用户身份外,shell也会切换为登陆shell。参考:Linux命令——su 、su -、sudo

su - lfs

修改lfs用户shell环境

当以lfs用户登陆时,通常是个登陆shell。这个登陆shell需要先读取2个配置文件的配置信息:host的/etc/profile 和 lfs用户.bash_profile

修改.bash_profile,表明除HOME 、TERM 和 PS1 变量环境变量按设置保留外,其他环境变量全部清空。为啥这么做?因为host的/etc/profile可能之前被写入了部分环境变量,这些环境变量可能会加载到lfs用户这里进而污染lfs的shell环境。

cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF

对于一个shell instance,通常是non-login shell,这种shell不读取/etc/profile 或 .bash_profile文件,而是读取.bashrc文件。创建或修改.bashrc文件如下

cat > ~/.bashrc << "EOF"
set +h
umask
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
EOF

set +h 命令关闭了 bash 的哈希功能。hash可以加快命令查找速度,但是这对于编译LFS不是啥好事。由于我们前面对tools做过软连接,取消hash可以强制每次查找命令时都从$PATH查找,这样tools下面一旦某些根据可用就能马上被系统用上。

LFS用于设置挂载点

source命令加载下配置文件,使修改生效

source ~/.bash_profile

说明

SBU

Standard Build Unit(标准编译单位)指代具体的编译时间。这里以编译Binutils所用时间作为一个标准编译单位(SBU),其它软件的生成时间都以其为标准进行比较。

Test Suites

测试套件由于帮助我们“检查”软件编译是否正确,出软件包的功能是否都如开发人员预想的那样正常。但是,它并不能总是保证所测试的软件包就一定没有问题。在编译临时工具的时候不建议使用测试套件

最新文章

  1. nginx-upload-module模块实现文件断点续传
  2. 从数据库得到的结果集存放到List集合中
  3. 两个升序链表的合并 Merge Two Sorted Lists 【 leetcode】
  4. python写入中文到文件乱码的问题
  5. java web学习
  6. VulToEs
  7. stm32出现错误“identifier file is undefined”
  8. https原理及实践
  9. zabbix的各种键值
  10. MQ服务器奔溃解决过程
  11. elasticsearch 6.1.1 transport jar
  12. 找不到命令 ifconfig
  13. 直接提交一个form表单后台返回一个新页面通过target属性可以放到iframe当中
  14. JNI 数据类型转换
  15. 最应该注意的Oracle版本之一
  16. postgresql 备份与恢复
  17. 玩转Linux文件描述符和重定向
  18. grep:字符串查找
  19. PHP下的命令行执行 php -S localhost -t public(public是根目录,也是入口文件所在目录,是LARAVEL的)
  20. Golang优秀开源项目汇总, 10大流行Go语言开源项目, golang 开源项目全集(golang/go/wiki/Projects), GitHub上优秀的Go开源项目

热门文章

  1. Laya微信小游戏的开放域
  2. Python - Django - 使用 Bootstrap 样式修改注册页
  3. 使用EF 4.1的DbContext的方法大全
  4. linux : 各个发行版中修改python27默认编码为utf-8
  5. VisualStudio开发UE4工程设置
  6. QT笔记-QlineEdit
  7. PHP 获取星期
  8. lay-verify进行非必填项校验
  9. redis使用bit做只有两种情况的“状态“统计(如是否在线的用户统计)
  10. Python-13-模块和包