----------------------------------------------------------------------
[ buildTechNoteWithDeps "Glossary.tex" "TN-001-Glossary.pdf" False False []
- [ Str "runghc", In SrcTree "src" "Main.hs", Str ">",
+ [ Str Config.runghc, In SrcTree "src" "Main.hs", Str ">",
Out "tools" "/tmp/gloss-from-haskell.tex", NL ]
]
\begin{versionhistory}
\vhEntry{1.0}{3.06.2010}{TR}{Initial version}
\vhEntry{1.1}{11.04.2010}{TR}{Support for out-of-tree builds}
+\vhEntry{1.2}{03.07.2015}{TR}{Added platform and boot constructs}
\end{versionhistory}
% \intro{Abstract} % Insert abstract here
$ cd /home/barrelfish/src
$ mkdir ../build
$ cd ../build
-$ ../src/hake/hake.sh -s ../src
-...
-$ make -j 32
+$ ../src/hake/hake.sh -s ../src -a x86_64
...
\end{verbatim}
+Type \texttt{make help-platforms} for a list of platforms you can now
+build for, and \texttt{make help-boot} for a list of options for
+booting Barrelfish under simulation if you don't want to use real
+hardware.
+
+You can supply multiple \texttt{-a} options to build for multiple
+architectures at the same time.
+
Edit the file \texttt{symbolic\_targets.mk} in your build directory to
add extra make targets.
\section{How to think about hake}
+Hake builds a single, very large \texttt{Makefile} which
+\texttt{make} can then use to build any part of Barrelfish.
+
Hake is essentially a Haskell embedded domain-specific language,
except that it is also evaluated dyanically (using the
\texttt{System.Eval.Haskell} package) and written by scattering code
no use of Make variables or generic Make rules, instead it simply
includes explicit rules to build every file required for Barrelfish.
+The Makefile also includes comments to help you locate the make rules
+generated from any particular Hakefile.
+
\section{Motivation and Design Principles}
\paragraph{Hake should be a full programming language.} The lesson
}
]
\end{verbatim}
+
+Finally, there are two other kinds of high-level construct that Hake
+provides. One is a \texttt{platform} -- a collection of related files
+to build to support a given hardware configuration. Here is the
+(pretty minimal) specification for the ARMv5 test platform - just the
+CPU driver and its bootable image:
+\begin{verbatim}
+[ platform "ARMv5" [ "armv5" ]
+ ([ ("armv5", "/sbin/" ++ f) | f <- [ "cpu", "cpu.bin" ]])
+ "Very basic ARMv5 configuration for testing",
+]
+\end{verbatim}
+The first argument is the name of the platform (``\texttt{ARMv5}''),
+the second is a set of architectures which must be built (and
+configured) for this platform. The third argument is a list of
+pathnames in the build tree of files which must be built, and the
+final argument is a description to be printed by \texttt{make
+ help-platforms}.
+
+The final high-level construct is a ``\texttt{boot}'' - a make target
+that boots Barrelfish in some kind of emulator. Examples can be found
+in \texttt{/platforms/Hakefile}.
+
This should be all you need to know to write simple Hakefile{s} for
the Barrelfish, and indeed to understand most of the Hakefile{s} in
the Barrelfish tree.
data HRule = Rule [ RuleToken ]
| Include RuleToken
| Error String
+ | Phony String Bool [ RuleToken ]
| Rules [ HRule ]
deriving (Show,Typeable)
\end{verbatim}
The \texttt{Error} constructor is used to signal errors, but in
practice is rarely used.
+The \texttt{Phony} constructor is used to create rules whose target is
+not actually a file. This should hardly ever be used in practice:
+right now, it is only used for defining ``platforms'' and ``boots''
+(see below).
+
An actual basic Makefile rule is constructed by \texttt{Rule} as a
list of \texttt{RuleToken}s. The declaration of \texttt{RuleToken}
is:
let
figoutput f = "/tmp/" ++ f ++ ".pdf"
- circo f = [ Str "circo", Str "-Tpdf",
+ circo f = [ Str Config.circo, Str "-Tpdf",
In SrcTree "src" (f ++ ".circo"), Str "-o", Out "tools" (figoutput f), NL ]
- dot f = [ Str "dot", Str "-Tpdf",
+ dot f = [ Str Config.dot, Str "-Tpdf",
In SrcTree "src" (f ++ ".dot"), Str "-o", Out "tools" (figoutput f), NL ]
in
[ buildTechNoteWithDeps "Spec.tex" "TN-010-Spec.pdf" True False []
let
figoutput f = "/tmp/" ++ f ++ ".pdf"
- dot f = [ Str "dot", Str "-Tpdf",
+ dot f = [ Str Config.dot, Str "-Tpdf",
In SrcTree "src" (f ++ ".dot"), Str "-o", Out "tools" (figoutput f), NL ]
in
[ buildTechNoteWithDeps "CapMgmt.tex" "TN-013-CapabilityManagement.pdf" True False []
figoutput f = "/tmp/" ++ f ++ ".pdf"
-- Fix issues with modified LD_LIBRARY_PATH breaking inkscape, -SG, 9/1/13
- inkscape f = [ Str "LD_LIBRARY_PATH=", Str "inkscape", Str "-D", Str "-A",
+ inkscape f = [ Str "LD_LIBRARY_PATH=", Str Config.inkscape, Str "-D", Str "-A",
Out "tools" (figoutput f), In SrcTree "src" ("figures/" ++ f ++ ".svg"), NL ]
in
[ buildTechNote "disk-driver-report.tex" "TN-015-DiskDriverArchitecture.pdf" True False
--- /dev/null
+--------------------------------------------------------------------------
+-- Copyright (c) 2015, 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, Universitätstr. 6, CH-8092 Zurich. Attn: Systems Group.
+--
+-- Hakefile for /platforms/x86
+--
+--------------------------------------------------------------------------
+
+[
+ platform "Documentation" []
+ [ ("docs", "/" ++ f) | f <- [
+ "TN-000-Overview.pdf",
+ "TN-001-Glossary.pdf",
+ "TN-002-Mackerel.pdf",
+ "TN-003-Hake.pdf",
+ "TN-004-VirtualMemory.pdf",
+ "TN-005-SCC.pdf",
+ "TN-006-Routing.pdf",
+ "TN-008-Tracing.pdf",
+ "TN-009-Notifications.pdf",
+ "TN-010-Spec.pdf",
+ "TN-011-IDC.pdf",
+ "TN-012-Services.pdf",
+ "TN-013-CapabilityManagement.pdf",
+ "TN-014-bulk-transfer.pdf",
+ "TN-015-DiskDriverArchitecture.pdf",
+ "TN-016-Serial.pdf",
+ "TN-017-ARM.pdf",
+ "TN-018-PracticalGuide.pdf",
+ "TN-019-DeviceDriver.pdf" ]]
+ "Documentation for Barrelfish"
+]
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on ARMv6K ISA.
--
arch = "arm11mp"
archFamily = "arm"
-compiler = "arm-none-linux-gnueabi-gcc"
-objcopy = "arm-none-linux-gnueabi-objcopy"
-objdump = "arm-none-linux-gnueabi-objdump"
-ar = "arm-none-linux-gnueabi-ar"
-ranlib = "arm-none-linux-gnueabi-ranlib"
-cxxcompiler = "arm-none-linux-gnueabi-g++"
+compiler = Config.arm_cc
+objcopy = Config.arm_objcopy
+objdump = Config.arm_objdump
+ar = Config.arm_ar
+ranlib = Config.arm_ranlib
+cxxcompiler = Config.arm_cxx
ourCommonFlags = [ Str "-fno-unwind-tables",
Str "-Wno-packed-bitfield-compat",
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on ARMv5 ISA.
--
arch = "armv5"
archFamily = "arm"
-compiler = "arm-linux-gnueabi-gcc"
-objcopy = "arm-linux-gnueabi-objcopy"
-objdump = "arm-linux-gnueabi-objdump"
-ar = "arm-linux-gnueabi-ar"
-ranlib = "arm-linux-gnueabi-ranlib"
-cxxcompiler = "arm-linux-gnueabi-g++"
+compiler = Config.arm_cc
+objcopy = Config.arm_objcopy
+objdump = Config.arm_objdump
+ar = Config.arm_ar
+ranlib = Config.arm_ranlib
+cxxcompiler = Config.arm_cxx
ourCommonFlags = [ Str "-fno-unwind-tables",
Str "-Wno-packed-bitfield-compat",
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on ARMv5 ISA.
--
arch = "armv7"
archFamily = "arm"
-compiler = "arm-linux-gnueabi-gcc"
-objcopy = "arm-linux-gnueabi-objcopy"
-objdump = "arm-linux-gnueabi-objdump"
-ar = "arm-linux-gnueabi-ar"
-ranlib = "arm-linux-gnueabi-ranlib"
-cxxcompiler = "arm-linux-gnueabi-g++"
+compiler = Config.arm_cc
+objcopy = Config.arm_objcopy
+objdump = Config.arm_objdump
+ar = Config.arm_ar
+ranlib = Config.arm_ranlib
+cxxcompiler = Config.arm_cxx
ourCommonFlags = [ Str "-fno-unwind-tables",
Str "-Wno-packed-bitfield-compat",
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on ARMv7-M ISA.
--
arch = "armv7-m"
archFamily = "arm"
-compiler = "arm-linux-gnueabi-gcc"
-objcopy = "arm-linux-gnueabi-objcopy"
-objdump = "arm-linux-gnueabi-objdump"
-ar = "arm-linux-gnueabi-ar"
-ranlib = "arm-linux-gnueabi-ranlib"
-cxxcompiler = "arm-linux-gnueabi-g++"
+compiler = Config.arm_cc
+objcopy = Config.arm_objcopy
+objdump = Config.arm_objdump
+ar = Config.arm_ar
+ranlib = Config.arm_ranlib
+cxxcompiler = Config.arm_cxx
ourCommonFlags = [ Str "-fno-unwind-tables",
Str "-Wno-packed-bitfield-compat",
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Default architecture-specific definitions for Barrelfish
--
"-Wstrict-prototypes",
"-Wold-style-definition",
"-Wmissing-prototypes" ] ]
- ++ [ ContStr Config.use_fp "-fno-omit-frame-pointer" ""]
+ ++ [ Str (if Config.use_fp then "-fno-omit-frame-pointer" else "") ]
commonCxxFlags = [ Str s | s <- [ "-nostdinc++",
"-fexceptions",
"-DLIBCXX_CXX_ABI=libcxxabi",
"-I" ] ]
++ [ NoDep SrcTree "src" "/include/cxx" ]
- ++ [ ContStr Config.use_fp "-fno-omit-frame-pointer" ""]
+ ++ [ Str (if Config.use_fp then "-fno-omit-frame-pointer" else "") ]
cFlags = [ Str s | s <- [ "-Wno-packed-bitfield-compat" ] ]
++ commonCFlags
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Arguments to major Hake targets
--
architectures = allArchitectures
}
-allArchitectures = [ "x86_64", "x86_32", "armv5", "arm11mp", "scc", "xscale", "armv7", "armv7-m", "k1om" ]
-allArchitectureFamilies = [ "x86_64", "x86_32", "arm", "scc", "k1om" ]
+allArchitectures = [ "x86_64", "x86_32", "armv5", "arm11mp", "xscale", "armv7", "armv7-m", "k1om" ]
+allArchitectureFamilies = [ "x86_64", "x86_32", "arm", "k1om" ]
-- architectures that currently support THC
-thcArchitectures = ["x86_64", "x86_32", "scc"]
+thcArchitectures = ["x86_64", "x86_32"]
-- all known flounder backends that we might want to generate defs for
allFlounderBackends
--------------------------------------------------------------------------
--- Copyright (c) 2007-2010, 2012, 2013, ETH Zurich.
+-- Copyright (c) 2007-2010, 2012, 2013, 2015 ETH Zurich.
-- Copyright (c) 2014, HP Labs.
-- All rights reserved.
--
import qualified Args
import Data.List
+--
+-- Toolchain definitions. By default, these rely on $PATH
+--
+arm_cc = "arm-linux-gnueabi-gcc"
+arm_objcopy = "arm-linux-gnueabi-objcopy"
+arm_objdump = "arm-linux-gnueabi-objdump"
+arm_ar = "arm-linux-gnueabi-ar"
+arm_ranlib = "arm-linux-gnueabi-ranlib"
+arm_cxx = "arm-linux-gnueabi-g++"
+
+x86_cc = "gcc"
+x86_cxx = "g++"
+
+k1om_cc = "k1om-mpss-linux-gcc"
+k1om_objcopy = "k1om-mpss-linux-objcopy"
+k1om_objdump = "k1om-mpss-linux-objdump"
+k1om_ar = "k1om-mpss-linux-ar"
+k1om_ranlib = "k1om-mpss-linux-anlib"
+k1om_cxx = "k1om-mpss-linux-g++"
+
+gem5 = "gem5.fast"
+runghc = "runghc" -- run GHC interactively
+circo = "circo" -- from graphviz
+dot = "dot" -- " "
+inkscape = "inkscape"
+
+
-- path to source and install directories; these are automatically set by hake.sh at setup time
source_dir :: String
-- source_dir = undefined -- (set by hake.sh, see end of file)
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Basic Hake rule combinators
--
data HRule = Rule [ RuleToken ]
| Include RuleToken
| Error String
+ | Phony String Bool [ RuleToken ]
| Rules [ HRule ]
deriving (Show,Typeable)
isFileRef :: RuleToken -> Bool
isFileRef (Str _ ) = False
isFileRef (NStr _ ) = False
-isFileRef (ContStr _ _ _) = False
isFileRef (ErrorMsg _) = False
isFileRef NL = False
isFileRef _ = True
formatToken (Target a f) = f ++ " "
formatToken (Str s) = s ++ " "
formatToken (NStr s) = s
-formatToken (ContStr True s _) = s ++ " "
-formatToken (ContStr False _ s) = s ++ " "
formatToken (ErrorMsg s) = "$(error " ++ s ++ ")"
formatToken (NL) = "\n\t"
-
-------------------------------------------------------------------------
--
-- Data type for default options to compilers, assemblers, dependency
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on x86_mic.
--
arch = "k1om"
archFamily = "k1om"
-compiler = "k1om-mpss-linux-gcc"
-objcopy = "k1om-mpss-linux-objcopy"
-objdump = "k1om-mpss-linux-objdump"
-ar = "k1om-mpss-linux-ar"
-ranlib = "k1om-mpss-linux-anlib"
-cxxcompiler = "k1om-mpss-linux-g++"
-
+compiler = Config.k1om_cc
+objcopy = Config.k1om_objcopy
+objdump = Config.k1om_objdump
+ar = Config.k1om_ar
+ranlib = Config.k1om_ranlib
+cxxcompiler = Config.k1om_cxx
ourCommonFlags = [ Str "-m64",
Str "-mno-red-zone",
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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
-}
resolveRelativePaths o (Include token) root
= Include ( resolveRelativePath o token root )
resolveRelativePaths o (Error s) root
- = (Error s)
-
+ = Error s
+resolveRelativePaths o (Phony name dbl tokens) root
+ = Phony name dbl [ resolveRelativePath o t root | t <- tokens ]
--- Now resolve at the level of individual rule tokens. At this
--- level, we need to take into account the tree (source, build, or
(Target a (resolveRelativePathName o BuildTree a f root))
resolveRelativePath _ (Str s) _ = (Str s)
resolveRelativePath _ (NStr s) _ = (NStr s)
-resolveRelativePath _ (ContStr b s1 s2) _ = (ContStr b s1 s2)
resolveRelativePath _ (ErrorMsg s) _ = (ErrorMsg s)
resolveRelativePath _ NL _ = NL
---- Now we get down to the nitty gritty. We have a tree (source,
---- build, or install), an architecture (e.g. ARM), a pathname, and
---- the pathname of the Hakefile in which it occurs.
-
+--- Now we get down to the nitty gritty. We have, in order:
+--- o: The options in force.
+--- t: The tree (source, build, or install)
+--- a: The architecture (e.g. armv7)
+--- p: The pathname we want to resolve to a full path, and
+--- h: The dirname of the Hakefile in which it occurs.
+--- If the tree is SrcTree or the architecture is "root", everything
+--- is relative to the top-level directory for that tree. Otherwise,
+--- it's relative to the top-level directory plus the architecture.
resolveRelativePathName :: Opts -> TreeRef -> String -> String -> String -> String
-resolveRelativePathName o InstallTree "root" f root =
- resolveRelativePathName' ((opt_installdir o)) "root" f root
-resolveRelativePathName o _ "root" f root =
- "." ./. f
-resolveRelativePathName o SrcTree a f root =
- resolveRelativePathName' (opt_sourcedir o) a f root
-resolveRelativePathName o BuildTree a f root =
- resolveRelativePathName' ("." ./. a) a f root
-resolveRelativePathName o InstallTree a f root =
- resolveRelativePathName' ((opt_installdir o) ./. a) a f root
-
---- This is where the work is done: take 'root' (pathname relative to
+
+resolveRelativePathName o SrcTree "root" f h =
+ resolveRelativePathName' ((opt_sourcedir o)) f h
+resolveRelativePathName o BuildTree "root" f h =
+ resolveRelativePathName' "." f h
+resolveRelativePathName o InstallTree "root" f h =
+ resolveRelativePathName' ((opt_installdir o)) f h
+
+resolveRelativePathName o SrcTree a f h =
+ resolveRelativePathName' (opt_sourcedir o) f h
+resolveRelativePathName o BuildTree a f h =
+ resolveRelativePathName' ("." ./. a) f h
+resolveRelativePathName o InstallTree a f h =
+ resolveRelativePathName' ((opt_installdir o) ./. a) f h
+
+--- This is where the work is done: take 'hd' (pathname relative to
--- us of the Hakefile) and resolve the filename we're interested in
--- relative to this. This gives us a pathname relative to some root
--- of some architecture tree, then return this relative to the actual
--- tree we're interested in. It's troubling that this takes more
--- bytes to explain than to code.
-resolveRelativePathName' d a f root =
- let af = Path.relToFile f root
+--- d: Pathname of top directory of the tree (source, build, install)
+--- f: Filename we are interested in, relative to 'root' below
+--- hd: Directory containing the Hakefile
+---
+resolveRelativePathName' d f hd =
+ let af = Path.relToFile f hd
rf = Path.makeRel $ Path.relToDir af "/"
in Path.relToDir rf d
Just d -> [d]
makeDirs1 (Rule toks) = [d | Just d <- [ tokDir t | t <- toks ]]
makeDirs1 (Error s) = []
+makeDirs1 (Phony name dbl toks) = [d | Just d <- [ tokDir t | t <- toks ]]
tokDir :: RuleToken -> Maybe String
tokDir (In t a f) = tokDir1 f
tokDir (Target a f) = tokDir1 f
tokDir (Str s) = Nothing
tokDir (NStr s) = Nothing
-tokDir (ContStr b s1 s2) = Nothing
tokDir (ErrorMsg s) = Nothing
tokDir NL = Nothing
makeMakefileSection fname rules =
"# From: " ++ fname ++ "\n\n" ++ makeMakeRules rules
+-- Format a rule or rules, of any type (including errors, inclusions,
+-- etc.). See makeMakeRules1 below for how to format rule tokens
+-- properly
makeMakeRules :: HRule -> String
makeMakeRules (Rules hrules)
= unlines [ s | s <- [ makeMakeRules h | h <- hrules ], s /= "" ]
"include " ++ (formatToken token),
"endif"]
makeMakeRules (Error s) = "$(error " ++ s ++ ")\n"
-makeMakeRules (Rule tokens) =
- let outs = nub [ f | (Out a f) <- tokens ] ++ [ f | (Target a f) <- tokens ]
+makeMakeRules (Phony name dbl tokens)
+ = ".PHONY: " ++ name ++ "\n" ++ makeMakeRules1 ([ Target "build" name ] ++ tokens) dbl
+makeMakeRules (Rule tokens) = makeMakeRules1 tokens False
+
+-- Now we get down to brass tacks. Format a rule proper. Sort out
+-- which tokens needs to be in the rule head, dependencies, body, etc.
+-- `dbl` specifies a double-colon rule, which is typically used for
+-- Phony rules generated as part of the help system.
+makeMakeRules1 :: [RuleToken] -> Bool -> String
+makeMakeRules1 tokens dbl =
+ let outs = nub [ f | (Out a f) <- tokens ]
+ ++ [ f | (Target a f) <- tokens ]
dirs = nub [ (Path.dirname f) ./. ".marker" | f <- outs ]
deps = nub [ f | (In t a f) <- tokens ] ++ [ f | (Dep t a f) <- tokens ]
predeps = nub [ f | (PreDep t a f) <- tokens ]
in if outs == [] then
("# hake: omitted rule with no output: " ++ ruleBody)
else
- (spaceSep outs) ++ ": "
+ (spaceSep outs) ++ (if dbl then ":: " else ": ")
++
-- It turns out that if you add 'dirs' here, in an attempt to
-- get Make to build the directories as well, it goes a bit
hakeModule :: [String] -> [(String,String)] -> String
hakeModule allfiles hakefiles =
- let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args"]
+ let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args" ]
qual_imports = ["Config", "Data.List" ]
relfiles = [ stripSrcDir f | f <- allfiles ]
wrap1 n c = wrapLet "build a"
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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
-}
module Path (dirname, basename,
import qualified X86_64
import qualified K1om
import qualified X86_32
-import qualified SCC
import qualified ARMv5
import qualified ARM11MP
import qualified XScale
options "x86_64" = X86_64.options
options "k1om" = K1om.options
options "x86_32" = X86_32.options
-options "scc" = SCC.options
options "armv5" = ARMv5.options
options "arm11mp" = ARM11MP.options
options "xscale" = XScale.options
options "armv7" = ARMv7.options
options "armv7-m" = ARMv7_M.options
+-- Remove this...
+options "scc" = X86_32.options
kernelCFlags "x86_64" = X86_64.kernelCFlags
kernelCFlags "k1om" = K1om.kernelCFlags
kernelCFlags "x86_32" = X86_32.kernelCFlags
-kernelCFlags "scc" = SCC.kernelCFlags
kernelCFlags "armv5" = ARMv5.kernelCFlags
kernelCFlags "arm11mp" = ARM11MP.kernelCFlags
kernelCFlags "xscale" = XScale.kernelCFlags
kernelLdFlags "x86_64" = X86_64.kernelLdFlags
kernelLdFlags "k1om" = K1om.kernelLdFlags
kernelLdFlags "x86_32" = X86_32.kernelLdFlags
-kernelLdFlags "scc" = SCC.kernelLdFlags
kernelLdFlags "armv5" = ARMv5.kernelLdFlags
kernelLdFlags "arm11mp" = ARM11MP.kernelLdFlags
kernelLdFlags "xscale" = XScale.kernelLdFlags
| optArch opts == "x86_64" = X86_64.cCompiler opts phase src obj
| optArch opts == "k1om" = K1om.cCompiler opts phase src obj
| optArch opts == "x86_32" = X86_32.cCompiler opts phase src obj
- | optArch opts == "scc" = SCC.cCompiler opts phase src obj
| optArch opts == "armv5" = ARMv5.cCompiler opts phase src obj
| optArch opts == "arm11mp" = ARM11MP.cCompiler opts phase src obj
| optArch opts == "xscale" = XScale.cCompiler opts phase src obj
K1om.makeDepend opts phase src obj depfile
| optArch opts == "x86_32" =
X86_32.makeDepend opts phase src obj depfile
- | optArch opts == "scc" =
- SCC.makeDepend opts phase src obj depfile
| optArch opts == "armv5" =
ARMv5.makeDepend opts phase src obj depfile
| optArch opts == "arm11mp" =
| optArch opts == "x86_64" = X86_64.cToAssembler opts phase src afile objdepfile
| optArch opts == "k1om" = K1om.cToAssembler opts phase src afile objdepfile
| optArch opts == "x86_32" = X86_32.cToAssembler opts phase src afile objdepfile
- | optArch opts == "scc" = SCC.cToAssembler opts phase src afile objdepfile
| optArch opts == "armv5" = ARMv5.cToAssembler opts phase src afile objdepfile
| optArch opts == "arm11mp" = ARM11MP.cToAssembler opts phase src afile objdepfile
| optArch opts == "xscale" = XScale.cToAssembler opts phase src afile objdepfile
| optArch opts == "x86_64" = X86_64.assembler opts src obj
| optArch opts == "k1om" = K1om.assembler opts src obj
| optArch opts == "x86_32" = X86_32.assembler opts src obj
- | optArch opts == "scc" = SCC.assembler opts src obj
| optArch opts == "armv5" = ARMv5.assembler opts src obj
| optArch opts == "arm11mp" = ARM11MP.assembler opts src obj
| optArch opts == "xscale" = XScale.assembler opts src obj
| optArch opts == "x86_64" = X86_64.archive opts objs libs name libname
| optArch opts == "k1om" = K1om.archive opts objs libs name libname
| optArch opts == "x86_32" = X86_32.archive opts objs libs name libname
- | optArch opts == "scc" = SCC.archive opts objs libs name libname
| optArch opts == "armv5" = ARMv5.archive opts objs libs name libname
| optArch opts == "arm11mp" = ARM11MP.archive opts objs libs name libname
| optArch opts == "xscale" = XScale.archive opts objs libs name libname
| optArch opts == "x86_64" = X86_64.linker opts objs libs bin
| optArch opts == "k1om" = K1om.linker opts objs libs bin
| optArch opts == "x86_32" = X86_32.linker opts objs libs bin
- | optArch opts == "scc" = SCC.linker opts objs libs bin
| optArch opts == "armv5" = ARMv5.linker opts objs libs bin
| optArch opts == "arm11mp" = ARM11MP.linker opts objs libs bin
| optArch opts == "xscale" = XScale.linker opts objs libs bin
| optArch opts == "x86_64" = X86_64.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
| optArch opts == "k1om" = K1om.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
| optArch opts == "x86_32" = X86_32.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
- | optArch opts == "scc" = SCC.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
| optArch opts == "armv5" = ARMv5.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
| optArch opts == "arm11mp" = ARM11MP.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
| optArch opts == "xscale" = XScale.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
cpuDriverBuildFn :: [String] -> String -> Args.Args -> HRule
cpuDriverBuildFn af tf args = Rules []
+--
+-- Build a platform
+--
+platform :: String -> [ String ] -> [ ( String, String ) ] -> String -> HRule
+platform name archs files docstr =
+ if null $ archs Data.List.\\ Config.architectures then
+ Rules [
+ Phony name False
+ ([ NStr "@echo 'Built platform <", NStr name, NStr ">'" ] ++
+ [ Dep BuildTree arch file | (arch,file) <- files ]) ,
+ Phony "help-platforms" True
+ [ Str "@echo \"", NStr name, Str ":\\n\\t", NStr docstr, Str "\"" ]
+ ]
+ else
+ Rules []
+
+--
+-- Boot an image.
+-- name: the boot target name
+-- archs: list of architectures required
+-- tokens: the hake tokens for the target
+-- docstr: description of the target
+--
+boot :: String -> [ String ] -> [ RuleToken ] -> String -> HRule
+boot name archs tokens docstr =
+ if null $ archs Data.List.\\ Config.architectures then
+ Rules [
+ Phony name False tokens,
+ Phony "help-boot" True
+ [ Str "@echo \"", NStr name, Str ":\\n\\t", NStr docstr, Str "\"" ]
+ ]
+ else
+ Rules []
+
+--
+-- Copy a file from the source tree
+--
+copyFile :: TreeRef -> String -> String -> String -> String -> HRule
+copyFile stree sarch spath darch dpath =
+ Rule [ Str "cp", Str "-v", In stree sarch spath, Out darch dpath ]
+
+++ /dev/null
---------------------------------------------------------------------------
--- Copyright (c) 2007-2011, 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.
---
--- Architectural definitions for Barrelfish on Single Chip Cloud (SCC).
---
---------------------------------------------------------------------------
-
-module SCC where
-
-import HakeTypes
-import Path
-import qualified Config
-import qualified ArchDefaults
-import qualified X86_32
-
--------------------------------------------------------------------------
---
--- Architecture specific definitions for SCC
---
--------------------------------------------------------------------------
-
-arch = "scc"
-archFamily = "x86_32"
-compiler = "gcc"
-cxxcompiler = "g++"
-
-ourCommonFlags = [ Str "-m32",
- Str "-mno-red-zone",
- Str "-fPIE",
- Str "-fno-stack-protector",
- Str "-D__scc__",
- Str "-D__x86__",
- Str "-Wno-unused-but-set-variable",
- Str "-march=pentium" ]
-
-
-commonCFlags = ArchDefaults.commonCFlags
- ++ ArchDefaults.commonFlags
- ++ ourCommonFlags
-
-commonCxxFlags = ArchDefaults.commonCxxFlags
- ++ ArchDefaults.commonFlags
- ++ ourCommonFlags
-
---
--- We inherit some flags here from X86_32, but we need to be careful.
--- If any specify arch-dependent files, such as libraries, they will
--- have dependencies on the wrong architecture. Worse, AB's hake hack
--- to file non-arch rules from the Makefile will mean they will never
--- even appear in the generated Makefile, which is very difficult to
--- debug.
---
-options = (ArchDefaults.options arch archFamily) {
- optFlags = commonCFlags,
- optCxxFlags = commonCxxFlags,
- optDefines = ArchDefaults.cDefines options,
- optLdFlags = ArchDefaults.ldFlags arch ++ X86_32.ourLdFlags,
- optLdCxxFlags = ArchDefaults.ldFlags arch ++ X86_32.ourLdFlags,
- optLibs = (ArchDefaults.stdLibs arch) ++ [ Str "-lgcc" ],
- optInterconnectDrivers = ["lmp", "ump"], -- ump needed for ump_ipi
- optFlounderBackends = ["lmp", "ump_ipi"]
- }
-
---
--- The kernel is "different"
---
-
-kernelCFlags = X86_32.kernelCFlags ++ [ Str "-march=pentium",
- Str "-D__scc__" ]
-kernelLdFlags = X86_32.kernelLdFlags
-
---
--- Compilers
---
-cCompiler = ArchDefaults.cCompiler arch compiler
-cxxCompiler = ArchDefaults.cxxCompiler arch cxxcompiler
-makeDepend = ArchDefaults.makeDepend arch compiler
-makeCxxDepend = ArchDefaults.makeCxxDepend arch cxxcompiler
-cToAssembler = ArchDefaults.cToAssembler arch compiler
-assembler = ArchDefaults.assembler arch compiler
-archive = ArchDefaults.archive arch
-linker = ArchDefaults.linker arch compiler
-cxxlinker = ArchDefaults.cxxlinker arch cxxcompiler
-
---
--- Link the kernel (CPU Driver)
---
-linkKernel :: Options -> [String] -> [String] -> String -> HRule
-linkKernel opts objs libs kbin =
- Rules [ Rule ([ Str compiler, Str Config.cOptFlags,
- NStr "-T", In BuildTree arch "/kernel/linker.lds",
- Str "-o", Out arch kbin
- ]
- ++ (optLdFlags opts)
- ++
- [ In BuildTree arch o | o <- objs ]
- ++
- [ In BuildTree arch l | l <- libs ]
- ++
- [ Str "-lgcc" ]
- ++
- [ NL, NStr "/bin/echo -e '\\0002' | dd of=",
- Out arch kbin,
- Str "bs=1 seek=16 count=1 conv=notrunc status=noxfer"
- ]
- ),
- Rule [ Str "cpp",
- NStr "-I", NoDep SrcTree "src" "/kernel/include/",
- Str "-D__ASSEMBLER__",
- Str "-P", In SrcTree "src" "/kernel/arch/x86_32/linker.lds.in",
- Out arch "/kernel/linker.lds"
- ]
- ]
--------------------------------------------------------------------------
--- Copyright (c) 2007-2010, ETH Zurich.
+-- Copyright (c) 2007-2015, 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, Universitätstr. 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on x86_32.
--
arch = "x86_32"
archFamily = "x86_32"
-compiler = "gcc"
-cxxcompiler = "g++"
+
+compiler = Config.x86_cc
+cxxcompiler = Config.x86_cxx
ourCommonFlags = [ Str "-m32",
Str "-mno-red-zone",
--
-- 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on x86_64.
--
arch = "x86_64"
archFamily = "x86_64"
-compiler = "gcc"
-cxxcompiler = "g++"
+
+compiler = Config.x86_cc
+cxxcompiler = Config.x86_cxx
ourCommonFlags = [ Str "-m64",
Str "-mno-red-zone",
--------------------------------------------------------------------------
--- Copyright (c) 2007-2013, ETH Zurich.
+-- Copyright (c) 2007-2015, 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
--
-- Architectural definitions for Barrelfish on ARMv5 ISA.
--
arch = "xscale"
archFamily = "arm"
-compiler = "arm-none-linux-gnueabi-gcc"
-objcopy = "arm-none-linux-gnueabi-objcopy"
-objdump = "arm-none-linux-gnueabi-objdump"
-ar = "arm-none-linux-gnueabi-ar"
-ranlib = "arm-none-linux-gnueabi-ranlib"
-cxxcompiler = "arm-none-linux-gnueabi-g++"
+compiler = Config.arm_cc
+objcopy = Config.arm_objcopy
+objdump = Config.arm_objdump
+ar = Config.arm_ar
+ranlib = Config.arm_ranlib
+cxxcompiler = Config.arm_cxx
ourCommonFlags = [ Str "-Wno-packed-bitfield-compat",
Str "-fno-unwind-tables",
#
# 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, Universitätstasse 6, CH-8092 Zurich. Attn: Systems Group.
##########################################################################
DFLTARCHS="\"x86_64\""
echo " argument specifying the top of the source tree."
echo ""
echo " Known architectures may include: "
- echo " x86_64 x86_32 armv5 arm11mp scc xscale armv7 armv7-m k10m"
+ echo " x86_64 x86_32 armv5 arm11mp xscale armv7 armv7-m k10m"
exit 1;
}
echo "Running hake..."
#./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -s -N -K64M -A64M -ls -lf || exit
./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -N -K64M -A64M || exit
-cat <<EOF
-OK - Hake has bootstrapped. You should now have a Makefile in this
-directory, and you can type "make" to build a predefined target.
-
-To change configuration options, edit the Config.hs file in the hake
-subdirectory of this directory and run "make rehake".
-
-To change the set of symbolic make targets available (for example, to
-build a different set of modules or architectures for your boot image),
-edit the local copy of the symbolic_targets.mk in this directory.
-EOF
+echo "Now running initial make to build dependencies."
+echo " (remove the '-j 4' if your system has trouble handling this"
+make -j 4 help
+++ /dev/null
-##########################################################################
-# Copyright (c) 2009-2015 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, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
-# Attn: Systems Group.
-#
-##########################################################################
-
-#######################################################################
-#
-# Pandaboard builds
-#
-#######################################################################
-
-PANDABOARD_MODULES=\
- armv7/sbin/cpu_omap44xx \
- armv7/sbin/init \
- armv7/sbin/mem_serv \
- armv7/sbin/monitor \
- armv7/sbin/ramfsd \
- armv7/sbin/spawnd \
- armv7/sbin/startd \
- armv7/sbin/skb \
- armv7/sbin/memtest \
- armv7/sbin/kaluga \
- armv7/sbin/fish \
- armv7/sbin/sdma \
- armv7/sbin/sdmatest \
- armv7/sbin/sdma_bench \
- armv7/sbin/bulk_sdma \
- armv7/sbin/usb_manager \
- armv7/sbin/usb_keyboard \
- armv7/sbin/serial \
- armv7/sbin/angler \
- armv7/sbin/corectrl \
-
-
-menu.lst.pandaboard: $(SRCDIR)/hake/menu.lst.pandaboard
- cp $< $@
-
-pandaboard_image: $(PANDABOARD_MODULES) \
- tools/bin/arm_molly \
- menu.lst.pandaboard
- # Translate each of the binary files we need
- $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.pandaboard molly_panda
- # Generate appropriate linker script
- cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
- molly_panda/molly_ld_script
- # Build a C file to link into a single image for the 2nd-stage
- # bootloader
- tools/bin/arm_molly menu.lst.pandaboard panda_mbi.c
- # Compile the complete boot image into a single executable
- $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
- -nostdlib -march=armv7-a -mapcs -fno-unwind-tables \
- -Tmolly_panda/molly_ld_script \
- -I$(SRCDIR)/include \
- -I$(SRCDIR)/include/arch/arm \
- -I./armv7/include \
- -I$(SRCDIR)/include/oldc \
- -I$(SRCDIR)/include/c \
- -imacros $(SRCDIR)/include/deputy/nodeputy.h \
- $(SRCDIR)/tools/arm_molly/molly_boot.S \
- $(SRCDIR)/tools/arm_molly/molly_init.c \
- $(SRCDIR)/tools/arm_molly/lib.c \
- ./panda_mbi.c \
- $(SRCDIR)/lib/elf/elf32.c \
- ./molly_panda/* \
- -o pandaboard_image
- @echo "OK - pandaboard boot image is built."
- @echo "If your boot environment is correctly set up, you can now:"
- @echo "$ usbboot ./pandaboard_image"
-
-#######################################################################
-#
-# Pandaboard build for the armv7-M slave image (to be used in conjunction with a master image)
-# (basically a normal pandaboard_image, but compiled for the cortex-m3)
-#
-#######################################################################
-
-HETEROPANDA_SLAVE_MODULES=\
- armv7-m/sbin/cpu_omap44xx \
- armv7-m/sbin/init \
- armv7-m/sbin/mem_serv \
- armv7-m/sbin/monitor \
- armv7-m/sbin/ramfsd \
- armv7-m/sbin/spawnd \
- armv7-m/sbin/startd \
- armv7-m/sbin/skb \
- armv7-m/sbin/memtest
-
-menu.lst.armv7-m: $(SRCDIR)/hake/menu.lst.armv7-m
- cp $< $@
-
-heteropanda_slave: $(HETEROPANDA_SLAVE_MODULES) \
- tools/bin/arm_molly \
- menu.lst.armv7-m
- # Translate each of the binary files we need
- $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.armv7-m molly_panda_slave
- # Generate appropriate linker script
- cpp -P -DBASE_ADDR=0x0 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
- molly_panda_slave/molly_ld_script
- # Build a C file to link into a single image for the 2nd-stage
- # bootloader
- tools/bin/arm_molly menu.lst.armv7-m panda_mbi_slave.c
- # Compile the complete boot image into a single executable
- $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
- -nostdlib -march=armv7-m -mcpu=cortex-m3 -mthumb -mapcs -fno-unwind-tables \
- -Tmolly_panda_slave/molly_ld_script \
- -I$(SRCDIR)/include \
- -I$(SRCDIR)/include/arch/arm \
- -I./armv7-m/include \
- -I$(SRCDIR)/include/oldc \
- -I$(SRCDIR)/include/c \
- -imacros $(SRCDIR)/include/deputy/nodeputy.h \
- $(SRCDIR)/tools/arm_molly/molly_boot.S \
- $(SRCDIR)/tools/arm_molly/molly_init.c \
- $(SRCDIR)/tools/arm_molly/lib.c \
- ./panda_mbi_slave.c \
- $(SRCDIR)/lib/elf/elf32.c \
- ./molly_panda_slave/* \
- -o heteropanda_slave
- @echo "OK - heteropanda slave image is built."
- @echo "you can now use this image to link into a regular pandaboard image"
-
-
-
-
-#######################################################################
-#
-# Pandaboard build for the heteropanda_master:
-# basically a regular pandaboard_image, except that it contains
-# a heteropanda_slave image, and arm_molly is called with -DHETEROPANDA
-#
-#######################################################################
-
-menu.lst.heteropanda_master: $(SRCDIR)/hake/menu.lst.heteropanda_master
- cp $< $@
-
-heteropanda_master_image: $(PANDABOARD_MODULES) \
- tools/bin/arm_molly \
- menu.lst.heteropanda_master \
- heteropanda_slave \
- $(SRCDIR)/tools/arm_molly/molly_ld_script.in
- # Translate each of the binary files we need
- $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.heteropanda_master molly_panda
- # Generate appropriate linker script
- cpp -P -DBASE_ADDR=0x82001000 $(SRCDIR)/tools/arm_molly/molly_ld_script.in \
- molly_panda/molly_ld_script
-
- # HETEROPANDA: convert slave image into a form we can insert in our image
- $(ARM_OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section \
- .data=.rodata_thumb,alloc,load,readonly,data,contents heteropanda_slave \
- molly_panda/heteropanda_slave
-
- # Build a C file to link into a single image for the 2nd-stage
- # bootloader
- tools/bin/arm_molly menu.lst.heteropanda_master panda_mbi.c
- # Compile the complete boot image into a single executable
- $(ARM_GCC) -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
- -nostdlib -march=armv7-a -mcpu=cortex-a9 -mapcs -fno-unwind-tables \
- -Tmolly_panda/molly_ld_script \
- -I$(SRCDIR)/include \
- -I$(SRCDIR)/include/arch/arm \
- -I./armv7/include \
- -I$(SRCDIR)/include/oldc \
- -I$(SRCDIR)/include/c \
- -imacros $(SRCDIR)/include/deputy/nodeputy.h \
- $(SRCDIR)/tools/arm_molly/molly_boot.S \
- $(SRCDIR)/tools/arm_molly/molly_init.c \
- $(SRCDIR)/tools/arm_molly/lib.c \
- ./panda_mbi.c \
- $(SRCDIR)/lib/elf/elf32.c \
- ./molly_panda/* \
- -DHETEROPANDA \
- -o heteropanda_master_image
- @echo "OK - heteropanda_master_image is built."
- @echo "If your boot environment is correctly set up, you can now:"
- @echo "$ usbboot ./heteropanda_master_image"
# Set default architecture to the first specified by Hake in generated Makefile.
ARCH ?= $(word 1, $(HAKE_ARCHS))
-# Set the directory to fetch include files from for this Makefile, to
-# introduce some modularity into this file. Note that hake will read
-# this file (symbolic_targets.mk) from the build directory, but this
-# file specifies its include subfiles from the source tree (unless
-# specified otherwise).
-MK ?= $(SRCDIR)/hake
-
-
-ARM_GCC?=arm-linux-gnueabi-gcc
-ARM_OBJCOPY?=arm-linux-gnueabi-objcopy
-K1OM_OBJCOPY?=k1om-mpss-linux-objcopy
-
-# upload Xeon Phi images to nfs share (leave blank to cancel)
-BARRELFISH_NFS_DIR ?="emmentaler.ethz.ch:/mnt/local/nfs/barrelfish/xeon_phi"
+# Generic help text: this is the default target.
+.PHONY: help
+help::
+ @echo "------------------------------------------------------------------"
+ @echo "This is the 'help' target for the Barrelfish Makefile. This Makefile"
+ @echo "has been generated by hake in the top-level directory of your build tree."
+ @echo "See the Hake documentation for more information."
+ @echo ""
+ @echo "This Makefile contains build targets for the following architectures:"
+ @echo ""
+ @echo "$(HAKE_ARCHS)"
+ @echo ""
+ @echo "To change configuration options, edit the Config.hs file in the hake"
+ @echo "subdirectory of this directory and run 'make rehake'."
+ @echo ""
+ @echo "To change the set of symbolic make targets available (for example, to"
+ @echo "build a different set of modules or architectures for your boot image),"
+ @echo "edit the local copy of the symbolic_targets.mk in this directory."
+ @echo ""
+ @echo "Useful make targets:"
+ @echo " - <file>: any file which can be built in the Barrelfish tree"
+ @echo " - 'help': show this help text"
+ @echo " - 'help-platforms': show the platforms (file collections) which can be built"
+ @echo " - 'help-boot': show the boot sequences which can be initiated"
+ @echo " - 'clean': remove most generated files"
+ @echo " - 'realclean': remove all generated files (clears the build tree)"
+ @echo " - 'rehake': attempt to re-run hake"
+ @echo ""
+
+# Print the list of defined platforms. Most of these will be
+# generated by Hake; this is just the preamble:
+.PHONY: help-platforms
+help-platforms::
+ @echo "------------------------------------------------------------------"
+ @echo "Platforms supported by this Makefile. Use 'make <platform name>':"
+ @echo " (these are the platforms available with your architecture choices)"
+ @echo ""
+
+# Print the list of defined boots. Most of these will be
+# generated by Hake; this is just the preamble:
+.PHONY: help-boot
+help-boot::
+ @echo "------------------------------------------------------------------"
+ @echo "Boot instructions supported by this Makefile. Use 'make <boot name>':"
+ @echo " (these are the targets available with your architecture choices)"
+ @echo ""
# All binaries of the RCCE LU benchmark
BIN_RCCE_LU= \
sbin/xcorecap \
sbin/xcorecapserv
-TESTS_k1om= \
- $(TESTS_x86) \
- sbin/tests/dma_test \
- sbin/tests/xeon_phi_inter \
- sbin/tests/xeon_phi_test \
- sbin/tests/xphi_nameservice_test
-
-
# All benchmark domains
BENCH_COMMON= \
sbin/channel_cost_bench \
sbin/sshd \
sbin/corectrl
-# SCC-specific module to build by default
-MODULES_scc=\
- sbin/cpu \
- $(BIN_RCCE_BT) \
- $(BIN_RCCE_LU) \
- sbin/rcce_pingpong \
- sbin/bench \
- sbin/eMAC \
- sbin/netd \
- sbin/NGD_mng \
- sbin/webserver \
- sbin/ipirc_test \
- sbin/thc_v_flounder_empty \
- sbin/thcidctest \
- sbin/thcminitest \
- sbin/thctest \
- sbin/mem_serv_dist \
- sbin/net-test \
- sbin/netthroughput \
- sbin/udp_throughput
-
# ARM-specific modules to build by default
MODULES_armv5=\
sbin/cpu \
$(foreach m,$(BENCH_COMMON),$(a)/$(m))) \
$(MODULES_GENERIC)
-all: $(MODULES) menu.lst
- @echo "You've just run the default ("all") target for Barrelfish"
- @echo "using Hake. The following modules have been built:"
- @echo $(MODULES)
- @echo "If you want to change this target, edit the file called"
- @echo "'symbolic_targets.mk' in your build directory."
-.PHONY: all
-
# XXX: this should be overridden in some local settings file?
INSTALL_PREFIX ?= /home/netos/tftpboot/$(USER)
+# upload Xeon Phi images to nfs share (leave blank to cancel)
+BARRELFISH_NFS_DIR ?="emmentaler.ethz.ch:/mnt/local/nfs/barrelfish/xeon_phi"
+
# Only install a binary if it doesn't exist in INSTALL_PREFIX or the modification timestamp differs
+
install: $(MODULES)
@echo ""; \
echo "Installing modules..." ; \
.PHONY: rehake
clean::
- $(RM) -r tools $(HAKE_ARCHS)
+ $(RM) -r tools docs $(HAKE_ARCHS)
.PHONY: clean
realclean:: clean
$(RM) hake/*.o hake/*.hi hake/hake Hakefiles.hs cscope.*
.PHONY: realclean
-# Documentation
-DOCS= \
- ./docs/TN-000-Overview.pdf \
- ./docs/TN-001-Glossary.pdf \
- ./docs/TN-002-Mackerel.pdf \
- ./docs/TN-003-Hake.pdf \
- ./docs/TN-004-VirtualMemory.pdf \
- ./docs/TN-005-SCC.pdf \
- ./docs/TN-006-Routing.pdf \
- ./docs/TN-008-Tracing.pdf \
- ./docs/TN-009-Notifications.pdf \
- ./docs/TN-010-Spec.pdf \
- ./docs/TN-011-IDC.pdf \
- ./docs/TN-012-Services.pdf \
- ./docs/TN-013-CapabilityManagement.pdf \
- ./docs/TN-014-bulk-transfer.pdf \
- ./docs/TN-015-DiskDriverArchitecture.pdf \
- ./docs/TN-016-Serial.pdf \
- ./docs/TN-017-ARM.pdf \
- ./docs/TN-018-PracticalGuide.pdf \
- ./docs/TN-019-DeviceDriver.pdf
-
-docs doc: $(DOCS)
-.PHONY: docs doc
-
-clean::
- $(RM) $(DOCS)
-.PHONY: clean
-
-doxygen: Doxyfile
- doxygen $<
-.PHONY: doxygen
-
-# pretend to be CMake's CONFIGURE_FILE command
-# TODO: clean this up
-Doxyfile: $(SRCDIR)/doc/Doxyfile.cmake
- sed -r 's#@CMAKE_SOURCE_DIR@#$(SRCDIR)#g' $< > $@
-
# Scheduler simulator test cases
RUNTIME = 1000
TESTS = $(addsuffix .txt,$(basename $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)))
schedsim-check: $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)
for f in $^; do tools/bin/simulator $$f $(RUNTIME) | diff -q - `dirname $$f`/`basename $$f .cfg`.txt || exit 1; done
+
+######################################################################
+#
+# Documentation
+#
+######################################################################
+
+# pretend to be CMake's CONFIGURE_FILE command
+# TODO: clean this up
+Doxyfile: $(SRCDIR)/doc/Doxyfile.cmake
+ sed -r 's#@CMAKE_SOURCE_DIR@#$(SRCDIR)#g' $< > $@
+
+doxygen: Doxyfile
+ doxygen $<
+.PHONY: doxygen
+
+
######################################################################
#
# Intel Xeon Phi Builds
k1om/sbin/weever: k1om/sbin/weever_elf
$(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever
+TESTS_k1om= \
+ $(TESTS_x86) \
+ sbin/tests/dma_test \
+ sbin/tests/xeon_phi_inter \
+ sbin/tests/xeon_phi_test \
+ sbin/tests/xphi_nameservice_test
+
+BENCH_k1om=\
+ $(BENCH_x86) \
+ sbin/benchmarks/bomp_mm \
+ sbin/benchmarks/dma_bench \
+ sbin/benchmarks/xomp_share \
+ sbin/benchmarks/xomp_spawn \
+ sbin/benchmarks/xomp_work \
+ sbin/benchmarks/xphi_ump_bench \
+ sbin/benchmarks/xphi_xump_bench
+
+MODULES_k1om= \
+ sbin/weever \
+ sbin/cpu \
+ sbin/xeon_phi \
+ sbin/corectrl \
+ xeon_phi_multiboot \
+
+# Objcopy utility from the Xeon Phi development tools
+K1OM_OBJCOPY?=k1om-mpss-linux-objcopy
+
+# we have to filter out the moduels that are generated below
+MODULES_k1om_filtered = $(filter-out xeon_phi_multiboot, \
+ $(filter-out sbin/weever,$(MODULES_k1om)))
+
+# Intel Xeon Phi-specific modules
+XEON_PHI_MODULES =\
+ $(foreach m,$(MODULES_COMMON),k1om/$(m)) \
+ $(foreach m,$(MODULES_k1om_filtered),k1om/$(m)) \
+ $(foreach m,$(BENCH_COMMON),k1om/$(m)) \
+ $(foreach m,$(TESTS_COMMON),k1om/$(m)) \
+ $(foreach m,$(BENCH_k1om),k1om/$(m)) \
+ $(foreach m,$(TESTS_k1om),k1om/$(m))
+
+menu.lst.k1om: $(SRCDIR)/hake/menu.lst.k1om
+ cp $< $@
+
+k1om/tools/weever/mbi.c: tools/bin/weever_multiboot \
+ k1om/xeon_phi_multiboot \
+ k1om/tools/weever/.marker
+ tools/bin/weever_multiboot k1om/multiboot.menu.lst.k1om k1om/tools/weever/mbi.c
+
+k1om/sbin/weever: k1om/sbin/weever.bin tools/bin/weever_creator
+ tools/bin/weever_creator ./k1om/sbin/weever.bin > ./k1om/sbin/weever
+
+k1om/sbin/weever.bin: k1om/sbin/weever_elf
+ $(K1OM_OBJCOPY) -O binary -R .note -R .comment -S k1om/sbin/weever_elf ./k1om/sbin/weever.bin
+
+k1om/xeon_phi_multiboot: $(XEON_PHI_MODULES) menu.lst.k1om
+ $(SRCDIR)/tools/weever/multiboot/build_data_files.sh menu.lst.k1om k1om
+
+
+
+################################################################################
+#
+# Backwards compatibility: remove soon
+#
+################################################################################
+
+all:
+ @echo "Type 'make help' for information on available targets."
+.PHONY : all
+
+sim: simulate
+.PHONY : sim
+
+simulate:
+ @echo "The targets 'sim' and 'simulate' have removed."
+ @echo "Type 'make help-boot' for a list of simulation targets."
+.PHONY : simulate
+
+# XXX: Horrid hack to hardcode size of romfs CPIO image into ARM kernel
+# This works in several recursive make steps:
+# 1. Create a dummy romfs_size.h header file
+# 2. Compile everything
+# 3. Create the romfs CPIO image
+# 4. Determine its size and write to romfs_size.h
+# 5. Re-compile kernel (but not the romfs) with correct size information
+# 6. Install romfs to installation location
+
+$(ARCH)/menu.lst: $(SRCDIR)/hake/menu.lst.$(ARCH)
+ cp $< $@
+
+$(ARCH)/romfs.cpio: $(SRCDIR)/tools/arm-mkbootcpio.sh $(MODULES) $(ARCH)/menu.lst
+ $(SRCDIR)/tools/arm-mkbootcpio.sh $(ARCH)/menu.lst $@
+
+# Location of hardcoded size of romfs CPIO image
+arm_romfs_cpio = "$(ARCH)/include/romfs_size.h"
+
+arm:
+ $(MAKE)
+ $(MAKE) $(ARCH)/romfs.cpio
+ echo "//Autogenerated size of romfs.cpio because the bootloader cannot calculate it" > $(arm_romfs_cpio)
+ echo "size_t romfs_cpio_archive_size = `ls -asl $(ARCH)/romfs.cpio | sed -e 's/ /\n/g' | head -6 | tail -1`;" >> $(arm_romfs_cpio)
+ $(MAKE)
+.PHONY: arm
+
+# Builds a dummy romfs_size.h
+$(ARCH)/include/romfs_size.h:
+ mkdir -p $(shell dirname $@)
+ echo "size_t romfs_cpio_archive_size = 0; //should not see this" > $@
+
+arminstall:
+ $(MAKE) arm
+ $(MAKE) install
+ install -p $(ARCH)/romfs.cpio ${INSTALL_PREFIX}/$(ARCH)/romfs.cpio
+.PHONY: arminstall
+
addLibraries = [ "elf_kernel" ]
},
--
- -- Intel Gauss Lake P54C core in the Rock Creek Single-Chip Cloud Computer
- --
- cpuDriver {
- architectures = [ "scc" ],
- assemblyFiles = [ "arch/scc/boot.S",
- "arch/x86_32/entry.S",
- "arch/x86_32/pic.S" ],
- cFiles = [ "arch/scc/rck.c",
- "arch/x86_32/debug.c",
- "arch/x86_32/gdb_arch.c",
- "arch/x86_32/init.c",
- "arch/x86_32/irq.c",
- "arch/x86_32/startup_arch.c",
- "arch/x86_32/exec.c",
- "arch/x86_32/syscall.c",
- "arch/x86_32/paging.c",
- "arch/x86_32/page_mappings_arch.c",
- "arch/x86/apic.c",
- "arch/x86/misc.c",
- "arch/x86/serial.c",
- "arch/x86/multiboot.c",
- "arch/x86/syscall.c",
- "arch/x86/debugregs.c",
- "arch/x86/timing.c",
- "arch/x86/startup_x86.c"
- ],
- mackerelDevices = [ "pc16550d",
- "ia32",
- "xapic",
- "rck",
- "eMAC",
- "cpuid",
- "lpc_rtc" ],
- addLibraries = [ "elf_kernel" ]
- },
- --
-- Generic ARMv5 core, unused?
--
cpuDriver {
--- /dev/null
+--------------------------------------------------------------------------
+-- Copyright (c) 2015, 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, Universitätstr. 6, CH-8092 Zurich. Attn: Systems Group.
+--
+-- Hakefile for /platforms/x86
+--
+--------------------------------------------------------------------------
+
+let bin_rcce_lu = [ "/sbin/" ++ f | f <- [
+ "rcce_lu_A1",
+ "rcce_lu_A2",
+ "rcce_lu_A4",
+ "rcce_lu_A8",
+ "rcce_lu_A16",
+ "rcce_lu_A32",
+ "rcce_lu_A64" ]]
+
+ bin_rcce_bt = [ "/sbin/" ++ f | f <- [
+ "rcce_bt_A1",
+ "rcce_bt_A4",
+ "rcce_bt_A9",
+ "rcce_bt_A16",
+ "rcce_bt_A25",
+ "rcce_bt_A36" ]]
+
+ tests_common = [ "/sbin/" ++ f | f <- [
+ "fputest",
+ "fread_test",
+ "fscanf_test",
+ "hellotest",
+ "idctest",
+ "memtest",
+ "schedtest",
+ "testerror",
+ "yield_test" ] ]
+
+ tests_x86 = [ "/sbin/" ++ f | f <- [
+ "tests/luatest",
+ "tests/numatest" ] ]
+
+ tests_x86_64 = [ "/sbin/" ++ f | f <- [
+ "arrakis_hellotest",
+ "ata_rw28_test",
+ "bomp_cpu_bound",
+ "bomp_cpu_bound_progress",
+ "bomp_sync",
+ "bomp_sync_progress",
+ "bomp_test",
+ "bulk_shm",
+ "cryptotest",
+ "mdbtest_addr_zero",
+ "mdbtest_range_query",
+ "mem_affinity",
+ "multihoptest",
+ "net-test",
+ "net_openport_test",
+ "perfmontest",
+ "phoenix_kmeans",
+ "socketpipetest",
+ "spantest",
+ "spin",
+ "testconcurrent",
+ "testdesc",
+ "testdesc-child",
+ "tests/cxxtest",
+ "tests/dma_test",
+ "tests/xphi_nameservice_test",
+ "thcidctest",
+ "thcminitest",
+ "thctest",
+ "timer_test",
+ "tlstest",
+ "tweedtest",
+ "xcorecap",
+ "xcorecapserv" ] ] ++ tests_x86
+
+ tests_x86_32 = tests_x86
+
+ bench_common = [ "/sbin/" ++ f | f <- [
+ "channel_cost_bench",
+ "flounder_stubs_buffer_bench",
+ "flounder_stubs_empty_bench",
+ "flounder_stubs_payload_bench",
+ "xcorecapbench" ]]
+
+ bench_x86 = [ "/sbin/" ++ f | f <- [
+ "multihop_latency_bench",
+ "net_openport_test",
+ "perfmontest",
+ "thc_v_flounder_empty",
+ "timer_test",
+ "udp_throughput",
+ "ump_exchange",
+ "ump_latency",
+ "ump_latency_cache",
+ "ump_receive",
+ "ump_send",
+ "ump_throughput" ]]
+
+ bench_x86_64 = bench_x86 ++ bin_rcce_bt ++ bin_rcce_lu ++
+ [ "/sbin/" ++ f | f <- [
+ "ahci_bench",
+ "apicdrift_bench",
+ "benchmarks/bomp_mm",
+ "benchmarks/dma_bench",
+ "benchmarks/xomp_share",
+ "benchmarks/xomp_spawn",
+ "benchmarks/xomp_work",
+ "benchmarks/xphi_ump_bench",
+ "bomp_benchmark_cg",
+ "bomp_benchmark_ft",
+ "bomp_benchmark_is",
+ "bulk_transfer_passthrough",
+ "bulkbench",
+ "bulkbench_micro_echo",
+ "bulkbench_micro_rtt",
+ "bulkbench_micro_throughput",
+ "elb_app",
+ "elb_app_tcp",
+ "lrpc_bench",
+ "mdb_bench",
+ "mdb_bench_old",
+ "netthroughput",
+ "phases_bench",
+ "phases_scale_bench",
+ "placement_bench",
+ "rcce_pingpong",
+ "shared_mem_clock_bench",
+ "tsc_bench" ]]
+
+ bench_x86_32 = bench_x86 ++ bin_rcce_bt ++ bin_rcce_lu
+
+
+ -- Default list of modules to build/install for all enabled architectures
+ modules_common = [ "/sbin/" ++ f | f <- [
+ "init",
+ "chips",
+ "skb",
+ "spawnd",
+ "startd",
+ "mem_serv",
+ "monitor",
+ "ramfsd" ]]
+
+ -- List of modules that are arch-independent and always built
+ modules_generic = [ "/skb_ramfs.cpio.gz", "/sshd_ramfs.cpio.gz" ]
+
+ -- x86_64-specific modules to build by default
+ -- this should shrink as targets are ported and move into the generic list above
+ modules_x86_64 = [ "/sbin/" ++ f | f <- [
+ "elver",
+ "cpu",
+ "acpi",
+ "ahcid",
+ "angler",
+ "arrakismon",
+ "bcached",
+ "bench",
+ "bfscope",
+ "block_server",
+ "block_server_client",
+ "boot_perfmon",
+ "bs_user",
+ "bulk_shm",
+ "corectrl",
+ "datagatherer",
+ "dma_mgr",
+ "e1000n",
+ "e10k",
+ "e10k_queue",
+ "echoserver",
+ "fbdemo",
+ "fish",
+ "hpet",
+ "ioat_dma",
+ "kaluga",
+ "lo_queue",
+ "lpc_kbd",
+ "lpc_timer",
+ "lshw",
+ "mem_serv_dist",
+ "netd",
+ "NGD_mng",
+ "pci",
+ "routing_setup",
+ "rtl8029",
+ "serial",
+ "sfxge",
+ "sif",
+ "slideshow",
+ "sshd",
+ "vbe",
+ "virtio_blk",
+ "virtio_blk_host",
+ "vmkitmon",
+ "vnode_map_test",
+ "webserver",
+ "xeon_phi",
+ "xeon_phi_mgr"
+ ]] ++ modules_generic
+
+ -- the following are broken in the newidc system
+ modules_x86_64_broken = [ "/sbin/" ++ f | f <- [
+ "barriers",
+ "ipi_bench",
+ "ring_barriers",
+ "ssf_bcast",
+ "lamport_bcast" ]]
+
+ -- x86-32-specific module to build by default
+ modules_x86_32 = [ "/sbin/" ++ f | f <- [
+ "cpu",
+ "lpc_kbd",
+ "serial",
+ "rcce_pingpong",
+ "bench",
+ "fbdemo",
+ "fish",
+ "fputest",
+ "pci",
+ "acpi",
+ "kaluga",
+ "slideshow",
+ "thc_v_flounder_empty",
+ "thcidctest",
+ "thcminitest",
+ "thctest",
+ "vbe",
+ "mem_serv_dist",
+ "routing_setup",
+ "multihoptest",
+ "multihop_latency_bench",
+ "angler",
+ "sshd",
+ "corectrl" ]] ++ bin_rcce_bt ++ bin_rcce_lu
+
+ -- ARMv7-a Pandaboard modules
+ pandaModules = [ "/sbin/" ++ f | f <- [
+ "cpu_omap44xx",
+ "init",
+ "mem_serv",
+ "monitor",
+ "ramfsd",
+ "spawnd",
+ "startd",
+ "skb",
+ "memtest",
+ "kaluga",
+ "fish",
+ "sdma",
+ "sdmatest",
+ "sdma_bench",
+ "bulk_sdma",
+ "usb_manager",
+ "usb_keyboard",
+ "serial",
+ "angler",
+ "corectrl"
+ ] ]
+
+ -- ARMv7-m Pandaboard modules
+ pandaM3Modules = [ "/sbin/" ++ f | f <- [
+ "cpu_omap44xx",
+ "init",
+ "mem_serv",
+ "monitor",
+ "ramfsd",
+ "spawnd",
+ "startd",
+ "skb",
+ "memtest"
+ ] ]
+
+ -- ARMv7-a modules for running under GEM5
+ gem5Modules = [ "/sbin/" ++ f | f <- [
+ "cpu_arm_gem5",
+ "init",
+ "mem_serv",
+ "monitor",
+ "ramfsd",
+ "spawnd",
+ "startd",
+ "corectrl",
+ "skb",
+ "memtest"
+ ] ]
+ in
+ [
+
+
+ --
+ -- Rules to build assorted platforms
+ --
+
+ platform "X86_64_Basic" [ "x86_64" ]
+ [ ("x86_64", f) | f <- modules_x86_64 ]
+ "Basic 64-bit x86 PC build",
+
+ platform "X86_64_Benchmarks" [ "x86_64" ]
+ [ ("x86_64", f) | f <- modules_x86_64 ++ bench_x86_64]
+ "64-bit x86 PC build with benchmarks",
+
+ platform "X86_64_Full" [ "x86_64" ]
+ [ ("x86_64", f) | f <- modules_x86_64 ++ bench_x86_64 ++ tests_x86_64 ]
+ "64-bit x86 PC build with benchmarks and test suites",
+
+ platform "X86_32_Basic" [ "x86_32" ]
+ [ ("x86_32", f) | f <- modules_x86_32 ]
+ "Basic 32-bit x86 PC build",
+
+ platform "X86_32_Benchmarks" [ "x86_32" ]
+ [ ("x86_32", f) | f <- modules_x86_32 ++ bench_x86_32]
+ "32-bit x86 PC build with benchmarks",
+
+ platform "X86_32_Full" [ "x86_32" ]
+ [ ("x86_32", f) | f <- modules_x86_32 ++ bench_x86_32 ++ tests_x86_32 ]
+ "32-bit x86 PC build with benchmarks and test suites",
+
+ platform "PandaboardES" [ "armv7" ]
+ ([ ("armv7", f) | f <- pandaModules ] ++ [ ("root", "/pandaboard_image") ])
+ "Standard Pandaboard ES build image and modules",
+
+ platform "PandaboardES-Heterogeneous" [ "armv7", "armv7-m" ]
+ ([ ("armv7", f) | f <- pandaModules ] ++ [ ("root", "/pandaboard_het_image") ])
+ "Pandaboard ES with experimental heterogeneous (Cortex-M3) support",
+
+ platform "ARMv7-GEM5" [ "armv7" ]
+ ([ ("armv7", f) | f <- gem5Modules ] ++ [ ("root", "/arm_gem5_image") ])
+ "GEM5 emulator for ARM Cortex-A series multicore processors",
+
+ platform "ARMv5" [ "armv5" ]
+ ([ ("armv5", "/sbin/" ++ f) | f <- [ "cpu", "cpu.bin" ]])
+ "Very basic ARMv5 configuration for testing",
+
+ platform "ARM11MP" [ "arm11mp" ]
+ ([ ("arm11mp", "/sbin/" ++ f) | f <- [ "cpu", "cpu.bin" ]])
+ "Very basic ARM11MP configuration for testing",
+
+ --
+ -- Rules to build assorted boot images
+ --
+
+ -- Build the default PandaBoard boot image
+ Rule ([ In SrcTree "tools" "/tools/arm_molly/build_pandaboard_image.sh",
+ Str "--srcdir", NoDep SrcTree "root" "/.",
+ Str "--builddir", NoDep BuildTree "root" "/.",
+ Str "--menu", In SrcTree "tools" "/hake/menu.lst.pandaboard",
+ Str "--baseaddr", Str "0x82001000",
+ Str "--image", Out "root" "/pandaboard_image",
+ Dep BuildTree "tools" "/bin/arm_molly"
+ ] ++ [ (Dep BuildTree "armv7" m) | m <- pandaModules ]),
+
+ -- Build the (old) PandaBoard Cortex-M3 image
+ Rule ([ In SrcTree "tools" "/tools/arm_molly/build_pandaboard_image.sh",
+ Str "--srcdir", NoDep SrcTree "root" "/.",
+ Str "--builddir", NoDep BuildTree "root" "/.",
+ Str "--menu", In SrcTree "tools" "/hake/menu.lst.armv7-m",
+ Str "--baseaddr", Str "0x00",
+ Str "--cflags", Str "\"-march=armv7-m -mcpu=cortex-m3 -mthumb\"",
+ Str "--image", Out "root" "/pandaboard_m3image_intermediate",
+ Dep BuildTree "tools" "/bin/arm_molly"
+ ] ++ [ (Dep BuildTree "armv7-m" m) | m <- pandaM3Modules ]),
+
+ -- Convert slave image into a form we can insert in our image
+ Rule ([ Str "arm-linux-gnueabi-objcopy",
+ Str "-I", Str "binary",
+ Str "-O", Str "elf32-littlearm",
+ Str "-B", Str "arm",
+ Str "--rename-section", Str ".data=.rodata_thumb,alloc,load,readonly,data,contents",
+ In BuildTree "root" "/pandaboard_m3image_intermediate",
+ Out "root" "/pandaboard_m3image" ]),
+
+ -- Build the PandaBoard Cortex-A9 image that includes the M3 image
+ Rule ([ In SrcTree "tools" "/tools/arm_molly/build_pandaboard_image.sh",
+ Str "--srcdir", NoDep SrcTree "root" "/.",
+ Str "--builddir", NoDep BuildTree "root" "/.",
+ Str "-D", Str "HETEROPANDA",
+ Str "--menu", In SrcTree "tools" "/hake/menu.lst.heteropandaboard",
+ Str "--baseaddr", Str "0x82001000",
+ Str "--extra", In BuildTree "root" "/pandaboard_m3image",
+ Str "--image", Out "root" "/pandaboard_hetero_image",
+ Dep BuildTree "tools" "/bin/arm_molly"
+ ] ++ [ (Dep BuildTree "armv7" m) | m <- pandaModules ]),
+
+ -- Build the ARM GEM5 simulation image
+ Rule ([ In SrcTree "tools" "/tools/arm_molly/build_pandaboard_image.sh",
+ Str "--srcdir", NoDep SrcTree "root" "/.",
+ Str "--builddir", NoDep BuildTree "root" "/.",
+ Str "--menu", In SrcTree "tools" "/hake/menu.lst.arm_gem5_mc",
+ Str "--baseaddr", Str "0x00100000",
+ Str "--image", Out "root" "/arm_gem5_image",
+ Dep BuildTree "tools" "/bin/arm_molly"
+ ] ++ [ (Dep BuildTree "armv7" m) | m <- gem5Modules ]),
+
+ --
+ -- Booting: various targets for booting Barrelfish under different circumstances
+ --
+
+ -- Copy menu.list files across
+ Rules [ copyFile SrcTree "root" ("/hake/menu.lst." ++ p)
+ "root" ("/platforms/arm/menu.lst." ++ p)
+ | p <- [ "arm_gem5",
+ "arm_gem5_mc",
+ "arm_gem5_panda",
+ "armv5",
+ "armv7-m",
+ "heteropanda_master",
+ "pandaboard",
+ "xscale" ]],
+ Rules [ copyFile SrcTree "root" ("/hake/menu.lst." ++ p)
+ "root" ("/platforms/x86/menu.lst." ++ p)
+ | p <- [ "x86_32", "x86_64", "k1om" ] ],
+
+ -- Convenient functions for running GEM5
+ boot "gem5_armv7" [ "armv7" ] [
+ Str Config.gem5,
+ In SrcTree "tools" "/tools/arm_gem5/gem5script.py",
+ Str "--caches",
+ Str "--l2cache",
+ Str "--n=2",
+ NStr "--kernel=", In BuildTree "root" "/arm_gem5_image" ]
+ "Boot an ARMv7a multicore image in GEM5",
+
+ boot "gem5_armv7_detailed" [ "armv7" ] [
+ Str Config.gem5,
+ In SrcTree "tools" "/tools/arm_gem5/gem5script.py",
+ Str "--caches",
+ Str "--l2cache",
+ Str "--n=2",
+ Str "--cpu-type=arm_detailed",
+ NStr "--kernel=", In BuildTree "root" "/arm_gem5_image" ]
+ "Boot an ARMv7a multicore image in GEM5 using a detailed CPU model",
+
+ boot "qemu_x86_64" [ "x86_64" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--menu", In BuildTree "root" "/platforms/x86/menu.lst.x86_64",
+ Str "--arch", Str "x86_64" ]
+ "Boot QEMU in 64-bit x86 mode emulating a PC",
+
+ boot "qemu_x86_32" [ "x86_32" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--menu", In BuildTree "root" "/platforms/x86/menu.lst.x86_32",
+ Str "--arch", Str "x86_32" ]
+ "Boot QEMU in 32-bit x86 mode emulating a PC",
+
+ boot "qemu_x86_64_debug" [ "x86_64" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--menu", In BuildTree "root" "/platforms/x86/menu.lst.x86_64",
+ Str "--arch", Str "x86_64",
+ Str "--debug", In SrcTree "tools" "/tools/debug.gdb" ]
+ "Boot QEMU under GDB in 64-bit x86 mode emulating a PC",
+
+ boot "qemu_x86_32_debug" [ "x86_32" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--menu", In BuildTree "root" "/platforms/x86/menu.lst.x86_32",
+ Str "--arch", Str "x86_32",
+ Str "--debug", In SrcTree "tools" "/tools/debug.gdb" ]
+ "Boot QEMU under GDB in 32-bit x86 mode emulating a PC",
+
+ boot "qemu_armv5" [ "armv5" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--kernel", In BuildTree "armv5" "/sbin/cpu.bin",
+ Str "--initrd", In BuildTree "armv5" "/romfs.cpio",
+ Str "--arch", Str "armv5" ]
+ "Boot QEMU as an ARMv5-based Integrator/CP board",
+
+ boot "qemu_armv5_debug" [ "armv5" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--kernel", In BuildTree "armv5" "/sbin/cpu.bin",
+ Str "--initrd", In BuildTree "armv5" "/romfs.cpio",
+ Str "--arch", Str "armv5",
+ Str "--debug", In SrcTree "tools" "/tools/debug.arm.gdb" ]
+ "Boot QEMU under GDB as an ARMv5-based Integrator/CP board",
+
+ boot "qemu_arm11mp" [ "arm11mp" ] [
+ In SrcTree "tools" "/tools/qemu-wrapper.sh",
+ Str "--kernel", In BuildTree "arm11mp" "/sbin/cpu.bin",
+ Str "--initrd", In BuildTree "arm11mp" "/romfs.cpio",
+ Str "--arch", Str "arm11mp" ]
+ "Boot QEMU as an ARM11MPCore-based Realview board"
+
+ ]
+
--- /dev/null
+#!/bin/bash
+##########################################################################
+# Copyright (c) 2009-2015 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, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
+# Attn: Systems Group.
+#
+# Shell script for constructing a multiboot image for Pandaboard
+#
+##########################################################################
+
+SRC_DIR=
+BUILD_DIR=
+ARM_GCC=$(which arm-linux-gnueabi-gcc)
+ARM_OBJCOPY=$(which arm-linux-gnueabi-objcopy)
+MENU_LST=""
+DEFINES=""
+EXTRAS=""
+BASE_ADDR=""
+IMAGE="pandaboard_image"
+CFLAGS="-march=armv7-a"
+
+usage () {
+ echo "Usage: $0 --srcdir <dir> --builddir <dir> --menu <menu.lst> [option].."
+ echo " where options are:"
+ echo " --gcc <gcc binary>"
+ echo " --objcopy <objcopy binary>"
+ echo " -D <define>"
+ echo " --extra <additional file>"
+ echo " --image <output image file> (default: $IMAGE)"
+ echo " --cflags <flags to pass to cc> (default: $CFLAGS)"
+ exit 0
+}
+
+if [ $# == 0 ]; then usage ; fi
+
+while [ $# != 0 ]; do
+ case $1 in
+ "--help")
+ usage
+ exit 0
+ ;;
+ "--srcdir")
+ shift; SRC_DIR="$1"
+ ;;
+ "--builddir")
+ shift; BUILD_DIR="$1"
+ ;;
+ "--baseaddr")
+ shift; BASE_ADDR="$1"
+ ;;
+ "--gcc")
+ shift; ARM_GCC="$1"
+ ;;
+ "--objcopy")
+ shift; ARM_OBJCOPY="$1"
+ ;;
+ "--menu")
+ shift; MENU_LST="$1"
+ ;;
+ "-D")
+ shift; DEFINES="$DEFINES -D$1"
+ ;;
+ "--extra")
+ shift; EXTRAS="$EXTRAS $1"
+ ;;
+ "--image")
+ shift; IMAGE="$1"
+ ;;
+ "--cflags")
+ shift; CFLAGS="$1"
+ ;;
+ *)
+ echo "Unknown option $1 (try: --help)" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$SRC_DIR" ] ; then
+ echo "No source directory defined." >&2; exit 1
+elif [ -z "$BUILD_DIR" ] ; then
+ echo "No build directory defined." >&2; exit 1
+elif [ -z "$ARM_GCC" ]; then
+ echo "No ARM GCC compiler defined." >&2; exit 1
+elif [ -z "$ARM_OBJCOPY" ]; then
+ echo "No ARM objcopy utility." >&2; exit 1
+elif [ -z "$MENU_LST" ]; then
+ echo "No boot menu list defined." >&2; exit 1
+elif [ -z "$BASE_ADDR" ]; then
+ echo "No kernel base address defined." >&2; exit 1
+fi
+
+
+TMP_DIR="$BUILD_DIR/molly_tmp_"`basename $IMAGE`
+
+# Dependencies:
+# - tools/bin/arm_molly must be built
+# - all modules mentioned in $MENU_LST must exist in $ARCH/sbin/
+# - the menu.list file
+#
+# Outputs:
+# - $IMAGE : the image to be built
+
+TMP_LDSCRIPT="$TMP_DIR/molly_ld_script"
+TMP_MBIC="$TMP_DIR/panda_mbi.c"
+
+# Prefix prepended to each output file within the directory
+# $OUTPUT_PREFIX (for safety, this means we can clean the directory
+# by removing everything with this prefix)
+TMP_PREFIX=tmp_molly
+
+echo "Cleaning temporary directory $TMP_DIR"
+rm -rf "$TMP_DIR"
+mkdir -p "$TMP_DIR"
+
+
+echo "Generating list of of binaries to translate"
+BINS=$(awk '/^kernel/ || /^module/ {print $2}' $MENU_LST)
+# For each binary generate an object file in the output directory.
+# The flags to objcopy cause it to place the binary image of the input
+# file into an .rodataIDX section in the generated object file where
+# IDX is a counter incremented for each binary.
+IDX=1
+echo "Translating data files"
+for BIN in $BINS; do
+ UNDERSCORED=${BIN//-/_}
+ SLASH=${UNDERSCORED////_}
+ BIN_OUT="$TMP_DIR/${TMP_PREFIX}_$SLASH"
+ echo ' ' $BIN '->' $BIN_OUT
+ $ARM_OBJCOPY -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata$IDX,alloc,load,readonly,data,contents .$BIN $BIN_OUT
+ IDX=$(($IDX+1))
+ if [ $IDX = 20 ]; then
+ echo Error: linker script cannot handle $IDX modules
+ exit 1
+ fi
+done
+
+echo "Creating appropriate linker script"
+cpp -P -DBASE_ADDR=$BASE_ADDR "$SRC_DIR/tools/arm_molly/molly_ld_script.in" "$TMP_LDSCRIPT"
+
+echo "Building a C file to link into a single image for the 2nd-stage bootloader"
+"$BUILD_DIR/tools/bin/arm_molly" "$MENU_LST" "$TMP_MBIC"
+
+echo "Compiling the complete boot image into a single executable"
+$ARM_GCC -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin \
+ -nostdlib $CFLAGS -mapcs -fno-unwind-tables \
+ -T$TMP_LDSCRIPT \
+ -I$SRC_DIR/include \
+ -I$SRC_DIR/include/arch/arm \
+ -I./armv7/include \
+ -I$SRC_DIR/include/oldc \
+ -I$SRC_DIR/include/c \
+ $SRC_DIR/tools/arm_molly/molly_boot.S \
+ $SRC_DIR/tools/arm_molly/molly_init.c \
+ $SRC_DIR/tools/arm_molly/lib.c \
+ $TMP_MBIC \
+ $SRC_DIR/lib/elf/elf32.c \
+ $TMP_DIR/${TMP_PREFIX}* \
+ $EXTRAS \
+ -o $IMAGE
+echo "OK - pandaboard boot image $IMAGE is built."
+echo "If your boot environment is correctly set up, you can now:"
+echo "usbboot $IMAGE"
--- /dev/null
+#!/bin/bash
+##########################################################################
+# Copyright (c) 2009-2015 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, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
+# Attn: Systems Group.
+#
+# Shell script for running Qemu with a Barrelfish image
+#
+##########################################################################
+
+HDFILE=hg.img
+MENUFILE=""
+ARCH=""
+DEBUG_SCRIPT=""
+
+usage () {
+ echo "Usage: $0 --menu <file> --arch <arch> [options]"
+ echo " where:"
+ echo " 'arch' is one of: x86_64, x86_32, armv5"
+ echo " 'file' is a menu.lst format file to read module list from"
+ echo " and options can be:"
+ echo " --debug <script> (run under the specified GDB script)"
+ echo " --hdfile <file> (hard disk image to be build for AHCI, defaults to $HDFILE"
+ echo " --kernel <file> (kernel binary, if no menu.lst given)"
+ echo " --initrd <file> (initial RAM disk, if no menu.lst given)"
+ echo " --args <args> (kernel command-line args, if no menu.lst given)"
+ exit 1
+}
+
+
+if [ $# == 0 ]; then usage ; fi
+while [ $# != 0 ]; do
+ case $1 in
+ "--help"|"-h")
+ usage
+ exit 0
+ ;;
+ "--menu")
+ shift; MENUFILE="$1"
+ ;;
+ "--arch")
+ shift; ARCH="$1"
+ ;;
+ "--hdfile")
+ shift; HDFILE="$1"
+ ;;
+ "--debug")
+ shift; DEBUG_SCRIPT="$1"
+ ;;
+ "--initrd")
+ shift; INITRD="$1"
+ ;;
+ "--kernel")
+ shift; KERNEL="$1"
+ ;;
+ "--args")
+ shift; KERNEL_CMDS="$1"
+ ;;
+ *)
+ echo "Unknown option $1 (try: --help)" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$MENUFILE" ]; then
+ echo "No menu.lst file specified."
+ if [ -z "$KERNEL" ]; then
+ echo "ERROR: No initial kernel given and no menu.lst file." >&2; exit 1
+ fi
+ if [ -z "$INITRD" ]; then
+ echo "ERROR: No initial RAM disk given and no menu.lst file." >&2; exit 1
+ fi
+else
+ echo "Using menu file $MENUFILE"
+ KERNEL=`sed -rne 's,^kernel[ \t]*/([^ ]*).*,\1,p' "$MENUFILE"`
+ if [ -z "$KERNEL" ]; then
+ echo "ERROR: No initial kernel specified in menu.lst file." >&2; exit 1
+ fi
+ KERNEL_CMDS=`sed -rne 's,^kernel[ \t]*[^ ]*[ \t]*(.*),\1,p' "$MENUFILE"`
+ INITRD=`sed -rne 's,^module(nounzip)?[ \t]*/(.*),\2,p' "$MENUFILE" | awk '{ if(NR == 1) printf($$0); else printf("," $$0) }'`
+ if [ -z "$INITRD" ]; then
+ echo "ERROR: No initial ram disk modules specified in menu.lst file." >&2; exit 1
+ fi
+fi
+
+echo "Initial kernel file: $KERNEL"
+echo "Initial RAM disk contents: $INITRD"
+echo "Kernel command line arguments: $KERNEL_CMDS"
+echo "Requested architecture is $ARCH."
+
+case "$ARCH" in
+ "x86_64")
+ QEMU_CMD="qemu-system-x86_64 \
+ -smp 2 \
+ -m 1024 \
+ -net nic,model=e1000 \
+ -net user \
+ -device ahci,id=ahci \
+ -device ide-drive,drive=disk,bus=ahci.0 \
+ -drive id=disk,file="$HDFILE",if=none"
+ QEMU_NONDEBUG=-nographic
+ GDB=gdb
+ echo "Creating hard disk image $HDFILE"
+ qemu-img create "$HDFILE" 10M
+ ;;
+ "x86_32")
+ QEMU_CMD="qemu-system-i386 \
+ -no-kvm \
+ -smp 2 \
+ -m 1024 \
+ -net nic,model=ne2k_pci \
+ -net user \
+ -device ahci,id=ahci \
+ -device ide-drive,drive=disk,bus=ahci.0 \
+ -drive id=disk,file="$HDFILE",if=none"
+ GDB=gdb
+ QEMU_NONDEBUG=-nographic
+ echo "Creating hard disk image $HDFILE"
+ qemu-img create "$HDFILE" 10M
+ ;;
+ "armv5")
+ QEMU_CMD="qemu-system-arm \
+ -machine integratorcp \
+ -kernel armv5/sbin/cpu.bin \
+ -nographic \
+ -no-reboot \
+ -m 256 \
+ -initrd armv5/romfs.cpio"
+ GDB=arm-linux-gnueabi-gdb
+ ;;
+ "arm11mp")
+ QEMU_CMD="qemu-system-arm \
+ -cpu mpcore \
+ -machine realview-eb-mpcore \
+ -kernel arm11mp/sbin/cpu.bin"
+ GDB=arm-linux-gnueabi-gdb
+ ;;
+ *)
+ echo "No Qemu environment defined for architecture=$ARCH." >&2
+ exit 1
+ ;;
+esac
+
+if [ "$DEBUG_SCRIPT" = "" ] ; then
+ echo "OK: about to run the follow qemu command:"
+ echo "$QEMU_CMD $QEMU_NONDEBUG -kernel $KERNEL -append $KERNEL_CMDS -initrd $INITRD"
+ exec $QEMU_CMD $QEMU_NONDEBUG -kernel "$KERNEL" -append "$KERNEL_CMDS" -initrd "$INITRD"
+fi
+
+
+# Now we run the debugger instead
+GDB_ARGS="-x $DEBUG_SCRIPT"
+SERIAL_OUTPUT=file:/dev/stdout
+PORT=$((10000 + UID))
+
+if [ "${SERIAL_OUTPUT}" = "" ] ; then
+ # Assuming session is interactive. Use terminal for serial output because
+ # stdout does not work for daemonized qemu and output is lost. This likely
+ # only matters on ARM where there is no video driver at time of writing.
+ SERIAL_OUTPUT=`tty`
+fi
+
+PIDFILE=/tmp/qemu_debugsim_${USER}_${PORT}.pid
+if test -f $PIDFILE; then
+ if ps `cat $PIDFILE` >/dev/null; then
+ echo "Another QEMU already running (PID: `cat $PIDFILE` PIDFILE: $PIDFILE)"
+ exit 1
+ else
+ echo "Deleting stale lockfile $PIDFILE"
+ rm -f $PIDFILE
+ fi
+fi
+
+echo args = $GDB_ARGS
+
+cat > barrelfish_debug.gdb <<EOF
+# Connect to QEMU instance
+target remote localhost:$PORT
+EOF
+
+QEMU_INVOCATION="${QEMU_CMD} \
+ -kernel \"$KERNEL\" \
+ -append \"$KERNEL_CMDS\" \
+ -initrd \"$INITRD\" \
+ -serial $SERIAL_OUTPUT \
+ -gdb tcp::$PORT \
+ -S \
+ -display none \
+ -daemonize \
+ -pidfile $PIDFILE"
+eval $QEMU_INVOCATION
+
+if [ $? -eq 0 ] ; then
+ stty sane
+ trap '' SIGINT
+ ${GDB} -x barrelfish_debug.gdb ${GDB_ARGS}
+ PID=`cat ${PIDFILE}`
+ kill ${PID} > /dev/null || true
+ rm -f $PIDFILE
+else
+ echo Failed to launch qemu with:
+ echo " ${QEMU_INVOCATION}"
+fi
-- the files are placed under /etc/ssh in the running system
let ramdisk_files = find inDir "ramdisk" ""
- ramdisk = "sshd_ramfs.cpio.gz"
+ ramdisk = "/sshd_ramfs.cpio.gz"
in
[ Rule ( [ Str "bash",
In SrcTree "src" "mkcpio",
find inDir "programs" ".pl"
++
find inDir "external_libraries/lib" ".eco"
- ramdisk = "skb_ramfs.cpio.gz"
+ ramdisk = "/skb_ramfs.cpio.gz"
args arch = application {
target = "skb",
cFiles = [ "skb_main.c", "skb_service.c", "queue.c",