Commit Graph

46 Commits

Author SHA1 Message Date
Matthew Brecknell c4d673b96d cspec: Use L4V_PLAT in build export script
CI is introducing an `L4V_PLAT` variable to support proof runs across
more platform configurations. This commit incorporates `L4V_PLAT` into
the paths generated by `export-kernel-builds.py`, to ensure that
exported builds can be disambiguated.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-06-05 13:34:14 +10:00
Gerwin Klein 7c422d7839 cspec: introduce L4V_PLAT
L4V_PLAT selects a platform variation within a L4V_ARCH. This mostly
affects which seL4 cmake config file is loaded when building config
data and the kernel C code. This in turn affects (and will rebuild)
ASpec, ExecSpec, and CSpec.

Examples:

    L4V_ARCH=ARM L4V_FEATURES="" L4V_PLAT=""

will load `ARM_verified.cmake`

    L4V_ARCH=ARM L4V_FEATURES="" L4V_PLAT=imx8mm

will load `ARM_imx8mm_verified.cmake`, and

    L4V_ARCH=ARM L4V_FEATURES=MCS L4V_PLAT=imx8mm

will load `ARM_MCS_imx8mm_verified.cmake`

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-06-05 12:04:29 +10:00
Gerwin Klein 4a42803c6d
cspec: make remaining relative paths absolute (#607)
Previous commit 1a7eb92111 on fixing up overlay paths in kernel.mk
missed two instances.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:14:17 +11:00
Gerwin Klein 1a7eb92111
cspec: use absolute path for overlay targets (#597)
The `export-kernel-builds.py` script expects to be able to run the
build from an arbitrary temporary directory.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-08 07:59:32 +11:00
Gerwin Klein 42c4e78e9f
cspec: provide mechanism for adding dts overlays (#591)
Add mechanism for adding overlay.dts files to the l4v build for all
architectures apart from X64 (which does not use dts files).

For example, place a file `overlays/ARM/overlay.dts` into the tree and
the build will pick it up as custom overlay file with the correct proof
session dependencies.

If no file is provided, an empty default overlay file is used.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-07 14:35:53 +11:00
Gerwin Klein c072a9c531
cspec: extract physBase from C headers
Extract the numeric value PHYS_BASE_RAW from the generated header
gen_headers/plat/machine/devices_gen.h and provide it as the constant
physBase in Kernel_Config.thy.

In C this will later match up with the value returned by physBase().

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-06 11:58:08 +11:00
Matthew Brecknell 2bed1814aa c-kernel: Support pre-built standalone C parser
Allow more settings to be overridden when using the standalone C parser
to generate kernel.sigs in the l4v kernel make files.

This makes it easier to use a pre-built standalone C parser, say, from a
Docker image.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-04 08:38:33 +11:00
Matthew Brecknell 4607098ded ci: Add a script to export kernel build artifacts
This can be used by l4v proof runs in GitHub CI to save kernel build outputs
for later use by binary verification.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-04 08:38:33 +11:00
Gerwin Klein eaf735c38f
cspec: adjust Kernel_Config generation (#590)
seL4/seL4#975 slightly changed how the config headers are generated.
They now need a (short) `ninja` build step and they produce less spaces
in the header file.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-02 11:54:20 +11:00
Gerwin Klein f5acf1cecd gen_config: add generator as dependency
Config files should be re-generated when generator content changes,
because that generally changes the content of the output.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein f46f9bd74e machine: make Kernel_Config available earlier
Definitions in Platform.thy may depend on kernel config options, so
we need Kernel_Config_Lemmas there already, and need to replace the
dependency in Machine_Types to avoid a dependency circle.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein ad1b3116f4 cspec gen-config: add bool config keys + defaults
Enables generation of boolean config keys. Since C for these often
equates absence with `false`, but Isabelle won't be able to deal with
the absence of the config name, we need to manually indicate which ones
we want. For now, we generate `false` for absence for all boolean keys
that have a custom Isabelle name.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Matthew Brecknell 96b2dfc1d3 cspec kernel.mk: avoid spurious dependencies
The rule for kernel.sigs previously depended on building standalone C
parsers and tokenizers for all architectures. With this change, we only
build the standalone C parser for the current architecture.

We also explicitly pass a --cpp argument based on the TOOLPREFIX.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2022-03-23 11:53:28 +11:00
Matthew Brecknell 8c68e549d0 cspec kernel.mk: always use TOOLPREFIX for objdump
Some development environments set an environment variable OBJDUMP by
default. With the previous version of kernel.mk, decompilation used the
objdump indicated by that OBJDUMP variable. This could cause
decompilation to fail if OBJDUMP did not match the TOOLPREFIX used for
compilation.

Since we don't currently have a need to specify a different objdump, we
remove the ability to override via the OBJDUMP environment variable.
With this commit, we always use TOOLPREFIX to locate a suitable objdump.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2022-03-23 11:53:28 +11:00
Gerwin Klein 04626b0a88 cspec: enable preprocess test for AArch64
This commit adds compiler prefixes for AArch64 so that the preprocess
test finds the right cross compilers for this architecture.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-02-03 13:41:06 +11:00
Gerwin Klein 8929a6d729 machine+C: generate Kernel_Config.thy from C
This script takes the gen_config.h file CMake produces for each kernel
configuration, parses it, and emits corresponding Isabelle definitions
into Kernel_Config.thy in spec/machine/$L4V_ARCH/

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-23 14:54:13 +11:00
Gerwin Klein 3b616f535a cspec: separately generate C config headers
This is in preparation for later turning these config headers into
Isabelle definitions.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-23 14:54:13 +11:00
Gerwin Klein ce67a725f7 cspec: more compiler options
The new docker containers that upgraded to gcc-10 use a different
version of the gcc Arm toolchain (`arm-linux-gnueabi`).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-12-09 11:07:22 +11:00
Gerwin Klein 4da8cfacdc
yet another TOOLPREFIX for riscv toolchain (#264)
This one is relevant for MacOs on Apple M1

Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-04-04 20:41:25 +10:00
Matthew Brecknell 16f87e04fe regression: use python3 for mk_umm_types
I previously updated the `#!` in `mk_umm_types.py` to use `python3`, but
forgot to remove the explicit `python` call from `kernel.mk`.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-10 13:45:35 +10:00
Matthew Brecknell 1c4c9a8153 c-kernel: remove Makefile dependency on seL4/.git
This allows some git operations (e.g. fetch) without requiring a
c-kernel rebuild.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-04-23 23:37:59 +10:00
Matthew Brecknell d8364c952d c-kernel: avoid unnecessary rebuilds due to `__pycache__` directories
Previously, we would rebuild the kernel if any file in the `seL4`
repository changed since previous `cmake` setup. Since the kernel build
after the `cmake` setup generates `__pycache__` directories in the
`seL4` tree, this would cause some unnecessary rebuilds.

This commit explicitly excludes `__pycache__` directories from the set
of files considered to be dependencies of the kernel build.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-04-17 10:27:30 +10:00
Gerwin Klein a424d55e3e licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Matthew Brecknell 65074bc35d c-kernel: add Makefile targets useful for binary verification
- Add Makefile targets for building ELF binaries and various dumps that
  are used in binary verification.

- Add support for extra CMake command-line arguments. For binary
  verification, this is used to set the optimisation level for the ELF
  targets.

- Add support for the Debian RISC-V toolchain packages, without breaking
  existing users with a manually built RISC-V toolchain.

- Move reusable parts of the C kernel Makefile out to a separate include
  file, with support for configuring the build directory. For binary
  verification, this is used to allow multiple builds at different
  optimisation levels.
2020-02-26 16:22:40 +11:00
Edward Pierzchalski 31d5c1c70e cspec: Add feature selection variable.
Adds an 'L4V_FEATURES' variable which can be used to select different
CMake configurations for seL4. This makes it easier to build and test
alternative configurations (like MCS).
2019-08-12 16:22:41 +10:00
Luke Mondy 89372de534 Update to new toolchain 2019-03-18 16:35:18 +11:00
Thomas Sewell d262d7f747 cspec Makefile: add target for kernel source.
Adds a target name that ensures that the preprocessed kernel source
is up to date, but doesn't do any other work. This avoids confusion
when doing a check of source compatibility in building the seL4 input
for graph-refine.
2018-07-20 14:57:54 +10:00
Rafal Kolanski 31b635401d riscv: setup cspec build for L4V_ARCH=RISCV64
C parser and word setup copied from X64
2018-06-27 10:05:44 +02:00
Japheth Lim 1966c2e07c cspec: fix make dependency breakage when CMake command fails
Once again, with feeling. This commit uses a dummy file as the CMake
dependency, to avoid re-running the kernel build in parallel.
2018-04-13 17:10:59 +10:00
Japheth Lim b264f59f8d Revert "cspec: fix make dependency breakage when CMake command fails"
This reverts commit 1635696387.

Unconditionally cleaning and invoking the kernel build system turns out
to be a bad idea; it breaks when multiple builds are run in parallel.
2018-04-13 16:46:29 +10:00
Japheth Lim 1635696387 cspec: fix make dependency breakage when CMake command fails 2018-04-12 12:07:42 +10:00
Adrian Danis 668d6ea361 cspec: Pass SORRY_BITFIELD_PROOFS to kernel build
SORRY_BITFIELD_PROOFS is potentially specified as an environment variable, which does not
implicitly become a CMake variable, and so must be explicitly constructed.
2017-10-25 11:07:43 +11:00
Adrian Danis 5f012d9c17 cspec: Reconfigure kernel build on sources change
Previously the kernel build would be reconfigured only if the explicit config file
passed in -C changed, but this file is very minimal and is only used when a variable
needs to be set to a non default value. As a result when default values are added
or changed a reconfigure will not be triggered.

This commit pays higher build times (by completely purging the build directory) in
order to more reliably capture reconfigures and rebuilds.
2017-10-25 11:07:43 +11:00
Adrian Danis 8273ca818d cspec: Remove redundancy in build rules and theory files for c-kernel builds
Removes files that were duplicated in cspec/$L4V_ARCH directories to exist directly in
the cspec directory and contain $L4V_ARCH switches where needed. This allows for a single
Makefile for building the C kernel and the KernelInc_C theory, which is different between
architectures, to still exist per L4V_ARCH.

As the build location of the C kernel, and the resulting kernel_all.c_pp artifact, is
moved this change needs to be reflected in all the theory files that refer to it.
2017-09-21 13:23:04 +10:00
Matthew Brecknell ce748b7522 x64: create arch-specific CKernel 2017-06-22 17:24:53 +10:00
Matthew Brecknell bcf92fb0bd x64 cspec: add x86-64 kernel config for building CKernel
This should be the right configuration. However, the c-parser does not
yet successfully parse the preprocessed source.
2017-05-02 15:46:53 +10:00
Rafal Kolanski ea771a8f7c arm-hyp: configure kernel Makefile for L4V_ARCH=ARM_HYP
Set as required for TK1 platform.
2017-03-06 17:16:28 +11:00
Matthew Brecknell 84d2889d45 Isabelle2016: merge master into 2016 2016-02-19 16:17:26 +11:00
Gao Xin bee4ba0052 l4v-sabre: fix refine 2016-02-17 11:18:02 +11:00
Matthew Brecknell c1574f1f32 cspec: build: avoid re-entering isabelle via dash-0.5.8 2016-02-17 11:04:20 +11:00
Daniel Matichuk fad2c6aae9 paramatrised abstract and haskell specs over L4V_ARCH
Haskell translator was modified to support multiple translations
of the haskell, with different build parameters.
2016-01-13 12:01:40 +11:00
Japheth Lim d92666bc30 regression: remove forceful build options from CSpec makefiles. They don't seem to be needed. 2016-01-07 18:39:50 +11:00
Joel Beeren 1ccd4f5dcc conversion: Rationalise standard types 2015-12-10 21:24:22 +11:00
Corey Richardson d28994d860 Consistently use /usr/bin/env to invoke python 2015-10-13 16:42:53 +11:00
Matthew Fernandez 2b23652b5e cspec: Check CPP exists and fallback on native CPP if possible. 2015-01-22 13:36:53 +11:00
Gerwin Klein 2a03e81df4 Import release snapshot. 2014-07-14 21:32:44 +02:00