I'm attempting my first Gentoo install, I'm relatively well versed in Linux but haven't done a ground up install before like this.

I'm installing from Minimal and trying to set my CPU_FLAGS_X86 and want to do it right the first time. All recommendations in the Handbook recommend using CPUID's tool for determining CPU flags (which seem to be different than those listed in /proc/cpuinfo) but I don't have this tool on the minimal iso.

My question is: How can I determine what flags to set for CPU_FLAGS_X86 without using cpuid2cpuflags?

Would using the output from /proc/cpuinfo be suitable or is this too much?:

livecd ~ # grep flags /proc/cpuinfo | sort | uniq
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp

Thanks in advance!


As Panther suggested in the comments, looking at the documentation on Gentoo's site indicates that most of the flags are the same as what is shown in /proc/cpuinfo, with some exceptions (notably, sse3 in cpuinfo is pni in CPU_FLAGS_X86).

In practice, I find that installing cpuid2cpuflags as a one-shot is not a problem at all: it's extremely small and when you do a depclean afterwards it'll go away. This is my standard procedure on a new install (inside the chroot after setting up the network and preparing the disks; you'll need to edit make.conf to change CPU_FLAGS_X86: foo bar into CPU_FLAGS_X86="foo bar"):

emerge -1 cpuid2cpuflags
cpuid2cpuflags >> /etc/portage/make.conf
nano /etc/portage/make.conf

You can also put the CPU flags into /etc/portage/package.use as the documentation describes.

When you run emerge --depclean later, the package should be uninstalled because nothing depends on it.

  • I suppose I should have posted where I was in the handbook. In particular I was speaking about this section: wiki.gentoo.org/wiki/Handbook:AMD64/Installation/… where they stress setting proper flags before initial invocation of emerge is important.
    – Ryan Smith
    Aug 2 '19 at 17:54
  • 1
    If you run cpuid2cpuflags before emerging anything else, you're essentially doing that. Very few core packages use CPU_FLAGS_* in any case: you usually only see these used in packages like ffmpeg and friends. Personally, I worry more about CFLAGS than CPU_FLAGS when starting on a new system.
    – ErikF
    Aug 2 '19 at 20:51
  • Awesome, thanks for the input. I ended up learning a bit more about --updated-use and @world so it looks like it shouldn't impact me too much at this stage.
    – Ryan Smith
    Aug 3 '19 at 6:10
  • To paste without modification: cpuid2cpuflags | sed 's/: /="/;s/$/"/' >> /etc/portage/make.conf
    – hoefling
    Aug 8 '19 at 15:39
  • @hoefling Absolutely, but in my workflow I use the time when editing make.conf to also give the settings a once-over and make sure that everything looks right. :-)
    – ErikF
    Aug 8 '19 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.