Skip to content

Instantly share code, notes, and snippets.

@janhieber
Created August 29, 2017 10:25
Show Gist options
  • Save janhieber/fc3cca30a0b6b0be8898d5fb9c83f44d to your computer and use it in GitHub Desktop.
Save janhieber/fc3cca30a0b6b0be8898d5fb9c83f44d to your computer and use it in GitHub Desktop.
Kernel build script
#!/usr/bin/env sh
# settings
USECCACHE=1
CROSS_COMPILE=arm-none-eabi-
ARCH=arm
MAKEPARAM="all"
#############################################
function help() {
echo "build kernel und copy to sd card"
echo -e "./build.sh <makejobs> [copy]\n"
echo -e "\tmakejobs: parallel make jobs"
echo -e "\tuse 0 to determine automatically\n"
echo -e "\tcopy: when specified, copy kernel to target\n"
}
function main() {
[[ -z $1 ]] && help && exit 1
[[ $USECCACHE == 1 ]] && export PATH="/usr/local/bin/ccache:$PATH"
export CROSS_COMPILE
export ARCH
[[ $1 > 0 ]] && JOBS=$1 || JOBS=$(nproc)
# build kernel
make -j $JOBS $MAKEPARAM
mkimage -f fitimage.its linux.fit
# copy to target
[[ $2 == "copy" ]] && ./target_copy.sh
}
main $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment