3 COLOR_RED_BG=$(tput setab 1)
4 COLOR_RED_BOLD=$(tput bold)$(tput setaf 1)
5 COLOR_RESET=$(tput sgr0)
7 NCPUS=`cat /proc/cpuinfo | grep processor | wc -l`
11 echo "Usage : $0 <architecture> [rt]"
12 echo " architecture : arm or arm64"
14 echo " e.g) $0 arm64 rt"
18 # Check this system has ccache
22 if [ "$?" -eq "0" ]; then
29 cleanup_localversion()
34 DEFCONFIG=tizen_bcm2711_defconfig
35 touch .kernel_buildenv
36 if [ "$2" = "rt" ]; then
37 echo "Build RT-Kernel"
38 BUILD_VERSION=`cat .kernel_buildenv`
39 if [ "$BUILD_VERSION" != "RT" ]; then
40 echo "Previous .config is for Normal Kernel, so remove"
43 DEFCONFIG=tizen_bcm2711_rt_defconfig
44 cp _localversion-rt localversion-rt
45 trap cleanup_localversion EXIT
46 echo "RT" > ./.kernel_buildenv
48 echo "Build Normal-Kernel"
49 BUILD_VERSION=`cat .kernel_buildenv`
50 if [ "$BUILD_VERSION" == "RT" ]; then
51 echo "Previous .config is for RT Kernel, so remove"
54 echo "NORMAL" > ./.kernel_buildenv
58 if [ $1 = "arm" ]; then
60 cross_compile="${CCACHE} arm-linux-gnueabi-"
62 elif [ $1 = "arm64" ]; then
64 cross_compile="${CCACHE} aarch64-linux-gnu-"
68 if ! [ -e .config ] ; then
69 make ARCH="${arch}" CROSS_COMPILE="${cross_compile}" ${DEFCONFIG}
72 make ARCH="${arch}" CROSS_COMPILE="${cross_compile}" -j ${NCPUS} 2>&1 | \
73 sed -e "/error:.*/{s/^.*error:/$(echo -e "${COLOR_RED_BG}&${COLOR_RESET}")/g;q1}" \
74 -e "/Error.*/{s/^.*Error:/$(echo -e "${COLOR_RED_BG}&${COLOR_RESET}")/g;q1}" \
75 -e "/ERROR.*/{s/^.*ERROR/$(echo -e "${COLOR_RED_BG}&${COLOR_RESET}")/g;q1}"
77 echo -e "${COLOR_RED_BOLD}Failed to build${COLOR_RESET}"
81 scripts/mkbootimg_rpi4.sh