From 21dab8363a664e2b81d5fc3dc104973e76c9e14f Mon Sep 17 00:00:00 2001 From: George Boudreau Date: Fri, 28 Jul 2006 03:55:40 +0000 Subject: [PATCH] Tweaking the hlfs code.. stomping on bugs --- Config.in | 18 ++++++++++++----- HLFS/master.sh | 54 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/Config.in b/Config.in index c22a143..7febc9c 100644 --- a/Config.in +++ b/Config.in @@ -276,11 +276,18 @@ depends on BOOK_HLFS # has been supplied? config CONFIG_RUNMAKE - bool "Run the makefile" + bool "Run the makefile" default n help #--- Automatically run the makefile once it has been created + config CONFIG_REBUILD + bool "Rebuild files" + default n + help + Clean the build directory before performing any other task. The directory + is cleaned only if it was populated by a previous JHALFS run. + config CONFIG_STRIP bool "Strip Installed Binaries/Libraries" default y @@ -387,7 +394,7 @@ depends on BOOK_HLFS endchoice config TEST int - default "0" if !CONFIG_TEST + default "0" if !CONFIG_TESTS default "1" if TST_1 default "2" if TST_2 default "3" if TST_3 @@ -432,9 +439,6 @@ depends on BOOK_HLFS default "letter" if PAGE_LETTER default "A4" if PAGE_A4 - - - config BUILDDIR string "Build Directory" default "/mnt/build_dir" @@ -524,3 +528,7 @@ depends on BOOK_HLFS default 0 if !CONFIG_FARCE default 1 if CONFIG_FARCE + config CLEAN + int + default 0 if !CONFIG_REBUILD + default 1 if CONFIG_REBUILD diff --git a/HLFS/master.sh b/HLFS/master.sh index 35f3a27..20def06 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -43,6 +43,22 @@ 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 #----------------------------# @@ -58,43 +74,40 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1 pkg_tarball=$(get_package_tarball_name "gcc-g++") wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1 + + 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 - if [[ ${toolchain} = "butterfly-toolchain" ]]; then - [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}" - wrt_run_as_chroot1 "$toolchain" "$this_script" - else - wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script" - fi + wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script" + ;; + esac 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@@'` - case $tc_phase in - embryo | cocoon) # toolchain phase ( cat << EOF @rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\ rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build EOF ) >> $MKFILE.tmp - ;; - butterfly ) # system phase -( -cat << EOF - @rm -r \$(SRC)/butterfly-toolchain && \\ - rm -r \$(SRC)/butterfly-build -EOF -) >> $MKFILE.tmp - ;; - esac } @@ -376,7 +389,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase # In the mount of kernel filesystems we need to set LFS 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}" @@ -421,7 +434,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)