主机平台:Gentoo 11.2 内核版本:Linux Kernel 3.2.1 CPU型号:Pentium Dual-Core T2370 32-bit 原创作品,转载请标明出处http://blog.csdn.net/yming0221/article/details/7354039 1、通过查看CPU的信息可以看到Intel Core 2 Duo/Quad / Xeon 51xx/53xx, Pentium Dual-Core T23xx+/Exxxx的硬件信息如下:
首先设置/etc/make.conf中CFLAGS 我的make.conf文件如下: - CFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
- CXXFLAGS="${CFLAGS}"
- # WARNING: Changing your CHOST is not something that should be done lightly.
- # Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
- CHOST="i686-pc-linux-gnu"
- MAKEOPTS="-j3"
- USE="gnome X dbus hal v4l -qt3 -qt4 gtk laptop samba -kde -arts consolekit policykit
- udev alsa cdr -cups -bluetooth"
-
- GENTOO_MIRRORS="http://mirrors.163.com/gentoo"
-
- SYNC="rsync://mirrors.163.com/gentoo-portage/"
-
- LINGUAS="en_US en_GB uk zh_CN "
如果机器是64位的,则设置CFLAGS如下:CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
2、内核编译选项
如果你的处理器是双核的,那么激活这个选项:
Linux Kernel Configuration: | Processor type and features ---> [*] Symmetric multi-processing support (2) Maximum number of CPUs (2-256) [ ] SMT (Hyperthreading) scheduler support [*] Multi-core scheduler support | 如果你的系统是32bit的,那么激活这个选项:
Linux Kernel Configuration: | Processor type and features ---> [*] Machine Check Exception < > Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4 | 如果是64bit的,激活这个选项:
Linux Kernel Configuration: | Processor type and features ---> -- Machine check support [*] Intel MCE features Executable file formats / Emulations ---> [*] IA32 Emulation |
3、自动降频 内核的配置 Linux Kernel Configuration: CPU frequency scaling | Power management options ---> ACPI (Advanced Configuration and Power Interface) Support ---> [*] ACPI Support <*> Processor CPU Frequency scaling ---> [*] CPU Frequency scaling <*> CPU frequency translation statistics [*] CPU frequency translation statistics details | 省电方式(Governor) 它们决定了你的CPU运行的频率。最常用到的可能是'按需分配(ondemand)'和'保守(conservative)'了。你可以按照你的需要来进行调整。 - Conservative 将CPU设置为最省电的状态,当CPU需要使用更多电力的时候一步步地提升CPU的频率.
- Ondemand 将CPU的频率设置为最低,当CPU在最低频率时如果使用率达到100%把CPU的频率提升到额定频率。
- Powersave将CPU的频率一直设置为最低。
- Performance 使CPU保持额定频率运行。
- Userspace 允许你手动设置CPU的频率。
你可以随时改变你的CPU的省电方式。 Linux Kernel Configuration: governor | Power management options ---> CPU Frequency scaling ---> # E.g. for ondemand <*> 'ondemand' cpufreq policy governor |
自动降频的驱动 你需要启用系统的CPU频率调整驱动.intel Core Solo/Duo, Intel Core2 Solo/Duo 的驱动是ACPI Processor P-States driver 。它已经被包含到内核中了。编译时在下面这个位置启用。
Linux Kernel Configuration: CPU frequency scaling driver | Power management options ---> CPU Frequency scaling ---> # E.g. for Intel Core2 Duo <*> ACPI Processor P-States driver |
软件 现在你需要安装一些软件来完成自动降频的工作.
emerge --ask --verbose cpufrequtils 下面这个命令可以查看具体有哪些哪些省电方式:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors 现在你知道你需要使用哪种省电方式了,编辑/etc/conf.d/cpufrequtils文件来设置你想要的方式。 默认的是ondemand.
最后,启用CPU自动降频
/etc/init.d/cpufrequtils start 你启用了它之后它不会在每次启动后自动运行,所以你需要把它加入rc脚本中。 rc-update add cpufrequtils boot 4、微码(microcode)的设置芯片内置的微代码,用于升级CPU中的微程序以修正处理器的BUG 首先添加内核的微码支持 然后添加软件的支持,并添加到开机启动服务自动运行。 - sudo emerge emerge -av microcode-ctl
- sudo /etc/init.d/microcode_ctl start
- sudo rc-update add microcode_ctl default
启动后lsmod查看下有没有microcode模块如果没有modprobe一下 下面是信息日志 2012-03-14T16:09:01.441949+08:00 yan-laptop kernel: [27137.253418] Registering platform device 'microcode'. Parent at platform 2012-03-14T16:09:01.441986+08:00 yan-laptop kernel: [27137.253423] device: 'microcode': device_add 2012-03-14T16:09:01.455766+08:00 yan-laptop kernel: [27137.253432] bus: 'platform': add device microcode 2012-03-14T16:09:01.455797+08:00 yan-laptop kernel: [27137.253442] PM: Adding info for platform:microcode 2012-03-14T16:09:01.455804+08:00 yan-laptop kernel: [27137.253470] microcode: CPU0 sig=0x6fd, pf=0x80, revision=0xa1 2012-03-14T16:09:01.455810+08:00 yan-laptop kernel: [27137.253477] platform microcode: firmware: requesting intel-ucode/06-0f-0d 2012-03-14T16:09:01.455815+08:00 yan-laptop kernel: [27137.253482] device: 'microcode': device_add 2012-03-14T16:09:01.455819+08:00 yan-laptop kernel: [27137.253493] PM: Adding info for No Bus:microcode 2012-03-14T16:09:01.490927+08:00 yan-laptop kernel: [27137.302793] device: 'microcode': device_unregister 2012-03-14T16:09:01.490964+08:00 yan-laptop kernel: [27137.302799] PM: Removing info for No Bus:microcode 2012-03-14T16:09:01.490970+08:00 yan-laptop kernel: [27137.302852] microcode: CPU1 sig=0x6fd, pf=0x80, revision=0xa1 2012-03-14T16:09:01.490976+08:00 yan-laptop kernel: [27137.302859] platform microcode: firmware: requesting intel-ucode/06-0f-0d 2012-03-14T16:09:01.490981+08:00 yan-laptop kernel: [27137.302864] device: 'microcode': device_add 2012-03-14T16:09:01.490986+08:00 yan-laptop kernel: [27137.302878] PM: Adding info for No Bus:microcode 2012-03-14T16:09:01.508965+08:00 yan-laptop kernel: [27137.320982] device: 'microcode': device_unregister 2012-03-14T16:09:01.509000+08:00 yan-laptop kernel: [27137.320988] PM: Removing info for No Bus:microcode 2012-03-14T16:09:01.509006+08:00 yan-laptop kernel: [27137.321062] device: 'microcode': device_add 2012-03-14T16:09:01.509922+08:00 yan-laptop kernel: [27137.321213] PM: Adding info for No Bus:microcode 2012-03-14T16:09:01.509939+08:00 yan-laptop kernel: [27137.321238] microcode: Microcode Update Driver: v2.00 , Peter Oruba 2012-03-14T16:09:36.164996+08:00 yan-laptop kernel: [27171.976391] microcode: CPU0 updated to revision 0xa4, date = 2010-10-02 2012-03-14T16:09:36.165032+08:00 yan-laptop kernel: [27171.976823] microcode: CPU1 updated to revision 0xa4, date = 2010-10-02 2012-03-14T16:09:36.258277+08:00 yan-laptop kernel: [27172.069653] device: 'microcode': device_unregister 2012-03-14T16:09:36.258314+08:00 yan-laptop kernel: [27172.069658] PM: Removing info for No Bus:microcode 2012-03-14T16:09:36.258321+08:00 yan-laptop kernel: [27172.069764] device: 'microcode': device_create_release 2012-03-14T16:09:36.258327+08:00 yan-laptop kernel: [27172.069794] PM: Removing info for platform:microcode 2012-03-14T16:09:36.258332+08:00 yan-laptop kernel: [27172.069804] bus: 'platform': remove device microcode 2012-03-14T16:09:36.258337+08:00 yan-laptop kernel: [27172.069817] microcode: Microcode Update Driver: v2.00 removed.
升级成功。 更多Gentoo的维护请参考Gentoo Linux维护(专栏) |