Skip to content

Commit a852e84

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 <nmanthey@amazon.de>
1 parent ac1e4dd commit a852e84

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)