harness: armv7 machines: deduplicate code and grab mmap menu.lst entries from <src...
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Wed, 3 Aug 2016 11:55:10 +0000 (13:55 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Wed, 3 Aug 2016 12:34:52 +0000 (14:34 +0200)
Also rename pandaboard targets to omap44xx for consistency in naming and fix
local pandaboard machine to run make usbboot_panda.

Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

hake/menu.lst.armv7_omap44xx [moved from hake/menu.lst.armv7_pandaboard with 100% similarity]
platforms/Hakefile
tools/harness/machines/__init__.py
tools/harness/machines/fvp.py
tools/harness/machines/gem5.py
tools/harness/machines/pandaboard.py
tools/harness/machines/qemu.py

index 6a18b79..3fc2930 100644 (file)
@@ -480,8 +480,8 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
 
     platform "PandaboardES" [ "armv7" ]
     ([ ("armv7", f) | f <- pandaModules ] ++
-     [ ("root", "/armv7_pandaboard_image"),
-       ("root", "/armv7_pandaboard_image-gdb.gdb") ])
+     [ ("root", "/armv7_omap44xx_image"),
+       ("root", "/armv7_omap44xx_image-gdb.gdb") ])
     "Standard Pandaboard ES build image and modules",
 
     platform "VExpressEMM-A15" [ "armv7" ]
@@ -513,7 +513,7 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
     --
 
     -- Build the default PandaBoard boot image
-    armv7Image "armv7_pandaboard" "omap44xx" "omap44xx" "0x80000000" pandaModules,
+    armv7Image "armv7_omap44xx" "omap44xx" "omap44xx" "0x80000000" pandaModules,
 
     -- Build the A15 simulation image (VersatileExpress EMM board)
     armv7Image "armv7_a15ve" "ve" "a15ve" "0x80000000" vExpressEMMModules_A15,
@@ -553,7 +553,7 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
                      "armv7_a9ve",
                      "armv7_a15ve",
                      "armv7_a15ve_gem5",
