Ported the new HLFS code from experimental branch.
This commit is contained in:
parent
cb39f79545
commit
d81c640cfa
4 changed files with 212 additions and 189 deletions
|
@ -26,7 +26,7 @@
|
|||
0 = none
|
||||
1 = only chapter06 Glibc, GCC and Binutils testsuites
|
||||
2 = all chapter06 testsuites
|
||||
3 = all chapter05 and chapter06 testsuites-->
|
||||
3 = alias to 2 -->
|
||||
<xsl:param name="testsuite" select="1"/>
|
||||
|
||||
<!-- Time zone -->
|
||||
|
@ -94,32 +94,30 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="(sect2[@role='installation'] and
|
||||
not(@id='bootable-kernel')) or
|
||||
@id='ch-tools-adjusting' or
|
||||
@id='ch-system-readjusting'">
|
||||
not(@id='bootable-kernel'))">
|
||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||
<xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
|
||||
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
|
||||
<xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
||||
|
||||
<!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc -->
|
||||
<xsl:if test="@id='ch-tools-embryo-toolchain' or
|
||||
@id='ch-tools-cocoon-toolchain' or
|
||||
@id='ch-system-butterfly-toolchain'">
|
||||
<xsl:text>tar -xvf gcc-core-&gcc-version;.*; 
</xsl:text>
|
||||
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; 
</xsl:text>
|
||||
<xsl:text>tar -xvf binutils-&binutils-version;.*; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
|
||||
<xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
|
||||
<xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
|
||||
<xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
||||
<!-- ONLY butterfly has a testsuite -->
|
||||
<xsl:if test="@id='ch-tools-butterfly-toolchain' and $testsuite != '0'">
|
||||
<xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<!-- END new toolchain format -->
|
||||
|
||||
<xsl:if test="@id='bootable-bootscripts'">
|
||||
<xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="@id='ch-system-kernfs'">
|
||||
<xsl:text>export HLFS=$LFS
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select=".//para/userinput | .//screen"/>
|
||||
<xsl:text>exit</xsl:text>
|
||||
</exsl:document>
|
||||
|
@ -135,24 +133,12 @@
|
|||
|
||||
<xsl:template match="para/userinput">
|
||||
<xsl:if test="(contains(string(),'test') or
|
||||
contains(string(),'check')) and
|
||||
(($testsuite = '1' and
|
||||
(ancestor::sect1[@id='ch-system-gcc'] or
|
||||
ancestor::sect1[@id='ch-system-glibc'])) or
|
||||
($testsuite = '2' and
|
||||
ancestor::chapter[@id='chapter-building-system']) or
|
||||
$testsuite = '3')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
|
||||
<xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="substring-before(string(),'make')"/>
|
||||
<xsl:text>make -k</xsl:text>
|
||||
<xsl:value-of select="substring-after(string(),'make')"/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
contains(string(),'check')) and
|
||||
($testsuite = '2' or $testsuite = '3')">
|
||||
<xsl:value-of select="substring-before(string(),'make')"/>
|
||||
<xsl:text>make -k</xsl:text>
|
||||
<xsl:value-of select="substring-after(string(),'make')"/>
|
||||
<xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
@ -227,29 +213,23 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Fixing toolchain test suites run -->
|
||||
<xsl:when test="string() = 'make check' or
|
||||
string() = 'make -k check'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
||||
ancestor::chapter[@id='chapter-building-system']) or
|
||||
$testsuite = '3'">
|
||||
<xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(),'make check') and
|
||||
ancestor::sect1[@id='ch-system-binutils']">
|
||||
<!-- Fixing butterfly toolchain test suites run -->
|
||||
<xsl:when test="string() = 'make -k check'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$testsuite != '0'">
|
||||
<xsl:value-of select="substring-before(string(),'make check')"/>
|
||||
<xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(string(),'hardened-specs') and
|
||||
ancestor::sect1[@id='ch-system-binutils']
|
||||
and $testsuite = '0'"/>
|
||||
<!-- Fixing Glbc test suite -->
|
||||
<xsl:when test="contains(string(),'glibc-check-log')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$testsuite != '0'">
|
||||
<xsl:value-of select="substring-before(string(),'> glibc-')"/>
|
||||
<xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- Don't stop on strip run and chapter05 GCC installation test-->
|
||||
<xsl:when test="contains(string(),'strip ') or
|
||||
ancestor::sect2[@id='testing-gcc'] and
|
||||
|
@ -265,6 +245,12 @@
|
|||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="literal">
|
||||
<xsl:if test="@condition=$model or not(@condition)">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="replaceable">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
||||
|
|
305
HLFS/master.sh
305
HLFS/master.sh
|
@ -7,24 +7,121 @@ set -e # Enable error trapping
|
|||
### FUNCTIONS ###
|
||||
###################################
|
||||
|
||||
#----------------------------------#
|
||||
wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $2
|
||||
#----------------------------------#
|
||||
local this_user=$1
|
||||
local this_script=$2
|
||||
local file=$3
|
||||
|
||||
(
|
||||
cat << EOF
|
||||
@( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------#
|
||||
wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var
|
||||
#----------------------------------#
|
||||
local USER_ACCT=$1
|
||||
local FILE=$2
|
||||
local optSAVE_PREVIOUS=$3
|
||||
|
||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
||||
wrt_remove_existing_dirs "$FILE"
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack,$FILE)
|
||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
||||
chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#----------------------------------#
|
||||
wrt_RunAsRoot() { # Some scripts must be run as root..
|
||||
#----------------------------------#
|
||||
local user_ACCT=$(echo $1 | tr [a-z] [A-Z])
|
||||
local this_script=$2
|
||||
local file=$3
|
||||
|
||||
(
|
||||
cat << EOF
|
||||
@( time { export ${user_ACCT}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
|
||||
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
|
||||
#----------------------------#
|
||||
process_toolchain() { # embryo,cocoon and butterfly need special handling
|
||||
#----------------------------#
|
||||
local toolchain=$1
|
||||
local this_script=$2
|
||||
local tc_phase
|
||||
|
||||
echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}"
|
||||
|
||||
case ${toolchain} in
|
||||
*butterfly*)
|
||||
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
||||
(
|
||||
cat << EOF
|
||||
@echo "export PKGDIR=\$(SRC)" > envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
wrt_run_as_chroot1 "$toolchain" "$this_script"
|
||||
;;
|
||||
|
||||
*)
|
||||
(
|
||||
cat << EOF
|
||||
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
|
||||
;;
|
||||
esac
|
||||
#
|
||||
# Safe method to remove packages unpacked outside the toolchain
|
||||
pkg_tarball=$(get_package_tarball_name "binutils")
|
||||
wrt_remove_existing_dirs "$pkg_tarball"
|
||||
pkg_tarball=$(get_package_tarball_name "gcc-core")
|
||||
wrt_remove_existing_dirs "$pkg_tarball"
|
||||
#
|
||||
# Manually remove the toolchain directories..
|
||||
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
|
||||
(
|
||||
cat << EOF
|
||||
@rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
|
||||
rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
||||
}
|
||||
|
||||
|
||||
#----------------------------#
|
||||
chapter3_Makefiles() { # Initialization of the system
|
||||
#----------------------------#
|
||||
local TARGET LOADER
|
||||
|
||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3${R_arrow}"
|
||||
|
||||
# Define a few model dependant variables
|
||||
if [[ ${MODEL} = "uclibc" ]]; then
|
||||
TARGET="tools-linux-uclibc"; LOADER="ld-uClibc.so.0"
|
||||
TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0"
|
||||
else
|
||||
TARGET="tools-linux-gnu"; LOADER="ld-linux.so.2"
|
||||
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
||||
fi
|
||||
|
||||
# NOTE: We use the lfs username and groupname also in HLFS
|
||||
# If /home/lfs is already present in the host, we asume that the
|
||||
# lfs user and group are also presents in the host, and a backup
|
||||
# If /home/hlfs is already present in the host, we asume that the
|
||||
# hlfs user and group are also presents in the host, and a backup
|
||||
# of their bash init files is made.
|
||||
(
|
||||
cat << EOF
|
||||
|
@ -43,38 +140,38 @@ cat << EOF
|
|||
|
||||
021-addinguser: 020-creatingtoolsdir
|
||||
@\$(call echo_message, Building)
|
||||
@if [ ! -d /home/lfs ]; then \\
|
||||
groupadd lfs; \\
|
||||
useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
||||
@if [ ! -d /home/hlfs ]; then \\
|
||||
groupadd hlfs; \\
|
||||
useradd -s /bin/bash -g hlfs -m -k /dev/null hlfs; \\
|
||||
else \\
|
||||
touch user-lfs-exist; \\
|
||||
touch user-hlfs-exist; \\
|
||||
fi;
|
||||
@chown lfs \$(MOUNT_PT)/tools && \\
|
||||
chown lfs \$(MOUNT_PT)/sources && \\
|
||||
@chown hlfs \$(MOUNT_PT)/tools && \\
|
||||
chown hlfs \$(MOUNT_PT)/sources && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
||||
022-settingenvironment: 021-addinguser
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
||||
mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
||||
@if [ -f /home/hlfs/.bashrc -a ! -f /home/hlfs/.bashrc.XXX ]; then \\
|
||||
mv /home/hlfs/.bashrc /home/hlfs/.bashrc.XXX; \\
|
||||
fi;
|
||||
@if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
||||
mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
||||
@if [ -f /home/hlfs/.bash_profile -a ! -f /home/hlfs/.bash_profile.XXX ]; then \\
|
||||
mv /home/hlfs/.bash_profile /home/hlfs/.bash_profile.XXX; \\
|
||||
fi;
|
||||
@echo "set +h" > /home/lfs/.bashrc && \\
|
||||
echo "umask 022" >> /home/lfs/.bashrc && \\
|
||||
echo "HLFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
||||
echo "export HLFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
||||
echo "" >> /home/lfs/.bashrc && \\
|
||||
@echo "set +h" > /home/hlfs/.bashrc && \\
|
||||
echo "umask 022" >> /home/hlfs/.bashrc && \\
|
||||
echo "HLFS=\$(MOUNT_PT)" >> /home/hlfs/.bashrc && \\
|
||||
echo "LC_ALL=POSIX" >> /home/hlfs/.bashrc && \\
|
||||
echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/hlfs/.bashrc && \\
|
||||
echo "export HLFS LC_ALL PATH" >> /home/hlfs/.bashrc && \\
|
||||
echo "" >> /home/hlfs/.bashrc && \\
|
||||
echo "target=$(uname -m)-${TARGET}" >> /home/lfs/.bashrc && \\
|
||||
echo "ldso=/tools/lib/${LOADER}" >> /home/lfs/.bashrc && \\
|
||||
echo "export target ldso" >> /home/lfs/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
|
||||
chown lfs:lfs /home/lfs/.bashrc && \\
|
||||
echo "source $JHALFSDIR/envars" >> /home/hlfs/.bashrc && \\
|
||||
chown hlfs:hlfs /home/hlfs/.bashrc && \\
|
||||
touch envars && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
|
@ -113,14 +210,11 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
|||
# the names of the targets in the Makefile
|
||||
chapter5="$chapter5 $this_script"
|
||||
|
||||
# Grab the name of the target (minus the -headers or -cross in the case of gcc
|
||||
# and binutils in chapter 5)
|
||||
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-cross@@' -e 's@-headers@@'`
|
||||
# Grab the name of the target
|
||||
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
||||
|
||||
# Adjust 'name'
|
||||
case $name in
|
||||
linux-libc) name="linux-libc-headers" ;;
|
||||
gcc) name="gcc-core" ;;
|
||||
uclibc) name="uClibc" ;;
|
||||
esac
|
||||
|
||||
|
@ -133,66 +227,41 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
|||
#
|
||||
# Drop in the name of the target on a new line, and the previous target
|
||||
# as a dependency. Also call the echo_message function.
|
||||
wrt_target "$this_script" "$PREV"
|
||||
|
||||
# This is a very special script and requires manual processing
|
||||
# NO Optimization allowed
|
||||
if [[ ${name} = "embryo-toolchain" ]] || \
|
||||
[[ ${name} = "cocoon-toolchain" ]]; then
|
||||
wrt_target "$this_script" "$PREV"
|
||||
process_toolchain "${this_script}" "${file}"
|
||||
wrt_touch
|
||||
PREV=$this_script
|
||||
continue
|
||||
fi
|
||||
#
|
||||
wrt_target "$this_script" "$PREV"
|
||||
# Find the version of the command files, if it corresponds with the building of
|
||||
# a specific package
|
||||
pkg_tarball=$(get_package_tarball_name $name)
|
||||
# If $pkg_tarball isn't empty, we've got a package...
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
case $this_script in
|
||||
*binutils* ) wrt_unpack "$pkg_tarball" 1 ;; # Do not delete an existing package directories
|
||||
*) wrt_unpack "$pkg_tarball" ;;
|
||||
esac
|
||||
wrt_Unpack_SetOwner "hlfs" "$pkg_tarball"
|
||||
# If the testsuites must be run, initialize the log file
|
||||
[[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
|
||||
# If using optimizations, write the instructions
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
case $this_script in
|
||||
*binutils* ) # Dump the path to sources directory for later removal
|
||||
(
|
||||
cat << EOF
|
||||
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
|
||||
echo "\$(MOUNT_PT)\$(SRC)/\$\$ROOT" >> sources-dir
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
;;
|
||||
*adjusting* ) # For the Adjusting phase we must to cd to the binutils-build directory.
|
||||
echo -e '\t@echo "export PKGDIR=$(MOUNT_PT)$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
|
||||
;;
|
||||
esac
|
||||
|
||||
# Insert date and disk usage at the top of the log file, the script run
|
||||
# and date and disk usage again at the bottom of the log file.
|
||||
wrt_run_as_su "${this_script}" "${file}"
|
||||
wrt_ExecuteAsUser "hlfs" "$this_script" "${file}"
|
||||
|
||||
# Remove the build directory(ies) except if the package build fails
|
||||
# (so we can review config.cache, config.log, etc.)
|
||||
# For Binutils the sources must be retained for some time.
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
case "${this_script}" in
|
||||
*binutils*) : ;; # do NOTHING
|
||||
*gcc*) wrt_remove_build_dirs "gcc" ;;
|
||||
*) wrt_remove_build_dirs "$name" ;;
|
||||
esac
|
||||
wrt_remove_build_dirs "$name"
|
||||
fi
|
||||
|
||||
# Remove the Binutils pass 1 sources after a successful Adjusting phase.
|
||||
case "${this_script}" in
|
||||
*adjusting*)
|
||||
(
|
||||
cat << EOF
|
||||
@rm -r \`cat sources-dir\` && \\
|
||||
rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
|
||||
rm sources-dir
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
;;
|
||||
esac
|
||||
|
||||
# Include a touch of the target name so make can check if it's already been made.
|
||||
wrt_touch
|
||||
#
|
||||
|
@ -209,7 +278,6 @@ EOF
|
|||
#----------------------------#
|
||||
chapter6_Makefiles() { # sysroot or chroot build phase
|
||||
#----------------------------#
|
||||
local TARGET LOADER
|
||||
local file
|
||||
local this_script
|
||||
# Set envars and scripts for iteration targets
|
||||
|
@ -237,14 +305,6 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
fi
|
||||
|
||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
|
||||
#
|
||||
# Set these definitions early and only once
|
||||
#
|
||||
if [[ ${MODEL} = "uclibc" ]]; then
|
||||
TARGET="pc-linux-uclibc"; LOADER="ld-uClibc.so.0"
|
||||
else
|
||||
TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2"
|
||||
fi
|
||||
|
||||
for file in chapter06$N/* ; do
|
||||
# Keep the script file name
|
||||
|
@ -262,17 +322,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
# Grab the name of the target
|
||||
name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
||||
|
||||
#
|
||||
# Sed replacement to fix some rm command that could fail.
|
||||
# That should be fixed in the book sources.
|
||||
#
|
||||
case $name in
|
||||
glibc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;;
|
||||
gcc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;;
|
||||
esac
|
||||
|
||||
case $name in
|
||||
gcc) name="gcc-core" ;;
|
||||
uclibc) name="uClibc" ;;
|
||||
esac
|
||||
|
||||
|
@ -301,17 +351,24 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
#--------------------------------------------------------------------#
|
||||
#
|
||||
# Drop in the name of the target on a new line, and the previous target
|
||||
# as a dependency. Also call the echo_message function.
|
||||
# as a dependency. Also call the echo_message function.
|
||||
if [[ ${name} = "butterfly-toolchain" ]]; then
|
||||
wrt_target "$this_script" "$PREV"
|
||||
process_toolchain "${this_script}" "${file}"
|
||||
wrt_touch
|
||||
PREV=$this_script
|
||||
continue
|
||||
fi
|
||||
|
||||
wrt_target "${this_script}${N}" "$PREV"
|
||||
|
||||
# If $pkg_tarball isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and changing directories
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
wrt_unpack2 "$pkg_tarball"
|
||||
wrt_target_vars
|
||||
# If the testsuites must be run, initialize the log file
|
||||
case $name in
|
||||
binutils | gcc-core | glibc )
|
||||
glibc )
|
||||
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
||||
;;
|
||||
* )
|
||||
|
@ -322,16 +379,10 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
case $this_script in
|
||||
*readjusting*) # For the Re-Adjusting phase we must to cd to the binutils-build directory.
|
||||
echo -e '\t@echo "export PKGDIR=$(SRC)/binutils-build" > envars' >> $MKFILE.tmp
|
||||
;;
|
||||
esac
|
||||
|
||||
# In the mount of kernel filesystems we need to set LFS and not to use chroot.
|
||||
# In the mount of kernel filesystems we need to set HLFS and not to use chroot.
|
||||
case "${this_script}" in
|
||||
*kernfs*)
|
||||
wrt_run_as_root "${this_script}" "${file}"
|
||||
wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
|
||||
;;
|
||||
*) # The rest of Chapter06
|
||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||
|
@ -343,19 +394,6 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
wrt_remove_build_dirs "$name"
|
||||
fi
|
||||
#
|
||||
# Remove the Binutils pass 2 sources after a successful Re-Adjusting phase.
|
||||
case "${this_script}" in
|
||||
*readjusting*)
|
||||
(
|
||||
cat << EOF
|
||||
@rm -r \`cat sources-dir\` && \\
|
||||
rm -r \$(MOUNT_PT)\$(SRC)/binutils-build && \\
|
||||
rm sources-dir
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
;;
|
||||
esac
|
||||
|
||||
# Include a touch of the target name so make can check if it's already been made.
|
||||
wrt_touch
|
||||
#
|
||||
|
@ -389,7 +427,6 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
|
|||
case $this_script in
|
||||
*usage) continue ;; # Contains example commands
|
||||
*grub) continue ;;
|
||||
*reboot) continue ;;
|
||||
*console) continue ;; # Use the file generated by lfs-bootscripts
|
||||
|
||||
*kernel)
|
||||
|
@ -519,7 +556,7 @@ all: chapter3 chapter5 chapter6 chapter7 do-housekeeping
|
|||
|
||||
chapter3: 020-creatingtoolsdir 021-addinguser 022-settingenvironment
|
||||
|
||||
chapter5: chapter3 $chapter5 restore-lfs-env
|
||||
chapter5: chapter3 $chapter5 restore-hlfs-env
|
||||
|
||||
chapter6: chapter5 $chapter6
|
||||
|
||||
|
@ -533,18 +570,18 @@ clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
|
|||
restart: restart_code all
|
||||
|
||||
clean-chapter3:
|
||||
-if [ ! -f user-lfs-exist ]; then \\
|
||||
userdel lfs; \\
|
||||
rm -rf /home/lfs; \\
|
||||
-if [ ! -f user-hlfs-exist ]; then \\
|
||||
userdel hlfs; \\
|
||||
rm -rf /home/hlfs; \\
|
||||
fi;
|
||||
rm -rf \$(MOUNT_PT)/tools
|
||||
rm -f /tools
|
||||
rm -f envars user-lfs-exist
|
||||
rm -f envars user-hlfs-exist
|
||||
rm -f 02* logs/02*.log
|
||||
|
||||
clean-chapter5:
|
||||
rm -rf \$(MOUNT_PT)/tools/*
|
||||
rm -f $chapter5 restore-lfs-env sources-dir
|
||||
rm -f $chapter5 restore-hlfs-env sources-dir
|
||||
cd logs && rm -f $chapter5 && cd ..
|
||||
|
||||
clean-chapter6:
|
||||
|
@ -561,15 +598,15 @@ clean-chapter7:
|
|||
rm -f $chapter7
|
||||
cd logs && rm -f $chapter7 && cd ..
|
||||
|
||||
restore-lfs-env:
|
||||
restore-hlfs-env:
|
||||
@\$(call echo_message, Building)
|
||||
@if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
||||
mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
||||
@if [ -f /home/hlfs/.bashrc.XXX ]; then \\
|
||||
mv -f /home/hlfs/.bashrc.XXX /home/hlfs/.bashrc; \\
|
||||
fi;
|
||||
@if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
||||
mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
||||
@if [ -f /home/hlfs/.bash_profile.XXX ]; then \\
|
||||
mv /home/hlfs/.bash_profile.XXX /home/hlfs/.bash_profile; \\
|
||||
fi;
|
||||
@chown lfs:lfs /home/lfs/.bash* && \\
|
||||
@chown hlfs:hlfs /home/hlfs/.bash* && \\
|
||||
touch \$@ && \\
|
||||
echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
||||
echo --------------------------------------------------------------------------------\$(WHITE)
|
||||
|
@ -580,25 +617,25 @@ do-housekeeping:
|
|||
@-umount \$(MOUNT_PT)/dev
|
||||
@-umount \$(MOUNT_PT)/sys
|
||||
@-umount \$(MOUNT_PT)/proc
|
||||
@-if [ ! -f user-lfs-exist ]; then \\
|
||||
userdel lfs; \\
|
||||
rm -rf /home/lfs; \\
|
||||
@-if [ ! -f user-hlfs-exist ]; then \\
|
||||
userdel hlfs; \\
|
||||
rm -rf /home/hlfs; \\
|
||||
fi;
|
||||
|
||||
restart_code:
|
||||
@echo ">>> This feature is experimental, BUGS may exist"
|
||||
|
||||
@echo ">>> This feature is experimental, BUGS may exist"
|
||||
|
||||
@if [ ! -L /tools ]; then \\
|
||||
echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\
|
||||
fi;
|
||||
|
||||
|
||||
@if [ ! -e /tools ]; then \\
|
||||
echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\
|
||||
fi;
|
||||
|
||||
|
||||
@if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
|
||||
echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
|
||||
fi;
|
||||
fi;
|
||||
|
||||
@if [ -f ???-kernfs ]; then \\
|
||||
mkdir -pv \$(MOUNT_PT)/{proc,sys};\\
|
||||
|
|
|
@ -82,7 +82,7 @@ ${BOLD} -T, --testsuites N ${OFF}
|
|||
1 = only final system Glibc, GCC and Binutils testsuites
|
||||
2 = all final system testsuites
|
||||
3 = all temporary tools and final system testsuites
|
||||
In CLFS, 3 is an alias to 2
|
||||
In CLFS and HLFS, 3 is an alias to 2
|
||||
|
||||
${BOLD} -W, --working-copy DIR${OFF}
|
||||
use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
|
||||
|
|
|
@ -16,7 +16,7 @@ BUILDDIR=/mnt/build_dir
|
|||
REPORT=1
|
||||
|
||||
#=== Getting packages ===
|
||||
# Files will be retrieved from the local archive SRC_ARCHIVE
|
||||
# Files will be retrieved from the local archive SRC_ARCHIVE
|
||||
# (if defined) or the 'net and will be stored in $BUILDDIR/sources
|
||||
#--- Download the source packages 0(no)/1(yes)
|
||||
GETPKG=0
|
||||
|
@ -48,7 +48,7 @@ OPTIMIZE=0
|
|||
# 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
||||
# 2 = all chapter06 testsuites
|
||||
# 3 = all chapter05 and chapter06 testsuites
|
||||
# (in CLFS, alias to 2)
|
||||
# (in CLFS and HLFS, alias to 2)
|
||||
TEST=1
|
||||
|
||||
#--- Run the stripping phases 0(no)/1(yes)
|
||||
|
|
Reference in a new issue