Changes in / [bc64795:9440e4a]
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Config.in
rbc64795 r9440e4a 1 # Check for "nproc" presence: 2 config HAVE_NPROC 3 def_bool $(shell,if nproc &>/dev/null; then echo y; else echo n; fi) 4 5 # Check for "cpuset controller in cgroup v2" presence: 6 config HAVE_CGROUP 7 def_bool $(shell,if grep -q cpuset /sys/fs/cgroup/cgroup.controllers 2>/dev/null; then echo y; else echo n; fi) 8 1 9 menu "BOOK Settings" 2 10 … … 751 759 depends on !BOOK_BLFS 752 760 761 #--- Parallelism 762 menu "Parallelism settings" 763 if HAVE_NPROC 764 config ALL_CORES 765 bool "Use all cores as in new books (say n for old books)" 766 default y 767 help 768 Use book instructions as written for parallelism since version 769 r12.0-87 included. If you answer no, then jhalfs will fall back 770 to a static number of cores, defined below. If you answer y, and 771 your system supports it, you'll be asked for a cpu set to use. 772 There is no detection of book version. If the book version 773 is lower than r12.0-87, say no! 774 775 if ALL_CORES && HAVE_CGROUP 776 config CPUSET 777 string "set of cpus to use, or 'all' for all cpus" 778 default "all" 779 help 780 See "List format" in cpuset(7). Choosing cpus depend 781 on the topology of your processors. Sometimes two 782 hyperthreads on the same core are numbered consecutively. 783 For example for using all cores and no hyperthreading on 784 a Haswell, use "0,2,4,6". Other brands may have a different 785 topology, and may require e.g. "0-3" to use the first 4 cores. 786 If not sure, keep the default. 787 endif 788 789 endif # HAVE_NPROC 790 if !HAVE_NPROC 791 config ALL_CORES 792 bool 793 default n 794 endif 795 796 config N_PARALLEL 797 int "Number of parallel `make' jobs" 798 depends on !ALL_CORES 799 default 1 800 help 801 #-- The usual recommandation is (number of CPU cores)+1 802 # Do not set for meaningful SBU calculations. 803 804 config REALSBU 805 bool "Build Binutils pass1 without parallelism (Real SBU)" 806 default n 807 help 808 #-- Use -j1 in make invokation for Binutils pass1 to 809 # get a valid SBU value. 810 endmenu # parallelism 811 812 #--- Optimizations 813 config CONFIG_OPTIMIZE 814 bool "Optimization" 815 default n 816 help 817 # Opens a menu for various optimization settings: 818 # Actual optimization flags MUST be defined in ./optimize/* 819 # before activating this option. 820 # 821 # WARNING: The use of build optimizations may lead to build issues. 822 # If the system doesn't work as expected, please rebuild 823 # without optimizations before asking for support. 824 menu "Optimization settings" 825 depends on CONFIG_OPTIMIZE 826 827 choice 828 prompt "Optimization level" 829 default OPT_1 830 help 831 #-- Optimization values are set in optimize/* files 832 833 config OPT_1 834 bool "Final system only" 835 836 config OPT_2 837 bool "Both temp tools and final system" 838 839 endchoice 840 841 endmenu # Optimization settings 842 config OPTIMIZE 843 int 844 default "0" if !CONFIG_OPTIMIZE 845 default "1" if OPT_1 846 default "2" if OPT_2 847 848 #--- End Optimizations 849 753 850 config REPORT 754 851 bool "Create SBU and disk usage report" … … 796 893 797 894 #--- End ICA 798 799 #--- Optimizations800 config CONFIG_OPTIMIZE801 bool "Optimization and parallelization"802 default n803 help804 # Opens a menu for various optimization settings:805 # Actual optimization flags MUST be defined in ./optimize/*806 # before activating this option.807 #808 # WARNING: The use of build optimizations may lead to build issues.809 # If the system doesn't work as expected, please rebuild810 # without optimizations before asking for support.811 menu "Parallelization and Optimization settings"812 depends on CONFIG_OPTIMIZE813 814 config N_PARALLEL815 int "Number of parallel `make' jobs"816 default 1817 help818 #-- The usual recommandation is (number of CPU cores)+1819 # Do not set for meaningful SBU calculations.820 821 choice822 prompt "Optimization level"823 default OPT_1824 help825 #-- Optimization values are set in optimize/* files826 827 config OPT_1828 bool "Final system only"829 830 config OPT_2831 bool "Both temp tools and final system"832 833 endchoice834 835 config REALSBU836 bool "Build Binutls pass1 without optimization (Real SBU)"837 depends on OPT_2838 default n839 help840 #-- Use -j1 in make invokation for Binutils pass1 to841 # get a valid SBU value.842 843 endmenu # Optimization settings844 config OPTIMIZE845 int846 default "0" if !CONFIG_OPTIMIZE847 default "1" if OPT_1848 default "2" if OPT_2849 850 #--- End Optimizations851 895 852 896 #-- Internal Settings -
LFS/lfs.xsl
rbc64795 r9440e4a 28 28 --> 29 29 <xsl:param name="testsuite" select="1"/> 30 31 <!-- Parallelism (LFS >= 12.1) --> 32 <xsl:param name="jobs" select="1"/> 33 34 <!-- value of jobs for binutils-pass1 --> 35 <xsl:param name="jobs-bp1" select="1"/> 30 36 31 37 <!-- Install non wide character ncurses 5? --> … … 618 624 <xsl:value-of select="$hostname"/> 619 625 </xsl:when> 626 <xsl:when test="contains(string(.),'$(nproc)')"> 627 <xsl:value-of select="$jobs"/> 628 </xsl:when> 620 629 <xsl:otherwise> 621 630 <xsl:text>**EDITME</xsl:text> … … 1244 1253 </xsl:text> 1245 1254 </xsl:if> 1255 <xsl:text> 1256 export MAKEFLAGS="-j</xsl:text> 1257 <xsl:choose> 1258 <xsl:when test="@id='ch-tools-binutils-pass1'"> 1259 <xsl:value-of select="$jobs-bp1"/> 1260 </xsl:when> 1261 <xsl:otherwise> 1262 <xsl:value-of select="$jobs"/> 1263 </xsl:otherwise> 1264 </xsl:choose> 1265 <xsl:text>" 1266 </xsl:text> 1246 1267 <xsl:text>SECONDS=${PREV_SEC} 1247 1268 -
LFS/master.sh
rbc64795 r9440e4a 128 128 # If using optimizations, write the instructions 129 129 case "${OPTIMIZE}$1${nb_chaps}${this_script}${REALSBU}" in 130 0* | *binutils-pass1y | 15* | 167* | 177*) 131 wrt_makeflags "$name" "-j1" "1" ;; 132 *kernel*) # No CFLAGS for kernel 133 wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL" ;; 134 *) wrt_optimize "$name" && 135 wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL" ;; 130 0* | *binutils-pass1y | 15* | 167* | 177*) ;; 131 *kernel*) ;; # No CFLAGS for kernel 132 *) wrt_optimize "$name" ;; 136 133 esac 137 fi 134 # There is no need to tweak MAKEFLAGS anymore, this is done 135 # by lfs.xsl. But still, NINJAJOBS needs to be set if 136 # N_PARALLEL is defined. 137 if [ -n "N_PARALLEL" ]; then 138 wrt_makeflags "$name" "$JH_MAKEFLAGS" "$N_PARALLEL" 139 fi 140 fi # end of package specific instructions 138 141 139 142 # Some scriptlet have a special treatment; otherwise standard … … 287 290 done 288 291 292 # If CPUSET is defined and not equal to "all", then we define a first target 293 # that calls a script which re-enters make calling target all 294 if [ -n "$CPUSET" ] && [ "$CPUSET" != all ]; then 295 ( 296 cat << EOF 297 298 all-with-cpuset: 299 @CPUSPEC="\$(CPUSET)" ./run-in-cgroup.sh \$(MAKE) all 300 EOF 301 ) >> $MKFILE 302 fi 289 303 # Drop in the main target 'all:' and the chapter targets with each sub-target 290 304 # as a dependency. Also prevent running targets in parallel. -
common/chroot.xsl
rbc64795 r9440e4a 6 6 extension-element-prefixes="exsl" 7 7 version="1.0"> 8 9 <xsl:param name="jobs_2" select="1"/> 8 10 9 11 <xsl:template match="/"> … … 56 58 <xsl:param name="instructions" select="''"/> 57 59 <xsl:choose> 60 <xsl:when test="contains($instructions, '$(nproc || echo 1)')"> 61 <xsl:call-template name="extract-chroot"> 62 <xsl:with-param 63 name="instructions" 64 select="concat(substring-before($instructions, '$(nproc || echo 1)'), $jobs_2, substring-after($instructions, '$(nproc || echo 1)'))"/> 65 </xsl:call-template> 66 </xsl:when> 58 67 <xsl:when test="not(starts-with($instructions,'
chroot')) and 59 68 contains($instructions, '
chroot')"> -
common/libs/func_book_parser
rbc64795 r9440e4a 64 64 popd > /dev/null 65 65 66 if [ "$ALL_CORES" = "y" ]; then 67 JOBS="\$(nproc)" 68 else 69 JOBS="$N_PARALLEL" 70 fi 71 if [ "$REALSBU" = y ]; then JOBSBP1=1; else JOBSBP1="$JOBS"; fi 72 66 73 # First profile the book, for revision and arch. Note that 67 74 # MULTIBLIB is set to "default" if pure 64 bit book. In this case, … … 103 110 --stringparam log-level "$LOG_LEVEL" \ 104 111 --stringparam script-root "$SCRIPT_ROOT" \ 112 --stringparam jobs "$JOBS" \ 113 --stringparam jobs-bp1 "$JOBSBP1" \ 105 114 --output "./${COMMANDS}/" \ 106 115 $XSL \ … … 142 151 echo -n "... " 143 152 xsltproc --nonet --xinclude \ 144 -o chroot-scripts/ chroot.xsl \ 153 --stringparam jobs_2 "$JOBS_2" \ 154 -o chroot-scripts/ chroot.xsl \ 145 155 $BOOK/chapter0?/*chroot*.xml >> $LOGDIR/$LOG 2>&1 146 156 echo "done" -
common/libs/func_install_blfs
rbc64795 r9440e4a 137 137 BUILD_ROOT=/sources 138 138 BUILD_SUBDIRS=y 139 JOBS=$(if [ -n "$N_PARALLEL" ]; then echo $N_PARALLEL; else echo 1; fi)139 JOBS=$(if [ "$ALL_CORES" = y ]; then echo 0; else echo $N_PARALLEL; fi) 140 140 EOF 141 # The 0 value above is for using all cores 141 142 for OPT_VAR in CFLAGS CXXFLAGS LDFLAGS; do 142 143 eval optVal=\$${OPT_VAR}_$DEF_OPT_MODE … … 218 219 # updating to the end of the process, adding an 'update' target 219 220 sed -i -e '/xsltproc/,+6d' \ 220 -e '/^all/ s@$@ update@' \221 -e '/^all/i update:' \ 221 222 -e 's/touch/@touch/' Makefile 222 223 cat >> Makefile << EOF 223 update: 224 update: all 224 225 @echo Updating the tracking file 225 226 @for pack in \$\$(grep '<productname' ../$LFS_XML/tmp/lfs-full.xml | \\ -
common/libs/func_validate_configs.sh
rbc64795 r9440e4a 36 36 37 37 # Full list of books settings 38 local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $LFS_system $ADVANCED_chroot N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common"38 local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $LFS_system $ADVANCED_chroot ALL_CORES CPUSET N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common" 39 39 # local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR" 40 40 … … 133 133 RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; 134 134 DOWNLOADTIMEOUT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; 135 N_PARALLEL) [[ "$OPTIMIZE" -gt "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;;136 REALSBU) [[ "$OPTIMIZE" = "2" ]] && echo -e "`eval echo $PARAM_VALS`" ;;135 CPUSET) [[ "$HAVE_CGROUP" = "y" ]] && [[ "$ALL_CORES" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; 136 N_PARALLEL) [[ "$ALL_CORES" = "n" ]] && echo -e "`eval echo $PARAM_VALS`" ;; 137 137 138 138 # Envars that requires some validation … … 167 167 168 168 # Treatment of LANG parameter 169 LANG ) # See i tthe locale value has been set169 LANG ) # See if the locale value has been set 170 170 echo -n "`eval echo $PARAM_VALS`" 171 171 [[ -z "${!config_param}" ]] && -
common/libs/func_wrt_Makefile
rbc64795 r9440e4a 45 45 PKGMNGT = $PKGMNGT 46 46 WRAP_INSTALL = $WRAP_INSTALL 47 CPUSET = $CPUSET 47 48 48 49 -
jhalfs
rbc64795 r9440e4a 176 176 UNICODE=${UNICODE:=n} 177 177 LOCAL=${LOCAL:=n} 178 ALL_CORES=${ALL_CORES:=n} 178 179 REALSBU=${REALSBU:=n} 179 180 SAVE_CH5=${SAVE_CH5:=n} … … 288 289 # optimize configurations 289 290 load_file optimize/opt_config 'Loading optimization config' 290 # The number of parallel jobs is taken from configuration now 291 # Validate optimize settings, if required 292 validate_opt_settings 293 fi 294 # Parallelization is outside optimization, because it is now in the book 295 if [[ "$ALL_CORES" = "n" ]]; then 291 296 # shellcheck disable=SC2034 292 297 JH_MAKEFLAGS="-j${N_PARALLEL}" 293 # Validate optimize settings, if required294 validate_opt_settings295 298 fi 296 299 # … … 321 324 322 325 # Copy common helper files 323 cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh } "$JHALFSDIR/"326 cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh,run-in-cgroup.sh} "$JHALFSDIR/" 324 327 325 328 # Copy needed stylesheets -
optimize/optimize_functions
rbc64795 r9440e4a 17 17 echo -e "asking for support.${OFF}\n" 18 18 19 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}" 20 [ -n "$JH_MAKEFLAGS" ] && \ 21 echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n" 19 # [ -n "$JH_MAKEFLAGS" ] && \ 20 # echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n" 22 21 23 22 echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
Note:
See TracChangeset
for help on using the changeset viewer.