Skip to content

Instantly share code, notes, and snippets.

@nwf
Last active May 22, 2020 14:39
Show Gist options
  • Save nwf/f731b0e9d6546e3e31a92fdfb0f71946 to your computer and use it in GitHub Desktop.
Save nwf/f731b0e9d6546e3e31a92fdfb0f71946 to your computer and use it in GitHub Desktop.
CheriOS build goo
#!/usr/bin/zsh
set -e -u -x
export CCACHE_DIR=/cheri/cache/ccache
C=/cheri
S=${C}/source/cherios
B=${C}/build/cherios
O=${C}/out/cherios
A=(
${S}/cheribuild/cheribuild.py
--config-file=${S}/cheribuild.json
-j 160
)
AHOST=(
--clang-path=/usr/lib/ccache/clang
--clang++-path=/usr/lib/ccache/clang++
)
if [ -n "${SKIP_UPDATE:-}" ]; then
A+=( --skip-update )
else
(cd cheribuild; git pull --rebase --autostash)
fi
PATH=/usr/lib/ccache:$PATH ${A[@]} ${AHOST[@]} cherios-qemu cherios-llvm "$@"
mkccachewrap() {
[ -r ${1} ] && return
cat > ${1} <<HERE
#!/bin/sh
exec /usr/bin/ccache ${O}/cherios-sdk/bin/${2} "\$@"
HERE
chmod +x ${1}
}
mkccachewrap ${O}/cherios-sdk/bin/ccache-clang clang
mkccachewrap ${O}/cherios-sdk/bin/ccache-clang-cpp clang-cpp
mkccachewrap ${O}/cherios-sdk/bin/ccache-clang++ clang++
PATH=${O}/cherios-sdk/bin:$PATH ${A[@]} -f \
--clang-path=${O}/cherios-sdk/bin/ccache-clang \
--clang++-path=${O}/cherios-sdk/bin/ccache-clang++ \
cherios \
"$@"
{
"source-root": "/cheri/source/cherios",
"build-root": "/cheri/build/cherios",
"output-root": "/cheri/out/cherios",
"cherios/cmake-options": [
"-DPYTHON_EXECUTABLE=/usr/bin/python3",
"-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF"
]
}
#!/usr/bin/zsh
set -e -u -x
C=/cheri
S=${C}/source/cherios
O=${C}/out/cherios
A=(
${S}/cheribuild/cheribuild.py
--config-file=${S}/cheribuild.json
)
PATH=${O}/cherios-sdk/bin:$PATH ${A[@]} run-cherios "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment