생각했던 것보다는 시스템이 안정적이지 않은지, 빌드 중에 다양한 오류를 만나게 됩니다. 이전의 LFS에서는 빌드 오류가 거의 없는 것과는 상당히 대조적입니다. 게다가, 의존성을 자동으로 해결해 주지 않기 때문에, 수동으로 의존성을 찾는 것도 상당히 귀찮습니다. 이럴 바에는 보다 의존성을 잘 해결해 주는, Gentoo Linux와 같은 소스 배포판을 stage 1부터 빌드하는 것이 더 좋을 수도 있겠습니다.
어쨌든, 아마도 사용자들의 선택이 거의 없고, 개발에 부담이 되는지 젠투에서 스테이지 1,2 타르볼을 사용자에게 제공하지 않습니다. 그만큼 바닥에서 부트스트래핑하는 과정이 일반 사용자에게 무의미하기 때문일 수 있습니다!! 반면에 관련된 사람들에게는 전반적인 내용을 파악할 수 있어서 필수적으로 수행해야 할 것으로 기대됩니다!!
Build Your Own Linux는 Linux From Scratch에 따라 수행한 내용이고, 이제 기록할 내용은 Beyond Linux From Scratch의 일부 내용으로써, Systemd를 사용하고 최종 목표는 GNOME 데스크탑을 실행하는 것입니다.
이제, 기본 시스템이 부팅이 되기 때문에, 기본 시스템으로 부팅한 후에 작업을 계속할 수 있지만, 터미널에서 모든 작업을 수행하는 것이 귀찮을 수 있어서, chroot로 여전히 작업을 이어갑니다. 이 내용은 이전 문서를 참조하십시오.
Important Information
Notes on Building Software
- export MAKEFLAGS='-j12'
- export NINJAJOBS=12
Stripping One More Time Stripping은 작업 중간에 수행하는 것은 좋지 않기 때문에, chroot를 시작한 후에 stripping을 수행하는 것이 좋습니다:
-
find /usr/{bin,lib,sbin} \ -type f \( -name \*.so* -a ! -name \*dbg \) \ -exec strip --strip-unneeded {} \;
/opt, /usr/local에 프로그램이 설치되어 있으면, 해당 디렉토리도 수행하는 것이 좋습니다.
BLFS Systemd Units
필요한 서비스의 제어 파일은 이미 만들어져 있어서 필요에 따라 컴파일할 수 있습니다.
About Libtool Archive (.la) files
- touch /etc/profile
-
cat > /usr/sbin/remove-la-files.sh << "EOF" #!/bin/bash # /usr/sbin/remove-la-files.sh # Written for Beyond Linux From Scratch # by Bruce Dubbs <bdubbs@linuxfromscratch.org> # Make sure we are running with root privs if test "${EUID}" -ne 0; then echo "Error: $(basename ${0}) must be run as the root user! Exiting..." exit 1 fi # Make sure PKG_CONFIG_PATH is set if discarded by sudo source /etc/profile OLD_LA_DIR=/var/local/la-files mkdir -p $OLD_LA_DIR # Only search directories in /opt, but not symlinks to directories OPTDIRS=$(find /opt -mindepth 1 -maxdepth 1 -type d) # Move any found .la files to a directory out of the way find /usr/lib $OPTDIRS -name "*.la" ! -path "/usr/lib/ImageMagick*" \ -exec mv -fv {} $OLD_LA_DIR \; ############### # Fix any .pc files that may have .la references STD_PC_PATH='/usr/lib/pkgconfig /usr/share/pkgconfig /usr/local/lib/pkgconfig /usr/local/share/pkgconfig' # For each directory that can have .pc files for d in $(echo $PKG_CONFIG_PATH | tr : ' ') $STD_PC_PATH; do # For each pc file for pc in $d/*.pc ; do if [ $pc == "$d/*.pc" ]; then continue; fi # Check each word in a line with a .la reference for word in $(grep '\.la' $pc); do if $(echo $word | grep -q '.la$' ); then mkdir -p $d/la-backup cp -fv $pc $d/la-backup basename=$(basename $word ) libref=$(echo $basename|sed -e 's/^lib/-l/' -e 's/\.la$//') # Fix the .pc file sed -i "s:$word:$libref:" $pc fi done done done EOF
- chmod +x /usr/sbin/remove-la-files.sh
After LFS Configuration Issues
About Firmware
필요한 디바이스의 펌웨어를 설치할 수 있습니다. 아마도 실제 컴퓨터에서 컴파일할 때, 이 과정을 수행해야 디바이스를 사용할 수 있을 것으로 보입니다.
About Devices
사운드 카드와 USB 디바이스에 대한 설정 내용입니다.
The Bash Shell Startup Files
/etc/profile
-
cat > /etc/profile << "EOF" # Begin /etc/profile # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg> # System wide environment variables and startup programs. # System wide aliases and functions should go in /etc/bashrc. Personal # environment variables and startup programs should go into # ~/.bash_profile. Personal aliases and functions should go into # ~/.bashrc. # Functions to help us manage paths. Second argument is the name of the # path variable to be modified (default: PATH) pathremove () { local IFS=':' local NEWPATH local DIR local PATHVARIABLE=${2:-PATH} for DIR in ${!PATHVARIABLE} ; do if [ "$DIR" != "$1" ] ; then NEWPATH=${NEWPATH:+$NEWPATH:}$DIR fi done export $PATHVARIABLE="$NEWPATH" } pathprepend () { pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" } pathappend () { pathremove $1 $2 local PATHVARIABLE=${2:-PATH} export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" } export -f pathremove pathprepend pathappend # Set the initial path export PATH=/usr/bin # Attempt to provide backward compatibility with LFS earlier than 11 if [ ! -L /bin ]; then pathappend /bin fi if [ $EUID -eq 0 ] ; then pathappend /usr/sbin if [ ! -L /sbin ]; then pathappend /sbin fi unset HISTFILE fi # Setup some environment variables. export HISTSIZE=1000 export HISTIGNORE="&:[bf]g:exit" # Set some defaults for graphical systems export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/} export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/} export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER} # Setup a red prompt for root and a green one for users. NORMAL="\[\e[0m\]" RED="\[\e[1;31m\]" GREEN="\[\e[1;32m\]" if [[ $EUID == 0 ]] ; then PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" else PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" fi for script in /etc/profile.d/*.sh ; do if [ -r $script ] ; then . $script fi done unset script RED GREEN NORMAL # End /etc/profile EOF
The /etc/profile.d Directory
- install --directory --mode=0755 --owner=root --group=root /etc/profile.d
/etc/profile.d/bash_completion.sh
-
cat > /etc/profile.d/bash_completion.sh << "EOF" # Begin /etc/profile.d/bash_completion.sh # Import bash completion scripts # If the bash-completion package is installed, use its configuration instead if [ -f /usr/share/bash-completion/bash_completion ]; then # Check for interactive bash and that we haven't already been sourced. if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then # Check for recent enough version of bash. if [ ${BASH_VERSINFO[0]} -gt 4 ] || \ [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \ . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then # Source completion code. . /usr/share/bash-completion/bash_completion fi fi fi else # bash-completions are not installed, use only bash completion directory if shopt -q progcomp; then for script in /etc/bash_completion.d/* ; do if [ -r $script ] ; then . $script fi done fi fi # End /etc/profile.d/bash_completion.sh EOF
- install --directory --mode=0755 --owner=root --group=root /etc/bash_completion.d
/etc/profile.d/dircolors.sh
-
cat > /etc/profile.d/dircolors.sh << "EOF" # Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc. if [ -f "/etc/dircolors" ] ; then eval $(dircolors -b /etc/dircolors) fi if [ -f "$HOME/.dircolors" ] ; then eval $(dircolors -b $HOME/.dircolors) fi alias ls='ls --color=auto' alias grep='grep --color=auto' EOF
/etc/profile.d/extrapaths.sh
-
cat > /etc/profile.d/extrapaths.sh << "EOF" if [ -d /usr/local/lib/pkgconfig ] ; then pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH fi if [ -d /usr/local/bin ]; then pathprepend /usr/local/bin fi if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then pathprepend /usr/local/sbin fi if [ -d /usr/local/share ]; then pathprepend /usr/local/share XDG_DATA_DIRS fi # Set some defaults before other applications add to these paths. pathappend /usr/share/man MANPATH pathappend /usr/share/info INFOPATH EOF
/etc/profile.d/readline.sh
-
cat > /etc/profile.d/readline.sh << "EOF" # Setup the INPUTRC environment variable. if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then INPUTRC=/etc/inputrc fi export INPUTRC EOF
/etc/profile.d/umask.sh
-
cat > /etc/profile.d/umask.sh << "EOF" # By default, the umask should be set. if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then umask 002 else umask 022 fi EOF
/etc/profile.d/i18n.sh
-
cat > /etc/profile.d/i18n.sh << "EOF" # Set up i18n variables . /etc/locale.conf export LANG EOF
/etc/bashrc
-
cat > /etc/bashrc << "EOF" # Begin /etc/bashrc # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # updated by Bruce Dubbs <bdubbs@linuxfromscratch.org> # System wide aliases and functions. # System wide environment variables and startup programs should go into # /etc/profile. Personal environment variables and startup programs # should go into ~/.bash_profile. Personal aliases and functions should # go into ~/.bashrc # Provides colored /bin/ls and /bin/grep commands. Used in conjunction # with code in /etc/profile. alias ls='ls --color=auto' alias grep='grep --color=auto' # Provides prompt for non-login shells, specifically shells started # in the X environment. [Review the LFS archive thread titled # PS1 Environment Variable for a great case study behind this script # addendum.] NORMAL="\[\e[0m\]" RED="\[\e[1;31m\]" GREEN="\[\e[1;32m\]" if [[ $EUID == 0 ]] ; then PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" else PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" fi unset RED GREEN NORMAL # End /etc/bashrc EOF
~/.bash_profile
-
cat > ~/.bash_profile << "EOF" # Begin ~/.bash_profile # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # updated by Bruce Dubbs <bdubbs@linuxfromscratch.org> # Personal environment variables and startup programs. # Personal aliases and functions should go in ~/.bashrc. System wide # environment variables and startup programs are in /etc/profile. # System wide aliases and functions are in /etc/bashrc. if [ -f "$HOME/.bashrc" ] ; then source $HOME/.bashrc fi if [ -d "$HOME/bin" ] ; then pathprepend $HOME/bin fi # Having . in the PATH is dangerous #if [ $EUID -gt 99 ]; then # pathappend . #fi # End ~/.bash_profile EOF
~/.profile
-
cat > ~/.profile << "EOF" # Begin ~/.profile # Personal environment variables and startup programs. if [ -d "$HOME/bin" ] ; then pathprepend $HOME/bin fi # Set up user specific i18n variables #export LANG=<ll>_<CC>.<charmap><@modifiers> # End ~/.profile EOF
~/.bashrc
-
cat > ~/.bashrc << "EOF" # Begin ~/.bashrc # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # Personal aliases and functions. # Personal environment variables and startup programs should go in # ~/.bash_profile. System wide environment variables and startup # programs are in /etc/profile. System wide aliases and functions are # in /etc/bashrc. if [ -f "/etc/bashrc" ] ; then source /etc/bashrc fi # Set up user specific i18n variables #export LANG=<ll>_<CC>.<charmap><@modifiers> # End ~/.bashrc EOF
~/.bash_logout
-
cat > ~/.bash_logout << "EOF" # Begin ~/.bash_logout # Written for Beyond Linux From Scratch # by James Robertson <jameswrobertson@earthlink.net> # Personal items to perform on logout. # End ~/.bash_logout EOF
/etc/dircolors
- dircolors -p > /etc/dircolors
BLFS directory
BLFS에서 사용되는 파일들을 모아둘 예정입니다. 물론 한꺼번에 모두 받을 수 있지만, 필요한 것만 받아서 설치할 예정입니다.
- mkdir -p /blfs/sources
Wget
다른 프로그램을 받기 위해서, 먼저 설치합니다. 호스트에서 받아서 이동시킵니다:
libtasn1-4.18.0 p11-kit-0.24.1 make-ca-1.10 키 추가 전에 아래의 wget을 먼저 설치해야 합니다. wget-1.21.2
Dash-0.5.11.5
설치하고, 추가해 줍니다.
Graphical Environments
Introduction to Xorg-7
- export XORG_PREFIX="/usr"
-
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc \ --localstatedir=/var --disable-static"
-
cat > /etc/profile.d/xorg.sh << EOF XORG_PREFIX="$XORG_PREFIX" XORG_CONFIG="--prefix=\$XORG_PREFIX --sysconfdir=/etc --localstatedir=/var --disable-static" export XORG_PREFIX XORG_CONFIG EOF
- chmod 644 /etc/profile.d/xorg.sh
Sudo-1.9.9 설치합니다:
-
cat > /etc/sudoers.d/xorg << EOF Defaults env_keep += XORG_PREFIX Defaults env_keep += XORG_CONFIG EOF
util-macros-1.19.3
XORG_PREFIX="/usr"를 설정함으로써 이것을 설치해야 합니다:
Shared Mime Info
오류 발생으로 컴파일이 안될 수 있습니다. 여기서 zip 파일을 받아서 data 디렉토리에 풀어주고, shared-mime-info-spec.xml 파일에서 URL을 파일 이름으로 바꾸고 컴파일할 수 있습니다.
freetype-2.11.1
HarfBuzz-3.4.0를 설치 전에 한번 설치하고, 설치 후에 한번 설치해 줍니다. 만약 HarfBuzz를 먼저 설치했다면, 다시 컴파일을 하고, ninja uninstall로 제거한 후에, freetype, HarfBuzz, freetype 순으로 다시 설치해 줍니다.
llvm-13
Git를 먼저 설치해야 합니다. 결국 컴파일이 되지 않습니다. 아마도 다른 의존성 패키지를 먼저 설치해야 할 수도 있습니다.