You cannot see this page without javascript.

LFS/Building - 빌드하기

Linux 조회 수 2614 추천 수 0 2014.08.06 10:30:11

1. LFS system 만들기


1.1. 기본 소프트웨어 설치


소개

가상 커널 파일 시스템 준비하기

패키지 관리

chroot환경에 들어가기

디렉토리 만들기

필요한 파일, symlinks 만들기

패스워드, 그룹, 로그파일 만들기

Makedev-1.7로 디바이스 만들기

Linux-3.5.2 API 헤더 설치

Man-pages-3.42 설치

Glibc-2.16.0 설치

the toolchain 재 조정

Zlib-1.2.7 설치

File-5.11 설치

Binutils-2.22 설치

GMP-5.0.5 설치

MPFR-3.1.1 설치

MPC-1.0

GCC-4.7.1 설치

Sed-4.2.1 설치

Bzip2-1.0.6 설치

Pkg-config-0.27 설치

Ncurses-5.9 설치

Util-linux-2.21.2 설치

Psmisc-22.19 설치

E2fsprogs-1.42.5 설치

Shadow-4.1.5.1 설치

Coreutils-8.19 설치

Iana-Etc-2.30 설치

M4-1.4.16 설치

Bison-2.6.2 설치

Procps-3.2.8 설치

Grep-2.14 설치

Readline-6.2 설치

Bash-4.2 설치

Libtool-2.4.2 설치

GDBM-1.10 설치

Inetutils-1.9.1 설치

Perl-5.16.1 설치

Autoconf-2.69 설치

Automake-1.12.3 설치

Diffutils-3.2 설치

Gawk-4.0.1 설치

Findutils-4.4.2 설치

Flex-2.5.37 설치

Gettext-0.18.1.1 설치

Groff-1.21 설치

Xz-5.0.4 설치

Grub-2.00 설치

Less-444 설치

Gzip-1.5 설치

IPRoute2-3.5.1 설치

Kbd-1.15.3 설치

Kmod-9 설치

Libpipeline-1.2.1 설치

Make-3.82 설치

Man-DB-2.6.2 설치

Patch-2.6.1 설치

Sysklogd-1.5 설치

Sysvinit-2.88dsf 설치

Tar-1.26 설치

Texinfo-4.13a 설치

Udev-188(systemd-188로부터 추출됨) 설치

Vim-7.3 설치

About Debugging Symbols

Stripping Again

Cleaning Up

1.1.1. 소개


이 장에서 우리는 이전 장에서 설치해놓은 빌드 장소($LFS)로 들어간 뒤 LFS시스템을 구축해 나갈 것입니다. 이것은 임시의 작은 리눅스 시스템을 만들고 몇가지 마무리 준비를 마친 뒤에 모든 패키지를 하나씩 설치를 시작하는 일을 말합니다.

이 모든 소프트웨어 설치는 간단합니다. 설치할 패키지들중 많은 것들의 설치 명령어들이 간단해지고 공통되는 부분들이 많아졌지만 우리는 실수가 일어날 가능성을 최소화하기 위해 간단한 것을 사용하는 대신 제공되는 설치 명령어들을 최대한 많이 사용하여 완벽하게 컴파일할 겁니다.

우리는 최적화 옵션을 사용하는 것을 권장하지는 않습니다. 최적화를 하게 될경우에 약간 빨라질 수는 있지만 컴파일이 힘들어지거나 실패할 가능성이 있습니다. 만약 해당 패키지가 최적화를 사용하여 컴파일하는 것을 거부한다면 최적화 옵션을 끄고 컴파일해보고 해당 문제에 대한 패치를 찾아보시기 바랍니다. 또한 컴파일시에 최적화 옵션을 사용하지 않는다고 해도 복잡한 코드와 빌드 툴들의 상호작용들로 인해서 언제든지 컴파일이 실패할 가능성은 존재합니다. 또한 -march와 -mtune 옵션은 이 책에서 테스트되지 않았다는 점을 명심하십시오. 이 옵션들은 툴체인 패키지들(Binutils, GCC, Glibc)를 설치하는데 문제를 일으킬수도 있습니다. 만약 LFS를 처음 설치해본다면 이러한 최적화 옵션을 사용하지 않기를 권장해드립니다.

어떠한 프로그램도 갑자기 일순간에 /tools안에 자신의 위치를 가지게 되지는 않기 때문에 이 장에서 설치되는 패키지순서는 반드시 지켜져야 합니다. 또한 반드시 컴파일은 한번에 하나씩만 이루어져야 합니다. 병렬적으로 컴파일하는 것은 시간을 절약할 수는 있지만 /tools 경로에 대해 다른 패키지들끼리 꼬일 수 있기 때문에 이렇게 컴파일된 프로그램은 반드시 멈추고 해당 디렉토리를 삭제해야합니다.

설치 전에 각각 설치 페이지들은 패키지에 대해 무엇을 포함하고 빌드하는데 얼마나 걸리는지, 또 필요 공간이 얼마나 되는지에 대한 정보를 제공합니다. 또한 패키지를 설치할 때 생성되는 프로그램과 라이브러리에 대한 간단한 정보 또한 설치 문서에 나와있습니다.

1.1.2. Virtual Kernel File System 준비하기


다양한 파일 시스템이 커널에 의해 제공되고 사용됩니다. 이러한 파일 시스템은 이들을 사용하는데 필요한 디스크공간을 가지지 않는 "가상"개념입니다. 파일시스템의 내용은 메모리에 위치하게 됩니다.

파일시스템이 마운트될 디렉토리들을 만들어줍니다.
mkdir -v $LFS/{dev,proc,sys}

1.1.2.1. 초기화된 디바이스 노드 만들기

커널이 시스템을 부팅할 때 console과 null device를 포함하여 몇가지 device node를 필요로 합니다. device node는 하드 디스크에 생성되어야 하며 이래야 udevd가 실행되고 리눅스가 init=/bin/bash로 실행되기 전에 사용가능한 상태가 됩니다. 다음의 명령으로 디바이스노드를 만들어줍니다
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3

1.1.2.2. /dev 마운트, 옮기기

/dev 디렉토리를 옮기는 방법으로는 tmpfs같은 가상 파일시스템을 마운트하고 검색되거나 접근되는 가상 파일시스템을 동적으로 생성하는 방법을 추천합니다. 일반적으로 디바이스 생성은 Udev에 의한 부트 과정에서 일어납니다. 하지만 아직 Udev를 설치하지 않았을뿐더러 아직 부팅도 안했으니 수작업으로 /dev를 옮겨줘야합니다. 이것은 호스트 시스템의 /dev 디렉토리를 바인드 마운트로 해결할 수 있습니다. 바인드 마운트(bind mount)는 특별한 종류의 마운트방법으로 디렉토리나 마운트포인트에 대해서 다른 위치에 미러를 생성하는 것을 허용합니다. 다음의 명령으로 이를 수행합니다:
mount -v --bind /dev $LFS/dev

1.1.2.3. 가상 커널 파일 시스템 마운트하기

이제 가상 커널 파일시스템만 남았네요
mount -vt devpts devpts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys

어떤 호스트 시스템에서는 /dev/shm가 /run/shm으로 심볼릭 링크되어있습니다. chroot 환경으로 들어가면 이러한 심볼릭링크는 tmpfs를 마운트하기전에 변경되어야합니다.
if [ -h /dev/shm ]; then
   rm -f $LFS/dev/shm
   mkdir $LFS/dev/shm
fi

mount -vt tmpfs shm $LFS/dev/shm

1.1.3. 패키지 관리


패키지 관리는 LFS 책에서 계속해서 추가되는 부분입니다. 패키지 매니저는 설치될 파일을 탐색하여 삭제하거나 업그레이드 할 때 쉽도록 해줍니다. 바이너리 파일과 라이브러리 파일뿐만 아니라 설정 파일들의 설치도 다룰 겁니다. 하지만 여러분들이 이에 대해 궁금해 하기 전에 이 절에서는 특정 패키지 매니저를 추천하지 않을 것입니다. 각각의 패키지 매니저들은 사용된 테크닉들과 어떻게 그것들이 작동하는지에 대한 정보들을 종합하여 제공합니다. 여러분에게 완벽한 패키지매니저는 이러한 사용된 테크닉들(어쩌면 두 개 이상의 테크닉이 종합된 것들)에 따라 달라질 것입니다. 이 절에서는 간단하게 패키지를 업그레이드 할때 나타날 수 있는 문제들에 대해서 언급할 것입니다.

다음은 LFS, BLFS에서 패키지매니저가 없는지에 대한 이유들입니다:
  • 패키지매니저를 다루다 보면 이 책의 목표(어떻게 리눅스 시스템이 만들어지는지 배우는 것)에서 벗어날 수 있습니다.
  • 패키지 매니저를 위한 여러가지의 방법이 있지만 각각마다 장단점이 있습니다. 따문에 하나를 선택하여 모든 책의 독자들을 만족시키에는 역부족입니다.

패키지 매니저를 주제로 쓴 도움말이 있습니다. [http]Hints Project 에 방문에여 여러분에게 맞는 패키지 매니저를 찾아보십시오.

1.1.3.1. 업그레이드 문제

패키지매니저는 새로 릴리즈된 버전으로 쉽게 업그레이드할 수 있도록 해줍니다. 일반적으로 LFS와 BLFS에 있는 설명들은 새로운 버전으로 업그레이드 하기 위해 사용될 수 있습니다. 다음 몇가지 주의사항을 읽어보시기 바랍니다:
  • 만약 툴체인 패키지(Glibc, GCC, Binutils) 중 한가지가 업그레이드가 되어야 한다면, LFS를 다시 빌드하는편이 더 안전합니다. 여러분이 모든 패키지를 의존성을 고려하고 그 순서에 따라서 올바르게 설치할 수 있다고 해도 권장하지 않습니다. 예를 들면, 만약 glibc-2.2.x가 glibc-2.3.x로 업데이트되어야 한다고 했을 때, 다시 빌드하는 편이 더 안전합니다. 하지만 micro 버전 업데이트(2.2.x에서 2.2.x+1로 바뀌는 것들)같은 경우에는 간단히 다시 설치하면 보통은 잘 작동합니다만 반드시 그렇게 되리라는 보장은 없습니다. 예를 들어 glibc-2.3.4에서 glibc-2.3.5로 업그레이드는 보통 아무런 문제도 야기하지 않습니다.

1.1.3.2. 패키지 관리 기법

다음의 몇가지 공통된 패키지 관리 기법들이 있습니다. 사용할 패키지 매니저를 결정하기 전에 다양한 기법들과 각각에 대한 장단점들을 찾아보기 바랍니다.

1.1.3.2.1. It is All in My Head!
(chaoxifer필자曰: 하....정말 노가다입니다)

맞습니다, 이것은 패키지 관리 기법입니다. 어떤 이들은 이미 각각의 패키지에 대해 친숙하게 알고 있고 어떤 파일들이 각각의 패키지에서 설치되는지 알기 때문에 패키지 매니저를 따로 찾을 필요가 없다고 말합니다. 또 어떤 이들은 한 패키지가 변했을 경우 전체의 시스템을 재빌드하면 되기 때문에 패키지 관리는 필요가 없다고 말하기도 합니다.

1.1.3.2.2. 분리된 디렉토리에서 설치하기

이것은 단순한 패키지 관리기법로써 패키지관리를 위해 따로 패키지가 필요하지 않습니다. 각각의 패키지는 분리된 디렉토리에 설치됩니다. 예를 들어 foo-1.1이라는 패키지는 /usr/pkg/foo-1.1에 설치되고 /usr/pkg/foo에서 /usr/pkg/foo-1.1로 symlink가 만들어져있습니다. 만약 새로운 버전인 foo-1.2가 설치될 때는 /usr/pkg/foo-1.2를 설치하고 새로운 버전을 가리키도록 symlink를 바꾸면 됩니다.

PATH, LD_LIBRARY_PATH, MANPATH, INFOPATH 그리고 CPPFLAGS와 같은 환경 변수들은 /usr/pkg/foo를 포함하여야 합니다. 점점 많은 패키지가 등장하면서 이러한 방법은 점점 관리하기가 힘들어집니다.
1.1.3.2.3. Symlink Style Package Management
이것은 이전 패키지 관리 기법에서 변화된 형태입니다. 설치된 각 패키지들을 이전과 비슷하게 분리합니다. 하지만 symlink를 만드는 대신에 각 파일을 /usr 디렉토리안에 계층적으로 symlink 됩니다. 이것은 각 패키지마다 환경변수에 추가해야되는 단점을 해결하였습니다. 사용자에 의해 자동적으로 symlink를 생성할 수 있지만 많은 패키지 매니저들이 이 접근방식을 사용하고 있습니다. 유명한 몇가지를 나열하자면 Stow, Epkg, Graft, Depot 등이 있습니다.

패키지가 /usr/pkg 아래에 설치되었지만 /usr에 설치되어 있다고 만들기 위해 설치는 fake로 되어야 합니다. 이러한 방식으로 설치하는 것은 보통 힘든일이 아닙니다. 예를 들어 여러분이 libfoo-1.1을 설치하려고 한다고 생각하십시오. 다음의 명령어대로 하면 패키지가 정상적으로 설치되지 않을 것입니다.
./configure --prefix=/usr/pkg/libfoo/1.1
make
make install

설치는 잘 되겠지만 의존 패키지들이 libfoo에 제대로 연결되지 않을 것입니다. 만약 패키지를 컴파일하여 libfoo에 대해 링크하려면 반드시 /usr/lib/libfoo.so.1데신에 /usr/pkg/libfoo/1.1/lib/libfoo.so.1로 연결되어야 합니다. 때문에 올바른 접근방법은 DESTDIR을 이용하여 fake 설치를 하는 것입니다:
./configure --prefix=/usr
make
make DESTDIR=/usr/pkg/libfoo/1.1 install

대부분의 패키지들이 이러한 접근 방법을 제공하고 있지만 모두다 그런 것은 아닙니다. 컴파일이 필요없는 패키지의 경우 여러분들이 직접 패키지를 일일이 설치해주거나 문제를 일으키는 패키지들은 /opt 안에 설치해야 할 것입니다.
1.1.3.2.4. Timestamp Based
이 기법에서는 패키지를 설치하기 전에 해당 파일의 변경날짜가 갱신됩니다. 설치 후에 간단하게 find커맨드에 적절한 옵션을 사용하여 타임스탬프(새로 갱신된 파일)가 적용된 파일들로부터 로그파일을 만들어낼 수 있습니다. 이러한 접근방법으로 만들어진 패키지 매니저에는 install-log가 있습니다.

이러한 방법은 매우 간단하다는 장점이 있지만 두가지 결점이 있습니다. 먼저, 설치중에 어떤 파일이 현재시간과 다른 시간으로 갱신된다면 이 파일들은 나중에 패키지 관리자에 의해 검색되지 않을 것입니다. 또한 이 방법은 한번에 한 패키지를 설치하는 경우에만 적용할 수 있습니다. 두 개의 콘솔환경에서 두 개의 패키지를 설치하는 경우 이 때 생성되는 log파일은 신뢰성을 잃어버립니다.
1.1.3.2.5. Tracing Installation Scripts
이 접근 방법은 설치 스크립트의 실행흔적들을 모두 기록합니다. 이를 위해 사용할 수 있는 방법은 두가지가 있습니다:

LD_PRELOAD 라는 환경 변수는 설치 전에 미리 로드될 라이브러리의 경로를 가리키도록 설정될 수 있습니다. 설치하게되면, 라이브러리는 설치하면서 사용하게될 cp, install, mv같은 패키지가 설치되어 있는지를 검색하고 파일시스템을 수정한 system call을 탐색합니다. 이러한 접근방법을 가능하게 하기 위해서는 모든 실행파일들은 suid나 sgid가 설정되지 않은 상태로 동적으로 연결되어 있어야 됩니다. 하지만 Preloading the library는 예상치못한 부작용을 일으킬수 있습니다. 그렇기 때문에 항상 패키지 매니저가 시스템을 고장내는걸 방지하고 항상 적절한 로그파일을 기록하도록 하기위해 테스트를 반드시 실행해주어야 합니다.

두번째 기법은 strace를 이용하는 것입니다. strace는 설치 스크립트가 실행되는 동안 모든 system call을 기록합니다.
1.1.3.2.6. Creating Package Archives
이것은 Symlink style package management에서 기술한 분리된 디렉토리에 패키지를 fake로 설치하는 방법입니다. 설치 후에는 패키지 아카이브가 설치된 파일들을 이용하여 만들어집니다. 이 아카이브는 로컬 컴퓨터나 다른 컴퓨터에 설치하기 위해 사용됩니다.

이 접근방법은 대부분의 패키지 매니저에서 사용됩니다. 예를 들면 RPM([http]Linux Standard Base Specification)에 부가적으로 요구되는), pkg-utils, 데바안의 apt, Gentoo의 portage 시스템 등이 있습니다. 어떻게 LFS 시스템에 패키지 매니저를 적용하는지에 대해 기술한 도움말이 있습니다. 다음을 참고하세요: [http]http://www.linuxfromscratch.org/hints/downloads/files/fakeroot.txt

의존성 정보를 담고 있는 패키지파일을 만드는 것은 복잡하고 LFS보다는 BLFS에서 하는 것이 적합합니다.

slackware는 tar를 기본으로 한 시스템을 사용합니다. 이 시스템은 일부러 패키지 매니저가 다루는 복잡한 패키지들의 의존성 문제를 다루지 않겠다는 것입니다.(모든 패키지에 대해 slackware가 stable버전만 제공하는 이유가 바로 이겁니다) Slackware의 패키지 관리방법에 대해 자세하게 보려면 다음을 참고하세요: [http]http://www.slackbook.org/html/package-management.html
1.1.3.2.7. User Based Management
이 이론은 LFS의 특징으로 Matthias Benkmann에 의해 고안되었고 현재 [http]Hints Project로부터 이용가능합니다. 이것은 각각의 패키지들이 설치될 때 표준 위치로 각각 다른 유저로써 설치되는 것입니다. 패키지에 따른 파일들은 userID를 통해서 식별이 가능합니다. 이러한 특징과 여기에 대한 단점에 대해 설명하려면 이 절에서 설명하기에는 너무 복잡합니다. 더 자세히 알고자 한다면 다음 링크를 참고하십시오: [http]http://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_man.txt

1.1.3.3. 다중 시스템에서 LFS 사용하기

LFS 시스템의 장점 중 하나는 디스크 시스템에서의 파일의 위치에 의존하는 파일이 없다는 것입니다. tar를 이용해서 아키텍쳐가 비슷한 기본 시스템으로부터 다른 컴퓨터로 root디렉토리를 포함한 LFS 파티션을 네트워크를 통해 전송하거나 CD-ROM을 이용하여 이동시킬 수 있습니다. 여기서 중요한 점은 몇가지 설청 파일들이 변경되어야한다는 점입니다. 설정 파일에는 다음의 것들이 포함됩니다: /etc/hosts, /etc/fstab, /etc/passwd, /etc/group, /etc/shadow, /etc/ld.so.conf, /etc/sysconfig/rc.site, /etc/sysconfig/network, /etc/sysconfig/ifconfig.eth0

커널설정은 새로운 시스템의 하드웨어에 따라 달라지며 원본 커널 설정과 다른점에 따라 설정하여 컴파일하면 됩니다.

마지막으로 새로운 시스템을 부팅 가능하도록 만드려면 Using GRUB to Set Up the Boot Process를 참고하십시오.

1.1.4. chroot환경에 들어가기


이제 우리가 필요한 패키지들을 설치하기 위해선 chroot 환경으로 들어 가야 합니다. root계 정만이 chroot를 실행할 수 있습니다. root로 로그인 합시다.


지금까지 이 책에서 지시한데로 잘 따라 했다면 /mnt/lfs란 디렉토리가 제대로 만들어져 있을 것입니다.