-                     "armv7_pandaboard",
+                     "armv7_omap44xx",
                      "armv7_zynq7" ]],
     Rules [ copyFile SrcTree "root" ("/hake/menu.lst." ++ p)
                      "root" ("/platforms/x86/menu.lst." ++ p)
@@ -650,7 +650,7 @@ let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
 
     boot "usbboot_panda" [ "armv7" ] [
       In BuildTree "tools" "/bin/usbboot",
-      In BuildTree "root" "/armv7_pandaboard_image"
+      In BuildTree "root" "/armv7_omap44xx_image"
     ]
     "Boot Barrelfish on a Pandaboard, over a local USB cable"
 
index 3ae9de0..d3d6738 100644 (file)
@@ -1,12 +1,14 @@
 ##########################################################################
-# Copyright (c) 2009, ETH Zurich.
+# Copyright (c) 2009-2016 ETH Zurich.
 # All rights reserved.
 #
 # This file is distributed under the terms in the attached LICENSE file.
 # If you do not find this file, copies can be found by writing to:
-# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+# ETH Zurich D-INFK, Universitaetstr 6, CH-8092 Zurich. Attn: Systems Group.
 ##########################################################################
 
+import os, debug, signal, shutil, time
+
 class Machine(object):
     name = None # should be overridden
 
@@ -104,6 +106,143 @@ class MachineLockedError(Exception):
     """May be raised by lock() when the machine is locked by another user."""
     pass
 
+class ARMMachineBase(Machine):
+    def __init__(self, options):
+        super(ARMMachineBase, self).__init__(options)
+        self.options = options
+
+    def _get_mmap(self):
+        """Grab MMAP data from menu lst in source tree"""
+        template_menulst = os.path.join(self.options.sourcedir, "hake",
+                "menu.lst." + self.get_bootarch() + "_" + self.get_platform())
+        debug.debug("getting MMAP from %s" % template_menulst)
+        mmap = []
+        with open(template_menulst) as m:
+            for line in m.readlines():
+                if line.startswith("mmap"):
+                    mmap.append(line)
+        debug.debug("got MMAP:\n  %s" % "  ".join(mmap))
+        return mmap
+
+    def _write_menu_lst(self, data, path):
+        debug.verbose('writing %s' % path)
+        debug.debug(data)
+        f = open(path, 'w')
+        f.write(data)
+        for line in self._get_mmap():
+            f.write(line)
+        f.close()
+
+class ARMSimulatorBase(ARMMachineBase):
+    def __init__(self, options):
+        super(ARMSimulatorBase, self).__init__(options)
+        self.child = None
+        self.telnet = None
+        self.tftp_dir = None
+        self.simulator_start_timeout = 5 # seconds
+
+    def setup(self, builddir=None):
+        self.builddir = builddir
+
+    def get_coreids(self):
+        return range(0, self.get_ncores())
+
+    def get_tickrate(self):
+        return None
+
+    def get_boot_timeout(self):
+        """Default boot timeout for ARM simulators: 2min"""
+        return 120
+
+    def get_test_timeout(self):
+        """Default test timeout for ARM simulators: 10min"""
+        return 10 * 60
+
+    def get_machine_name(self):
+        return self.name
+
+    def get_bootarch(self):
+        raise NotImplementedError
+
+    def get_platform(self):
+        raise NotImplementedError
+
+    def force_write(self, consolectrl):
+        pass
+
+    def lock(self):
+        pass
+
+    def unlock(self):
+        pass
+
+    def get_free_port(self):
+        import socket
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.bind(('', 0))
+        # extract port from addrinfo
+        self.telnet_port = s.getsockname()[1]
+        s.close()
+
+    def _get_cmdline(self):
+        raise NotImplementedError
+
+    def _kill_child(self):
+        # terminate child if running
+        if self.child:
+            try:
+                os.kill(self.child.pid, signal.SIGTERM)
+            except OSError, e:
+                debug.verbose("Caught OSError trying to kill child: %r" % e)
+            except Exception, e:
+                debug.verbose("Caught exception trying to kill child: %r" % e)
+            try:
+                self.child.wait()
+            except Exception, e:
+                debug.verbose(
+                    "Caught exception while waiting for child: %r" % e)
+            self.child = None
+
+    def shutdown(self):
+        debug.verbose('Simulator:shutdown requested');
+        debug.verbose('terminating simulator')
+        if not self.child is None:
+            try:
+                self.child.terminate()
+            except OSError, e:
+                debug.verbose("Error when trying to terminate simulator: %r" % e)
+        debug.verbose('closing telnet connection')
+        if not self.telnet is None:
+            self.output.close()
+            self.telnet.close()
+        # try to cleanup tftp tree if needed
+        if self.tftp_dir and os.path.isdir(self.tftp_dir):
+            shutil.rmtree(self.tftp_dir, ignore_errors=True)
+        self.tftp_dir = None
+
+    def get_output(self):
+        # wait a bit to give FVP time to listen for a telnet connection
+        if self.child.poll() != None: # Check if child is down
+            print 'Simulator is down, return code is %d' % self.child.returncode
+            return None
+        # use telnetlib
+        import telnetlib
+        self.telnet_connected = False
+        while not self.telnet_connected:
+            try:
+                self.telnet = telnetlib.Telnet("localhost", self.telnet_port)
+                self.telnet_connected = True
+                self.output = self.telnet.get_socket().makefile()
+            except IOError, e:
+                errno, msg = e
+                if errno != 111: # connection refused
+                    debug.error("telnet: %s [%d]" % (msg, errno))
+                else:
+                    self.telnet_connected = False
+            time.sleep(self.simulator_start_timeout)
+
+        return self.output
+
 
 all_machines = []
 
index 3a503d5..15b5c0f 100644 (file)
@@ -7,45 +7,27 @@
 # ETH Zurich D-INFK, Universitaetstr 6, CH-8092 Zurich. Attn: Systems Group.
 ##########################################################################
 
-import os, signal, tempfile, subprocess, shutil, time
+import os, tempfile, subprocess, time
 import debug, machines
-from machines import Machine
+from machines import ARMSimulatorBase
 
 FVP_PATH = '/home/netos/tools/DS-5_v5.24.0/bin'
 FVP_LICENSE = '8224@sgv-license-01.ethz.ch'
 FVP_START_TIMEOUT = 5 # in seconds
 IMAGE_NAME="armv7_a9ve_image"
 
-class FVPMachineBase(Machine):
+class FVPMachineBase(ARMSimulatorBase):
     def __init__(self, options):
         super(FVPMachineBase, self).__init__(options)
         self.child = None
         self.telnet = None
         self.tftp_dir = None
         self.options = options
+        self.simulator_start_timeout = FVP_START_TIMEOUT
 
     def get_buildall_target(self):
         return "VExpressEMM-A9"
 
-    def get_coreids(self):
-        return range(0, self.get_ncores())
-
-    def get_tickrate(self):
-        return None
-
-    def get_boot_timeout(self):
-        return 120
-
-    def get_test_timeout(self):
-        # 15 mins
-        return 15 * 60
-
-    def get_machine_name(self):
-        return self.name
-
-    def force_write(self, consolectrl):
-        pass
-
     def get_tftp_dir(self):
         if self.tftp_dir is None:
             debug.verbose('Creating temporary directory for FVP files')
@@ -53,51 +35,15 @@ class FVPMachineBase(Machine):
             debug.verbose('FVP install directory is %s' % self.tftp_dir)
         return self.tftp_dir
 
-    # Use menu.lst in hake/menu.lst.arm_fvp
-    def _write_menu_lst(self, data, path):
-        pass
-
-    def set_bootmodules(self, modules):
-        pass
-
-    def lock(self):
-        pass
-
-    def unlock(self):
-        pass
-
-    def setup(self, builddir=None):
-        self.builddir = builddir
-
-    def _get_cmdline(self):
-        raise NotImplementedError
-
     def get_kernel_args(self):
         # Fixed virtual platform has 100MHz clock that is not discoverable
         return [ "periphclk=100000000", "consolePort=0" ]
 
-    def _kill_child(self):
-        # terminate child if running
-        if self.child:
-            try:
-                os.kill(self.child.pid, signal.SIGTERM)
-            except OSError, e:
-                debug.verbose("Caught OSError trying to kill child: %r" % e)
-            except Exception, e:
-                debug.verbose("Caught exception trying to kill child: %r" % e)
-            try:
-                self.child.wait()
-            except Exception, e:
-                debug.verbose(
-                    "Caught exception while waiting for child: %r" % e)
-            self.child = None
-
     def reboot(self):
         self._kill_child()
         cmd = self._get_cmdline()
         debug.verbose('starting "%s" in FVP:reboot' % ' '.join(cmd))
         devnull = open('/dev/null', 'w')
-        import os
         env = dict(os.environ)
         env['ARMLMD_LICENSE_FILE'] = FVP_LICENSE
         self.child = \
@@ -105,46 +51,6 @@ class FVPMachineBase(Machine):
                              stderr=devnull, env=env)
         time.sleep(FVP_START_TIMEOUT)
 
-    def shutdown(self):
-        debug.verbose('FVP:shutdown requested');
-        debug.verbose('terminating FVP')
-        if not self.child is None:
-            try:
-                self.child.terminate()
-            except OSError, e:
-                debug.verbose("Error when trying to terminate FVP: %r" % e)
-        debug.verbose('closing telnet connection')
-        if not self.telnet is None:
-            self.output.close()
-            self.telnet.close()
-        # try to cleanup tftp tree if needed
-        if self.tftp_dir and os.path.isdir(self.tftp_dir):
-            shutil.rmtree(self.tftp_dir, ignore_errors=True)
-        self.tftp_dir = None
-
-    def get_output(self):
-        # wait a bit to give FVP time to listen for a telnet connection
-        if self.child.poll() != None: # Check if child is down
-            print 'FVP is down, return code is %d' % self.child.returncode
-            return None
-        # use telnetlib
-        import telnetlib
-        self.telnet_connected = False
-        while not self.telnet_connected:
-            try:
-                self.telnet = telnetlib.Telnet("localhost", self.telnet_port)
-                self.telnet_connected = True
-                self.output = self.telnet.get_socket().makefile()
-            except IOError, e:
-                errno, msg = e
-                if errno != 111: # connection refused
-                    debug.error("telnet: %s [%d]" % (msg, errno))
-                else:
-                    self.telnet_connected = False
-            time.sleep(FVP_START_TIMEOUT)
-
-        return self.output
-
 class FVPMachineARMv7(FVPMachineBase):
     def get_bootarch(self):
         return 'armv7'
@@ -158,9 +64,15 @@ class FVPMachineARMv7(FVPMachineBase):
                                        self.options.builds[0].name,
                                        IMAGE_NAME)
 
