Skip to content

Commit 8de4522

Browse files
committed
linuxci: test compiling linux
Similarly to Xen, CBMC should be able to compile the linux kernel. As compiling the full kernel is very time consuming, and with CBMC also space consuming, only compile a single file and all its dependencies, with the smalles configuration possible. Once this is working, the configuration, as well as targets to be compiled can be increased. Signed-off-by: Norbert Manthey <[email protected]>
1 parent 8a28135 commit 8de4522

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build Linux partially with CPROVER tools
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
CompileLinux:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: true
15+
- name: Install Packages
16+
env:
17+
# This is needed in addition to -yq to prevent apt-get from asking for
18+
# user input
19+
DEBIAN_FRONTEND: noninteractive
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install --no-install-recommends -y coreutils build-essential gcc git make flex bison software-properties-common curl python
23+
sudo apt-get install --no-install-recommends -y bin86 gdb bcc liblzma-dev python-dev gettext iasl uuid-dev libncurses5-dev libncursesw5-dev pkg-config
24+
sudo apt-get install --no-install-recommends -y libgtk2.0-dev libyajl-dev sudo time ccache
25+
sudo apt-get install --no-install-recommends -y automake bc libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf gawk jq
26+
27+
- name: Prepare ccache
28+
uses: actions/cache@v2
29+
with:
30+
path: .ccache
31+
key: ${{ runner.os }}-20.04-make-${{ github.ref }}-${{ github.sha }}-KERNEL
32+
restore-keys: |
33+
${{ runner.os }}-20.04-make-${{ github.ref }}
34+
${{ runner.os }}-20.04-make
35+
- name: ccache environment
36+
run: |
37+
echo "CCACHE_BASEDIR=$PWD" >> $GITHUB_ENV
38+
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
39+
- name: Zero ccache stats and limit in size
40+
run: ccache -z --max-size=500M
41+
- name: Build CBMC tools
42+
run: |
43+
make -C src minisat2-download
44+
make -C src CXX='ccache /usr/bin/g++' cbmc.dir goto-cc.dir goto-diff.dir -j2
45+
- name: Print ccache stats
46+
run: ccache -s
47+
48+
- name: Get one-line-scan
49+
run: git clone -b path-addition https://github.com/awslabs/one-line-scan.git
50+
51+
- name: Get Linux v5.10
52+
run: git clone -b v5.10 --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux_5_10
53+
54+
- name: Prepare compile a part of the kernel with CBMC via one-line-scan
55+
run: |
56+
ln -s goto-cc src/goto-cc/goto-ld
57+
ln -s goto-cc src/goto-cc/goto-as
58+
ln -s goto-cc src/goto-cc/goto-g++
59+
60+
- name: Compile Linux with CBMC via one-line-scan, and check for goto-cc section
61+
run: |
62+
ls
63+
make -C linux_5_10 allnoconfig
64+
make -C linux_5_10 kvm_guest.config
65+
make -C linux_5_10 bzImage -j $(nproc)
66+
du -h . --max-depth=1
67+
rm "linux_5_10/arch/x86/kernel/kvm.o"
68+
one-line-scan/one-line-scan --add-to-path $(pwd)/src/cbmc --add-to-path $(pwd)/src/goto-diff --add-to-path $(pwd)/src/goto-cc --no-analysis --trunc-existing --extra-cflags -Wno-error -o CPROVER -j 3 -- make -C linux_5_10 bzImage -j $(nproc) -k || true
69+
du -h . --max-depth=1
70+
71+
- name: Check for faulty input
72+
run: ls CPROVER/faultyInput/* || true
73+
74+
- name: Check for goto-cc section in a created file
75+
run: objdump -h linux_5_10/arch/x86/kernel/kvm.o | grep "goto-cc"

0 commit comments

Comments
 (0)