转载请标明出处: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

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

LFS7.10——准备Host系统的更多相关文章

  1. LFS7.10——构建LFS系统

    参考:LFS7.10——准备Host系统 LFS7.10——构造临时Linux系统 本文正式开始构建LFS系统,后面所有命令的执行都是在root用户下完成的. 这时开始构建LFS前准备工作 更改$LF ...

  2. LFS7.10——构造临时Linux系统

    参考:LFS编译——准备Host系统 前言 在准备好Host环境后,接下来构造一个临时Linux系统.该系统包含****构建所需要的工具.构造临时Linux系统分两步: 构建一个宿主系统无关的新工具链 ...

  3. Windows 10 安装双系统 CentOS 7

    系统环境:Windows 10 && CentOS 7 准备工具: ●CentOS7 官网下载地址:https://wiki.centos.org/Download (注意: i386 ...

  4. windows10 下访问 virtualbox 虚拟机的linux15.10/16.04 系统 及 用 putty 访问虚拟机的配置

    参考: http://www.doc88.com/p-915707596190.html --- 安装samba http://my.oschina.net/u/2260265/blog/405598 ...

  5. Ubuntu 14.10 下查看系统硬件信息(实例详解)

    linux查看系统的硬件信息,并不像windows那么直观,这里我罗列了查看系统信息的实用命令,并做了分类,实例解说. cpu lscpu命令,查看的是cpu的统计信息. blue@blue-pc:~ ...

  6. VMWare 14.1 15 Pro 安装 macOS Mojave 10.14.1系统 遇到的问题解决方案

    安装环境 WIN10VMware Workstation Pro 15.0.0 Build 10134415工具准备1.VMware Workstation Pro 15.0.0 Build 1013 ...

  7. Linux笔记(二): WIN 10 Ubuntu 双系统

    (一)  说明 记录一次ubuntu安装过程及遇到的问题. 环境:WIN 10 单硬盘 (二)  ubuntu ISO文件下载 ubuntu 18.04 https://www.ubuntu.com/ ...

  8. 在windows 10 64位系统下安装TensorFlow

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/mao_hui_fei/article/de ...

  9. Mac 10.14.5系统偏好设置安全性与隐私不展示任何来源解决办法

    Mac新系统升级(10.14.5)后未从appstore下载的软件在安装时会提示安装包已损坏之类的东东,这是因为没有打开“设置”—“安全与隐私”中的“任何来源”造成的,可是升级后的10.14.5却没有 ...

随机推荐

  1. post 发送方式

    /** * post 方式 解码 */ public static String getWebContentByPost(String urlString, String data, final St ...

  2. [转]windows 下 gcc/g++ 的安装

    链接地址:https://www.jianshu.com/p/ff24a81f3637 不过下载地址直接进这里就可以了:https://sourceforge.net/projects/mingw/

  3. linux修改系统时间和时区

    1.修改系统时间linux系统时钟有两个,一个是硬件时钟,即BIOS时间,就是我们进行CMOS设置时看到的时间,另一个是系统时钟,是linux系统Kernel时间.当Linux启动时,系统Kernel ...

  4. [LeetCode] 276. Paint Fence 粉刷篱笆

    There is a fence with n posts, each post can be painted with one of the k colors. You have to paint ...

  5. [LeetCode] 97. Interleaving String 交织相错的字符串

    Given s1, s2, s3, find whether s3 is formed by the interleaving of s1and s2. Example 1: Input: s1 = ...

  6. ContainsExtensions不分区大小写

    public static class ContainsExtensions { public static bool Contains(this string source, string valu ...

  7. Linux06 文件的打包和压缩(gzip/gunzip、tar、bzip2)

    一.gzip/gunzip 这是用于压缩和解压单个文件的工具,且使用方法比较简单 gzip  文件名 gunzip  文件名 二.tar(用的比较多) 不仅可以用于打包文件,还可以将整个目录中的全部文 ...

  8. [基础]C++:名字的作用域

    每个名字都有自己的活动空间,同一个名字在不同的作用域可能指向不同的实体. 作用域:通常是以{}为分隔. 名字的有效区域开始于名字的声明,以声明语句所在的末端为结束. #include<iostr ...

  9. 数据分析——matplotlib的用法

    Matplotlib是一个强大的Python绘图和数据可视化的工具包.数据可视化也是我们数据分析的最重要的工作之一,可以帮助我们完成很多操作,例如:找出异常值.必要的一些数据转换等.完成数据分析的最终 ...

  10. pandas再次学习

    numpy.scipy官方文档  pandas官方网站  matplotlib官方文档 一.数据结构 二.数据处理 1.数据获取(excel文件数据基本信息) #coding=utf-8 import ...