Skip to content

Commit f155771

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 f155771

File tree

1 file changed

+74
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)