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]

 



Comments below.

On Fri, Apr 27, 2012 at 09:59:28AM -0500, d.marlin wrote:
> From: "d.marlin" <dmarlin@xxxxxxxxxx>
> 
> Signed-off-by: David A. Marlin <dmarlin@xxxxxxxxxx>
> ---
>  pyanaconda/iutil.py      |   36 ++++++++++++++++++++++++++++++++++++
>  pyanaconda/platform.py   |    5 +++++
>  pyanaconda/yuminstall.py |    6 ++++++
>  3 files changed, 47 insertions(+), 0 deletions(-)
> 
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index dd691dc..2864980 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -656,6 +656,42 @@ def getPPCMacBook():
>          return 1
>      return 0
>  
> +## 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]
> +
> +    if machine is not None:
> +        for type in armType.items():
> +            if machine.find(type[0]) != -1:
> +                armMachine = type[1]
> +
> +    return armMachine

I really _really_ dislike things like the armType hash.  I know we have it
for ppc, but none of us were consulted when those names were ending up in
the kernel and packages.

Is there no way to get the strings like omap, tegra, kirkwood, imx, and
highbank from /proc/cpuinfo -or- from somewhere else in /sys?  And if not,
why?  I would very much prefer that we just be able to extract that string
from some info the kernel provides than to carry this list which will need
updating, and probably a lot because it's ARM.

> +
> +
>  cell = None
>  ## Determine if the hardware is the Cell platform.
>  # @return True if so, False otherwise.
> diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
> index 335ab5c..5c6ddea 100644
> --- a/pyanaconda/platform.py
> +++ b/pyanaconda/platform.py
> @@ -348,6 +348,7 @@ class Sparc(Platform):
>          return start+1
>  
>  class ARM(Platform):
> +    _armMachine = iutil.getARMMachine()
>      _bootloaderClass = bootloader.GRUB2
>      _boot_stage1_device_types = ["disk"]
>      _boot_mbr_description = N_("Master Boot Record")
> @@ -356,6 +357,10 @@ class ARM(Platform):
>  
>      _disklabel_types = ["msdos"]
>  
> +    @property
> +    def armMachine(self):
> +        return self._armMachine
> +
>  def getPlatform(anaconda):
>      """Check the architecture of the system and return an instance of a
>         Platform subclass to match.  If the architecture could not be determined,
> 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)

Yuck, but ok.  Would be nice if a single kernel package could happen for
ARM.  Maybe someday

> +                foundkernel = True
> +
>          if not foundkernel:
>              selectKernel("kernel")
>  
> -- 
> 1.7.6.5
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
David Cantrell <dcantrell@xxxxxxxxxx>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
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