root 에서 chroot환경변수로 들어가는 명령어를 실행하세요. (참고로 아래 명령어들은 스크립트로 만들어 두는 것이 편합니다.)

chroot "$LFS" /tools/bin/env -i 
    HOME=/root                  
    TERM="$TERM"                
    PS1='u:w$ '              
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin 
    /tools/bin/bash --login +h
-i 옵션을 주면 env 명령어는 chroot의 모든 변수들을 초기화 할 것입니다. 그 후에 HOME, TERM, PS1 그리고 PATH 변수만이 다시 셋팅됩니다. TERM=$TERM 명령어는 TERM 변수의 chroot 내부의 값을 외부 chroot와 같은 값으로 셋팅할 것입니다, 이 변수는 vim 과 less 프로그램이 정확하게 동작하는데 필요합니다다. 만약 당신에게 CFLAGS, CXXFLAGS 와 같은 변수들이 필요하다면 그것들을 다시 셋팅하기에 좋은 장소입니다.


지금 이시점으로 부터 LFS 변수는 더이상 사용되지 않을 것입니다. 왜냐하면 shell이 LFS 변수가 chroot명령으로 전달되었다고 생각한 후 당신이 하는 모든 것들이 LFS시스템(chroot 명령에 의해 보내진 value of $LFS)으로 부터 제한받을 것이기 때문입니다. since what the shell thinks is / is actually the value of $LFS, which was passed to the chroot command.


PATH에 /tools/bin 이 마지막 경로로 지정했습니다. 이 뜻은 마지막 버젼이 인스톨된후 임시툴은 더이상 사용되지 않는다는 뜻입니다. 쉘이 실행된 바이너리의 위치를 기억하지 못할때 bash에+h 을 줌으로써 쓰레기값이 처리됩니다.



당신은 이 장에서 나오는 나머지 명령어들을 확실히 알아야 하고 chroot 환경내에서 이번 장의 내용을 따라 실행시켜야 합니다. 만약 어떤 이유에서든 이 환경을 떠났다면 당신은 반드시 다시 chroot로 들어와야 한다는 것을 기억해야하고 proc 와 devpts 파일 시스템(나중에 설명)을 인스톨을 계속 진행하기 전에 설치하는것을 기억해야합니다.


위와 같이 chroot 명령을 실행하며 "I have no name!:/# "란 메세지가 프롬프트 제일 앞에 나오게 되는게 /etc/passwd 파일을 만들지 않았기 때문에 생기는 메세지니까 신경 안 쓰셔도 됩니다.


1.1.5. 디렉토리 만들기


이제 LFS 파일 시스템 내에서 새로운 디렉토리를 만들어 봅시다. 명령어 결과에 따라 더 많거나 적은 기본 트리가 만들어 질 것입니다:

{{{{
mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt,run}
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/{doc,info,locale,man}
mkdir -v  /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
for dir in /usr /usr/local; do
  ln -sv share/{man,doc,info} $dir
done
case $(uname -m) in
 x86_64) ln -sv lib /lib64 && ln -sv lib /usr/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/{misc,locate},local}
}}}      

   /root의 퍼미션을 0750으로 바꾸어 주면 아무나 /root에 들어 가지 못하게 해 줍니다. 두 번째 chmod명령은 아무나 /tmp 나 /var/tmp 디렉토리에 write할 수 있게 해 줍니다.  그러나 다른 사용자들이 생성한  파일을 지울수는 없습니다. 퍼미션이 777인데  다른 사용자의 파일을 지울 수 없게 하는 것은  "sticky bit"(까다로운 비트)라고 불리는 것에 의해 설정됩니다. --(1777 bit mask에서 가장높은 비트) 

==== FHS에 대해서 ====
디렉토리 트리는 Filesystem Hierarchy Standard (FHS) ([http://www.pathname.com/fhs/ http://www.pathname.com/fhs/]에서 참고)를 기본으로 합니다. 우리는 아직도 많은 패키지들이 /usr/share/<directory>나 /usr/local/share/<directory>와는 반대로 /usr/<directory> 또는 /usr/local/<directory> 안에 문서들을 설치하게끔 설정되어 있어서 man, doc, info 디렉토리를 위해 적절한 symlink를 만들 것입니다. FHS는 /usr/local/share 안에 있는 서브디렉토리만큼 정밀하지는 않습니다. 때문에 우리는 우리가 필요한 디렉토리만 만들 것입니다.


=== 필수 file과 symlink 만들기 ===

일부 프로그램들은 아직 존재하지 않는 프로그램들과 하드 링크 되어 있습니다. 우리는 안정성을 보장하기 위해 실제 파일들을 대신할 심볼릭 링크를 생성하여 인스톨 하는 동안 사용하게 됩니다. 

{{{
ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
ln -sv /tools/bin/perl /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
ln -sv bash /bin/sh
}}}      
 
리눅스 시스템은 마운트된 파일시스템의 목록을 /etc/mtab에 보관하고 있습니다. 보통적으로 이 파일은 우리가 새로운 파일시스템을 마운트할 때 생성됩니다. 하지만 우리는 chroot환경으로 들어간 후부터 아무런 파일시스템도 마운트하지 않았기 때문에 다음과 같이 새로운 /etc/mtab파일을 만들어주어야 합니다.
{{{
touch /etc/mtab
}}}

=== 패스워드, 그룹, 로그파일 만들기 ===

root로 로그인 하기 위해 /etc/passwd와 /etc/group 파일이 필요합니다.


아래 명령을 실행해서 /etc/passwd 를 만드세요:
{{{
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
}}}      
 

root의 정확한 패스워드는 나중에 설정할 것입니다. (여기에서의 "x"는 그냥 빈칸을 채우기 위해 사용합니다.)

아래 명령어를 실행해서 /etc/group 를 생성하세요:
{{{
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:
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:
mail:x:34:
nogroup:x:99:
EOF
}}}      
 

  생성된 그룹들은 표준이 아닙니다. 이 그룹들은 다음 페이지의 MAKEDEV Script가 이용하게 됩니다.  LSB(http://www.linuxbase.org)에 서는  root 그룹을 을 제외한 나머지 그룹들의 이름과 GID에 대해서 정해 놓지 않았습니다. 다만, bin이라는 그룹명과 bin의 GID는 1로 할 것을 추천하고 있습니다. 모든 다른 그룹의 이름이나 그룹아이디는 유저에 의해서 자유롭게 선택될 수 있습니다. 잘 쓰여진 패키지들은 GID숫자들에 의해 영향받지 않습니다. 

"I have no name!"이란 메세지를 해결하기 위해 우리는 새로운 쉘을 시작할 것입니다. 우리는 5장에서 Glibc를 완벽하게 설치한 상태이고, 방금전에/etc/passwd 와 /etc/group 파일을 생성한후부터 유저 이름과 그룹이름은 작동하기 시작합니다.
{{{
exec /tools/bin/bash --login +h
}}}  
 

+h :  +h는 bash가 내부 path Hashing 기능을 사용하지 않도록 해 줍니다.  이 옵션이 없으면, bash는 실행되었던 바이너리 경로들을 기억할 것입니다. 우리들이 앞으로 팩키지들을 다 설치할 때까지는 이 옵션을 이용해서 Path Hashing 기능을 꺼 놓을 것입니다.

The login, agetty 그리고 init 프로그램(그리고 어떤 다른프로그램들)은 누가 언제 시스템에 로그인 했는지 기록할 몇개의 로그파일들을 사용합니다. 그러나 이 프로그램들은 접속자가 이미 존재하지 않다면 기록하지 않습니다. 로그파일들을 초기화하고 그것들에 적당한 허가권을 부여합니다:

{{{
touch /var/log/{btmp,lastlog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664  /var/log/lastlog
chmod -v 600  /var/log/btmp
}}}  
 

/var/run/utmp 파일은 현재 로그인된 사용자들을 기록합니다.   

/var/log/wtmp 파일은 모든 로그인과 로그아웃을 기록합니다.    

/var/log/lastlog 파일은 사용자가 언제 마지막으로 로그인했는지 기록합니다.    

/var/log/btmp 잘못 시도된 로그인을 기록합니다.     




=== Linux-3.5.2 API 헤더 설치 ===
--역주)5.1.1 버전에는 2.4.26 을 사용합니다. 차후에 변경하도록 하겠습니다.--
{{{
Approximate build time:  0.1 SBU
Required disk space:     515 MB
}}}

==== kernel 헤더 설치 ====
리눅스 커널은 C 라이브러리(Glibc)에 Application Programming Interface(API)를 제공하기 위해 반드시 필요합니다. 이것은 리눅스 커널 소스 파일로부터 헤더파일만 따로 정리해서 해결할 수 있습니다.

먼저 이전의 make로 혹시나 지워지지 않고 남아있는 불필요한 파일이 있는지 확인하고 정리합니다:
{{{
make mrproper
}}}
이제 사용자가 커널 소스로부터 볼 수 있는 커널 헤더파일들을 추출합니다. 추출된 파일들은 중간 로컬 디렉토리에 놓여진 뒤 복사되는데 이러한 추출 과정이 끝나면 target 디렉토리에 남아있는 파일들을 지워버리고 해당 위치로 바로 복사해버리기 때문에 복사할 위치(&#4447;target 디렉토리)를 정해주어야 합니다. 여기에는 커널 개발자들이 사용하는 몇몇 숨겨진 파일들이 있지만 이러한 파일들은 지금 LFS에서는 필요하지 않습니다.
{{{
make headers_check
make INSTALL_HDR_PATH=dest headers_install
find dest/include ( -name .install -o -name ..install.cmd ) -delete
cp -rv dest/include/* /usr/include
}}}

===== 리눅스 API headers =====
6.7.2. Contents of Linux API Headers
'''Installed headers:'''

/usr/include/asm/*.h, /usr/include/asm-generic/*.h, /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, /usr/include/sound/*.h, /usr/include/video/*.h, /usr/include/xen/*.h

'''Installed directories:'''

/usr/include/asm, /usr/include/asm-generic, /usr/include/drm, /usr/include/linux, /usr/include/mtd, /usr/include/rdma, /usr/include/scsi, /usr/include/sound, /usr/include/video, /usr/include/xen

'''Short Descriptions'''

 * /usr/include/asm/*.h: The Linux API ASM Headers

 * /usr/include/asm-generic/*.h: The Linux API ASM Generic Headers

 * /usr/include/drm/*.h: The Linux API DRM Headers

 * /usr/include/linux/*.h: The Linux API Linux Headers

 * /usr/include/mtd/*.h: The Linux API MTD Headers

 * /usr/include/rdma/*.h: The Linux API RDMA Headers

 * /usr/include/scsi/*.h: The Linux API SCSI Headers

 * /usr/include/sound/*.h: The Linux API Sound Headers

 * /usr/include/video/*.h: The Linux API Video Headers

 * /usr/include/xen/*.h: The Linux API Xen Headers 

===== platform-specific include/asm symlink만들기: =====
{{{
make symlinks
}}}  
 

===== platform specific-header파일들 설치: =====
{{{
cp -HR include/asm /usr/include
cp -R include/asm-generic /usr/include
}}}  
 

==== cross-platform kernel header파일들 설치: =====
{{{
cp -R include/linux /usr/include
}}}      
 

  일부 커널 헤더파일은 autoconf.h 헤더파일을 사용합니다. 아직 커널을 구성하지 않았기 때문에, 컴파일의 실패를 피하기 위한 파일을 만들 필요가 있습니다. 비어있는 autoconf.h 파일을 만들어 주세요. 
{{{
touch /usr/include/linux/autoconf.h
}}}      
 

==== 우리가 커널 헤더들을 복사하고 symlink를 걸지않는 이유 ====
예전에는 /usr/include/{linux,asm}과 /usr/src/linux/include/{linux,asm}을 심볼릭 링크로 연결해 주었었습니다. 
하지만 요즘은 이런 방식을 사용하지 않습니다. (안 좋은 방법이라고 하더군요) 
다음은 Linus Torvalds 의 the Linux Kernel Mailing List에서 발췌한 내용입니다. 


 I would suggest that people who compile new kernels should:  - not have a single symbolic link in sight (except the one that the    kernel build itself sets up, namely the "linux/include/asm" symlink    that is only used for the internal kernel compile itself) And yes, this is what I do. My /usr/src/linux still has the old 2.2.13 header files, even though I haven't run a 2.2.13 kernel in a _loong_ time. But those headers were what Glibc was compiled against, so those headers are what matches the library object files. And this is actually what has been the suggested environment for at least the last five years. I don't know why the symlink business keeps on living on, like a bad zombie. Pretty much every distribution still has that broken symlink, and people still remember that the linux sources should go into "/usr/src/linux" even though that hasn't been true in a _loong_ time.
 
 The essential part is where Linus states that the header files should be the ones which Glibc was compiled against. These are the headers that should be used when you later compile other packages, as they are the ones that match the object-code library files. By copying the headers, we ensure that they remain available if later you upgrade your kernel.




그런데, /usr/include/{linux,asm}symlink들이 필요 없을 만큼 /usr/src/linux가 완벽해 졌습니다. 





=== Man-pages-3.42 설치 ===

Approximate build time:  <=0.1 SBU
Required disk space:     22 MB

설명: 1,900개가 넘는 man 페이지를 포함한 패키지를 설치합니다.
==== Man-pages 설치 ====

다음과 같이 실행해서 Man-pages를 설치하라:
{{{
make install      
}}}


==== Man-pages 내용 ====

설치된 파일들: various manual pages


==== 요약 ====

manual pages는 C와 C++함수, 중요한 디바이스 파일들, 중요한 구성 파일들을 서술한 페이지입니다.



=== Glibc-2.16.0 설치 ===
Glibc패키지는 주요한 C 라이브러리를 포함하고 있습니다. 이 라이브러리는 모든 메모리할당, 디렉토리 검색, 파일 입출력, 그것들에 대한 읽고 쓰기,  패턴일치, 계산, 그리고 여러가지 일들의 기초적인 규칙을 제공합니다.

{{{
Approximate build time:  17.6 SBU
Required disk space:     852 MB
}}}

Glibc (2.16.0)공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/glibc/

Glibc와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Gettext, Grep, Make, Perl, Sed, Texinfo.


==== Glibc 설치 ====
 '''Note'''
 
 몇몇의 LFS에 포함되지 않는 패키지들은 data를 다른것으로 인코딩하여 전송하기 위해 GNU libiconv를 설치하라고 하는 것도 있습니다. libiconv의 프로젝트 홈페이지([http://www.gnu.org/software/libiconv/ http://www.gnu.org/software/libiconv/])에서는 "이 라이브러리는 iconv()를 가지고 있지 않거나 unicode에서 혹은 unicode로 변환하지 못하는 경우를 위해 제공되는 라이브러리입니다."라고 말하고 있습니다. 하지만 Glibc에서 이미 iconv()를 제공하며 이것 또한 유니코드간의 데이터 변환을 제공합니다. 이때문에 LFS에서는 libiconv를 따로 설치할 필요는 없습니다.

Glibc 설치 시스템은 컴파일러 스펙 파일과 링커가 아직 /tools에 연결되어 있어도 완벽하게 설치될 것입니다. Glibc를 설치하기 전에는 스펙과 링커를 적용할수 없으므로 Glibc의 자동 설정테스트는 오류의 결과를 줄것이며 완벽한 시스템을 성취하는 목표를 실패하게 될 것입니다.

Glibc를 구축하기전에 어떤 환경변수를 최적화된 기본 플래그로 다시 설정하는 것을 잊지 마세요.

먼저 LFS환경에서 빌드 실패를 야기할 수 있는 부분을 다음과 같이 고칩니다:
{{{
sed -i 's#<rpc/types.h>#"rpc/types.h"#' sunrpc/rpc_clntout.c
}}}

'''make install'''를 실행하면 스크립트는 test-installation.pl를 실행하여 새로 설치된 Glibc를 테스트할 것입니다. 하지만 이것은 버그를 가지고 있어서 빌드실패로 이어질 수 있기 때문에 미리 test-installation.pl을 실행하지 못하도록 설정합니다.
{{{
sed -i '/test-installation.pl/d' Makefile
}}}

'''ldd''' 셸 스크립트는 Bash로 국한되어 있는 구문을 포함하고 있습니다. 그렇기 때문에 명령어 해석기로 /bin/bash를 기본으로 사용하도록 설정합니다.(/bin/sh -> /bin/bash)
{{{
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
}}}

다음은 몇몇 어플리케이션에서 네임서버를 이용할 때 발생하는 문제를 수정합니다:
{{{
patch -Np1 -i ../glibc-2.16.0-res_query_fix-1.patch
}}}

Glibc 설명서는 Glibc를 구축할때 구축대상이되는 디렉토리에서 소스 디렉토리를 밖으로 빼내도록 권고하고 있습니다:

{{{
mkdir -v ../glibc-build
cd ../glibc-build
}}}      

지금 Glibc를 컴파일하기위한 준비를 해라:(5장에서도 설명했지만, Glibc를 구축할 때는, Glibc의 압축을  푼 다음 그 디렉토리 밖에서 configure를 실행해야 한다.)
{{{
../glibc-2.16.0/configure  
    --prefix=/usr          
    --disable-profile      
    --enable-add-ons       
    --enable-kernel=2.6.25 
    --libexecdir=/usr/lib/glibc
}}}      

Configure 옵션의 의미:

    * --libexecdir=/usr/lib: 이것은 프로그램의 pt_chown 의 기본위치인 /usr/libexec 에서 /usr/lib로 위치를 변경해준다. libexec 를 사용하는것은 FHS-compliant를 생각하지 않기위해서이다. 왜냐하면 FHS를 언급하지 않기위해서이다.

패키지 컴파일하기:
{{{
make
}}}      

 주의: 이 절에서 Glibc를 위한 test suite는 정말 중요합니다. 절대 그냥 지나치시면 안됩니다.

테스트 하기 :
{{{
make -k check 2>&1 | tee glibc-check-log
grep Error glibc-check-log
}}}      

일반적으로 몇몇 테스트는 통과되지 못할 겁니다. 하지만 여러분들은 아래 있는 테스트 실패들은 그냥 무시하셔도 됩니다. 

여러분들은 아마도 ''posix/annexc''와 ''conform/run-conformtest'' 테스트에서 실패할 것입니다. 게다가 Glibc test suite는 호스트 시스템에 의존하는 것이 있기 때문에 실패하는 것이 있을 수도 있습니다. 다음은 공통적으로 발생되는 것들입니다:
 * ''nptl/tst-clock2, nptl/tst-attr3, tst/tst-cputimer1, rt/tst-cpuclock2'' 테스트는 원인은 완벽하게 이해할 수 ㅤㅇㅣㅄ지만 작은 타이밍 문제가 이러한 실패의 원인일 것입니다.
 
 * 만일 여러분의 CPU가 Intel 또는 AMD 프로세서 종류가 아닐 경우에는 math test가 가끔씩 실패할 수 있습니다.

 * 정말 오래되었거나 느린 하드웨어를 사용하는 경우 테스트 timeout을 초과하여 실패할 수도 있습니다. 이것은 make check에 '''TIMEOUTFACTOR=16 make -k check'''처럼 TIMEOUTFACTOR을 설정하여 재설정할 수 있습니다.

 * 다른 테스트들:poxis/bug-regex32, misc/tst-writev, elf/check-textrel, nptl/tst-getpid2, stdio-common/bug22 등은 몇몇 아키텍쳐에서 실패한다고 알려져 있습니다.

무시해도 되는 메세지이지만 Glibc가 /etc/ld.so.conf 파일이 없다고 설치시에 메세지를 출력할 겁니다. 이러한 경고 메세지를 막기 위해 파일을 하나 생성해줍니다.
{{{
touch /etc/ld.so.conf
}}}

팩키지를 인스톨하세요.
{{{
make install
}}}

NIS와 PRC에 관련된 헤더파일들을 설치해줍니다. 이것들은 나중에 BLFS 패키지들을 설치할 때 Glibc를 재빌드하지 않기 위해 필요한 과정입니다.
{{{
cp -v ../glibc-2.16.0/sunrpc/rpc/*.h /usr/include/rpc
cp -v ../glibc-2.16.0/sunrpc/rpcsvc/*.h /usr/include/rpcsvc
cp -v ../glibc-2.16.0/nis/rpcsvc/*.h /usr/include/rpcsvc
}}}

아래 명령을 입력하면 모든 로케일이 설치된다.
{{{
make localedata/install-locales
}}}      

이전의 명령을 실행함으로써  모든 로케일을 설치할 수 있었다. 하지만 원하는 localses만을 설치 할수도 있다.  localedef 명령을 사용함으로서 필요한 로케일만을 설치할 수 있는 것이다. Glibc 소스의 INSTALL 파일에서 이 정보를 찾을 수 있다.  앞으로의 패키지를 설치하기위한 테스트들 중요한 다수의 locales가 있다. 특히 GCC의 libstdc++ 테스터들이 그러하다. 설치를 하다보면 install-locales 목표를 넘어 테스트를 성공적으로 실행하기위해 최소한으로 locales에 설치될것이다.
{{{
mkdir -pv /usr/lib/locale
localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
localedef -i de_DE -f ISO-8859-1 de_DE
localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
localedef -i de_DE -f UTF-8 de_DE.UTF-8
localedef -i en_GB -f UTF-8 en_GB.UTF-8
localedef -i en_HK -f ISO-8859-1 en_HK
localedef -i en_PH -f ISO-8859-1 en_PH
localedef -i en_US -f ISO-8859-1 en_US
localedef -i en_US -f UTF-8 en_US.UTF-8
localedef -i es_MX -f ISO-8859-1 es_MX
localedef -i fa_IR -f UTF-8 fa_IR
localedef -i fr_FR -f ISO-8859-1 fr_FR
localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
localedef -i it_IT -f ISO-8859-1 it_IT
localedef -i it_IT -f UTF-8 it_IT.UTF-8
localedef -i ja_JP -f EUC-JP ja_JP
localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
localedef -i zh_CN -f GB18030 zh_CN.GB18030
}}}      


==== Glibc 설정 ====

  우리는 /etc/nsswitch.conf 파일을 만들어야 합니다.  왜냐하면, Glibc는 기본적으로 이 파일이 없거나 손상되었을때 Glibc는 네트워크와 관련된 작업을 하지 않기 때문입니다.  또한 시간대를 설정하기 위해서도 필요합니다.


아래의 내용을 참조하여(실행하여) /etc/nsswitch.conf 파일을 생성합니다.

{{{
cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

hosts: files dns
networks: files

protocols: files
services: files
ethers: files
rpc: files

# End /etc/nsswitch.conf
EOF
}}}      

당신이 있는 시간대를 찾기위해 아래의 스크립트를 실행하세요.
{{{
tzselect
}}}      

  당신의 위치에 관한 약간의 질문의 답변을 하면 그 스크립트는 EST5EDT or Canada/Eastern 와 같은 당신의 시간대의 이름을 출력해 줄것입니다. 그리고 나서 아래와 같이 함으로써 /etc/localtime 을 생성할 수 있습니다.
{{{
cp --remove-destination /usr/share/zoneinfo/Canada/Eastern /etc/localtime
(한국일 경우에는)
cp --remove-destination /usr/share/zoneinfo/Asia/Seoul /etc/localtime
}}}

옵션이 의미하는 것:

    *

      --remove-destination: 이것은 이미 존재하는 심볼릭 링크를 강제 제거하기위해 필요합니다. 심볼릭 링크 대신 복사하는 이유는 /usr 이 분리된 파티션의 상황으로부터 보호하기 위해서이다. 이것은 싱글 유저모드로 부팅했을때 문제가 될 수 있습니다.

물론, Canada/Eastern대신에, tzselect 스크립트로써 타입존의 이름을 주었다.(각 지역의 타임존이 /usr/share/zoneinfo 에 존재합니다)

==== 다이나믹 로더 설정 ====

  기본적으로 동적 로더(/lib/ld-linux.so.2)는 /lib 와 /usr/lib에서 찾으며 당신이 프로그램에서 동적 라이브러리를 실행시킬때 필요합니다. 그러나, 만약 라이브러리가 /lib and /usr/lib외의 다른곳에 있다면, 당신은 /etc/ld.so.conf 파일에 동적로더가 발견할 수 있도록 추가해 줄 필요가 있습니다. /usr/local/lib 와 /opt/lib 디렉토리는 일반적으로 추가적으로 포함 됩니다. 그래서 우리는 이 디렉토리들을 동적로더의 탐색 경로에 추가해야 합니다.

아래의 내용으로써 /etc/ld.so.conf 파일을 새로 생성한다.
{{{
cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf

/usr/local/lib
/opt/lib

# End /etc/ld.so.conf
EOF
 }}}     

==== Glibc의 내용 ====

Installed programs: catchsegv, gencat, getconf, getent, glibcbug, iconv, iconvconfig, ldconfig, ldd, lddlibc4, locale, localedef, mtrace, nscd, nscd_nischeck, pcprofiledump, pt_chown, rpcgen, rpcinfo, sln, sprof, tzselect, xtrace, zdump and zic

Installed libraries: ld.so, libBrokenLocale.[a,so], libSegFault.so, libanl.[a,so], libbsd-compat.a, libc.[a,so], libc_nonshared.a, libcrypt.[a,so], libdl.[a,so], libg.a, libieee.a, libm.[a,so], libmcheck.a, libmemusage.so, libnsl.a, libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so, libnss_nis.so, libnss_nisplus.so, libpcprofile.so, libpthread.[a,so], libresolv.[a,so], librpcsvc.a, librt.[a,so], libthread_db.so and libutil.[a,so]


==== 요 약 ====

catchsegv 프로그램이 세그먼트 부재로 종료되었을때 스택 트레이스를 생성하는데 사용되곤 한다.

gencat 메세지 목록 생성.

getconf 시스템의 일반적인 가변의 파일의 설정값을 보여준다.

getent 관리자 데이터 베이스로부터 목록을 얻는다.

glibcbug 버그 리포트를 생성하고 그것을 이메일을 보낸다.

iconv 문자의 변환을 수행한다.

iconvconfig iconv 모듈의 빠른 실행을위해 설정 파일을 생성한다.

ldconfig 런타임 바인딩시 동적 링커를 설정한다.

ldd 각 프로그램이나 공유라이브러리에 필요한 공유라이브러리를 보고한다.

lddlibc4 object파일과 함께 ldd명령을 보조한다.

locale is a Perl program that tells the compiler to enable or disable the use of POSIX locales for built-in operations. built-in 수행을 위해 POSIX locales를 가능하게하거나 혹은 불가능하게 하는 컴파일러라 불리우는 Perl프로그램이다.

localedef locale 컴파일 설명서.

mtrace...

nscd is a name service cache daemon providing a cache for the most common name service requests.

nscd_nischeck 보호 모듈이 NIS+ 찾는데 필요한지 안한지 체크한다.

pcprofiledump dumps information generated by PC profiling.

pt_chown is a helper program for grantpt to set the owner, group and access permissions of a slave pseudo terminal.

rpcgen generates C code to implement the RPC protocol.

rpcinfo makes an RPC call to an RPC server.

sln is used to make symbolic links. The program is statically linked, so it is useful for making symbolic links to dynamic libraries if the dynamic linking system for some reason is nonfunctional.

sprof reads and displays shared object profiling data.

tzselect asks the user about the location of the system and reports the corresponding time zone description.

xtrace traces the execution of a program by printing the currently executed function.

zdump is the time zone dumper.

zic is the time zone compiler.

ld.so is the helper program for shared library executables.

libBrokenLocale is used by programs, such as Mozilla, to solve broken locales.

libSegFault is a segmentation fault signal handler. It tries to catch segfaults.

libanl is an asynchronous name lookup library.

libbsd-compat provides the portability needed in order to run certain BSD programs under Linux.

libc is the main C library -- a collection of commonly used functions.

libcrypt is the cryptography library.

libdl is the dynamic linking interface library.

libg is a runtime library for g++.

libieee is the IEEE floating point library.

libm is the mathematical library.

libmcheck contains code run at boot.

libmemusage is used by memusage to help collect information about the memory usage of a program.

libnsl is the network services library.

libnss* are the Name Service Switch libraries, containing functions for resolving host names, user names, group names, aliases, services, protocols,and the like.

libpcprofile contains profiling functions used to track the amount of CPU time spent in which source code lines.

libpthread is the POSIX threads library.

libresolv contains functions for creating, sending, and interpreting packets to the Internet domain name servers.

librpcsvccontains functions providing miscellaneous RPC services.

librt contains functions providing most of the interfaces specified by the POSIX.1b Realtime Extension.

libthread_db contains functions useful for building debuggers for multi-threaded programs.

libutil contains code for "standard" functions used in many different Unix utilities.




=== toolchain 재 조정 === 


 이제 새 C라이브러리들은 설치가 완료 되었고 toolchain을 다시 조절할 때입니다. 왜냐하면 컴파일된 여러 프로그램이 새 C라이브러리로 링크될 것이기 때문입니다. 기본적으로, 전 장에서 시작한 "locking in"부분에서 한것을 거꾸로 한것입니다.

  첫 번째로 할것은 linker를 조절하는 것입니다. /tools 링커를 백업하고 이전 장에서 만들어놓은 링커로 대체합니다. 또한 우리는 /tools/$(gcc -dumpmachine)/bin으로 링크를 하나 만들 겁니다.

{{{
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
}}}      

다음은 새로운 동적 링커를 가리키도록 GCC spec 파일을 수정합니다. 단순하게 /tools의 모든 인스턴스들을 지웠기 때문에 다이나믹 링커로 올바른 경로를 설정을 해주어야합니다. spec 파일을 조종하는 것은 GCC가 어디에서 헤더파일과 Glibc start 파일들을 찾아야하는지 알려주기 위한 것입니다. '''sed''' 커맨드를 다음과 같이 사용합니다:
{{{
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
}}}

모든 컴파일된 프로그램들은 이제 부터 /usr/lib 와 /lib의 그 라이브러리들에게만 링크될 것입니다.

다음으로 할것은 새 다이나믹 링커를 포인트하기 위해 GCC 스펙을 수정하는 것입니다. 지난번에 한 것처럼, 우리는 이 작업을 하기 위해 sed를 사용할 것입니다.

{{{
SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' 
    $SPECFILE > newspecfile &&
mv -f newspecfile $SPECFILE &&
unset SPECFILE
}}}

위의 명령어들을 일일히 손으로 입력하는 것도 좋지만, 오타가 발생할 가능성이 있기 때문에 붙여넣기 하는 것이 더 좋을 것입니다.
그리고 진짜 만들어졌다는것을 증명하기 위해 스팩파일들을 시각적으로 조사하는것은 좋은 방법입니다.

여기서 재조정된 툴체인의 기본 기능들(컴파일, 링크)들이 제대로 작동하는지 확실하게 검사하여야 합니다. 이를 위해서 다음의 sanity check를 실행합니다:
{{{
echo 'main(){}' > dummy.c
cc dummy.c -v -Wl, --verbose &> dummy.log
readelf -l a.out | grep ': /lib'
}}}

만약 제대로 작동했다면, 에러없이 다음과 같이 출력할 것입니다:
{{{
[Requesting program interpreter: /lib/ld-linux.so.2]
}}}

/lib 이 동적 링커의 경로로 되었다는 것을 확인하였습니다. 이제 적절한 startfile을 사용했는지 다음과 같이 확인합니다.
{{{
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
}}}

만약 제대로 작동했다면 다음과 같이 출력될 것입니다:
{{{
/usr/lib/crt1.o succeeded
/usr/lib/crti.o succeeded
/usr/lib/crtn.o succeeded
}}}

이제 컴파일러가 올바른 헤더 파일을 검색하는지 확인합니다.
{{{
grep -B1 '^ /usr/include' dummy.log
}}}

제대로 작동할경우 다음과 같이 출력됩니다:
{{{
SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib");
}}}

다음과 같이 올바른 libc를 사용하도록 설정해줍니다:
{{{
grep "/lib.*/libc.so.6 " dummy.og
}}}

제대로 작동할경우 다음과 같이 출력됩니다:
{{{
found ld-linux.so.2 at /lib/ld-linux.so.2
}}}

만약에 출력결과가 위와 같이 되지 않는다면 어딘가에서 심각하게 잘못된 것입니다. 다시 되돌아가서 처음부터 다시 실행하십시오. 대부분은 spec파일 재조정을 잘못한 것이 원인입니다. 이러한 문제들은 빌드 과정을 다시하면 해결될 것입니다.

모든 것이 올바르게 테스트된 것을 확인했다면 테스트 파일을 제거합니다:
{{{
rm -v dummy.c a.out dummy.log
}}} 

=== Zlib-1.2.7 설치 ===

The Zlib package contains compression and uncompression routines used by some programs.
{{{
Approximate build time:  0.1 SBU
Required disk space:     3.9 MB
}}}
Zib(1.2.7)공식 다운로드 사이트 :
http://www.gzip.org/zlib/

Zib와 의존성 관계에 있는 프로그램들: Binutils, Coreutils, GCC, Glibc, Make, Sed.
Zib 설치

Zlib 컴파일 준비하기:
{{{
./configure --prefix=/usr
}}}
    Note: Zlib is known to build its shared library incorrectly if CFLAGS is specified in the environment. If you are using your own CFLAGS variable, be sure to add the -fPIC directive to your CFLAGS for the duration of the above command, then remove it afterwards.

팩키지 컴파일:
{{{
make      
}}}
Zlib 팩키지는 컴파일이 제대로 되었는지를 검사하기 위한 Test suite를 가지고 있습니다. Zlib의 Test suite은 속도가 빠르고 굉장히 쉽습니다. 그러므로 한번 해 보길 바랍니다. 아래 명령어를 실행하면 공유 라이브러리를 테스트 하게 됩니다.
{{{
make check      
}}}
라이브러리 설치하기:
{{{
make install      
}}}

아래 명령을 실행해서 라이브러리들을 /lib로 옮깁시다. 
{{{
mv -v /usr/lib/libz.so.* /lib
ln -sfv ../../lib/libz.so.1.2.7 /usr/lib/libz.so
}}}

==== Zlib의 내용 ====
설치된 라이브러리들: libz{a,so}

==== 요약 ====
libz* contains compression and uncompression functions used by some programs.

=== File-5.11  ===

The File package contains a utility for determining the type of files.
{{{
Approximate build time:  0.1 SBU
Required disk space:     12.5 MB
}}}
File (5.11) 공식 다운로드 사이트: 
ftp://ftp.astron.com/pub/file/

File와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Sed, Zlib.
==== File 설치 ====

File 컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}
컴파일하기:
{{{
make      
}}}
test suite실행하기:
{{{
make check
}}}
설치하기:
{{{
make install      
}}}
==== File 내용 ====

설치된 프로그램: file

설치된 라이브러리: libmagic.{a,so}
==== 요약 ====
file tries to classify each given file. It does this by performing several tests: file system tests, magic number tests, and language tests. The first test that succeeds determines the result.

libmagic contains routines for magic number recognition, used by the file program.s

=== Binutils-2.22 설치 ===

The Binutils package contains a linker, an assembler, and other tools for handling object files.
{{{
Approximate build time:  1.9 SBU
Required disk space:     343 MB
}}}
Binutils (2.22)공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/binutils/

Bunutils와 의존성 관계에 있는 프로그램들: Bash, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo.

==== Binutils 설치 ====

  이제 pseudo터미널이 ch-root(su)환경에서 정확하게 동작하는지 확인해야 할 시간입니다:
{{{
expect -c "spawn ls"
}}}      

만약 당신이 입력한 내용과 같은 응답을 받았다면 정상입니다. 하지만 그렇지 않고 다른 메세지를 받았다면:

The system has no more ptys.  Ask your system administrator to create more.

chroot환경이 적절한 PTY 연산을 하지 못한 것입니다. 이 문제는 Binutils과 GCC의 test suite를 실행하기 전에 반드시 해결되어야 합니다.

standards.info 파일의 설치는 금지합니다. 이 파일은 나중에 Autoconf 설치에서 더 새로운 버전으로 설치될 것입니다.
{{{
rm -fv etc/standards.info
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
}}}

컴파일 최적화를 사용할 때 빌드 실패를 방지하기 위해 패치를 적용합니다:
{{{
patch -Np1 -i ../binutils-2.22-build_fix-1.patch
}}}

binutils 문서에서는 binutils를 설치할때 새로운 디렉토리를 만들어서 설치하는것을 권장합니다:
{{{
mkdir -v ../binutils-build
cd ../binutils-build
}}}


Binutils 컴파일 준비하기:
{{{
../binutils-2.22/configure --prefix=/usr --enable-shared
}}}      

package 컴파일하기:
{{{
make tooldir=/usr
}}}      

Normally, the tooldir (the directory where the executables end up) is set to $(exec_prefix)/$(target_alias), which expands into, for example, /usr/i686-pc-linux-gnu. 이제부터는 /usr 안에 그런 디렉토리가 있을 필요가 없습니다. 그런 디렉토리들은 Cross-compile (인텔 계열 PC에서 PowerPC 계열에서 돌아가는 프로그램을 컴파일 하는)을 했을 경우에만 사용됩니다.

    중요: 이 장에서는 Test suite가 상당히 중요합니다. 주의해 주세요.

Test 하기:
{{{
make -k check
}}}      

test suite에 대해선 the Section called Installing Binutils-2.22 - Pass 2 in Chapter 5 에 잘 나와 있으므로 문제가 생기면 꼭 참고하길 바랍니다.

Package 인스톨하기:
{{{
make tooldir=/usr install
}}}      

libiberty 헤더 파일을 사용하는 팩키지들을 위해 libiberty헤더들을 설치합시다:
{{{
cp -v ../binutils-2.22/include/libiberty.h /usr/include
}}}      

==== Binutils의 내용 ====

설치된 프로그램: addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump, ranlib, readelf, size, strings and strip

설치된 라이브러리: libiberty.a, libbfd.[a,so] and libopcodes.[a,so]


==== 요약 ====

addr2line translates program addresses to file names and line numbers. Given an address and the name of an executable, it uses the debugging information in the executable to figure out which source file and line number are associated with the address.

ar creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).

as is an assembler. It assembles the output of gcc into object files.

c++filt is used by the linker to demangle C++ and Java symbols, to keep overloaded functions from clashing.

gprof displays call graph profile data.

ld is a linker. It combines a number of object and archive files into a single file, relocating their data and tying up symbol references.

nm lists the symbols occurring in a given object file.

objcopy is used to translate one type of object file into another.

objdump displays information about the given object file, with options controlling what particular information to display. The information shown is mostly only useful to programmers who are working on the compilation tools.

ranlib generates an index of the contents of an archive, and stores it in the archive. The index lists all the symbols defined by archive members that are relocatable object files.

readelf displays information about elf type binaries.

size lists the section sizes -- and the grand total -- for the given object files.

strings outputs for each file given the sequences of printable characters that are of at least the specified length (defaulting to 4) For object files it prints by default only the strings from the initializing and loading sections. For other types of files it scans the whole file.

strip discards symbols from object files.

libiberty contains routines used by various GNU programs, including getopt, obstack, strerror, strtol and strtoul.

libbfd is the Binary File Descriptor library.

libopcodes is a library for dealing with opcodes. It is used for building utilities like objdump. Opcodes are the "readable text" versions of instructions for the processor.

=== GMP-5.0.5 설치 ===
빌드 시간: 1.2 SBU
필요 공간:  50 MB
설치 내용: GMP 패키지는 math 라이브러리들을 포함하고 있습니다. 이것은 임의 수의 정밀한 산술연산을 위한 유용한 함수들을 포함하고 있습니다.
==== GMP 설치하기 ====
 '''Note'''
 만약 여러분이 x86 32-bit를 빌드하고 있지만 64-bit 코드를 실행할 수 있는 CPU를 가지고 있고 CFLAGS를 지정해놓은 환경이라면 configure 스크립트는 64-bit로 configure를 진행하려할 것입니다. 이를 피하기 위해서는 다음의 명령을 실행하십시오:
 {{{
 ABI=32 ./configure ...
 }}}

GMP 컴파일을 준비합니다:
{{{
./configure --prefix=/usr --enable-cxx --enable-mpbsd
}}}

* '''--enable-cxx''': C++ 지원하게 합니다.
* '''--enable-mpbsd''': Berkeley MP 호환 라이브러리를 빌드하도록 만듭니다.

패키지를 컴파일합니다.
{{{
make
}}}

test suite를 실행하여 검사합니다:
{{{
make check 2>&1 | tee gmp-check-log
}}}

166 테스트 모두 통과되었는지 반드시 확인하십시오:
{{{
awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log
}}}

패키지를 설치합니다:
{{{
make install
}}}

만약 관련 문서도 같이 설치하고 싶다면 다음과 같이 하십시오:
{{{
mkdir -v /usr/share/doc/gmp-5.0.5
cp    -v doc/{isa_abi_headache,configuration} doc/*.html 
         /usr/share/doc/gmp-5.0.5
}}}

==== GMP의 내용들 ====
설치 라이브러리: libgmp.{a,so}, libgmpxx.{a,so}, libmp.{a,so}
설치 디렉토리  : /usr/share/doc/gmp-5.0.5

* libgmp: Contains precision math functions.

* libgmpxx: Contains C++ precision math functions.

* libmp: Contains the Berkeley MP math functions. 

=== MPFR-3.1.1 설치 ===
빌드 시간: 0.8 SBU
필요 공간:  27 MB
설치 내용: The MPFR package contains functions for multiple precision math.

==== MPFR 설치하기 ====
컴파일 준비를 합니다:
{{{
./configure  --prefix=/usr        
             --enable-thread-safe 
             --docdir=/usr/share/doc/mpfr-3.1.1
}}}

패키지를 컴파일합니다:
{{{
make
}}}

test suite를 실행합니다. 반드시 모든 테스트들이 통과되어야 합니다:
{{{
make check
}}}

패키지를 설치합니다
{{{
make install
}}}

문서를 설치합니다
{{{
make html
make install-html
}}}

=== MPC-1.0 설치 ===
빌드 시간:  0.4 SBU
필요 용량: 10.2 MB

The MPC package contains a library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result. 

==== MPC 설치하기 ====
MPC 컴파일을 준비합니다:
{{{
./configure --prefix=/usr
}}}

패키지를 컴파일합니다
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치합니다
{{{
make install
}}}

=== GCC-4.7.1 설치 ===

GCC 팩키지에는 C나 C++과 같은 GNU compiler들이 있습니다.
{{{
Approximate build time:  11.7 SBU
Required disk space:     294 MB
}}}
GCC(4.7.1) 공식 다운로드 사이트:
ftp://ftp.gnu.org/pub/gnu/gcc/

GCC 와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo.

==== GCC 설치 ====

  기본 최적화 플래그(including the -march and -mcpu options)들을 변경하는것은 그리 좋지 습관이 아닙니다. 그러므로 만약에 당신이 CFLAGS나 CXXFLAG 같은 이미 최적화 되어있는 환경변수들을 변경했을 경우에는 Glibc를 설치할 때 원상복귀 시켜주세요.

'''sed'''를 이용해 libiberty.a의 설치부분을 제거합니다. libiberty.a는 Binutils에서 대신 설치될 것입니다.
{{{
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
}}}

이전 장에서 설명했듯이 -fomit-frame-pointer을 컴파일 플래그로 사용하기 위해 '''sed'''를 이용해 설정을 바꿔줍니다.
{{{
case `uname -m` in
  i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
esac
}}}

Makefile에서 check의 에러부분을 고칩니다:
{{{
sed -i -e /autogen/d -e /check.sh/d fixincludes/Makefile.in
}}}

GCC 문서에서는 GCC를 빌드할 때 소스 디렉토리 밖에서 하는 것을 권장했기 때문에 다음과 같이 밖에 디렉토리를 하나 만들어줍니다
{{{
mkdir -v ../gcc-build
cd ../gcc-build
}}}

GCC 컴파일 준비하기:
{{{
../gcc-4.7.1/configure --prefix=/usr            
                       --libexecdir=/usr/lib    
                       --enable-shared          
                       --enable-threads=posix   
                       --enable-__cxa_atexit    
                       --enable-clocale=gnu     
                       --enable-languages=c,c++ 
                       --disable-multilib       
                       --disable-bootstrap      
                       --with-system-zlib
}}}      

'''--with-system-zlib'''

GCC가 내부에 zlib을 복사하지 않고 설치된 Zlib 라이브러리로 링크하도록 설치합니다.

팩키지 컴파일:
{{{
make
}}}      

GCC testsuite중 하나는 스택이 부족하다고 알려져있기 때문에 다음과 같이 테스트전에 스택 사이즈를 설정해줍니다
{{{
ulimit -s 32768
}}}
    중요: 이 장에서는 Test suite가 상당히 중요합니다. 주의해 주세요.

테스트를 해 봅시다. 테스트 결과에서 에러가 발생하더라도 설치를 포기 하지 말고 계속 노력해 봅시다.
{{{
make -k check
}}}      

test suite에 대해선 5장 GCC-4.7.1 - Pass 2 인스톨 에 잘 나와 있으므로 문제가 생기면 꼭 참고하길 바랍니다.

test suite 결과의 요약된 정보를 얻고자 한다면 다음을 실행하십시오:
{{{
../gcc-4.7.1/contrib/test_summary
}}}

Package 설치하기:
{{{
make install
}}}      

일부 팩키지들은 C PreProcess가 /lib 안에 설치된 걸로 알고 있습니다. 에러를 없애기 위해서 심볼릭 링크를 만들어 줍시다.
{{{
ln -s /usr/bin/cpp /lib
}}}      

많은 팩키지들이 Gcc대신 cc를 사용합니다. 다음과 같이 심볼릭 링크를 걸어 주면 에러를 방지 할 수 있습니다.:
{{{
ln -s gcc /usr/bin/cc
}}}      

    주의: 전 장에서 한 것과 같은 sanity check를 해 보는 것이 중요합니다.  toolchain 재적용을 참조해서  sanity check(dummy.c를 컴파일 하는)를 해 봅시다. 문제가 생긴다면, 5장 에서 한 "GCC specs Patch" 부분부터 잘못되었을 가능성이 있습니다.
     

==== 컴파일과 링크 상태 확인하기 ====
이전에 했던 sanity check와 마찬가지로 똑같이 할 것입니다.
{{{
echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'
}}}

제대로 작동ㅤㅎㅙㅆ다면 에러없이 다음과 같이 출력되어야 합니다.
{{{
[Requesting program interpreter: /lib/ld-linux.so.2]
}}}

이제 올바른 startfiles을 사용하도록 제대로 설정되었는지 확인합니다:
{{{
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
}}}


제대로 작동ㅤㅎㅙㅆ다면 에러없이 다음과 같이 출력되어야 합니다.
{{{
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../crt1.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../crti.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../crtn.o succeeded
}}}

컴퓨터의 아키텍쳐에 따라 /usr/lib/gcc/다음에 오는 디렉토리의 이름이 약간씩 다를겁니다. 만약에 여러분의 컴퓨터가 64-bit 시스템이면 문자열의 끝의 앞에서 lib64을 볼 수 있을 것입니다. 중요한 건 /usr/lib 디렉토리안에 '''gcc'''가 세개의 crt*.o 가 있는지를 모두 찾아냈는가가 중요합니다.

다음은 컴파일러가 올바른 헤더 파일을 ㅤㅊㅏㅊ고있는지 확인합니다
{{{
grep -B4 '^ /usr/include' dummy.log
}}}

제대로 작동ㅤㅎㅙㅆ다면 에러없이 다음과 같이 출력되어야 합니다.
{{{
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include-fixed
 /usr/include
}}}

위의 결과또한 아키텍쳐에 따라 달라질 수 있습니다.

 '''Note'''
 GCC의 4.3.0버전부터는 무조건적으로 limits.h 파일이 include-fixed 디렉토리 안에 설치합니다. 그렇기 때문에 해당 디렉토리가 위치에 존재해야만 합니다.

다음은 새로운 링커가 제대로 경로를 찾는지 확인합니다.
{{{
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.7.1/include-fixed
 /usr/include
}}}


제대로 작동ㅤㅎㅙㅆ다면 에러없이 다음과 같이 출력되어야 합니다.
{{{
SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
}}}

64-bit 시스템에서는 아마 몇개의 디렉토리가 더 보일수도 있습니다. 다음은 x86_64에서의 출력된 결과입니다.
{{{
SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib64")
SEARCH_DIR("/usr/local/lib64")
SEARCH_DIR("/lib64")
SEARCH_DIR("/usr/lib64")
SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/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.so.2 at /lib/ld-linux.so.2
}}}

만약 제대로 출력값이 나오지 않았다면 어딘가에서 잘못된 것입니다. 다시 처음으로 돌아가서 단계적으로 빌드를 다시 해보십시오. 아마도 대부분의 이유는 specs 파일을 재조정할 때 잘못되었을 겁니다. 

모든 것이 올바르게 출력되었다면, 테스트파일을 삭제합니다.
{{{
rm -v dummy.c a.out dummy.log
}}}

마지막으로, 잘못된 위치를 바로잡아줍니다
{{{
mkdir -pv /usr/share/gdb/auto-load/usr/lib
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
}}}

==== GCC 내용들 ====

설치된 프로그램들: c++, cc (link to gcc), cc1, cc1plus, collect2, cpp, g++, gcc, gccbug, and gcov

설치된 라이브러리들: libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so] and libsupc++.a


==== 요약 ====

cpp 는 C전처리기이다. 이것은 컴파일러에 의해 #include와 #define와 그런 상태들을 소스파일안에서 확장되어 가지는것을 사용한다.

g++ 는 C++ 컴파일러이다.

gcc 는 C 컴파일러이다. 그것은 프로그램의 소스코드를 어셈코드로 변환하는데 사용된다.

gccbug 는 좋은 bug보고서를 만드는 도움말이 사용된 shell script이다.

gcov 는 시험한 tool의 적용범위이다. 이것은 가방 효과적인 최적화된 방법을 찾기위해 프로그램을 분석하는데 사용된다.

libgcc* 는 gcc를 위한 run-time제공을 포함한다.

libstdc++ 는 standard C++라이브러리이다. 이것은 많은 자주 사용되는 함수들을 포함한다.

libsupc++ 은 C++프로그램언어를 위한 제공된 일괄처리과정을 제공한다.

=== Sed-4.2.1 설치 ===

The Sed package contains a stream editor.
{{{
Approximate build time:  0.2 SBU
Required disk space:     6.7 MB
}}}
Sed (4.2.1) 공식 다운로드 사이트:
ftp://ftp.gnu.org/gnu/sed/

Sed와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Texinfo.
ed 설치

testsuite 패치:
{{{
patch -Np1 -i ../sed-4.2.1-testsuite_fixes-1.patch
}}}

컴파일준비:
{{{
./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.1
}}}

팩키지 컴파일:
{{{
make      
}}}

HTML 문서 만들기
{{{
make html
}}}

이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 아래 명령어를 입력하세요:
{{{
make check      
}}}
팩키지 설치:
{{{
make install      
}}}

HTML 문서 설치하기
{{{
make -C doc install-html
}}}
==== Sed 내용 ====

설치된 프로그램들: sed

==== 요약 ====

sed is used to filter and transform text files in a single pass.

=== Bzip2-1.0.6 설치 ===

The Bzip2 package contains programs for compressing and decompressing files. On text files they achieve a much better compression than the traditional gzip.
{{{
Approximate build time:  <=0.1 SBU
Required disk space:       6.9 MB
}}}
Bzip2 (1.0.6) 공식 다운로드 사이트: 
ftp://sources.redhat.com/pub/bzip2/

Bzip2와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Make.
==== Bzip2 설치 ====
패키지에 있는 문서를 설치하도록 패치를 적용합니다
{{{
patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch
}}}

관련된 심볼링 링크들을 설치하도록 합니다.
{{{
sed -i 's@(ln -s -f )$(PREFIX)/bin/@1@' Makefile
}}}

man 페이지들이 올바른 위치에 설치되도록 합니다.
{{{
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
}}}

Bzip2 컴파일 준비하기:
{{{
make -f Makefile-libbz2_so
make clean
}}}      

  -f flag는 다른 Makefile들을 사용해서 컴파일할 때 사용합니다. 동적 라이브러리인  libbz2.so를 만들고 Bzip2 utilities를 그 라이브러리와 연결시키지 않았을 경우 Makefile-libbz2_so 를  사용합니다.

컴파일하기:
{{{
make      
}}}
  만약 당신이 Bzip2를 다시 설치하려면 우선 rm -f /usr/bin/bz* 명령으로 /usr/bin에 있는 bz로 시작하는 모든 파일을 지워야 합니다. 아래와 같이 make install명 령으로 덮어쓰기를 할 경우에는 실패할 것입니다.

설치하기:
{{{
make PREFIX=/usr install
}}}      

공유되는(shared) bzip2프로그램들은 /bin directory에 설치합니다. 그리고 나서 symbolic link들을 만들고  필요 없는 것들은 지우세요.
{{{
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
}}}

==== Bzip2 내용 ====

설치된 프로그램들: bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp, bzdiff, bzegrep, bzfgrep, bzgrep, bzip2, bzip2recover, bzless and bzmore

설치된 라이브러리들: libbz2.a, libbz2.so (link to libbz2.so.1.0), libbz2.so.1.0 (link to libbz2.so.1.0.2) and libbz2.so.1.0.2

==== 요약 ====

bunzip2 decompresses bzipped files.

bzcat decompresses to standard output.

bzcmp runs cmp on bzipped files.

bzdiff runs diff on bzipped files.

bzgrep and friends run grep on bzipped files.

bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm with Huffman coding. The compression rate is generally considerably better than that achieved by more conventional compressors using LZ77/LZ78, like gzip.

bzip2recover tries to recover data from damaged bzip2 files.

bzless runs less on bzipped files.

bzmore runs more on bzipped files.

libbz2* is the library implementing lossless, block-sorting data compression, using the Burrows-Wheeler algorithm.

=== Pkg-config-0.27 설치 ===
빌드 시간: 0.4 SBU
필요 공간:  30 MB

==== Pkg-config 설치하기 ====
컴파일준비:
{{{
./configure --prefix=/usr         
            --with-internal-glib  
            --docdir=/usr/share/doc/pkg-config-0.27
}}}

컴파일
{{{
make
}}}
test suite를 실행합니다
{{{
make check
}}}
패키지를 설치합니다
{{{
make install
}}}

=== Ncurses-5.9 설치 ===

The Ncurses package contains libraries for the terminal-independent handling of character screens.
{{{
Approximate build time:  0.6 SBU
Required disk space:     40 MB
}}}

Ncurses (5.9)공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/ncurses/

Ncurses와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Sed.

==== Ncurses 설치 ====

Ncurses컴파일 준비하기:
{{{
./configure --prefix=/usr --mandir=/usr/share/man --with-shared 
            --without-debug --enable-widec
}}}

'''--enable-widec'''

이 스위치는 wide-character 라이브러리(libcursesw.so.5.9)를 libncurses.so.5.9 대신 설치되도록 합니다. 이러한 wide-character 라이브러리는 예전에 사용되던 8bit 로케일과 multibyte에서 사용가능하지만 예전에 사용되던 라이브러리는 8bit에서만 작동합니다. 때문에 우리는 wide-character과 보통의 라이브러리에 호환가능하도록 하기 위해 이 옵션을 사용할 겁니다.

팩키지 컴파일:
{{{
make      
}}}
팩키지 설치:
{{{
make install      
}}}

공유 라이브러리를 /lib 디렉토리로 옮깁니다.
{{{
mv -v /usr/lib/libncursesw.so.5* /lib
}}}

라이브러리를 옮기게 될경우 symlink가 가리키는 파일이 없어지게 되므로 다시 만들어줍니다
{{{
ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
}}}

많은 어플리케이션이 아직도 링커가 non-wide-character가 Ncurses 라이브러리에서 찾는다고 가정하고 있습니다. 다음과같이 해당 어플리케이션에 wide-character 라이브러리를 연결해주어 문제를 해결해줍니다
{{{
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${lib}w.a /usr/lib/lib${lib}.a ; 
done
ln -sfv libncurses++w.a /usr/lib/libncurses++.a
}}}

마지막으로 빌드타임때 -lcurses를 찾아서 사용했던 오래된 어플리케이션을 찾아서 림크를 만들어줍니다.
{{{
rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
ln -sfv libncursesw.a /usr/lib/libcursesw.a
ln -sfv libncurses.a /usr/lib/libcurses.a
}}}

원한다면 Ncurses 문서를 설치하십시오:
{{{
mkdir -v       /usr/share/doc/ncurses-5.9
cp -v -R doc/* /usr/share/doc/ncurses-5.9
}}}

==== Ncurses 내용 ====

설치된 프로그램들: captoinfo (link to tic), clear, infocmp, infotocap (link to tic), reset (link to tset), tack, tic, toe, tput and tset

설치된 라이브러리들: libcurses.[a,so] (link to libncurses.[a,so]), libform.[a,so], libmenu.[a,so], libncurses++.a, libncurses.[a,so], libpanel.[a,so]


==== 요약 ====

captoinfo converts a termcap description into a terminfo description.

clear clears the screen, if this is possible.

infocmp compares or prints out terminfo descriptions.

infotocap converts a terminfo description into a termcap description.

reset reinitializes a terminal to its default values.

tack is the terminfo action checker. It is mainly used to test the correctness of an entry in the terminfo database.

tic is the terminfo entry-description compiler. It translates a terminfo file from source format into the binary format needed for the ncurses library routines. A terminfo file contains information on the capabilities of a certain terminal.

toe lists all available terminal types, for each giving its primary name and its description.

tput makes the values of terminal-dependent capabilities available to the shell. It can also be used to reset or initialize a terminal, or report its long name.

tset can be used to initialize terminals.

libncurses* contain functions to display text in many complicated ways on a terminal screen. A good example of the use of these functions is the menu displayed during the kernel's make menuconfig.

libform* contain functions to implement forms.

libmenu* contain functions to implement menus.

libpanel* contain functions to implement panels.

=== Util-linux-2.21.2 설치 ===
빌드 시간: 0.7 SBU
필요 공간:  81 MB

==== FHS compliance notes ====
FHS는 /etc 디렉토리 대신에 /var/lib/hwclock을 사용하기를 권장하고 있습니다. FHS에 맞게 설치하기 위해 hwclock을 설정합니다.
{{{
sed -i -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' 
    $(grep -rl '/etc/adjtime' .)
mkdir -pv /var/lib/hwclock
}}}
==== Util-linux 설치하기 ====
{{{
./configure
make
make install
}}}

Util-linux에서 설치되는 프로그램 목록을 보려면 다음을 참고하십시오:
[http://www.linuxfromscratch.org/lfs/view/stable/chapter06/util-linux.html http://www.linuxfromscratch.org/lfs/view/stable/chapter06/util-linux.html]

=== Psmisc-22.19 설치 ===
빌드 시간: <= 0.1 SBU
필요 공간:    4.2 MB

{{{
./configure --prefix=/usr

make

make install
}}}

마지막으로 '''killall'''과 '''fuser''' 프로그램을 FHS에 맞게 위치를 바꿉니다.
{{{
mv -v /usr/bin/fuser   /bin
mv -v /usr/bin/killall /bin
}}}

=== E2fsprogs-1.42.5 ===
빌드 시간: 1.7 SBU
필요 공간:  64 MB

E2fsprogs 문서는 소스 디렉토리의 하위 디렉토리에서 빌드하기를 권장하고 있습니다.
{{{
mkdir -v build
cd build
}}}

E2fsprogs의 컴파일을 준비합니다
{{{
../configure --prefix=/usr         
             --with-root-prefix="" 
             --enable-elf-shlibs   
             --disable-libblkid    
             --disable-libuuid     
             --disable-uuidd       
             --disable-fsck
}}}

'''--with-root-prefix=""'''

'''e2fsck'''같은 특정 프로그램들은 필수 프로그램으로 고려됩니다. 예를들면 /usr가 마운트되지 않았을 때 이러한 프로그램들은 이러한 상황에서도 사용가능합니다. 이 프로그램들은 /lib과 /sbin같은 디렉토리에 있기 때문입니다. 만약 이 옵션이 없다면 프로그램은 /usr 디렉토리 내부에 설치될 것입니다.

'''--enable-elf-shlibs'''

패키지가 사용할 프로그램들에 대한 공유 라이브러리를 만듭니다.

'''--disable-*'''

이것은 E2fsprogs가 ''libuuid''와 ''libblkid'' 라이브러리를 빌드하고 설치하는 것을 막습니다. ''uuidd'' 데몬과 '''fsck'''는 Util-linux에서 이전에 이미 설치되었기 때문에 제외합니다.

{{{
make
make -k check
make install
}}}

정적 라이브러리와 헤더 파일들을 설치합니다.
{{{
make install-libs
}}}

설치한 정적 라이브러리들을 나중에 debugging symbol을 지우기 위해 쓰기가 가능하도록 바뀌줍니다.
{{{
chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
}}}

이 패키지는 gzipped로 압축된 .info 파일을 설치하지만 system-wide dir 파일을 업데이트하지는 않습니다. 이 파일을 풀어서 system dir 파일을 다음과 같이 업데이트 해줍니다.
{{{
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
}}}

=== Shadow-4.1.5.1 설치 ===
빌드 시간: 0.2 SBU
필요 용량:  42 MB

==== Shadow 설치하기 ====
 '''Note'''
 만약 보안성이 강한 패스워드를 사용하고 싶다면 [http://www.linuxfromscratch.org/blfs/view/svn/postlfs/cracklib.html http://www.linuxfromscratch.org/blfs/view/svn/postlfs/cracklib.html] Shadow를 빌드하기에 앞서 CrackLib을 설치하기 바랍니다. 그리고 아래의 '''configure'''에서 --with-libcrack을 하면 됩니다.

'''groups'''와 해당 프로그램의 man 페이지 설치를 하지 않기 위해 다음과 같이 설청합니다. '''groups'''는 Coreutils에서 더 나은 버전으로 제공됩니다.
{{{
sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups.1 / /' {} ;
}}}

기본 ''crypt'' 메서드를 사용하는 대신 8개의 문자를 이용하는 ''SHA-512'' 라는 보안 메서드를 사용하는 것이 비밀번호 암호화에 더 안전합니다. 또한 절대경로인 /var/spool/mail의 위치도 Shadow가 기본으로 /var/mail 경로를 사용하기 때문에 바꿔줘야 합니다.
{{{
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' 
       -e 's@/var/spool/mail@/var/mail@' etc/login.defs
}}}

 '''Note'''
 만약에 Cracklib을 지원하는 Shadow를 빌드하고 싶으면 다음과 같이 하십시오:
 {{{
 sed -i 's@DICTPATH.*@DICTPATHt/lib/cracklib/pw_dict@' 
    etc/login.defs
 }}}

Shadow 컴파일을 준비합니다
{{{
./configure --sysconfdir=/etc
}}}

패키지를 컴파일합니다
{{{
make
}}}

이 패키지는 test suite를 가지고 있지 않습니다.

패키지를 설치합시다
{{{
make install
}}}

프로그램의 위치를 수정해줍니다
{{{
mv -v /usr/bin/passwd /bin
}}}

==== Shadow 설정하기 ====

이 패키지는 사용자나 그룹을 추가하거나 수정, 삭제하는 유틸리티를 가지고 있습니다. 또한 패시워드를 설정하고 바꾸거나 다른 것들을 관리하는 역할을 합니다. ''password shadowing''의 완벽한 의미에 대한 설명을 위해서 소스 트리안의 doc/HOWTO 를 살펴보십시오. 만약에 Shadow support를 사용하려면 해당 패스워드가 필요한 프로그램(display manager, FTP program, pop3 daemons, etc)이 Shadow와 호환이 잘 되는지를 확실히 알아두어야 함을 명심하십시오. 즉, 이러한 프로그램들이 shadow를 이용한 패스워드로 잘 작동이 되는지 알아야합니다.

shadow 패스워드를 사용하기 위해서는 다음의 명령을 실행하십시오:
{{{
pwconv
}}}

shadow된 group 패스워드를 사용하려면 다음과 같이 실행하십시오:
{{{
grpconv
}}}

'''useradd''' 유틸리티를 위해 Shadow가 보관하고 있는 설정들에 대해 설명하자면 약간의 부담이 있습니다. 먼저 '''useradd'''유틸리티의 기본 동작은 사용자를 생성하고 사용자와 같은 이름의 그룹을 만드는 것입니다. 기본적으로 user ID(UID)와 group ID(GID) 숫자는 1000부터 시작됩니다. 이것은 만약 '''useradd'''로 파라미터를 보내지 않으면 각각의 사용자들은 고야한 그룹을 가지게 될 것입니다. 이러한 결과를 원지 않는다면 -g 라는 파라미터를 사용하여 '''useradd'''를 사용하여야 합니다. 기본적으로 사용될 파라미터의 내용은 /etc/default/useradd 파일에 저장되어 있습니다. 여러분이 필요로 하는 것에 맞게 다음의 두가지를 수정할 필요가 있습니다.

'''/etc/default/useradd''' 파라미터 설명
 
 ''GROUP=1000''
 
 이 파라미터는 /etc/group 파일에 있는 group number의 시작점을 설정합니다. 여러분들은 여러분들이 원하는대로 수정할 수 있습니다. 대신 알아두어야 할 점은 '''useradd'''는 절대로 UID나 GID를 다시 재사용해서는 안된다는 점입니다. 만약 어떤 고유 식별 번호를 파라미터로 사용했다면 다음번에는 그 숫자 다음부터 사용할 수 있습니다. 또 한가지 알아두어야 할점은 반드시 시스템에서 처음 여러분이 -g 파라미터 없이 '''useradd'''를 사용할 때 group 1000를 사용해야하는 것은 아닙니다. 여러분들이 그렇게 했다고 해도 다음과 같은 출력 결과를 볼 것입니다: useradd: unknown GID 1000. You may disregard this message and group number 1000 will be used.

 ''CREATE_MAIL_SPOOL=yes''
 
 이 파라미터는 '''useradd'''가 새로운 사용자에게 mailbox를 생성할건지를 정하는 옵션입니다. '''useradd'''는 이 파일의 group 소유권을 mail group으로 0660의 권한을 주어 변경할 것입니다. 만약 이러한 mailbox 파일을 생생하고 싶지 않으시다면 다음의 명령을 실행하십시오:
{{{
sed -i 's/yes/no' /etc/default/useradd
}}}
==== root password 설정하기 ====

root 계정의 비밀번호를 설정합니다.
{{{
passwd root
}}}
==== Shadow of contets ====

설치되는 프로그램: chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd, groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv, lastlog, login, logoutd, newgrp, newusers, nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su, useradd, userdel, usermod, vigr (link to vipw), and vipw

chage: Used to change the maximum number of days between obligatory password changes

chfn: Used to change a user's full name and other information

chgpasswd: Used to update group passwords in batch mode

chpasswd: Used to update user passwords in batch mode

chsh: Used to change a user's default login shell

expiry: Checks and enforces the current password expiration policy

faillog: Is used to examine the log of login failures, to set a maximum number of failures before an account is blocked, or to reset the failure count

gpasswd: Is used to add and delete members and administrators to groups

groupadd: Creates a group with the given name

groupdel: Deletes the group with the given name

groupmems: Allows a user to administer his/her own group membership list without the requirement of super user privileges.

groupmod: Is used to modify the given group's name or GID

grpck: Verifies the integrity of the group files /etc/group and /etc/gshadow

grpconv: Creates or updates the shadow group file from the normal group file

grpunconv: Updates /etc/group from /etc/gshadow and then deletes the latter

lastlog: Reports the most recent login of all users or of a given user

login: Is used by the system to let users sign on

logoutd: Is a daemon used to enforce restrictions on log-on time and ports

newgrp: Is used to change the current GID during a login session

newusers: Is used to create or update an entire series of user accounts

nologin: Displays a message that an account is not available. Designed to be used as the default shell for accounts that have been disabled

passwd: Is used to change the password for a user or group account

pwck: Verifies the integrity of the password files /etc/passwd and /etc/shadow

pwconv: Creates or updates the shadow password file from the normal password file

pwunconv: Updates /etc/passwd from /etc/shadow and then deletes the latter

sg: Executes a given command while the user's GID is set to that of the given group

su: Runs a shell with substitute user and group IDs

useradd: Creates a new user with the given name, or updates the default new-user information

userdel: Deletes the given user account

usermod: Is used to modify the given user's login name, User Identification (UID), shell, initial group, home directory, etc.

vigr: Edits the /etc/group or /etc/gshadow files

vipw: Edits the /etc/passwd or /etc/shadow files 
=== Coreutils-8.19 설치 ===

The Coreutils package contains utilities for showing and setting the basic system characteristics.
{{{
Approximate build time:  4.0 SBU
Required disk space:     154 MB
}}}
Coreutils (8.19)공식 다운로드 사이트:
ftp://ftp.gnu.org/gnu/coreutils/
Coreutils의 패치를 받을 수 있는 사이트:
ftp://ftp.osuosl.org/pub/lfs/lfs-packages/7.2/

Coreutils와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed.

==== Coreutils 설치 ====

test case의 버그를 고칩니다:
{{{
sed -i -e 's/! isatty/isatty/' 
       -e '45i              || errno == ENOENT' gnulib-tests/test-getlogin.c
}}}

POSIX는 Coreutils의 프로그램이 multibyte 로케일인 경우에도 올바르게 문자의 bit경계를 알 수 있어야 한다고 요구했는데, 다음에 실행할 패치는 이를 위한 것입니다.
{{{
patch -Np1 -i ../coreutils-8.19-i18n-1.patch
}}}

Coreutils 컴파일 준비하기:
{{{
FORCE_UNSAFE_CONFIGURE=1 ./configure 
            --prefix=/usr         
            --libexecdir=/usr/lib 
            --enable-no-install-program=kill,uptime
}}}
kill, uptime은 나중에 설치할 바이너리들이기 때문에 설치옵션으로 제외시켜주었습니다.

팩키지 컴파일:
{{{
make      
}}}

이제 test suite를 실행할 차례입니다. 먼저 root 사용자로 test를 실행합니다.
{{{
make NON_ROOT_USERNAME=nobody check-root
}}}

우리는 ''nobody'' 사용자로 나머지 test들을 실행할 것입니다. 하지만 특정 test들은 특정 사용자 뿐만 아니라 특정 group도 요구하는 경우가 있습니다. 이러한 테스트들 때문에 임시 그룹을 만들고 ''nobody''라는 사용자를 그룹의 멤버로 만들기 전까지는 계속해서 설치를 진행할 수 없습니다. 

아래와 같이 echo 명령을 이용하여 사용자와 그룹을 추가합시다:
{{{
echo "dummy:x:1000:nobody" >> /etc/group   
}}}

nobody에 대한 권한을 설청해서 non-root 사용자도 컴파일과 test를 할 수 있도록 설정합니다:
{{{
chown -Rv nobody .
}}}

이제 테스트를 실행할 수 있습니다. '''su''' 환경에서 PATH(환경 변수)에 /tools/bin을 포함시키는 것을 잊지 마세요
{{{
su nobody -s /bin/bash 
          -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes -k check || true"
}}}

이제 임시로 만들어놓은 group을 지웁니다.
{{{
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
}}}

'''head, sleep, nice'''에 의존성을 가지는 LFS-Bootscript 패키지 스크립트가 있습니다. 하지만 이것들은 /usr에 있기 때문에 booting 스테이지에서 실행될 수 없으므로 root 파티션으로 옮겨줍니다:
{{{
mv -v /usr/bin/{head,sleep,nice} /bin
}}}
==== Coreutils의 목록 ====

인스톨된 프로그램들: basename, cat, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, hostname, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, seq, sha1sum, shred, sleep, sort, split, stat, stty, su, sum, sync, tac, tail, tee, test, touch, tr, true, tsort, tty, uname, unexpand, uniq, unlink, uptime, users, vdir, wc, who, whoami and yes

==== 요약 ====

basename strips any path and a given suffix from the given file name.

cat concatenates files to standard output.

chgrp changes the group ownership of each given file to the given group. The group can be either given a a name or a numeric ID.

chmod changes the permissions of each given file to the given mode. The mode can be either a symbolic representation of the changes to make, or an octal number representing the new permissions.

chown changes the user and/or group ownership of each given file to the given user:group pair.

chroot runs a given command with the specified directory as the / directory. The given command can be an interactive shell. On most systems only root can do this.

cksum prints the CRC checksum and the byte counts of each specified file.

comm compares two sorted files, outputting in three columns the lines that are unique, and the lines that are common.

cp copies files.

csplit splits a given file into several new files, separating them according to given patterns or line numbers, and outputting the byte count of each new file.

cut prints parts of lines, selecting the parts according to given fields or positions.

date displays the current time in the given format, or sets the system date.

dd copies a file using the given blocksize and count, while optionally performing conversions on it.

df reports the amount of disk space available (and used) on all mounted file systems, or only on the file systems holding the given files.

dir is the same as ls.

dircolors outputs commands to set the LS_COLOR environment variable, to change the color scheme used by ls.

dirname strips the non-directory suffix from a given file name.

du reports the amount of disk space used by the current directory, or by each of the given directories including all their subdirectories, or by each of the given files.

echo displays the given strings.

env runs a command in a modified environment.

expand converts tabs to spaces.

expr evaluates expressions.

factor prints the prime factors of all specified integer numbers.

false does nothing, unsuccessfully. It always exits with a status code indicating failure.

fmt reformats the paragraphs in the given files.

fold wraps the lines in the given files.

groups reports a user's group memberships.

head prints the first ten lines (or the given number of lines) of each given file.

hostid reports the numeric identifier (in hexadecimal) of the host.

hostname reports or sets the name of the host.

id reports the effective user ID, group ID, and group memberships of the current user, or of a given user.

install copies files while setting their permission modes and, if possible, their owner and group.

join joins from two files the lines that have identical join fields.

link creates a hard link with the given name to the given file.

ln makes hard links or soft links between files.

logname reports the current user's login name.

ls lists the contents of each given directory. By default it orders the files and subdirectories alphabetically.

md5sum reports or checks MD5 checksums.

mkdir creates directories with the given names.

mkfifo creates FIFOs with the given names.

mknod creates device nodes with the given names. A device node is a character special file, or a block special file, or a FIFO.

mv moves or renames files or directories.

nice runs a program with modified scheduling priority.

nl numbers the lines from the given files.

nohup runs a command immune to hangups, with output redirected to a log file.

od dumps files in octal and other formats.

paste merges the given files, joining sequentially corresponding lines side by side, separated by TABs.

pathchk checks whether file names are valid or portable.

pinky is a lightweight finger. It reports some information about the given users.

pr paginates and columnates files for printing.

printenv prints the environment.

printf prints the given arguments according to the given format -- much like the C printf function.

ptx produces from the contents of the given files a permuted index, with each keyword in its context.

pwd reports the name of the current directory.

readlink reports the value of the given symbolic link.

rm removes files or directories.

rmdir removes directories, if they are empty.

seq prints a sequence of numbers, within a given range and with a given increment.

sha1sum prints or checks 160-bit SHA1 checksums.

shred overwrites the given files repeatedly with strange patterns, to make it real hard to recover the data.

sleep pauses for the given amount of time.

sort sorts the lines from the given files.

split splits the given file into pieces, by size or by number of lines.

stty sets or reports terminal line settings.

su runs a shell with substitute user and group IDs.

sum prints checksum and block counts for each given file.

sync flushes file system buffers. It forces changed blocks to disk and updates the super block.

tac concatenates the given files in reverse.

tail prints the last ten lines (or the given number of lines) of each given file.

tee reads from standard input while writing both to standard output and to the given files.

test compares values and checks file types.

touch changes file timestamps, setting the access and modification times of the given files to the current time. Files that do not exist are created with zero length.

tr translates, squeezes, and deletes the given characters from standard input.

true does nothing, successfully. It always exits with a status code indicating success.

tsort performs a topological sort. It writes a totally ordered list according to the partial ordering in a given file.

tty reports the file name of the terminal connected to standard input.

uname reports system information.

unexpand converts spaces to tabs.

uniq discards all but one of successive identical lines.

unlink removes the given file.

uptime reports how long the system has been running, how many users are logged on, and the system load averages.

users reports the names of the users currently logged on.

vdir is the same as ls -l.

wc reports the number of lines, words, and bytes for each given file, and a total line when more than one file is given.

who reports who is logged on.

whoami reports the user name associated with the current effective user ID.

yes outputs 'y' or a given string repeatedly, until killed.

===  Iana-Etc-2.30 설치하기 ===

 The Iana-Etc package provides data for network services and protocols.
{{{
Approximate build time:  <=0.1 SBU
Required disk space:       2.2 MB
}}}
The installation dependencies for Iana-Etc haven't been checked yet.

==== Iana-Etc 설치하기 ====

다음의 명령어가 IANA에서 제공되는 raw 데이터를 /etc/protocols 외 /etc/services 데이터 파일의 형석으로 적절하게 바꿀 것입니다.
{{{
make
}}}

이 패키지는 test suite가 제공되지 않습니다. 그냥 설치하시면 됩니다.
{{{
make install
}}}

=== M4-1.4.16 설치하기 ===

The M4 package contains a macro processor.

Approximate build time:  0.4 SBU
Required disk space:    26.6 MB

M4 (1.4.16)공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/m4/

M4와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed.

==== M4 설치 ====

Glibc-2.16.0과의 호환성 문제를 해결합니다.
{{{
sed -i -e '/gets is a/d' lib/stdio.in.h
}}}

M4컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}

팩키지 컴파일:
{{{
make      
}}}

이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다.  검사를 원한다면 다음 명령어를 실행하세요.
{{{
sed -i -e '41s/ENOENT/& || errno == EINVAL/' tests/test-readlink.h
make check
}}}
팩키지 설치:
{{{
make install      
}}}

==== M4 내용 ====

설치된 프로그램: m4


==== 요약 ====

m4 copies the given files while expanding the macros that they contain. These macros are either built-in or user-defined and can take any number of arguments. Besides just doing macro expansion, m4 has built-in functions for including named files, running Unix commands, doing integer arithmetic, manipulating text in various ways, recursion, and so on. The m4 program can be used either as a front-end to a compiler or as a macro processor in its own right.

==== Contents of Iana-Etc ====

Installed files: /etc/protocols, /etc/services

=== Bison-2.6.2 설치 ===

The Bison package contains a parser generator.
{{{
Approximate build time:  1.3 SBU
Required disk space:      34 MB
}}}
Bison (2.6.2) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/bison/

Bison와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, Sed.

==== Bison 설치 ====

Bison 컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}

configure 시스템은 Bison을 빌드하려 할때 $PATH를 아직 갖고 있지 않기 때문에 internationalization을 지원하지 않는 경우에 에러메세지가 나타날 수 있습니다. 다음의 명령으로 이를 올바르게 잡아줍니다:
{{{
echo '#define YYENABLE_NLS 1' >> lib/config.h
}}}

팩키지 컴파일:
{{{
make      
}}}
이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 다음 문장을 실행하세요.(대신 시간은 좀 오래 걸립니다.)
{{{
make check
}}}      

그리고 패키지를 설치:
{{{
make install
}}}      

==== Bison 내용 ====

설치된 프로그램들: bison and yacc

설치된 라이브러리들: liby.a

==== 요약 ====

bison generates, from a series of rules, a program for analyzing the structure of text files. Bison is a replacement for yacc (Yet Another Compiler Compiler).

yacc is a wrapper for bison, meant for programs that still call yacc instead of bison. It calls bison with the -y option.

liby.a is the Yacc library containing implementations of Yacc-compatible yyerror and main functions. This library is normally not very useful, but POSIX requires it.

=== Procps-3.2.8 설치하기 ===
빌드 시간: 0.1 SBU
필요 공간: 2.6 MB

먼저 커널 시간의 tick 발생률을 지정해주어서 에러 메세지가 출력될 수 있기 때문에 미리 패치합니다:
{{{
patch -Np1 -i ../procps-3.2.8-fix_HZ_errors-1.patch
}}}

'''watch''' 프로그램과 관련된 유니코드 문제를 패치합니다:
{{{
patch -Np1 -i ../procps-3.2.8-watch_unicode-1.patch
}}}

Makefile에 있는 버그를 패치하여 procps가 make-3.82를 빌드하는 것을 방지합니다:
{{{
sed -i -e 's@*/module.mk@proc/module.mk ps/module.mk@' Makefile
}}}

패키지를 컴파일합니다.
{{{
make
}}}

패키지를 설치합니다.
{{{
make install
}}}

=== Grep-2.14 ===
빌드 시간: 0.4 SBU
필요 공간:  30 MB
설치 내용: egrep, fgrep, grep
{{{
./configure --prefix=/usr --bindir==/bin
make
make check
make install
}}}

=== Readline-6.2 ===
빌드 시간:  0.1 SBU
필요 공간: 17.2 MB

Readline을 다시 설치하면 기존에 있던 라이브러리를 <libraryname>.old의 형태로 바꿀수 있습니다. 이것은 일반적으로 문제를 일으키지는 않지만 '''ldconfig'''에서 링크에 관련된 버그를 일으킬 수 있기 때문에 다음의 sed 명령으로 이 부분을 삭제합니다.
{{{
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
}}}

버그 패치를 적용합니다.
{{{
patch -Np1 -i ../readline-6.2-fixes-1.patch
}}}

Readline을 configure, 컴파일합니다.
{{{
./configure --prefix=/usr --libdir=/lib
make SHLIB_LIBS=-lncurses
}}}

'''SHLIB_LIBS=-lncurses''': 이 옵션은 Readline이 libncurses(really, libncursesw) 라이브러리와 링크하도록 설정하는 옵션입니다.

패키지를 설치합니다:
{{{
make install
}}}

이제 정적 라이브러리를 적절한 위치로 옮깁니다.
{{{
mv -v /lib/lib{readline,history}.a /usr/lib
}}}

/lib안에 있는 .so 파일들을 삭제하고 /usr/lib으로 링크를 다시 걸어줍니다.
{{{
rm -v /lib/lib{readline,history}.so
ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
}}}

원한다면 문서를 설치합니다.
{{{
mkdir   -v       /usr/share/doc/readline-6.2
install -v -m644 doc/*.{ps,pdf,html,dvi} 
                 /usr/share/doc/readline-6.2
}}}

=== Bash-4.2 설치 ===

The Bash package contains the Bourne-Again SHell.
{{{
Approximate build time:  1.7 SBU
Required disk space:     45 MB
}}}
Bash (4.2) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/bash/

Bash의 패치를 받을 수 있는 사이트:
ftp://ftp.osuosl.org/pub/lfs/lfs-packages/7.2/

Bash와 의존성 관계에 있는 프로그램들: Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Ncurses, Sed.
==== Bash 인스톨 ====

패치 하기:
{{{
patch -Np1 -i ../bash-4.2-fixes-8.patch
}}}
Bash 컴파일 준비하기:
{{{
./configure --prefix=/usr                     
            --bindir=/bin                     
            --htmldir=/usr/share/doc/bash-4.2 
            --without-bash-malloc             
            --with-installed-readline
}}}

컴파일하기:
{{{
make      
}}}
test suite를 실행하지 않으려면 패키지 설치부분으로 넘어가세요.

test suite를 위해 소스 트리에서 ''nobody'' 사용자가 쓸 수 있는 권한을 부여합니다.
{{{
chown -Rv nobody .
}}}

이제 ''nobody'' 사용자로 테스트를 실행합니다.
{{{
make tests      
}}}

패키지 설치하기:
{{{
make install      
}}}

이번에 새로 컴파일한 bash 프로그램을 실행하자:
{{{
exec /bin/bash --login +h      
}}}
==== Bash 내용 ====

설치된 프로그램들: bash, sh (link to bash) and bashbug
==== 요약 ====

bash is a widely-used command interpreter. It performs all kinds of expansions and substitutions on a given command line before executing it, thus making this interpreter a powerful tool.

bashbug is a shell script to help the user compose and mail bug reports concerning bash in a standard format.

sh is a symlink to the bash program. When invoked as sh, bash tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.

=== Libtool-2.4.2 설치 ===
빌드 시간: 3.0 SBU
필요 공간:  37 MB

Libtool () 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/libtool/

Libtool과 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Sed.
==== Libtool 설치 ====

Libtool 컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}

컴파일하기:
{{{
make      
}}}

  이 팩키지는 팩키지가 제대로 빌드 되었는지를 다양하게 검사할 수 있는 Test suite 를 이용할 수 있습니다. 테스트를 해보려면 다음과 같은 명령을 실행하세요:
{{{
make check      
}}}
설치하기:
{{{
make install      
}}}

==== Libtool 내용 ====

설치된 프로그램들: libtool and libtoolize

설치된 라이브러리들: libltdl.[a,so].
==== 요약 ====
libtool provides generalized library-building support services.

libtoolize provides a standard way to add libtool support to a package.

libltdl hides the various difficulties of dlopening libraries.

=== GDBM-1.10 설치하기 ===
설명: GDBM 패키지는 GNU Database Manager를 포함하고 있습니다. 이것은 하나의 파일에 key/data-pairs에 대한 정보들을 저장하는 데이터베이스 형식입니다.

빌드 시간: 0.1 SBU
필요 공간: 8.5 MB

컴파일 준비를 합니다:
{{{
./configure --prefix=/usr --enable-libgdbm-compat
}}}

'''--enable-libgdbm-compat''' 

LFS 이외의 패키지들은 오래된 DBM 루틴을 필요로 할 때도 있기 때문에 이 옵션을 통해 libgdbm 호환 라이브러리를 빌드하도록 만듭니다. 

패키지를 컴파일합니다
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치합니다
{{{
make install
}}}

=== Inetutils-1.9.1 설치 ===

The Inetutils package contains programs for basic networking.
{{{
Approximate build time:  0.4 SBU
Required disk space:      27 MB
}}}
Inetutils (1.9.1) 공식 다운로드 사이트:
ftp://ftp.gnu.org/gnu/inetutils/

Inetutils의 패치를 받을 수 있는 사이트:
ftp://ftp.osuosl.org/pub/lfs/lfs-packages/7.2/

Inetutils와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed.

==== Inetutils 설치 ====

Glibc-2.16.0과의 호환성 문제를 위해 다음과 같이 패키지를 수정합니다
{{{
sed -i -e '/gets is a/d' lib/stdio.in.h
}}}

Inetutils 컴파일 준비하기:
{{{
./configure --prefix=/usr  
    --libexecdir=/usr/sbin 
    --localstatedir=/var   
    --disable-ifconfig     
    --disable-logger       
    --disable-syslogd      
    --disable-whois        
    --disable-servers
}}}
Configure 옵션의 의미:

    * '''--disable-ifconfig:''' Inetutils이 '''ifconfig''' 프로그램을 설치하는것을 막습니다. LFS에서는 IPRoute2 패키지안의 '''ip'''를 사용합니다.
    * '''--disable-logger:''' 이 옵션은 Inetutiles 팩키지중에서 logger 프로그램을 설치하지 않도록  해 줍니다. (UTil-linux 팩키지에 더 좋은 프로그램이 있기 때문에)
    * '''--disable-syslogd:''' 이 옵션은 inetutils 팩키지 안에 있는 "System Log Daemon"을 설치하지 않도록 합니다. 뒤에 설치할 Sysklogd 팩키지에서 설치하기 때문입니다.
    * '''--disable-whois:''' 이 옵션은 Whois client를 설치하지 않도록 해 줍니다. Inetutils에 포함되어 있는 Whois client는 구버전이기 때문입니다. 신 버전의 Whois client를 설치하실려면 http://www.linuxfromscratch.org/blfs/view/stable/basicnet/inetutils.html 를 참조해 주세요.
    * '''--disable-servers:''' 이 옵션은 Ineutils package 안에 포함된 다양한 네트웍 서비스들을 설치하지 않게 해줍니다. 이 서비스들은 네트웍의 안정성을 유지하는데 악영향을 끼칠 가능성이 있기 때문에 사용하지 않도록 하겠습니다. 더 많은 걸 알고 싶다면http://www.linuxfromscratch.org/blfs/view/stable/basicnet/inetutils.html 을 참조해주세요.  이 팩키지에 포함되어 있는 많은 서버 프로그램들은 다른 더 나은 서버 프로그램들로 대체해 사용할 수 있습니다.

팩키지 컴파일하기:
{{{
make      
}}}

test suite를 실행합니다:
{{{
make check
}}}

팩키지 설치하기:
{{{
make install 
make -C doc html
make -C doc install-html docdir=/usr/share/doc/inetutils-1.9.1    
}}}

FHS에 만족하기 위해 ping program을 /bin으로 옮깁시다.
{{{
mv -v /usr/bin/{hostname,ping,ping6} /bin
mv -v /usr/bin/traceroute /sbin
}}}

==== Inetutils 내용 ====

설치된 프로그램들: ftp, ping, rcp, rlogin, rsh, talk, telnet and tftp

==== 요약 ====

ftp is the ARPANET file transfer program.

ping sends echo-request packets and reports how long the replies take.

rcp does remote file copy.

rlogin does remote login.

rsh runs a remote shell.

talk is used to chat up another user.

telnet is an interface to the TELNET protocol.

tftp is a trivial file transfer program.

=== Perl-5.16.1 설치 ===

The Perl package contains the Practical Extraction and Report Language.
{{{
Approximate build time:  7.5 SBU
Required disk space:     247 MB
}}}
Perl (5.16.1) 공식 다운로드 사이트:
http://www.perl.com/

Perl과 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Sed.

==== Perl 설치 ====

/etc/hosts 파일을 만들어서 부가적인 test suite를 실행했을 때 정상적으로 작동되도록 다음과 같이 설정해줍니다.
{{{
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
}}}

Perl의 버전은 이제 Compress::Raw::Zlib 모듈을 빌드합니다. 기본적으로 Perl은 내부적으로 Zlib 소스를 복사하여 빌드합니다. 여기에 사용될 소스 라이브러리를 위해 다음과 같이 시스템에 있는 Zlib 라이브러리를 사용하도록 설정해줍니다
{{{
sed -i -e "s|BUILD_ZLIBs*= True|BUILD_ZLIB = False|"           
       -e "s|INCLUDEs*= ./zlib-src|INCLUDE    = /usr/include|" 
       -e "s|LIBs*= ./zlib-src|LIB        = /usr/lib|"         
    cpan/Compress-Raw-Zlib/config.in
}}}


만약 Perl의 default 설정으로 컴파일 하기보다 다른 더 자세한 옵션을 주고 싶다면, "-des"옵션을 제거하고 Interactive Configure Script를 실행하고 컴파일시에 다양하게 수정(편집)해서 컴파일 할 수 있습니다. 이렇게 일일이 설정하는 게 싫다면 Perl이 자동적으로 검색하여 설정하는 기본방법을 사용하십시오:
{{{
sh Configure -des -Dprefix=/usr                 
                  -Dvendorprefix=/usr           
                  -Dman1dir=/usr/share/man/man1 
                  -Dman3dir=/usr/share/man/man3 
                  -Dpager="/usr/bin/less -isR"  
                  -Duseshrplib
}}}

Configure 옵션의 의미:
    * -Dvendorprefix=/usr: '''perl'''이 어디에 perl을 설치해야되는지 경로를 알려주는 옵션입니다.
    * -Dpager="/bin/less -isR": '''perldoc'''이 '''less'''프로그램을 이용해 에러를 고칩니다.
    * -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3: 아직 Groff가 설치되지 않았기 때문에 '''Configure'''은 Perl을 위해 man 페이지를 설치하지 않으려 할 것이기 때문에 이렇게 파라미터를 정해주어야 man페이지를 설치할 수 있습니다.
    * -Duseshrplib: Perl 모듈이 사용될 때 필요한 shared libperl를 빌드할 때 사용하는 옵션입니다.

팩키지 컴파일하기:
{{{
make      
}}}

테스트를 해 봅시다:
{{{
make -k test      
}}}
팩키지 설치:
{{{
make install      
}}}
==== Perl 내용 ====

설치된 프로그램들: a2p, c2ph, dprofpp, enc2xs, find2perl, h2ph, h2xs, libnetcfg, perl, perl5.8.3 (link to perl), perlbug, perlcc, perldoc, perlivp, piconv, pl2pm, pod2html, pod2latex, pod2man, pod2text, pod2usage, podchecker, podselect, psed (link to s2p), pstruct (link to c2ph), s2p, splain and xsubpp

설치된 라이브러리들: (too many to name)
==== 요약 ====

a2p translates awk to perl.

c2ph dumps C structures as generated from "cc -g -S" stabs.

dprofpp displays perl profile data.

en2cxs builds a Perl extension for the Encode module, from either Unicode Character Mappings or Tcl Encoding Files.

find2perl translates find commands to perl.

h2ph converts .h C header files to .ph Perl header files.

h2xs converts .h C header files to Perl extensions.

libnetcfg can be used to configure the libnet.

perl combines some of the best features of C, sed, awk and sh into a single swiss-army language.

perlbug is used to generate bug reports about Perl or the modules that come with it, and mail them.

perlcc generates executables from Perl programs.

perldoc displays a piece of documentation in pod format that is embedded in the perl installation tree or in a perl script.

perlivp is the Perl Installation Verification Procedure. It can be used to verify that Perl and its libraries have been installed correctly.

piconv is a Perl version of the character encoding converter iconv.

pl2pm is a rough tool for converting Perl4 .pl files to Perl5 .pm modules.

pod2html converts files from pod format to HTML format.

pod2latex converts files from pod format to LaTeX format.

pod2man converts pod data to formatted *roff input.

pod2text converts pod data to formatted ASCII text.

pod2usage prints usage messages from embedded pod docs in files.

podchecker checks the syntax of pod format documentation files.

podselect displays selected sections of pod documentation.

psed is a Perl version of the stream editor sed.

pstruct dumps C structures as generated from "cc -g -S" stabs.

s2p translates sed to perl.

splain is used to force verbose warning diagnostics in perl.

xsubpp converts Perl XS code into C code.

=== Autoconf-2.69 설치 ===

The Autoconf package contains programs for producing shell scripts that can automatically configure source code.
{{{
Approximate build time:  4.5 SBU
Required disk space:    17.1 MB
}}}
Autoconf (2.69) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/autoconf/

Autoconf와 의존성 관계에 있는 프로그램들: Bash, Coreutils, Diffutils, Grep, M4, Make, Perl, Sed.

==== Autoconf 설치 ====

Autoconf 컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}

컴파일하기:
{{{
make      
}}}

이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 다음 문장을 실행하세요.(대신 시간은 좀 오래 걸립니다.)
{{{
make check      
}}}

팩키지 설치하기:
{{{
make install      
}}}

==== Autoconf 내용 ====

설치된 프로그램들: autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate and ifnames
==== 요약 ====

autoconf is a tool for producing shell scripts that automatically configure software source code packages to adapt to many kinds of Unix-like systems. The configuration scripts it produces are independent -- running them does not require the autoconf program.

autoheader is a tool for creating template files of C #define statements for configure to use.

autom4te is a wrapper for the M4 macro processor.

autoreconf comes in handy when there are a lot of autoconf-generated configure scripts around. The program runs autoconf and autoheader repeatedly (where appropriate) to remake the autoconf configure scripts and configuration header templates in a given directory tree.

autoscan can help to create a configure.in file for a software package. It examines the source files in a directory tree, searching them for common portability problems and creates a configure.scan file that serves as as a preliminary configure.in for the package.

autoupdate modifies a configure.in file that still calls autoconf macros by their old names to use the current macro names.

ifnames can be helpful when writing a configure.in for a software package. It prints the identifiers that the package uses in C preprocessor conditionals. If a package has already been set up to have some portability, this program can help to determine what configure needs to check. It can fill in some gaps in a configure.in file generated by autoscan.

=== Automake-1.12.3 설치 ===

The Automake package contains programs for generating Makefiles for use with Autoconf.
{{{
Approximate build time:  <=0.1 SBU(test하는데 34.1 SBU)
Required disk space:     100 MB
}}}
Automake (1.12.3) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/automake/

Automake와 의존성 관계에 있는 프로그램들: Autoconf, Bash, Coreutils, Diffutils, Grep, M4, Make, Perl, Sed.

==== Automake의 인스톨 ====

Automake 컴파일 준비하기:
{{{
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.12.3
}}}
컴파일하기:
{{{
make      
}}}
 이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 다음 문장을 실행하세요.(대신 시간은 좀 오래 걸립니다.)

[chaoxifer]: 진짜 오래걸립니다.....문서에서도 test suite 실행하는 것을 권하지 않습니다.
{{{
make check 
}}}
설치하기:
{{{
make install      
}}}

==== Automake 내용 ====
설치된 프로그램들: acinstall, aclocal, aclocal-1.8, automake, automake-1.8, compile, config.guess, config.sub, depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs, py-compile, symlink-tree, ylwrap

==== 요약 ====
acinstall is a script that installs aclocal-style M4 files.

aclocal generates aclocal.m4 files based on the contents of configure.in files.

automake is a tool for automatically generating Makefile.in's from files called Makefile.am. To create all the Makefile.in files for a package, run this program in the top level directory. By scanning the configure.ins it automatically finds each appropriate Makefile.am and generate the corresponding Makefile.in.

compile is a wrapper for compilers.

config.guess is a script that attempts to guess the canonical triplet for the given build, host, or target architecture.

config.sub is a configuration validation subroutine script.

depcomp is a script for compiling a program so that not only the desired output is generated but also dependency information.

elisp-comp byte-compiles Emacs Lisp code.

install-sh is a script that installs a program, a script, or a datafile.

mdate-sh is a script that prints the modification time of a file or directory.

missing is a script acting as a common stub for missing GNU programs during an installation.

mkinstalldirs is a script that creates a directory tree.

py-compile compiles a Python program.

symlink-tree is a script to create a symlink tree of a directory tree.

ylwrap is a wrapper for lex and yacc.

=== Diffutils-3.2 설치하기 ===
빌드 시간: 0.5 SBU
필요 공간:  25 MB

Glibc-2.16.0과의 호환성을 위해 다음과 같이 패키지를 수정합니다:
{{{
sed -i -e '/gets is a/d' lib/stdio.in.h
}}}

컴파일 준비를 합니다:
{{{
./configure --prefix=/usr
}}}

패키지를 컴파일합니다:
{{{
make
}}}

test suite를 실행합니다:
{{{
make check
}}}

패키지를 설치합니다:
{{{
make install
}}}

==== Diffutils 의 설치목록 ====

설치되는 프로그램: cmp, diff, diff3, sdiff

=== Gawk-4.0.1 설치 ===

The Gawk package contains programs for manipulating text files.
{{{
Approximate build time:  0.2 SBU
Required disk space:     30 MB
}}}
Gawk (4.0.1)공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/gawk/

Gawk와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Sed.

==== Gawk 설치 ====

Gawk을 컴파일 준비하기:
{{{
./configure --prefix=/usr --libexecdir=/usr/lib
}}}      

팩키지 컴파일:
{{{
make      
}}}
이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 원한다면 다음 명령을 입력하세요.
{{{
make check      
}}}
그리고 패키지 설치:
{{{
make install
}}}      

만약 관련 문서를 설치하고 싶다면 다음을 실행하십시오:
{{{
mkdir -v /usr/share/doc/gawk-4.0.1
cp    -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.0.1
}}}

==== Gawk 내용 ====

설치된 프로그램: awk (link to gawk), gawk, gawk-3.1.3, grcat, igawk, pgawk, pgawk-3.1.3 and pwcat


==== 요약 ====

gawk is a program for manipulating text files. It is the GNU implementation of awk.

grcat dumps the group database /etc/group.

igawk gives gawk the ability to include files.

pgawk is the profiling version of gawk.

pwcat dumps the password database /etc/passwd.

=== Findutils-4.4.2 설치 ===

The Findutils package contains programs to find files. The finding is done either by doing a live recursive search through a directory tree, or by consulting a previously set up database.
{{{
Approximate build time:  0.4 SBU
Required disk space:      29 MB
}}}
Findutils (4.4.2)공식 다운로드 사이트:
ftp://alpha.gnu.org/gnu/findutils/

FindutilsCoreutils와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Sed.

==== Findutils 설치 ====
컴파일 준비하기
{{{
./configure --prefix=/usr                   
            --libexecdir=/usr/lib/findutils 
            --localstatedir=/var/lib/locate
}}}
데이타베이스의 기본 위치는 /usr/var입니다. FHS 을 기준으로 데이터 베이스 의 위치를 지정하고자 하면 configure를 할 때, 시키는대로 이  --localstatedir=/var/lib/misc 를 추가하세요.

팩키지 컴파일:
{{{
make      
}}}
이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶으면 다음 명령을 실행하세요.
{{{
make check      
}}}
팩키지 설치:
{{{
make install      
}}}
LFS-Bootscript 패키지에 있는 스크립트 중 '''find'''에 의존 관계에 있는 것이 있습니다. 때문에 /usr 에 있으면 boot 스테이지가 적절하게 실행되지 않을 겁니다. 이를 수정하기 위해 해당 프로그램을 root 파티션으로 옮겨줍니다.
{{{
mv -v /usr/bin/find /bin
sed -i 's/find:=${BINDIR}/find:=/bin/' /usr/bin/updatedb
}}}

==== Findutils 내용 ====

설치된 프로그램들: bigram, code, find, frcode, locate, updatedb and xargs

==== 요약 ====

bigram 은 데이타베이스의 위치를 산출해내기 위해 전에 사용되었다.

code 는 데이타베이스의 위치를 산출해내기 위해 전에 사용되었다. 그것은 frcode의 조상이다.

find 는 열거된 criteria를 같은 파일을 위한 입력한 디렉토리을 찾는다.

frcode 는 파일이름의 목록을 압축하기위해 updatedb에 의해 불려진다. 그것은 앞-압축을 사용한다, 4에서 5까지의 원소에 의한 데이타베이스사이즈를 줄인다.

locate 는 파일이름들의 데이타베이스를 통해 찾는다. 그리고 그 이름들을 보고한다.

updatedb 는 데이타배이스 위치를 업데이트한다. 그것은 전체 파일시스템을 조사한다.(다른 파일 시스템을 포함. 현제 마운트된, 만약 얘기 하지 않았다면) 그리고 데이타베이스안에 찾은 모든 파일이름을 올린다.

xargs 는 입력된 파일의 목록에서 명령을 공급하는데 사용할수있다.

=== Flex-2.5.37 설치 ===

The Flex package contains a utility for generating programs that recognize patterns in text.
.
{{{
Approximate build time:  0.4 SBU
Required disk space:      39 MB
}}}
(2.5.37)공식 다운로드 사이트: 
http://flex.sourceforge.net/

Flex와 의존성 관계에 있는 프로그램들: Bash, Binutils, Bison, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, Sed.

==== Flex 설치 ====
먼저, test관련 버그를 패치합니다
{{{
patch -Np1 -i ../flex-2.5.37-bison-2.6.1-1.patch
}}}

Flex 컴파일 준비하기:
{{{
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
}}}

패키지 컴파일:
{{{
make      
}}}

이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 아래 명령어를 입력하세요:
{{{
make -k check
}}}
그리고 패키지 설치:
{{{
make install      
}}}
일부 프로그램들은 /usr/lib안의  Lex라이브러리를 사용합니다.  아래와 같이 심볼릭 링크를 만들어 주세요:
{{{
ln -sv libfl.a /usr/lib/libl.a
}}}
일부 프로그램들은 flex가 아니라  lex를 사용 합니다. 그런 프로그램들을 위해서  Lex emulation mode의  flex를 lex라는 이름의  shell스크립트를 만듭시다.
{{{
cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
chmod -v 755 /usr/bin/lex
}}}

원한다면 flex.pdf 문서 파일을 설치합니다
{{{
mkdir -v /usr/share/doc/flex-2.5.37
cp    -v doc/flex.pdf /usr/share/doc/flex-2.5.37
}}}
==== Flex 내용 ====
설치된 프로그램들: flex, flex++ (link to flex) and lex

설치된 라이브러리들: libfl.a

==== 요약 ====

flex is a tool for generating programs that recognize patterns in text. Pattern recognition is useful in many applications. From a set of rules on what to look for flex makes a program that looks for those patterns. The reason to use flex is that it is much easier to specify the rules for than to write the actual pattern-finding program.

flex++ invokes a version of flex that is used exclusively for C++ scanners.

libfl.a is the flex library.

=== Gettext-0.18.1.1 설치 ===

The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with Native Language Support (NLS), enabling them to output messages in the user's native language.
{{{
Approximate build time:  2.3 SBU
Required disk space:     180 MB
}}}
Gettext (0.18.1.1) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/gettext/

Gettext와 의존성 관계에 있는 프로그램들: Bash, Binutils, Bison, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Sed.

==== Gettext 설치 ====
Glibc-2.16.0과의 호환성 문제를 해결합니다:
{{{
sed -i -e '/gets is a/d' gettext-*/*/stdio.in.h
}}}

Gettext 컴파일 준비하기:
{{{
./configure --prefix=/usr 
            --docdir=/usr/share/doc/gettext-0.18.1.1
}}}
팩키지 컴파일:
{{{
make      
}}}
이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 다음 문장을 실행하세요.(대신 시간은 좀 오래 걸립니다.)
{{{
make check      
}}}
패키지 설치:
{{{
make install      
}}}

==== Gettext 내용 ====

설치된 프로그램들: autopoint, config.charset, config.rpath, envsubst, gettext, gettextize, hostname, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen, msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq, ngettext, project-id, team-address, trigger, urlget, user-email and xgettext

설치된 라이브러리들: libasprintf[a,so], libgettextlib[a,so], libgettextpo[a,so] and libgettextsrc[a,so]


==== 요약 ====

autopoint copies standard gettext infrastructure files into a source package.

config.charset outputs a system-dependent table of character encoding aliases.

config.rpath outputs a system-dependent set of variables, describing how to set the runtime search path of shared libraries in an executable.

envsubst substitutes environment variables in shell format strings.

gettext translates a natural language message into the user's language, by looking up the translation in a message catalog.

gettextize copies all standard Gettext files into the given top-level directory of a package, to begin internationalizing it.

hostname displays a network hostname in various forms.

msgattrib filters the messages of a translation catalog according to their attributes and manipulates the attributes.

msgcat concatenates and merges the given .po files.

msgcmp compares two .po files to check that both contain the same set of msgid strings.

msgcomm finds the messages that are common to to the given .po files.

msgconv converts a translation catalog to a different character encoding.

msgen creates an English translation catalog.

msgexec applies a command to all translations of a translation catalog.

msgfilter applies a filter to all translations of a translation catalog.

msgfmt generates a binary message catalog from from a translation catalog.

msggrep extracts all messages of a translation catalog that match a given pattern or belong to some given source files.

msginit creates a new .po file, initializing the meta information with values from the user's environment.

msgmerge combines two raw translations into a single file.

msgunfmt decompiles a binary message catalog into raw translation text.

msguniq unifies duplicate translations in a translation catalog.

ngettext displays native language translations of a textual message whose grammatical form depends on a number.

xgettext extracts the translatable message lines from the given source files, to make the first translation template.

libasprintf defines the autosprintf class which makes C formatted output routines usable in C++ programs, for use with the <string> strings and the <iostream> streams.

libgettextlib is a private library containing common routines used by the various gettext programs. They're not meant for general use.

libgettextpo is used to write specialized programs that process PO files. This library is used when the standard applications shipped with gettext won't suffice (such as msgcomm, msgcmp, msgattrib and msgen).

libgettextsrc is a private library containing common routines used by the various gettext programs. They're not meant for general use.

=== Groff-1.21 설치 ===

The Groff package contains programs for processing and formatting text.
{{{
Approximate build time:  0.5 SBU
Required disk space:     83 MB
}}}
Groff (1.21) 공식 다운로드 사이트 :
ftp://ftp.gnu.org/gnu/groff/

Groff와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Sed.


==== Groff 설치 ====

Groff는 기본 문서 사이즈를 포함하는 환경변수 PAGE를 필요로 합니다. 미국에서는 PAGE=letter로 지정하지만, 만약 당신이 미국이 아닌 다른 곳에서 살고 있다면 PAGE=letter를 PAGE=A4로 바꿔 주어야 합니다.

Groff컴파일 준비하기:
{{{
PAGE=A4 ./configure --prefix=/usr (PAGE를 한국 실정에 맞게 A4로)      
}}}
팩키지 컴파일:
{{{
make      
}}}
팩키지 설치:
{{{
make install      
}}}
'''xman'''같은 일부 documentation program들은 다음과 같이 심볼릭 링크를 만들어 주지 않으면 실행되지 않을 것입니다:
{{{
ln -s soelim /usr/bin/zsoelim
ln -s eqn /usr/bin/geqn
ln -s tbl /usr/bin/gtbl      
}}}

==== Groff 내용 ====

설치된 프로그램: addftinfo, afmtodit, eqn, eqn2graph, geqn (link to eqn), grn, grodvi, groff, groffer, grog, grolbp, grolj4, grops, grotty, gtbl (link to tbl), hpftodit, indxbib, lkbib, lookbib, mmroff, neqn, nroff, pfbtops, pic, pic2graph, post-grohtml, pre-grohtml, refer, soelim, tbl, tfmtodit, troff and zsoelim (link to soelim)

==== 요약 ====

addftinfo reads a troff font file and adds some additional font-metric information that is used by the groff system.

afmtodit creates a font file for use with groff and grops.

eqn compiles descriptions of equations embedded within troff input files into commands that are understood by troff.

eqn2graph converts an EQN equation into a cropped image.

grn is a groff preprocessor for gremlin files.

grodvi is a driver for groff that produces TeX dvi format.

groff is a front-end to the groff document formatting system. Normally it runs the troff program and a post-processor appropriate for the selected device.

groffer displays groff files and man pages on X and tty.

grog reads files and guesses which of the groff options -e, -man, -me, -mm, -ms, -p, -s, and -t are required for printing files, and reports the groff command including those options.

grolbp is a groff driver for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers).

grolj4 is a driver for groff that produces output in PCL5 format suitable for an HP Laserjet 4 printer.

grops translates the output of GNU troff to Postscript.

grotty translates the output of GNU troff into a form suitable for typewriter-like devices.

gtbl is the GNU implementation of tbl.

hpftodit creates a font file for use with groff -Tlj4 from an HP-tagged font metric file.

indxbib makes an inverted index for the bibliographic databases a specified file for use with refer, lookbib, and lkbib.

lkbib searches bibliographic databases for references that contain specified keys and reports any references found.

lookbib prints a prompt on the standard error (unless the standard input is not a terminal), reads from the standard input a line containing a set of keywords, searches the bibliographic databases in a specified file for references containing those keywords, prints any references found on the standard output and repeats this process until the end of input.

mmroff is a simple preprocessor for groff.

neqn formats equations for ascii output.

nroff is a script that emulates the nroff command using groff.

pfbtops translates a Postscript font in .pfb format to ASCII.

pic compiles descriptions of pictures embedded within troff or TeX input files into commands understood by TeX or troff.

pic2graph converts a PIC diagram into a cropped image.

pre-grohtml translates the output of GNU troff to html.

post-grohtml translates the output of GNU troff to html.

refer copies the contents of a file to the standard output, except that lines between .[ and .] are interpreted as citations, and lines between .R1 and .R2 are interpreted as commands about how citations are to be processed.

soelim reads files and replaces lines of the form .so file by the contents of the mentioned file.

tbl compiles descriptions of tables embedded within troff input files into commands that are understood by troff.

tfmtodit creates a font file for use with groff -Tdvi.

troff is highly compatible with Unix troff. Usually it should be invoked using the groff command, which will also run preprocessors and post-processors in the appropriate order and with the appropriate options.

zsoelim is the GNU implementation of soelim.

=== Xz-5.0.4 설치하기 ===
빌드 시간: 0.3 SBU
필요 용량:  18 MB

Xz 컴파일을 준비합니다:
{{{
./configure --prefix=/usr --libdir=/lib --docdir=/usr/share/doc/xz-5.0.4
}}}

패키지를 컴파일합니다:
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치합니다
{{{
make pkgconfigdir=/usr/lib/pkgconfig install
}}}

=== Grub-2.00 설치 ===
빌드 시간: 0.7 SBU
필요 공간: 112 MB

Glibc-2.16.0과의 호환성 문제를 수정합니다:
{{{
sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h
}}}

GRUB을 컴파일할 준비를 합니다
{{{
./configure --prefix=/usr          
            --sysconfdir=/etc      
            --disable-grub-emu-usb 
            --disable-efiemu       
            --disable-werror
}}}

{{{
make 
make install
}}}

=== Less-444 설치 ===

The Less package contains a text file viewer.
{{{
Approximate build time:  0.1 SBU
Required disk space:     3.8 MB
}}}
Less (444) 공식 다운로드 사이트: 
ftp://ftp.gnu.org/gnu/less/

Less와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed.

==== Less 설치 ====
Less 컴파일 준비하기:
{{{
./configure --prefix=/usr --bindir=/bin --sysconfdir=/etc      
}}}
Configure 옵션의 의미:

    * --sysconfdir=/etc: This option tells the programs created by the package to look in /etc for their configuration files.

팩키지 컴파일:
{{{
make      
}}}
팩키지 설치하기:
{{{
make install      
}}}
==== Less 내용 ====

설치된 프로그램들: less, lessecho and lesskey

==== 요약 ====

less is a file viewer or pager. It displays the contents of the given file, letting you scroll around, find strings, and jump to marks.

lessecho is needed to expand metacharacters, such as * and ?, in filenames on Unix systems.
lesskey is used to specify the key bindings for less.

=== Gzip-1.5 ===
컴파일하여 설치합니다
{{{
./configure --prefix=/usr --bindir=/bin
make
make check
make install
}}}

루트 파일시스템에 필요하지 않는 프로그램들을 /usr/bin 으로 옮깁니다.
{{{
mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
}}}

=== IPRoute2-3.5.1 ===
패키지에 포함되어있는 '''arpd''' 바이너리는 berkeley DB에 대해 의존성을 가지고 있습니다. '''arpd'''가 리눅스 시스템 기반에서 공통적으로 요구되지 않기 때문에 다음과 같은 방법으로 Berkeley DB에 대한 의존성을 없앨 수 있습니다. 만약 '''arpd''' 바이너리가 필요하다면 BLFS 책에 나와있는 Berkeley DB를 컴파일하는 방법을 살펴보십시오:
[http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db]

{{{
sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
sed -i /ARPD/d Makefile
sed -i 's/arpd.8//' man/man8/Makefile
}}}

패키지를 컴파일합니다
{{{
make DESTDIR=
}}}

여기서 DESTDIR= 이라고 한 것은 IPRoute2 바이너리가 설치될 디렉토리를 설정해 준 겁니다. 여기서는 디폴트값으로 /usr 가 됩니다.

패키지를 설치합니다:
{{{
make DESTDIR=              
     MANDIR=/usr/share/man 
     DOCDIR=/usr/share/doc/iproute2-3.5.1 install
}}}

=== Kbd-1.15.3 설치 ===

설명: Kbd 패키지는 key-table 파일과, 콘솔 폰트, 키보드 유틸리티를 포함합니다.

빌드 시간: 0.1 SBU
필요 공간:  20 MB

'''loadkeys'''는 이번 릴리즈에서 filename이 없이 실행하면 손상되는데 이를 패치해줍니다:
{{{
patch -Np1 -i ../kbd-1.15.3-upstream_fixes-1.patch
}}}

Backspace와 Delete 키의 동작은 Kbd 패키지에서 지속적으로 영향을 주고 있습니다. i386 키맵에서 발생하는 버그를 패치합니다:
{{{
patch -Np1 -i ../kbd-1.15.3-backspace-1.patch
}}}

패치 후에 Backspace 키는 127코드를, Delete 키는 escape 시퀀스를 산출할것입니다.

스페인어 메세지 번역이 kbd가 gettext-1.18.1.1와 함께 빌드되는 것을 방해하는 것을 패치합니다.
{{{
sed -i '/guardado el/s/(^.*en %)(.*)/14$2/' po/es.po
}}}

불필요한 '''resizecons''' 프로그램과 해당 man 페이지를 삭제합니다.(32-bit x86에만 해당됩니다.)

configure.ac의 버전은 aclocal.m4보다 새 버전이기 때문에 autotools는 '''make'''를 실행하여 configure를 덮어쓰기하려 할 것입니다. configure.ac의 시간과 날짜 대신에 시스템의 timezone을 사용하도록 다음과 같이 바꿔줍니다.
{{{
sed -i 's/(RESIZECONS_PROGS=)yes/1no/' configure &&
sed -i 's/resizecons.8 //' man/man8/Makefile.in &&
touch -d '2011-05-07 08:30' configure.ac
}}}

Kbd 컴파일을 준비합니다
{{{
./configure --prefix=/usr --datadir=/lib/kbd
}}}

패키지를 컴파일하고 설치합니다
{{{
make
make install
}}}

부트 스크립트에 필요한 파일들을 root 파티션쪽으로 옮깁니다.
{{{
mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
}}}

원하시는 분들만 문서를 설치하세요:
{{{
mkdir -v /usr/share/doc/kbd-1.15.3
cp -R -v doc/* 
         /usr/share/doc/kbd-1.15.3
}}}
=== Kmod-9 설치 ===
설명: Kmod 패키지는 커널 모듈을 로드하기 위한 라이브러리와 유틸리티를 가지고 있습니다.

빌드 시간: 0.1 SBU
필요 공간:  30 MB

x86 호스트시스템에서 test suite를 실행할 때 생기는 문제를 패치합니다:
{{{
patch -Np1 -i ../kmod-9-testsuite-1.patch
}}}

Kmod 컴파일을 준비합니ㄷ
{{{
./configure --prefix=/usr       
            --bindir=/bin       
            --libdir=/lib       
            --sysconfdir=/etc   
            --with-xz           
            --with-zlib
}}}

컴파일 옵션 설명:
  * '''lib* and --with-*''': 이 옵션들은 Kmod가 압축된 커널 모듈들을 핸들링 할 수 있도록 합니다. xz와 zlib 헤더파일과 라이브러리가 필요로하는 셸 변수가 pkg-config에 빠져있기 때문에 이 옵션을 설정해 주어야합니다. 

패키지를 컴파일합니다
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치하고 module-init-tools과의 호환성을 위해 symlink를 만들어줍니다.
{{{
make pkgconfigdir=/usr/lib/pkgconfig install

for target in depmod insmod modinfo modprobe rmmod; do
  ln -sv ../bin/kmod /sbin/$target
done

ln -sv kmod /bin/lsmod
}}}
=== Libpipeline-1.2.1 설치 ===

설명: Libpipeline 패키지는 하위프로세스들의 파이프라인을 제공하는 라이브러리입니다.

빌드 시간: 0.2 SBU
필요 공간: 7.4 MB

Glibc-2.16.0과의 유연성을 위해 다음과 같이 고쳐줍니다:
{{{
sed -i -e '/gets is a/d' gnulib/lib/stdio.in.h
}}}

Libpipeline 컴파일을 준비합니다
{{{
PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr
}}}

패키지를 컴파일합니다
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치합니다
{{{
make install
}}}
=== Make-3.82 설치 ===
설명: Make 패키지는 컴파일 패키지를 포함하고 있습니다

빌드 시간:  0.4 SBU
필요 공간: 11.3 MB

upstream 패치를 적용합니다
{{{
patch -Np1 -i ../make-3.82-upstream_fixes-2.patch
}}}

컴파일 준비를 합니다
{{{
./configure --prefix=/usr
}}}

패키지를 컴파일합니다.
{{{
make
}}}

test suite를 실행합니다
{{{
make check
}}}

패키지를 설치합니다
{{{
make install
}}}
=== Man-DB-2.6.2 설치 ===

Man-DB 패키지는 man page를 찾거나 볼 수 있는 프로그램을 포함하고 있습니다.

필드 시간: 0.5 SBU
필요 용량: 27  MB

Glibc-2.16.0과의 호환성 문제를 해결합니다
{{{
sed -i -e '/gets is a/d' gnulib/lib/stdio.in.h
}}}

컴파일 준비를 합니다
{{{
./configure --prefix=/usr                        
            --libexecdir=/usr/lib                
            --docdir=/usr/share/doc/man-db-2.6.2 
            --sysconfdir=/etc                    
            --disable-setuid                     
            --with-browser=/usr/bin/lynx         
            --with-vgrind=/usr/bin/vgrind        
            --with-grap=/usr/bin/grap
}}}

컴파일 옵션 설명

  * '''--disable-setuid:''' '''man'''프로그램이 '''man'''사용자의 setuid를 하도록 하는 것을 방지합니다.
  * '''--with-...: ''' 이 세개의 파라미터들은 기본 프로그램들을 설정하기위해 사용됩니다. '''lynx'''는 텍스트기반의 웹 브라우저이고 '''vgrind'''는 프로그램의 소스를 Groff 입력으로 변환하는 프로그램, '''grap'''은 Groff 문서들을 설정된 형식의 그래프로 유용한 프로그램들입니다. '''vgrind'''와 '''grap'''프로그램은 manual 페이지를 보는데 일반적으로 필요하지는 않습니다. 이것은 LFS나 BLFS에 속하지는 않지만 여러분들이 LFS를 설치하고 난 후에 원하는 것을 하기 위해 설치해야할 것입니다.

패키지를 컴파일하고 설치합니다
{{{
make
make check
make install
}}}
=== Patch-2.6.1 설치 ===

'''diff''' 프로그램에 의해 구현된 프로그램으로 patch 파일을 적용하여 파일을 수정하거나 만들 수 있는 프로그램입니다.

빌드 시간: <= 0.1 SBU
필요 용량:    3.4 MB

먼저 test suite를 실행할 때 '''ed'''를 찾지 않도록 패치를 적용합니다.
{{{
patch -Np1 -i ../patch-2.6.1-test_fix-1.patch
}}}

컴파일 후 설치합니다
{{{
./configure --prefix=/usr
make
make -k check
make install
}}}
=== Sysklogd-1.5 설치 ===

syslogd 패키지는 시스템 메세지를 로깅하는 프로그램을 가지고 있습니다.

빌드 시간: <= 0.1 SBU
필요 공간:    0.6 MB

패키지를 컴파일합니다
{{{
make
}}}

이 패키지는 test suite를 제공하지 않습니다.

패키지를 설치합니다.
{{{
make BINDIR=/sbin install
}}}

이제 /etc/syslog.conf 파일을 다음과 같이 만들어줍니다.
{{{
cat > /etc/syslog.conf << "EOF"
# Begin /etc/syslog.conf

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 *

# End /etc/syslog.conf
EOF
}}}
=== Sysvinit-2.88dsf 설치 ===

이 패키지는 시스템의 start, running, shutdown 등을 컨트롤하는 프로그램을 제공합니다.

run-level이 바뀔때(예를 들어, 시스템을 끄려고 할 때), '''init'''은 termination 시그널을 새로운 run-level에 있지 않은 프로세스와 자기 자신에게 보냅니다. 이 때 '''init'''은 "Sending processes the TERM signal" 이라는 메세지를 출력하면서 현재 작동하고 있는 모든 프로세스에게 시그널을 보냅니다. 하지만 잘못 해석하는 것을 피하기 위해 이를 "Sending processes configured via /etc/inittab the TERM signal"로 바꿔줍시다
{{{
sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c
}}}

여기에 포함된 '''wall'''과 '''mountpoint'''프로그램의 버전은 이전에 Util-linux에서 설치되었기 때문에 이 둘을 설치목록에서 제외시킵니다.
{{{
sed -i -e 's/utmpdump wall/utmpdump/' 
       -e '/= mountpoint/d' 
       -e 's/mountpoint.1 wall.1//' src/Makefile
}}}

패키지를 컴파일하고 설치합니다
{{{
make -C src
make -C src install
}}}
=== Tar-1.26 설치 ===

빌드 시간: 2.4 SBU
필요 공간:  34 MB

Glibc-2.16.0과의 호환문제를 해결합니다.
{{{
sed -i -e '/gets is a/d' gnu/stdio.in.h
}}}

T&#4447;ar 패키지 컴파일을 준비합니다
{{{
FORCE_UNSAFE_CONFIGURE=1  
./configure --prefix=/usr 
            --bindir=/bin 
            --libexecdir=/usr/sbin
}}}

'''FORCE_UNSAFE_CONFIGURE=1''': 이것은 mknod를 실행할 때 root로 실행하라고 하는 옵션입니다. 일반적으로 test suite를 root로 실행하게 되면 위험하지만 여기에서는 빌드 시스템의 일부에서만 실행되므로 사용해도 괜찮습니다.

패키지를 컴파일하여 설치합니다
{{{
make
make check
make install
make -C doc install-html docdir=/usr/share/doc/tar-1.26
}}}
=== Texinfo-4.6 설치 ===

The Texinfo package contains programs for reading, writing, and converting Info documents.
{{{
Approximate build time:  0.2 SBU
Required disk space:     17 MB
}}}
Texinfo (4.6) 공식 다운로드 사이트:
ftp://ftp.gnu.org/gnu/texinfo/

Texinfo와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed.
==== Texinfo-4.13a 설치 ====

Texinfo 컴파일 준비하기:
{{{
./configure --prefix=/usr      
}}}
컴파일하기:
{{{
make      
}}}
  이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 검사를 하고 싶다면 다음 문장을 실행하세요.
{{{
make check      
}}}
설치하기:
{{{
make install      
}}}
TeX의 다양한 부가적인 컨포넌트들을  설치할 수 있습니다:
{{{
make TEXMF=/usr/share/texmf install-tex      
}}}
make 파리미터의 의미:

    *

      TEXMF=/usr/share/texmf:  The TEXMF makefile variable holds the location of the root of your TeX tree if, for example, you plan to install a TeX package later on.

  Info documentation시스템은 메뉴엔트리 리스트를 유지하기 위해서 간단한 텍스트 파일을 사용합니다. 그 파일은 /usr/share/info/dir 에 위치합니다. 불행하게도 가끔식 시스템에서  Info manual들을 실제로 설치할때, 팩키지들의Makefile의 내용에 따라 문제가 생길수 있습니다. 당신이 /usr/share/info/dir file을 다시 만들 필요가 있을때는 다음과 같은 작업을 수행하세요:
{{{
cd /usr/share/info
rm dir
for f in *
do install-info $f dir 2>/dev/null
done      
}}}
==== Texinfo 내용 ====

설치된 프로그램들: info, infokey, install-info, makeinfo, texi2dvi and texindex
==== 요약 ====

info is used to read Info documents. Info documents are a bit like man pages, but often go much deeper than just explaining all the flags. Compare for example man tar and info tar.

infokey compiles a source file containing Info customizations into a binary format.

install-info is used to install Info files. It updates entries in the Info index file.

makeinfo translates the given Texinfo source documents into various other formats: Info files, plain text, or HTML.

texi2dvi is used to format the given Texinfo document into a device-independent file that can be printed.

texindex is used to sort Texinfo index files.

=== Udev-188 설치(systemd-188에서 추출) ===

빌드 시간:  0.1 SBU
필요 공간: 17.4 MB

Udev 패키지는 동적으로 디바이스 노드를 생성해주는 프로그램입니다.

udev-lfs tarball은 Udev를 빌드하기 위한 LFS-specific 파일을 포함하고 있습니다. systemd 소스 디렉토리에 풀어줍니다.

{{{
tar -xvf ../udev-lfs-188-3.tar.bz2
}}}

패키지를 컴파일합니다.
{{{
make -f udev-lfs-188/Makefile.lfs
}}}

패키지를 설치합니다.
{{{
make -f udev-lfs-188/Makefile.lfs install
}}}

마지막으로 network udev rules를 작성합니다. 여기에 대해 자세히 보려면 [http://www.linuxfromscratch.org/lfs/view/stable/chapter07/network.html#stable-net-names http://www.linuxfromscratch.org/lfs/view/stable/chapter07/network.html#stable-net-names]를 참고하십시오. 중요한건 /sys와 /proc 파일시스템은 chroot환경에서 반드시 마운트되어야 한다는 것을 확인해햐 한다는 점입니다. 다음 스크립트는 마운트가 되어있어야 제대로 작동할 수 있습니다.
{{{
bash udev-lfs-188/init-net-rules.sh
}}}
=== Vim-7.3 설치 ===

The Vim package contains a powerful text editor.
{{{
Approximate build time:  1.1 SBU
Required disk space:     96 MB
}}}
Vim (7.3) 공식 다운로드 사이트:
ftp://ftp.vim.org/pub/editors/vim/unix/

Vim와 의존성 관계에 있는 프로그램들: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed.
Vim 대안

Emacs, Joe, 또는 Nano 같은 다른 에디터들을 사용하고 싶을 경우에는-- http://www.linuxfromscratch.org/blfs/view/stable/postlfs/editors.html 를 참조해 주세요.

==== Vim 설치 ====
/etc에 vimrc 설정파일이 위치하도록 기본 위치를 바꿔줍니다.
{{{
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
}}}

vimrc 와 gvimrc 파일의 기본위치를 /etc로 바꿔 주세요.
{{{
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h      
}}}
Vim컴파일 준비하기:
{{{
./configure --prefix=/usr --enable-multibyte
}}}

'''--enable-multibyte: ''' 인코딩을 위해 설정하는 옵션입니다. 

팩키지 컴파일:
{{{
make      
}}}
이 팩키지는 제대로 컴파일 되었는지를 검사 할 수 있는 Test suite를 가지고 있습니다. 하지만, Vim test suite는 많은 쓰레기 출력값들을 보여 줄 것이고, 가끔씩은 터미널을 멈추게 하기도 합니다. 그러므로 꼭 하실 필요는 없습니다. Vim test suite를 실행하시려면, 다음 명령을 입력하세요:
{{{
make test      
}}}
팩키지 설치:
{{{
make install     
}}}
다음과 같이 심볼릭 링크를 만들어 주세요. (vi에 익숙한 사용자들을 위해서..)
{{{
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/vim73/doc /usr/share/doc/vim-7.3
}}}
당신의 LFS 시스템에 X윈도우를 설치할 예정이라면, Vim을 재 컴파일 해서 X에 설치하고 싶어질 것입니다. Vim의 GUI버전을 사용하려면 X 윈도우와 그 밖에 다른 라이브러리들을 먼저 설치해야 합니다. 더 많은 정보는 Vim문서를 참조해 주세요.
==== Vim 설정 ====

기본적으로, vim은 vi-compatible모드로 실행됩니다. 하지만, 몇몇 사람들은 자신의 방법(이 책에선 다루지 않습니다. )으로 vim을 실행하기를 원합니다. 아래와 같이 기본적인 vim구성 파일을 만드세요.
{{{
cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc

set nocompatible
set backspace=2
syntax on
if (&term == "iterm") || (&term == "putty")
  set background=dark
endif

" End /etc/vimrc
EOF
}}}

The set nocompatible will make vim behave in a more useful way than the default vi-compatible manner. The set backspace=2 allows backspacing over line breaks, autoindent and the start of insert. And the syntax on switches on vim's semantic colouring.

사용가능한 옵션에 관련된 문서를 보려면 다음과 같이 하십시오
{{{
vim -c ':options'
}}}
==== Vim 내용 ====

설치된 프로그램: efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, vimtutor and xxd


==== 요약 ====

efm_filter.pl is a filter for creating an error file that can be read by vim.

efm_perl.pl reformats the error messages of the Perl interpreter for use with the quickfix mode of vim.

ex starts vim in ex mode.

less.sh is a script that starts vim with less.vim.

mve.awk processes vim errors.

pltags.pl creates a tags file for perl code, for use by vim.

ref checks the spelling of arguments.

rview is a restricted version of view: no shell commands can be started and view can't be suspended.

rvim is a restricted version of vim: no shell commands can be started and vim can't be suspended.

shtags.pl generates a tag file for perl scripts.

tcltags generates a tag file for TCL code.

vi starts vim in vi-compatible mode.

view starts vim in read-only mode.

vim is the editor.

vim132 starts vim with the terminal in 132-column mode.

vim2html.pl converts vim documentation to HTML.

vimdiff edits two or three versions of a file with vim and show differences.

vimm enables the DEC locator input model on a remote terminal.

vimspell.sh is a script which spells a file and generates the syntax statements necessary to highlight in vim.

vimtutor teaches you the basic keys and commands of vim.

xxd makes a hexdump of the given file. It can also do the reverse, so it can be used for binary patching.

=== About Debugging Symbols ===
대부분의 프로그램과 라이브러리들이 기본적으로 디버깅 심볼과 함께 컴파일 됩니다.(gcc의 -g 옵션이 포함된) 이것은 프로그램이나 라이브러리가 디버깅 정보를 포함한 상태로 컴파일된다는 의미입니다. 이 때 디버거는 메모리 주소 뿐만 아니라 루틴과 변수의 이름까지 제공합니다.

그러나 이러한 디버깅 심볼의 포함은 정말로 큽니다. 다음은 심볼이 나타내는 용량을 나열한 것입니다:
 * 디버깅 심볼이 포함된 '''bash''' 바이너리 파일: 1200 KB
 * 디버깅 심볼이 포함되지 않은 '''bash''' 바이너리 파일: 480 KB
 * 디버깅 심볼이 포함된 Glibc와 GCC 파일들(lib, /usr/lib): 87 MB
 * 디버깅 심볼이 포함되지 않은 Glibc, GCC 파일들 : 16 MB

크기는 컴파일러와 사용된 C 라이브러리에 의해 달라지지만 debugging symbol에 따라서도 크게 변화합니다.

대부분의 사용자들이 디버거를 사용하지 않기 때문에 사용하지 않을 경우에는 디버깅 심볼을 제외하고 컴파일해서 공간의 낭비를 줄이실 수 있습니다.

=== Stripping Again ===

만약 의도한 사용자가 프로그래머가 아니고 시스템 소프트웨어를 디버깅할 일이 없다면 바이너리와 라이브러리로부터 디버깅 심볼을 없애서 대략 90MB 정도의 공간을 절약할 수 있습니다. 이 때문에 소프트웨어를 완전하게 디버그하지 못한다는 점을 빼고는 아무런 불편함이 없습니다.

대부분의 사람들은 앞서 언급한 명령어들을 사용하는데 어려움을 느끼지 못할 것입니다. 하지만 새로운 시스템을 고장내는 건 순식간이므로 '''strip''' 명령어를 실행하기 전에 현재 상태의 LFS 시스템을 백업하는 것도 좋은 방법입니다. '''strip''' 명령어는 바이너리의 정보를 수정하는 작업을 수행합니다.

stripping을 하기 전에 실행되고 있는 바이너리 파일이 없는지 확실하게 확인해야 합니다. 만약 chroot 상태인지 확실하지 않다면 먼저 chroot 환경에서 나옵니다.
{{{
logout
}}}

다시 chroot 환경으로 들어갑니다.
{{{
chroot $LFS /tools/bin/env -i 
    HOME=/root TERM=$TERM PS1='u:w$ ' 
    PATH=/bin:/usr/bin:/sbin:/usr/sbin 
    /tools/bin/bash --login
}}}

이제 안전하게 바이너리와 라이브러리를 strip을 할 수 있습니다.
{{{
/tools/bin/find /{,usr/}{bin,lib,sbin} -type f 
  -exec /tools/bin/strip --strip-debug '{}' ';'
}}}

많은 수의 파일들이 그들의 파일 형식을 알 수 없다는 메세지를 출력할 것입니다. 하지만 이러한 경고들은 무시해도 됩니다. 이러한 경고는 해당 파일들이 바이너리 파일이 아니라 스크립트이기 때문에 발생합니다.

=== Cleaning Up ===

이제 chroot 환경에서 나왔다가 다시 들어갈 때는 항상 다음의 수정된 chroot 커맨드를 사용하십시오:
{{{
chroot "$LFS" /usr/bin/env -i 
    HOME=/root TERM="$TERM" PS1='u:w$ ' 
    PATH=/bin:/usr/bin:/sbin:/usr/sbin 
    /bin/bash --login
}}}

이렇게 해야만 하는 이유는 더이상 /tools안에 있는 프로그램을 필요로 하지 않기 때문입니다. 만약 원한다면 /tools 디렉토리를 지우셔도 됩니다.

만약에 가상 커널 파일 시스템이 마운트되지 않았다면 직접 재부팅을 통해서 마운트해주어야 합니다. chroot 환경으로 진입할 때 항상 virtual kernel file system이 마운트 되어있는지 확인하십시오. 반드시 마운트 되어있어야 합니다. 

이제 Bootscript를 작성할 차례입니다. [LFS/Bootscripts]를 참고하세요
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
169 Linux LFS/TheEnd - 마무리 LynX 2014-08-06 382
168 Linux LFS/Make Bootable System - LFS 시스템 부팅하기 LynX 2014-08-06 445
167 Linux LFS/Bootscripts - 시스템 부트로더 설정하기 [8] LynX 2014-08-06 570
» Linux LFS/Building - 빌드하기 [11] LynX 2014-08-06 2614
165 Linux LFS/Preparation - 준비 LynX 2014-08-06 745
164 Linux LFS/Introduction - 소개 [8] LynX 2014-08-06 669
163 Linux LFS/Preface - 서문 [9] LynX 2014-08-06 1072
162 Linux Custom Kernel 컴파일링 & 설치하기 [8] LynX 2014-08-06 457
161 Linux PDO_MYSQL 설치 [8] LynX 2014-08-01 310
160 Linux sendmail, dovecot 설치 및 설정 [20] LynX 2014-08-01 2724
159 Linux rc.local 서비스 등록하기 LynX 2014-07-22 504
158 Linux systemd unit 등록 옵션 LynX 2014-07-22 20455
157 Linux 페도라17(centos7) 새로운 서비스 관리 LynX 2014-07-20 570
156 Linux SSH 컴파일 설치 LynX 2014-07-19 376
155 Xpress Engine XML 쿼리 대신 직접 mysql 사용하기 LynX 2014-07-19 273
154 Xpress Engine XML 쿼리 대신 직접 mysql 사용하기 LynX 2014-07-16 391
153 Linux 리눅스 기본 명령어 LynX 2014-07-16 792
152 Xpress Engine xe 외부 php 파일에서 db 접근하기 executeQuery() LynX 2014-07-14 919
151 Xpress Engine xe 모든 변수값 출력해 보기 LynX 2014-07-14 93715
150 Xpress Engine XE용 query xml 방식으로 일반 테이블도 접근 처리 하기 LynX 2014-07-14 459

XE Login