Re: [PATCH anaconda/master] Add support to determine the ARM processor variety and select the correct kernel to install.

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

 



> +## Get the ARM processor variety.
> +# @return The ARM processor variety type, or 0 if not ARM.
> +def getARMMachine():
> +    if not os.uname()[4].startswith('arm'):
> +        return 0
> +
> +    armMachine = None
> +    machine = None
> +
> +    # ARM machine hash
> +    armType = {
> +                'OMAP3 Beagle Board'                  : 'omap',
> +                'OMAP4 Panda board'                   : 'omap',
> +                'trimslice'                           : 'tegra',
> +                'Marvell GuruPlug Reference Board'    : 'kirkwood',
> +                'Efika MX'                            : 'imx',
> +                'Genesi Efika MX'                     : 'imx',
> +                'Genesi Efika MX (Smartbook)'         : 'imx',
> +                'Highbank'                            : 'highbank',
> +              }
> +
> +    f = open('/proc/cpuinfo', 'r')
> +    lines = f.readlines()
> +    f.close()
> +    for line in lines:
> +        if line.find('Hardware') != -1:
> +            machine = line.split(':')[1]

Once you've found what you're looking for, you should break out of the
loop.  There's no need to keep looking.

> +
> +    if machine is not None:
> +        for type in armType.items():
> +            if machine.find(type[0]) != -1:
> +                armMachine = type[1]

Same here.

> diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
> index 109daec..d762959 100644
> --- a/pyanaconda/yuminstall.py
> +++ b/pyanaconda/yuminstall.py
> @@ -1452,6 +1452,12 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
>              if selectKernel("kernel-PAE"):
>                  foundkernel = True
>  
> +        if not foundkernel and iutil.isARM():
> +            armMachine = iutil.getARMMachine()
> +            if armMachine is not None:
> +                selectKernel("kernel-" + armMachine)
> +                foundkernel = True
> +
>          if not foundkernel:
>              selectKernel("kernel")

You've gone to the trouble of making a property on the platform, might
as well use it here instead of calling back into iutil:
anaconda.platform.armMachine.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux