diff --git a/Config.in b/Config.in index 8bc7161..a0bfc0f 100644 --- a/Config.in +++ b/Config.in @@ -771,6 +771,95 @@ endmenu #--- System configuration menu "Advanced Features" depends on !BOOK_BLFS + #--- Parallelism + menu "Parallelism settings" + if HAVE_NPROC + config ALL_CORES + bool "Use all cores as in new books (say n for old books)" + default y + help + Use book instructions as written for parallelism since version + r12.0-87 included. If you answer no, then jhalfs will fall back + to a static number of cores, defined below. If you answer y, and + your system supports it, you'll be asked for a cpu set to use. + There is no detection of book version. If the book version + is lower than r12.0-87, say no! + + if ALL_CORES && HAVE_CGROUP + config CPUSET + string "set of cpus to use, or 'all' for all cpus" + default "all" + help + See "List format" in cpuset(7). Choosing cpus depend + on the topology of your processors. Sometimes two + hyperthreads on the same core are numbered consecutively. + For example for using all cores and no hyperthreading on + a Haswell, use "0,2,4,6". Other brands may have a different + topology, and may require e.g. "0-3" to use the first 4 cores. + If not sure, keep the default. + endif + + endif # HAVE_NPROC + if !HAVE_NPROC + config ALL_CORES + bool + default n + endif + + config N_PARALLEL + int "Number of parallel `make' jobs" + depends on !ALL_CORES + default 1 + help + #-- The usual recommandation is (number of CPU cores)+1 + # Do not set for meaningful SBU calculations. + + config REALSBU + bool "Build Binutils pass1 without parallelism (Real SBU)" + default n + help + #-- Use -j1 in make invokation for Binutils pass1 to + # get a valid SBU value. + endmenu # parallelism + + #--- Optimizations + config CONFIG_OPTIMIZE + bool "Optimization" + default n + help + # Opens a menu for various optimization settings: + # Actual optimization flags MUST be defined in ./optimize/* + # before activating this option. + # + # WARNING: The use of build optimizations may lead to build issues. + # If the system doesn't work as expected, please rebuild + # without optimizations before asking for support. + menu "Optimization settings" + depends on CONFIG_OPTIMIZE + + choice + prompt "Optimization level" + default OPT_1 + help + #-- Optimization values are set in optimize/* files + + config OPT_1 + bool "Final system only" + + config OPT_2 + bool "Both temp tools and final system" + + endchoice + + endmenu # Optimization settings + config OPTIMIZE + int + default "0" if !CONFIG_OPTIMIZE + default "1" if OPT_1 + default "2" if OPT_2 + + #--- End Optimizations + config REPORT bool "Create SBU and disk usage report" default y @@ -817,99 +906,6 @@ depends on !BOOK_BLFS #--- End ICA - #--- Optimizations - config CONFIG_OPTIMIZE - bool "Optimization" - default n - help - # Opens a menu for various optimization settings: - # Actual optimization flags MUST be defined in ./optimize/* - # before activating this option. - # - # WARNING: The use of build optimizations may lead to build issues. - # If the system doesn't work as expected, please rebuild - # without optimizations before asking for support. - menu "Optimization settings" - depends on CONFIG_OPTIMIZE - - choice - prompt "Optimization level" - default OPT_1 - help - #-- Optimization values are set in optimize/* files - - config OPT_1 - bool "Final system only" - - config OPT_2 - bool "Both temp tools and final system" - - endchoice - - endmenu # Optimization settings - config OPTIMIZE - int - default "0" if !CONFIG_OPTIMIZE - default "1" if OPT_1 - default "2" if OPT_2 - - #--- End Optimizations - #--- Parallelism - menu "Parallelism settings" - if HAVE_NPROC - config ALL_CORES - bool "Use all cores as in the book" - default y - help - Use book instructions as written for parallelism. If you - answer no, then jhalfs will fall back to a static number of - cores, defined below. If you answer y, and your system - supports it, you'll be asked for a cpu set to use. - - if HAVE_CGROUP - config CPUSET - string "set of cpus to use, or 'all' for all cpus" - default "all" - help - See "List format" in cpuset(7). Choosing cpus depend - on the topology of your processors. Sometimes two - hyperthreads on the same core are numbered consecutively. - For example for using all cores and no hyperthreading on - a Haswell, use "0,2,4,6". Other brands may have a different - topology, and may require e.g. "0-3" to use the first 4 cores. - If not sure, keep the default. - endif - if !HAVE_CGROUP - config CPUSET - string - default "all" - endif - - endif # HAVE_NPROC - if !HAVE_NPROC - config ALL_CORES - bool - default n - endif - - config N_PARALLEL - int "Number of parallel `make' jobs" - depends on !ALL_CORES - default 1 - help - #-- The usual recommandation is (number of CPU cores)+1 - # Do not set for meaningful SBU calculations. - - config REALSBU - bool "Build Binutls pass1 without parallelism (Real SBU)" - depends on ALL_CORES != 1 - default n - help - #-- Use -j1 in make invokation for Binutils pass1 to - # get a valid SBU value. - endmenu # parallelism - - #-- Internal Settings menu "Internal Settings (WARNING: for jhalfs developers only)" diff --git a/common/libs/func_validate_configs.sh b/common/libs/func_validate_configs.sh index ec21656..34d07ec 100644 --- a/common/libs/func_validate_configs.sh +++ b/common/libs/func_validate_configs.sh @@ -35,7 +35,7 @@ inline_doc local -r LFS_system="HOSTNAME INTERFACE IP_ADDR GATEWAY PREFIX BROADCAST DOMAIN DNS1 DNS2 FONT KEYMAP LOCAL LOG_LEVEL" # Full list of books settings - local -r lfs_PARAM_LIST="$LFS_book $GENERAL_common $LFS_build $LFS_system $ADVANCED_chroot N_PARALLEL REALSBU SAVE_CH5 $ADVANCED_common" + 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" # local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR" # Additional variables @@ -133,8 +133,8 @@ inline_doc RETRYSRCDOWNLOAD) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; RETRYDOWNLOADCNT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; DOWNLOADTIMEOUT) [[ "$GETPKG" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; - N_PARALLEL) [[ "$OPTIMIZE" -gt "0" ]] && echo -e "`eval echo $PARAM_VALS`" ;; - REALSBU) [[ "$OPTIMIZE" = "2" ]] && echo -e "`eval echo $PARAM_VALS`" ;; + CPUSET) [[ "$HAVE_CGROUP" = "y" ]] && [[ "$ALL_CORES" = "y" ]] && echo -e "`eval echo $PARAM_VALS`" ;; + N_PARALLEL) [[ "$ALL_CORES" = "n" ]] && echo -e "`eval echo $PARAM_VALS`" ;; # Envars that requires some validation LUSER) echo -e "`eval echo $PARAM_VALS`" diff --git a/jhalfs b/jhalfs index 2166769..fe2c30c 100755 --- a/jhalfs +++ b/jhalfs @@ -175,6 +175,7 @@ SET_MISC=${SET_MISC:=n} SET_BLOWFISH=${SET_BLOWFISH:=n} UNICODE=${UNICODE:=n} LOCAL=${LOCAL:=n} +ALL_CORES=${ALL_CORES:=n} REALSBU=${REALSBU:=n} SAVE_CH5=${SAVE_CH5:=n} @@ -287,12 +288,14 @@ if [[ "$OPTIMIZE" != "0" ]]; then # # optimize configurations load_file optimize/opt_config 'Loading optimization config' - # The number of parallel jobs is taken from configuration now - # shellcheck disable=SC2034 - JH_MAKEFLAGS="-j${N_PARALLEL}" # Validate optimize settings, if required validate_opt_settings fi +# Parallelization is outside optimization, because it is now in the book +if [[ "$ALL_CORES" = "n" ]]; then + # shellcheck disable=SC2034 + JH_MAKEFLAGS="-j${N_PARALLEL}" +fi # if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then diff --git a/optimize/optimize_functions b/optimize/optimize_functions index 26d5043..1a73cd3 100644 --- a/optimize/optimize_functions +++ b/optimize/optimize_functions @@ -16,9 +16,8 @@ validate_opt_settings() { # Show optimize setting and wait user agreeme echo -e "expected, please rebuild without optimizations before" echo -e "asking for support.${OFF}\n" - echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}" - [ -n "$JH_MAKEFLAGS" ] && \ - echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n" +# [ -n "$JH_MAKEFLAGS" ] && \ +# echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n" echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"