[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Defaulting to i686 for the Debian i386 architecture



On Tue, Oct 06, 2015 at 10:47:43AM +0200, Jakub Wilk wrote:
> * Philip Hands <phil@hands.com>, 2015-10-06, 09:35:
> > sed -ne '/^flags\t/{s/\b\(fpu\|tsc\|cx8\|cmov\)\b/%/g;s/[^%]*//g;s/%%%%/i686 SUPPORTED/p}' /proc/cpuinfo
> 
> Or a more readable version:
> 
> [ $(lscpu | grep ^Flags: | grep -owE 'fpu|tsc|cx8|cmov' | wc -l) = 4 ] && echo i686 SUPPORTED

Phil's second one works for me, yours does not, on a CPU identified as
"Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz" in /proc/cpuinfo. I don't
really know what the right test is (I don't keep of CPU changes), but
I changed Phil's sed into a shell script that I find more readable.
Attached. Hopefully that's helpful to someone and not too badly wrong.
#!/bin/sh

set -eu

# Get CPU feature flags from /proc/cpuinfo.

get_flags()
{
    sed -ne '/^flags\t*: /s///p' /proc/cpuinfo | tr ' ' '\n'
}


# Do we have the right flags for an i686?

if get_flags | grep -Ee 'fpu|tac|cx8|cmov' > /dev/null
then
    echo "i686 is supported" 
else
    echo "i686 is NOT SUPPORTED" 1>&2
    exit 1
fi

Reply to: