ubuntu x64, 编译库 使用 make -j4 -j8 时会自动重启,开始还以为是CPU 过热引起,其实不是,这是 OS BUG。

在编译 buildroot时就会发生这种问题, 这是可以修改 package/Makefile.in 文件。把 PARALLEL_JOBS设置成 2 或者 1 即可。或者直接配置 buildroot menuconfig 时 制定 BR2_LEVEL = 2 或者 1

  9 # If BR2_LEVEL is 0, scale the maximum concurrency with the number of
 10 # CPUs.  A coefficient of 2 is used in order to keep processors busy
 11 # while waiting on I/O.
 12 ifeq ($(BR2_JLEVEL),0)
 13 PARALLEL_JOBS:=$(shell echo \
 14     $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
 15 else
 16 PARALLEL_JOBS:=$(BR2_JLEVEL)
 17 endif

对CPU 过热,使用如下方式

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 找出最大最小值。

udo apt-get install sysfsutils

sudo vim /etc/sysfs.conf

That will open a file, you need to add the following lines to that file (at the end of it):

devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
devices/system/cpu/cpu0/cpufreq/scaling_max_freq = MAX
devices/system/cpu/cpu0/cpufreq/scaling_min_freq = MIN


01-08 12:16