[PATCH lorax/master] Add initial support for ARM based systems.

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

 



From: "d.marlin" <dmarlin@xxxxxxxxxx>

Signed-off-by: David A. Marlin <dmarlin@xxxxxxxxxx>
---
 share/arm.tmpl                          |   36 +++++++++++++++++++++++
 share/config_files/uboot/boot.highbank  |    5 +++
 share/config_files/uboot/boot.tegra     |    4 ++
 share/config_files/uboot/uboot.highbank |   30 +++++++++++++++++++
 share/config_files/uboot/uboot.tegra    |   30 +++++++++++++++++++
 share/runtime-install.tmpl              |    8 ++++-
 src/pylorax/__init__.py                 |   48 +++++++++++++++++++++++++++++-
 src/pylorax/treebuilder.py              |    4 ++-
 8 files changed, 161 insertions(+), 4 deletions(-)
 create mode 100644 share/arm.tmpl
 create mode 100644 share/config_files/uboot/boot.highbank
 create mode 100644 share/config_files/uboot/boot.tegra
 create mode 100644 share/config_files/uboot/uboot.highbank
 create mode 100644 share/config_files/uboot/uboot.tegra

diff --git a/share/arm.tmpl b/share/arm.tmpl
new file mode 100644
index 0000000..368d511
--- /dev/null
+++ b/share/arm.tmpl
@@ -0,0 +1,36 @@
+<%page args="kernels, runtime_img, runtime_base, basearch, outroot"/>
+<%
+configdir="tmp/config_files/uboot"
+BOOTDIR="boot"
+KERNELDIR=BOOTDIR
+UIMAGE_ADDRESS="0x00008000"
+INITRD_ADDRESS="0x00000000"
+# U-Boot will only handle one kernel
+kernel = kernels[0]
+%>
+
+## install bootloader (such as it is) and bootloader config
+
+mkdir ${BOOTDIR}
+# default to Trim Slice (tegra) for now
+install ${configdir}/boot.tegra ${BOOTDIR}/boot.cmd
+
+## configure bootloader
+#replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} ${BOOTDIR}/boot.cmd
+#replace @IMAGE_LOAD_ADDRESS@ ${UIMAGE_ADDRESS} ${BOOTDIR}/boot.cmd
+
+runcmd mkimage \
+  -A arm -O linux -T script -C none \
+  -a 0 -e 0 -n "Trim Slice boot script" \
+  -d ${outroot}/${BOOTDIR}/boot.cmd ${outroot}/${BOOTDIR}/boot.scr
+
+
+install ${runtime_img} ${BOOTDIR}
+#treeinfo stage2 mainimage boot/${runtime_base}
+
+## install kernel
+installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
+installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
+
+## FIXME: ARM may need some extra boot config
+
diff --git a/share/config_files/uboot/boot.highbank b/share/config_files/uboot/boot.highbank
new file mode 100644
index 0000000..b24e660
--- /dev/null
+++ b/share/config_files/uboot/boot.highbank
@@ -0,0 +1,5 @@
+setenv bootargs console=ttyAMA0  root=/dev/sda2 rw rootwait earlyprintk rd_NO_PLYMOUTH
+ext2load scsi 0:1 600000 uImage
+ext2load scsi 0:1 880000 uInitrd
+ext2load scsi 0:1 1000000 highbank.dtb
+bootm 600000 880000 1000000
diff --git a/share/config_files/uboot/boot.tegra b/share/config_files/uboot/boot.tegra
new file mode 100644
index 0000000..44f16bc
--- /dev/null
+++ b/share/config_files/uboot/boot.tegra
@@ -0,0 +1,4 @@
+setenv bootargs mem=384M@0M mem=512M@512M nvmem=128M@384M vmalloc=248M video=tegrafb console=ttyS0,115200n8 rw root=/dev/sda3 nohdparm rootwait earlyprintk rd_NO_PLYMOUTH
+ext2load usb 0:3 4080000 /boot/uImage
+ext2load usb 0:3 4480000 /boot/uInitrd
+bootm 4080000 4480000
diff --git a/share/config_files/uboot/uboot.highbank b/share/config_files/uboot/uboot.highbank
new file mode 100644
index 0000000..0b83dee
--- /dev/null
+++ b/share/config_files/uboot/uboot.highbank
@@ -0,0 +1,30 @@
+# Settings for uBoot setup in /sbin/new-kernel-pkg
+#
+# Default values are provided below (as comments)
+#
+# WARNING: These values affect where grubby installs and removes
+#          uBoot kernel images.  Changing these _after_ kernels have
+#          been installed may cause removing a kernel image to fail.
+
+# directory where uBoot images and scripts are found
+#UBOOT_DIR=/boot/uboot
+UBOOT_DIR=/boot
+
+# name of the text file containing the list of installed kernel versions
+# NOTE: The versions are in order of installation.  The last entry should
+#       always be the default boot kernel version.
+#UBOOT_KLIST=klist.txt
+
+# device partition where uBoot images reside; mounted on $UBOOT_DIR
+#UBOOT_DEVICE=mmcblk0p1
+UBOOT_DEVICE=sda1
+
+# NOTE: Both of the following files are automatically overwritte
+#       when a kernel package is installed or removed.
+
+# default kernel uImage file name
+#UBOOT_UIMAGE=uImage
+
+# default initrd uInitrd file name
+#UBOOT_UINITRD=uInitrd
+
diff --git a/share/config_files/uboot/uboot.tegra b/share/config_files/uboot/uboot.tegra
new file mode 100644
index 0000000..0b83dee
--- /dev/null
+++ b/share/config_files/uboot/uboot.tegra
@@ -0,0 +1,30 @@
+# Settings for uBoot setup in /sbin/new-kernel-pkg
+#
+# Default values are provided below (as comments)
+#
+# WARNING: These values affect where grubby installs and removes
+#          uBoot kernel images.  Changing these _after_ kernels have
+#          been installed may cause removing a kernel image to fail.
+
+# directory where uBoot images and scripts are found
+#UBOOT_DIR=/boot/uboot
+UBOOT_DIR=/boot
+
+# name of the text file containing the list of installed kernel versions
+# NOTE: The versions are in order of installation.  The last entry should
+#       always be the default boot kernel version.
+#UBOOT_KLIST=klist.txt
+
+# device partition where uBoot images reside; mounted on $UBOOT_DIR
+#UBOOT_DEVICE=mmcblk0p1
+UBOOT_DEVICE=sda1
+
+# NOTE: Both of the following files are automatically overwritte
+#       when a kernel package is installed or removed.
+
+# default kernel uImage file name
+#UBOOT_UIMAGE=uImage
+
+# default initrd uInitrd file name
+#UBOOT_UINITRD=uInitrd
+
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index 29c8565..aadb47e 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -11,7 +11,13 @@ installpkg iscsi-initiator-utils
 installpkg firstaidkit-plugin-{passwd,key-recovery,mdadm-conf}
 
 ## kernel and firmware
-installpkg kernel
+## ARM kernels are platform specific
+%if basearch in ("arm", "armhfp") and arch.platform != None:
+    installpkg kernel-${arch.platform}
+%else:
+    installpkg kernel
+%endif
+
 %if basearch != "s390x":
     installpkg *-firmware
 %endif
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 2133d60..1c13de7 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -55,13 +55,57 @@ class ArchData(DataHolder):
     lib64_arches = ("x86_64", "ppc64", "sparc64", "s390x", "ia64")
     bcj_arch = dict(i386="x86", x86_64="x86",
                     ppc="powerpc", ppc64="powerpc",
-                    sparc="sparc", sparc64="sparc")
+                    sparc="sparc", sparc64="sparc",
+                    armv5tel="arm", armv7l="arm",
+                    armv7hl="armhfp")
+
     def __init__(self, buildarch):
         self.buildarch = buildarch
         self.basearch = getBaseArch(buildarch)
         self.libdir = "lib64" if self.basearch in self.lib64_arches else "lib"
         self.bcj = self.bcj_arch.get(self.basearch)
 
+        self.platform = None
+        if self.basearch in ("arm", "armhfp"):
+            self.platform = self.getARMMachine()
+
+
+    ## Get the ARM processor variety.
+    # @return The ARM processor variety type, or 0 if not ARM.
+    def getARMMachine(self):
+        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 part.find(type[0]) != -1:
+                    armMachine = type[1]
+
+        return armMachine
+
+
 class Lorax(BaseLoraxClass):
 
     def __init__(self):
@@ -173,7 +217,7 @@ class Lorax(BaseLoraxClass):
 
         logger.info("setting up build architecture")
         self.arch = ArchData(buildarch)
-        for attr in ('buildarch', 'basearch', 'libdir'):
+        for attr in ('buildarch', 'basearch', 'libdir', 'platform'):
             logger.debug("self.arch.%s = %s", attr, getattr(self.arch,attr))
 
         logger.info("setting up build parameters")
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index 50fb1f9..9809ebc 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -39,6 +39,8 @@ templatemap = {
     'sparc64': 'sparc.tmpl',
     's390':    's390.tmpl',
     's390x':   's390.tmpl',
+    'arm':     'arm.tmpl',
+    'armhfp':  'arm.tmpl',
 }
 
 def generate_module_info(moddir, outfile=None):
@@ -154,7 +156,7 @@ class TreeBuilder(object):
     def __init__(self, product, arch, inroot, outroot, runtime, isolabel, templatedir=None):
         # NOTE: if you pass an arg named "runtime" to a mako template it'll
         # clobber some mako internal variables - hence "runtime_img".
-        self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime,
+        self.vars = DataHolder(arch=arch, platform=arch.platform, product=product, runtime_img=runtime,
                                runtime_base=basename(runtime),
                                inroot=inroot, outroot=outroot,
                                basearch=arch.basearch, libdir=arch.libdir,
-- 
1.7.6.5

_______________________________________________
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