一、确认构建环境
1. 确认$LFS变量
lfs:~$ echo $LFS
/mnt/lfs
2. 确认用户
lfs:~$ whoami
lfs
3. 确认进入home目录
lfs:~$ cd ~
lfs:~$ pwd
/home/lfs
二、执行构建指令
#!/bin/bash
tar -jxf $LFS/sources/binutils-2.27.tar.bz2
(
cd binutils-2.27/
mkdir -v build
cd build
../configure --prefix=/tools \
--with-sysroot=$LFS \
--with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror
make -j12
case $(uname -m) in
x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
esac
make install
)
rm -fr binutils-2.27/
三、验证安装
lfs:~/binutils-2.27/build$ find $LFS/tools
/mnt/lfs/tools
/mnt/lfs/tools/share
/mnt/lfs/tools/share/info
/mnt/lfs/tools/share/info/as.info
/mnt/lfs/tools/share/info/binutils.info
/mnt/lfs/tools/share/info/gprof.info
/mnt/lfs/tools/share/info/bfd.info
/mnt/lfs/tools/share/info/ld.info
/mnt/lfs/tools/share/man
/mnt/lfs/tools/share/man/man1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-c++filt.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-as.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-nm.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-nlmconv.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-windmc.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-elfedit.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-gprof.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-objdump.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-windres.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-strip.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-objcopy.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-ar.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-ld.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-addr2line.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-dlltool.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-size.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-readelf.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-strings.1
/mnt/lfs/tools/share/man/man1/x86_64-lfs-linux-gnu-ranlib.1
/mnt/lfs/tools/lib
/mnt/lfs/tools/lib64
/mnt/lfs/tools/bin
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-objdump
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-strip
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-ar
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-addr2line
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-c++filt
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-ranlib
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-gprof
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-as
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-ld
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-nm
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-size
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-elfedit
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-strings
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-readelf
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-objcopy
/mnt/lfs/tools/bin/x86_64-lfs-linux-gnu-ld.bfd
/mnt/lfs/tools/x86_64-lfs-linux-gnu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xdc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xs
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_iamcu.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.x
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xdw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xr
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xbn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xu
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_k1om.xn
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf32_x86_64.xsw
/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xsc
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/strip
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/objdump
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/readelf
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/nm
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/as
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/ld
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/ranlib
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/objcopy
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/ld.bfd
/mnt/lfs/tools/x86_64-lfs-linux-gnu/bin/ar