Adapt for the cross 2 branch. Note that ICA is broken now. Keeping some old
code to use for fixing ICA, but committing now so that testing can begin!
This commit is contained in:
parent
36f5dce727
commit
ebe1ba613c
3 changed files with 157 additions and 61 deletions
201
LFS/master.sh
201
LFS/master.sh
|
@ -10,53 +10,97 @@
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#-------------------------#
|
||||||
chapter4_Makefiles() { #
|
chapter_targets() { #
|
||||||
#----------------------------#
|
#-------------------------#
|
||||||
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter4 ( SETUP ) ${R_arrow}"
|
# $1 is the chapter number. Pad it with 0 to the left to obtain a 2-digit
|
||||||
# Ensure the first dependency is empty
|
# number:
|
||||||
unset PREV
|
printf -v dir chapter%02d $1
|
||||||
|
|
||||||
for file in chapter04/* ; do
|
echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter $1${R_arrow}"
|
||||||
|
|
||||||
|
for file in $dir/* ; do
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
|
|
||||||
# First append each name of the script files to a list (this will become
|
# Some scripts need peculiar actions:
|
||||||
# the names of the targets in the Makefile
|
# - glibc chap 5: ix locales creation when running chapter05 testsuites
|
||||||
# DO NOT append the settingenvironment script, it need be run as luser.
|
# - Stripping at the end of system build: lfs.xsl does not generate
|
||||||
# A hack is necessary: create script in chap4 BUT run as a dependency for
|
# correct commands if the user does not want to strip, so skip it
|
||||||
# LUSER target
|
# in this case
|
||||||
|
# - grub config: must be done manually; skip it
|
||||||
|
# - handle fstab and .config. Skip kernel if .config not supplied
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*settingenvironment) chapter5="$chapter5 ${this_script}" ;;
|
5*glibc) [[ "${TEST}" = "3" ]] && \
|
||||||
*) chapter4="$chapter4 ${this_script}" ;;
|
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
|
||||||
|
*strippingagain) [[ "${STRIP}" = "n" ]] && continue ;;
|
||||||
|
8*grub) (( nb_chaps == 5 )) && continue ;;
|
||||||
|
10*grub) continue ;;
|
||||||
|
*fstab) [[ -z "${FSTAB}" ]] ||
|
||||||
|
[[ ${FSTAB} == $BUILDDIR/sources/fstab ]] ||
|
||||||
|
cp ${FSTAB} $BUILDDIR/sources/fstab ;;
|
||||||
|
*kernel) [[ -z ${CONFIG} ]] && continue
|
||||||
|
[[ ${CONFIG} == $BUILDDIR/sources/kernel-config ]] ||
|
||||||
|
cp ${CONFIG} $BUILDDIR/sources/kernel-config ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Append the name of the script to a list. The name of the
|
||||||
|
# list is contained in the variable Makefile_target. We adjust this
|
||||||
|
# variable at various points. Note that it is initialized to "SETUP"
|
||||||
|
# in the main function, before calling this function for the first time.
|
||||||
|
case "${this_script}" in
|
||||||
|
*settingenvironment) Makefile_target=LUSER_TGT ;;
|
||||||
|
*changingowner ) Makefile_target=SUDO_TGT ;;
|
||||||
|
*creatingdirs ) Makefile_target=CHROOT_TGT ;;
|
||||||
|
*bootscripts ) Makefile_target=BOOT_TGT ;; # case of sysv book
|
||||||
|
*network ) Makefile_target=BOOT_TGT ;; # case of systemd book
|
||||||
|
esac
|
||||||
|
eval $Makefile_target=\"\$$Makefile_target ${this_script}\"
|
||||||
|
|
||||||
# Grab the name of the target
|
# Grab the name of the target
|
||||||
name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
|
name=`echo ${this_script} | sed -e 's@[0-9]\{3,4\}-@@' \
|
||||||
|
-e 's@-pass[0-9]\{1\}@@' \
|
||||||
|
-e 's@-libstdc++@@'`
|
||||||
|
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
#
|
#
|
||||||
|
# Find the name of the tarball and the version of the package
|
||||||
|
pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
|
||||||
|
pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
|
||||||
|
|
||||||
# Drop in the name of the target on a new line, and the previous target
|
# 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.
|
||||||
LUSER_wrt_target "${this_script}" "$PREV"
|
case $Makefile_target in
|
||||||
|
CHROOT_TGT) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||||
|
*) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If $pkg_tarball isn't empty, we've got a package...
|
||||||
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
|
# Touch timestamp file if installed files logs shall be created.
|
||||||
|
# But only for the final install chapter
|
||||||
|
if [ "${INSTALL_LOG}" = "y" ] && (( 1+nb_chaps <= $1 )) ; then
|
||||||
|
CHROOT_wrt_TouchTimestamp
|
||||||
|
fi
|
||||||
|
# Always initialize the test log file, since the test instructions may
|
||||||
|
# be "uncommented" by the user
|
||||||
|
case $Makefile_target in
|
||||||
|
CHROOT_TGT) CHROOT_wrt_test_log "${this_script}" "$pkg_version" ;;
|
||||||
|
LUSER_TGT ) LUSER_wrt_test_log "${this_script}" "$pkg_version" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If using optimizations, write the instructions
|
||||||
|
case "${OPTIMIZE}$1${nb_chaps}${this_script}${REALSBU}" in
|
||||||
|
0* | *binutils-pass1y | 15* | 167* | 177*) ;;
|
||||||
|
*kernel) wrt_makeflags "$name" ;; # No CFLAGS for kernel
|
||||||
|
*) wrt_optimize "$name" && wrt_makeflags "$name" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Some scriptlet have a special treatment; otherwise standard
|
||||||
case "${this_script}" in
|
case "${this_script}" in
|
||||||
*settingenvironment)
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@cd && \\
|
|
||||||
function source() { true; } && \\
|
|
||||||
export -f source && \\
|
|
||||||
\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1 && \\
|
|
||||||
sed 's|/mnt/lfs|\$(MOUNT_PT)|' -i .bashrc && \\
|
|
||||||
echo source $JHALFSDIR/envars >> .bashrc
|
|
||||||
@\$(PRT_DU) >>logs/\$@
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
;;
|
|
||||||
*addinguser)
|
*addinguser)
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
@ -74,8 +118,44 @@ cat << EOF
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE.tmp
|
) >> $MKFILE.tmp
|
||||||
;;
|
;;
|
||||||
*) wrt_RunAsRoot "$file" ;;
|
*settingenvironment)
|
||||||
|
(
|
||||||
|
cat << EOF
|
||||||
|
@cd && \\
|
||||||
|
function source() { true; } && \\
|
||||||
|
export -f source && \\
|
||||||
|
\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@ 2>&1 && \\
|
||||||
|
sed 's|/mnt/lfs|\$(MOUNT_PT)|' -i .bashrc && \\
|
||||||
|
echo source $JHALFSDIR/envars >> .bashrc
|
||||||
|
@\$(PRT_DU) >>logs/\$@
|
||||||
|
EOF
|
||||||
|
) >> $MKFILE.tmp
|
||||||
|
;;
|
||||||
|
*fstab) if [[ -n "$FSTAB" ]]; then
|
||||||
|
CHROOT_wrt_CopyFstab
|
||||||
|
else
|
||||||
|
CHROOT_wrt_RunAsRoot "$file"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
# 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.
|
||||||
|
case "${Makefile_target}" in
|
||||||
|
SETUP_TGT | SUDO_TGT) wrt_RunAsRoot "$file" "$pkg_version" ;;
|
||||||
|
LUSER_TGT) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
|
||||||
|
CHROOT_TGT | BOOT_TGT) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Write installed files log and remove the build directory(ies)
|
||||||
|
# except if the package build fails.
|
||||||
|
if [ "$pkg_tarball" != "" ] ; then
|
||||||
|
if [ "${INSTALL_LOG}" = "y" ] && (( 1+nb_chaps <= $1 )) ; then
|
||||||
|
CHROOT_wrt_LogNewFiles "$name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Include a touch of the target name so make can check
|
# Include a touch of the target name so make can check
|
||||||
# if it's already been made.
|
# if it's already been made.
|
||||||
|
@ -87,11 +167,10 @@ EOF
|
||||||
|
|
||||||
# Keep the script file name for Makefile dependencies.
|
# Keep the script file name for Makefile dependencies.
|
||||||
PREV=${this_script}
|
PREV=${this_script}
|
||||||
done # end for file in chapter04/*
|
done # end for file in $dir/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# NOT USED -- NOT USED
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter5_Makefiles() {
|
chapter5_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -112,12 +191,6 @@ chapter5_Makefiles() {
|
||||||
# Keep the script file name
|
# Keep the script file name
|
||||||
this_script=`basename $file`
|
this_script=`basename $file`
|
||||||
|
|
||||||
# Fix locales creation when running chapter05 testsuites (ugly)
|
|
||||||
case "${this_script}" in
|
|
||||||
*glibc) [[ "${TEST}" = "3" ]] && \
|
|
||||||
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Append each name of the script files to a list that Makefile_target
|
# Append each name of the script files to a list that Makefile_target
|
||||||
# points to. But before that, change Makefile_target at the first script
|
# points to. But before that, change Makefile_target at the first script
|
||||||
# of each target.
|
# of each target.
|
||||||
|
@ -187,7 +260,7 @@ chapter5_Makefiles() {
|
||||||
done # end for file in chapter05/*
|
done # end for file in chapter05/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# NOT USED -- NOT USED keep for ICA code
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter6_Makefiles() {
|
chapter6_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -333,7 +406,7 @@ chapter6_Makefiles() {
|
||||||
system_build="$chapter6"
|
system_build="$chapter6"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# NOT USED -- NOT USED
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
chapter78_Makefiles() {
|
chapter78_Makefiles() {
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -426,8 +499,6 @@ chapter78_Makefiles() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
build_Makefile() { #
|
build_Makefile() { #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
@ -436,17 +507,36 @@ build_Makefile() { #
|
||||||
|
|
||||||
cd $JHALFSDIR/${PROGNAME}-commands
|
cd $JHALFSDIR/${PROGNAME}-commands
|
||||||
|
|
||||||
# Start with a clean Makefile.tmp file
|
# Start with empty files
|
||||||
>$MKFILE
|
>$MKFILE
|
||||||
|
>$MKFILE.tmp
|
||||||
|
|
||||||
chapter4_Makefiles
|
# Ensure the first dependency is empty
|
||||||
chapter5_Makefiles
|
unset PREV
|
||||||
|
|
||||||
|
# We begin with the SETUP target; successive targets will be assigned in
|
||||||
|
# the chapter_targets function.
|
||||||
|
Makefile_target=SETUP_TGT
|
||||||
|
|
||||||
|
# We need to know the chapter numbering, which depends on the version
|
||||||
|
# of the book. Use the number of subdirs to know which version we have
|
||||||
|
chaps=($(echo *))
|
||||||
|
nb_chaps=${#chaps[*]} # 5 if classical version, 7 if new version
|
||||||
|
# DEBUG
|
||||||
|
# echo chaps: ${chaps[*]}
|
||||||
|
# echo nb_chaps: $nb_chaps
|
||||||
|
# end DEBUG
|
||||||
|
|
||||||
|
# Make a temporary file with all script targets
|
||||||
|
for (( i = 4; i < nb_chaps+4; i++ )); do
|
||||||
|
chapter_targets $i
|
||||||
|
if (( i == nb_chaps )); then : # we have finished temporary tools
|
||||||
# Add the save target, if needed
|
# Add the save target, if needed
|
||||||
[[ "$SAVE_CH5" = "y" ]] && wrt_save_target $Makefile_target
|
[[ "$SAVE_CH5" = "y" ]] && wrt_save_target $Makefile_target
|
||||||
chapter6_Makefiles
|
fi
|
||||||
# Add the iterations targets, if needed
|
# TODO Add the iterations targets, if needed
|
||||||
[[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
# [[ "$COMPARE" = "y" ]] && wrt_compare_targets
|
||||||
chapter78_Makefiles
|
done
|
||||||
# Add the CUSTOM_TOOLS targets, if needed
|
# Add the CUSTOM_TOOLS targets, if needed
|
||||||
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
[[ "$CUSTOM_TOOLS" = "y" ]] && wrt_CustomTools_target
|
||||||
|
|
||||||
|
@ -612,9 +702,9 @@ chroot: devices
|
||||||
sudo \$(CHROOT2)
|
sudo \$(CHROOT2)
|
||||||
\$(MAKE) teardown
|
\$(MAKE) teardown
|
||||||
|
|
||||||
SETUP: $chapter4
|
SETUP: $SETUP_TGT
|
||||||
LUSER: $chapter5
|
LUSER: $LUSER_TGT
|
||||||
SUDO: $runasroot
|
SUDO: $SUDO_TGT
|
||||||
EOF
|
EOF
|
||||||
) >> $MKFILE
|
) >> $MKFILE
|
||||||
if [ "$INITSYS" = systemd ]; then
|
if [ "$INITSYS" = systemd ]; then
|
||||||
|
@ -629,11 +719,10 @@ fi
|
||||||
(
|
(
|
||||||
cat << EOF
|
cat << EOF
|
||||||
CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
|
CHROOT: SHELL=\$(filter %bash,\$(CHROOT1))
|
||||||
CHROOT: $chapter6
|
CHROOT: $CHROOT_TGT
|
||||||
BOOT: $chapter78
|
BOOT: $BOOT_TGT
|
||||||
CUSTOM_TOOLS: $custom_list
|
CUSTOM_TOOLS: $custom_list
|
||||||
|
|
||||||
|
|
||||||
create-sbu_du-report: mk_BOOT
|
create-sbu_du-report: mk_BOOT
|
||||||
@\$(call echo_message, Building)
|
@\$(call echo_message, Building)
|
||||||
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
@if [ "\$(ADD_REPORT)" = "y" ]; then \\
|
||||||
|
|
|
@ -197,7 +197,7 @@ extract_commands() { #
|
||||||
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
$BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
||||||
# Remove flags requesting user action in some cases. Much easier here than
|
# Remove flags requesting user action in some cases. Much easier here than
|
||||||
# in the stylesheet...
|
# in the stylesheet...
|
||||||
sed -i 's/-iv /-v /' ./${PROGNAME}-commands/chapter08/*kernel*
|
sed -i 's/-iv /-v /' ./${PROGNAME}-commands/chapter??/*kernel*
|
||||||
;;
|
;;
|
||||||
*) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
*) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
|
@ -315,7 +315,7 @@ create_kernfs_scripts() { #
|
||||||
$BOOK/*/kernfs.xml >> $LOGDIR/$LOG 2>&1
|
$BOOK/*/kernfs.xml >> $LOGDIR/$LOG 2>&1
|
||||||
xsltproc --nonet \
|
xsltproc --nonet \
|
||||||
-o kernfs-scripts/teardown.sh kernfs.xsl \
|
-o kernfs-scripts/teardown.sh kernfs.xsl \
|
||||||
$BOOK/chapter09/reboot.xml >> $LOGDIR/$LOG 2>&1
|
$BOOK/chapter??/reboot.xml >> $LOGDIR/$LOG 2>&1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
esac
|
esac
|
||||||
|
|
9
jhalfs
9
jhalfs
|
@ -185,7 +185,6 @@ if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
||||||
NO_PROGRESS="#"
|
NO_PROGRESS="#"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
# Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
||||||
CWD="$(cd "$(dirname "$0")" && pwd)"
|
CWD="$(cd "$(dirname "$0")" && pwd)"
|
||||||
if [[ $JHALFSDIR == "$CWD" ]]; then
|
if [[ $JHALFSDIR == "$CWD" ]]; then
|
||||||
|
@ -454,6 +453,14 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
# Note that all customization to $JHALFSDIR have to be done before this.
|
# Note that all customization to $JHALFSDIR have to be done before this.
|
||||||
# But the LFS book is needed for BLFS tools.
|
# But the LFS book is needed for BLFS tools.
|
||||||
get_book
|
get_book
|
||||||
|
# At this point, we should have a way to know whether we have a cross
|
||||||
|
# or regular book... In case of cross, prohibite TEST=3
|
||||||
|
# the position of gcc-pass2 (chapter 6 or 5) tells us (not valid for
|
||||||
|
# cross-chap5 branch).
|
||||||
|
if (( TEST == 3 )) && \
|
||||||
|
[ -f "$JHALFSDIR/${PROGNAME}-commands/chapter06/gcc-pass2.xml" ]; then
|
||||||
|
TEST=2
|
||||||
|
fi
|
||||||
extract_commands
|
extract_commands
|
||||||
echo "${SD_BORDER}${nl_}"
|
echo "${SD_BORDER}${nl_}"
|
||||||
cd "$CWD" # the functions above change directory
|
cd "$CWD" # the functions above change directory
|
||||||
|
|
Reference in a new issue