-        # write menu.lst
-        path = os.path.join(self.get_tftp_dir(), 'menu.lst')
-        self._write_menu_lst(modules.get_menu_data('/'), path)
+        # write menu.lst in build directory
+        debug.verbose("writing menu.lst in build directory")
+        menulst_fullpath = os.path.join(self.builddir,
+                "platforms", "arm", "menu.lst.armv7_a9ve")
+        debug.verbose("writing menu.lst in build directory: %s" %
+                menulst_fullpath)
+        self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
+        debug.verbose("building proper FVP image")
+        debug.checkcmd(["make", IMAGE_NAME], cwd=self.builddir)
 
 @machines.add_machine
 class FVPMachineARMv7SingleCore(FVPMachineARMv7):
@@ -172,41 +84,6 @@ class FVPMachineARMv7SingleCore(FVPMachineARMv7):
     def get_cores_per_socket(self):
         return 1
 
-    def setup(self, builddir=None):
-        self.builddir = builddir
-
-    def get_free_port(self):
-        import socket
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.bind(('', 0))
-        # extract port from addrinfo
-        self.telnet_port = s.getsockname()[1]
-        s.close()
-
-    def _write_menu_lst(self, data, path):
-        debug.verbose('writing %s' % path)
-        debug.debug(data)
-        f = open(path, 'w')
-        f.write(data)
-        # TODO: provide mmap properly somehwere (machine data?)
-        # The FVP simulates 4GB of RAM, 2GB of which is in the 32-bit address space.
-        #        start       size       id
-        f.write("mmap map  0x80000000  0x40000000 1\n")
-        f.write("mmap map  0xC0000000  0x40000000 1\n")
-        f.write("mmap map 0x880000000  0x80000000 1\n")
-        f.close()
-
-    def set_bootmodules(self, modules):
-        super(FVPMachineARMv7SingleCore, self).set_bootmodules(modules)
-        debug.verbose("writing menu.lst in build directory")
-        menulst_fullpath = os.path.join(self.builddir,
-                "platforms", "arm", "menu.lst.armv7_a9ve")
-        debug.verbose("writing menu.lst in build directory: %s" %
-                menulst_fullpath)
-        self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
-        debug.verbose("building proper FVP image")
-        debug.checkcmd(["make", IMAGE_NAME], cwd=self.builddir)
-
     def _get_cmdline(self):
         self.get_free_port()
 
index 462e0d1..c03885d 100644 (file)
@@ -13,7 +13,7 @@
 
 import os, signal, tempfile, subprocess, shutil, time
 import debug, machines
-from machines import Machine
+from machines import ARMSimulatorBase
 
 GEM5_PATH = '/home/netos/tools/gem5/gem5-stable'
 # gem5 takes quite a while to come up. If we return right away,
@@ -22,23 +22,18 @@ GEM5_START_TIMEOUT = 5 # in seconds
 
 IMAGE_NAME="armv7_a15ve_image"
 
-class Gem5MachineBase(Machine):
+class Gem5MachineBase(ARMSimulatorBase):
     def __init__(self, options):
         super(Gem5MachineBase, self).__init__(options)
         self.child = None
         self.telnet = None
         self.tftp_dir = None
         self.options = options
+        self.simulator_start_timeout = GEM5_START_TIMEOUT
 
     def get_buildall_target(self):
         return "VExpressEMM-A15"
 
-    def get_coreids(self):
-        return range(0, self.get_ncores())
-
-    def get_tickrate(self):
-        return None
-
     def get_boot_timeout(self):
         # we set this to 10 mins since gem5 is very slow
         return 600
@@ -48,12 +43,6 @@ class Gem5MachineBase(Machine):
         # 20 mins
         return 15 * 60
 
-    def get_machine_name(self):
-        return self.name
-
-    def force_write(self, consolectrl):
-        pass
-
     def get_tftp_dir(self):
         if self.tftp_dir is None:
             debug.verbose('creating temporary directory for Gem5 files')
@@ -61,45 +50,11 @@ class Gem5MachineBase(Machine):
             debug.verbose('Gem5 install directory is %s' % self.tftp_dir)
         return self.tftp_dir
 
-    # Use menu.lst in hake/menu.lst.arm_gem5
-    def _write_menu_lst(self, data, path):
-        pass
-
-    def set_bootmodules(self, modules):
-        pass
-
-    def lock(self):
-        pass
-
-    def unlock(self):
-        pass
-
-    def setup(self, builddir=None):
-        self.builddir = builddir
-
-    def _get_cmdline(self):
-        raise NotImplementedError
-
     def get_kernel_args(self):
         # gem5 needs periphbase as argument as it does not implement the cp15
         # CBAR register
         return [ "periphbase=0x2c000000" ]
 
-    def _kill_child(self):
-        # terminate child if running
-        if self.child:
-            try:
-                os.kill(self.child.pid, signal.SIGTERM)
-            except OSError, e:
-                debug.verbose("Caught OSError trying to kill child: %r" % e)
-            except Exception, e:
-                debug.verbose("Caught exception trying to kill child: %r" % e)
-            try:
-                self.child.wait()
-            except Exception, e:
-                debug.verbose("Caught exception while waiting for child: %r" % e)
-            self.child = None
-
     def reboot(self):
         self._kill_child()
         cmd = self._get_cmdline()
@@ -107,53 +62,12 @@ class Gem5MachineBase(Machine):
         devnull = open('/dev/null', 'w')
         # remove ubuntu chroot from environment to make sure gem5 finds the
         # right shared libraries
-        import os
         env = dict(os.environ)
         if 'LD_LIBRARY_PATH' in env:
             del env['LD_LIBRARY_PATH']
         self.child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull, env=env)
         time.sleep(GEM5_START_TIMEOUT)
 
-    def shutdown(self):
-        debug.verbose('gem5:shutdown requested');
-        debug.verbose('terminating gem5')
-        if not self.child is None:
-            try:
-                self.child.terminate()
-            except OSError, e:
-                debug.verbose("Error when trying to terminate gem5: %r" % e)
-        debug.verbose('closing telnet connection')
-        if not self.telnet is None:
-            self.output.close()
-            self.telnet.close()
-        # try to cleanup tftp tree if needed
-        if self.tftp_dir and os.path.isdir(self.tftp_dir):
-            shutil.rmtree(self.tftp_dir, ignore_errors=True)
-        self.tftp_dir = None
-
-    def get_output(self):
-        # wait a bit to give gem5 time to listen for a telnet connection
-        if self.child.poll() != None: # Check if child is down
-            print 'gem5 is down, return code is %d' % self.child.returncode
-            return None
-        # use telnetlib
-        import telnetlib
-        self.telnet_connected = False
-        while not self.telnet_connected:
-            try:
-                self.telnet = telnetlib.Telnet("localhost", self.telnet_port)
-                self.telnet_connected = True
-                self.output = self.telnet.get_socket().makefile()
-            except IOError, e:
-                errno, msg = e
-                if errno != 111: # connection refused
-                    debug.error("telnet: %s [%d]" % (msg, errno))
-                else:
-                    self.telnet_connected = False
-            time.sleep(GEM5_START_TIMEOUT)
-
-        return self.output
-
 class Gem5MachineARM(Gem5MachineBase):
     def get_bootarch(self):
         return 'armv7'
@@ -167,9 +81,16 @@ class Gem5MachineARM(Gem5MachineBase):
                                        self.options.builds[0].name,
                                        IMAGE_NAME)
 
-        #write menu.lst
-        path = os.path.join(self.get_tftp_dir(), 'menu.lst')
-        self._write_menu_lst(modules.get_menu_data('/'), path)
+        # write menu.lst in build directory
+        debug.verbose("writing menu.lst in build directory")
+        menulst_fullpath = os.path.join(self.builddir,
+                "platforms", "arm", "menu.lst.armv7_a15ve")
+        debug.verbose("writing menu.lst in build directory: %s" %
+                menulst_fullpath)
+        self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
+        debug.verbose("building proper gem5 image")
+        debug.checkcmd(["make", IMAGE_NAME], cwd=self.builddir)
+
 
 # SK: did not test this yet, but should work
 # @machines.add_machine
@@ -200,37 +121,6 @@ class Gem5MachineARMSingleCore(Gem5MachineARM):
     def get_cores_per_socket(self):
         return 1
 
-    def setup(self, builddir=None):
-        self.builddir = builddir
-
-    def get_free_port(self):
-        import socket
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.bind(('', 0))
-        # extract port from addrinfo
-        self.telnet_port = s.getsockname()[1]
-        s.close()
-
-    def _write_menu_lst(self, data, path):
-        debug.verbose('writing %s' % path)
-        debug.debug(data)
-        f = open(path, 'w')
-        f.write(data)
-        # TODO: provide mmap properly somehwere (machine data?)
-        f.write("mmap map 0x80000000 0x20000000 1\n")
-        f.close()
-
-    def set_bootmodules(self, modules):
-        super(Gem5MachineARMSingleCore, self).set_bootmodules(modules)
-        debug.verbose("writing menu.lst in build directory")
-        menulst_fullpath = os.path.join(self.builddir,
-                "platforms", "arm", "menu.lst.armv7_a15ve")
-        debug.verbose("writing menu.lst in build directory: %s" %
-                menulst_fullpath)
-        self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
-        debug.verbose("building proper gem5 image")
-        debug.checkcmd(["make", IMAGE_NAME], cwd=self.builddir)
-
     def _get_cmdline(self):
         self.get_free_port()
         script_path = \
index d876a1c..f871f3f 100644 (file)
@@ -9,7 +9,7 @@
 
 import debug, machines, eth_machinedata
 import subprocess, os, socket, sys, shutil, tempfile, pty
-from machines import Machine
+from machines import ARMMachineBase
 from eth import ETHBaseMachine
 
 PANDA_ROOT='/mnt/local/nfs/pandaboot'
@@ -18,10 +18,10 @@ PANDA_PORT=10000
 TOOLS_PATH='/home/netos/tools/bin'
 RACKBOOT=os.path.join(TOOLS_PATH, 'rackboot.sh')
 RACKPOWER=os.path.join(TOOLS_PATH, 'rackpower')
-IMAGE_NAME="armv7_pandaboard_image.bin"
+IMAGE_NAME="armv7_omap44xx_image.bin"
 
 @machines.add_machine
-class PandaboardMachine(Machine):
+class PandaboardMachine(ARMMachineBase):
     '''Machine to run tests on locally attached pandaboard. Assumes your
     pandaboard's serial port is attached to /dev/ttyUSB0'''
     name = 'panda_local'
@@ -50,26 +50,17 @@ class PandaboardMachine(Machine):
             self.tftp_dir = tempfile.mkdtemp(prefix="panda_")
         return self.tftp_dir
 
-    def _write_menu_lst(self, data, path):
-        debug.verbose('writing %s' % path)
-        debug.debug(data)
-        f = open(path, 'w')
-        f.write(data)
-        # TODO: provide mmap properly somehwere (machine data?)
-        f.write("mmap map 0x80000000 0x40000000 1\n")
-        f.close()
-
     def set_bootmodules(self, modules):
         menulst_fullpath = os.path.join(self.builddir,
-                "platforms", "arm", "menu.lst.armv7_pandaboard")
+                "platforms", "arm", "menu.lst.armv7_omap44xx")
         self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
         debug.verbose("building proper pandaboard image")
         debug.checkcmd(["make", IMAGE_NAME], cwd=self.builddir)
 
     def __usbboot(self):
-        imagename = os.path.join(self.builddir, IMAGE_NAME)
         debug.verbose("Usbbooting pandaboard; press reset")
-        debug.checkcmd(["usbboot", imagename])
+        debug.verbose("build dir: %s" % self.builddir)
+        debug.checkcmd(["make", "usbboot_panda"], cwd=self.builddir)
 
     def _get_console_status(self):
         # for Pandaboards we cannot do console -i <machine> so we grab full -i
@@ -116,7 +107,7 @@ class PandaboardMachine(Machine):
         return self.console_out
 
 
-class ETHRackPandaboardMachine(ETHBaseMachine):
+class ETHRackPandaboardMachine(ETHBaseMachine, ARMMachineBase):
     _machines = eth_machinedata.pandaboards
 
     def __init__(self, options):
@@ -144,18 +135,9 @@ class ETHRackPandaboardMachine(ETHBaseMachine):
             self.__chmod_ar(self._tftp_dir)
         return self._tftp_dir
 
-    def _write_menu_lst(self, data, path):
-        debug.verbose('writing %s' % path)
-        debug.debug(data)
-        f = open(path, 'w')
-        f.write(data)
-        # TODO: provide mmap properly somehwere (machine data?)
-        f.write("mmap map 0x80000000 0x40000000 1\n")
-        f.close()
-
     def set_bootmodules(self, modules):
         menulst_fullpath = os.path.join(self.builddir,
-                "platforms", "arm", "menu.lst.armv7_pandaboard")
+                "platforms", "arm", "menu.lst.armv7_omap44xx")
         self._write_menu_lst(modules.get_menu_data("/"), menulst_fullpath)
         source_name = os.path.join(self.builddir, IMAGE_NAME)
         self.target_name = os.path.join(self.get_tftp_dir(), IMAGE_NAME)
index 057aaad..b77e775 100644 (file)
@@ -1,15 +1,15 @@
 ##########################################################################
-# Copyright (c) 2009, 2010, 2011, ETH Zurich.
+# Copyright (c) 2009-2016 ETH Zurich.
 # All rights reserved.
 #
 # This file is distributed under the terms in the attached LICENSE file.
 # If you do not find this file, copies can be found by writing to:
-# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
+# ETH Zurich D-INFK, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group.
 ##########################################################################
 
 import os, signal, tempfile, subprocess, shutil
 import debug, machines
-from machines import Machine
+from machines import Machine, ARMMachineBase
 
 QEMU_SCRIPT_PATH = 'tools/qemu-wrapper.sh' # relative to source tree
 GRUB_IMAGE_PATH = 'tools/grub-qemu.img' # relative to source tree
@@ -177,7 +177,7 @@ class QEMUMachineX32Multiproc(QEMUMachineX32):
         return 4
 
 @machines.add_machine
-class QEMUMachineARMv7Uniproc(QEMUMachineBase):
+class QEMUMachineARMv7Uniproc(QEMUMachineBase, ARMMachineBase):
     '''Uniprocessor ARMv7 QEMU'''
     name = 'qemu_armv7'
 
@@ -192,6 +192,9 @@ class QEMUMachineARMv7Uniproc(QEMUMachineBase):
     def get_platform(self):
         return 'a15ve'
 
+    def _write_menu_lst(self, data, path):
+        ARMMachineBase._write_menu_lst(self, data, path)
+
     def set_bootmodules(self, modules):
         # store path to kernel for _get_cmdline to use
         self.kernel_img = os.path.join(self.options.buildbase,
@@ -202,8 +205,6 @@ class QEMUMachineARMv7Uniproc(QEMUMachineBase):
         menulst_fullpath = os.path.join(self.builddir,
                 "platforms", "arm", "menu.lst.armv7_a15ve")
         self._write_menu_lst(modules.get_menu_data('/'), menulst_fullpath)
-        with open(menulst_fullpath, 'a') as m:
-            m.write("mmap map 0x80000000  0x20000000 1")
 
         # produce ROM image
         debug.verbose("Building QEMU image.")
@@ -215,7 +216,7 @@ class QEMUMachineARMv7Uniproc(QEMUMachineBase):
         return ([qemu_wrapper, '--arch', 'a15ve', '--image', self.kernel_img])
 
 @machines.add_machine
-class QEMUMachineZynq7(QEMUMachineBase):
+class QEMUMachineZynq7(QEMUMachineBase, ARMMachineBase):
     '''Zynq7000 as modelled by QEMU'''
     name = 'qemu_armv7_zynq7'
 
@@ -230,6 +231,9 @@ class QEMUMachineZynq7(QEMUMachineBase):
     def get_platform(self):
         return 'zynq7'
 
+    def _write_menu_lst(self, data, path):
+        ARMMachineBase._write_menu_lst(self, data, path)
+
     def set_bootmodules(self, modules):
         # store path to kernel for _get_cmdline to use
         self.kernel_img = os.path.join(self.options.buildbase,
@@ -240,8 +244,6 @@ class QEMUMachineZynq7(QEMUMachineBase):
         menulst_fullpath = os.path.join(self.builddir,
                 "platforms", "arm", "menu.lst.armv7_zynq7")
         self._write_menu_lst(modules.get_menu_data('/'), menulst_fullpath)
-        with open(menulst_fullpath, 'a') as m:
-            m.write("mmap map 0x00000000 0x40000000 1")
 
         # produce ROM image
         debug.verbose("Building QEMU image.")