diff options
Diffstat (limited to 'kbuild.sh')
-rwxr-xr-x | kbuild.sh | 47 |
1 files changed, 27 insertions, 20 deletions
@@ -5,13 +5,12 @@ set -e kbuild_root=$(dirname $(readlink -f "$0")) -#OPTIONS='CONFIG_DEBUG_SECTION_MISMATCH=y' -#OPTIONS='C=1' -OPTIONS="KALLSYMS_EXTRA_PASS=0" -KCFLAGS="-Werror -Wno-error=cpp" +#kbuild_options='CONFIG_DEBUG_SECTION_MISMATCH=y' +#kbuild_options='C=1' +kbuild_options="KALLSYMS_EXTRA_PASS=0" -NFS_ROOT=$HOME/src/netboot -TFTP_ROOT=$HOME/tftpboot +nfs_root=$HOME/src/netboot +tftp_root=$HOME/tftpboot # # Options parsing @@ -76,6 +75,8 @@ done # Platform # +kcflags="-Werror -Wno-error=cpp" + if [[ -z "$platform" ]] ; then for f in $kbuild_root/platforms/*.sh ; do pattern=$(cat $f | grep "dir_pattern=" | head -1) @@ -112,8 +113,8 @@ fi source "${kbuild_root}/arch/$arch.sh" || exit 1 -target_dir=${target_dir:-$NFS_ROOT/$arch_dir} -output_dir=${output_dir:-$PWD/output/$arch_dir} +target_dir=${target_dir:-$nfs_root/$arch_dir} +output_dir=$PWD/output/$arch_dir # # Parallelize make with twice as many jobs as CPUs @@ -122,7 +123,7 @@ output_dir=${output_dir:-$PWD/output/$arch_dir} num_cpus=$(cat /proc/cpuinfo | grep '^processor\b' | wc -l) pmake="make -j$((num_cpus*2))" -OPTIONS="KALLSYMS_EXTRA_PASS=0 KCFLAGS='$KCFLAGS'" +kbuild_options="$kbuild_options KCFLAGS='$kcflags'" echo "Compiling for platform $platform with $num_cpus CPUs" @@ -152,18 +153,18 @@ fi # Compile the kernel, modules and DTBs # -dtbs= -for dtb in $DTBS ; do +kernel_dtbs= +for dtb in $dtbs ; do dtb=${dtb/:*/} - dtbs="$dtbs $dtb" + kernel_dtbs="$kernel_dtbs $dtb" done -eval $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile $OPTIONS \ - $image_kernel $dtbs +eval $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile $kbuild_options \ + $image_kernel $kernel_dtbs grep 'CONFIG_MODULES=y' $output_dir/.config > /dev/null && modules=modules if [[ x$modules == xmodules ]] ; then - eval $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile $OPTIONS \ + eval $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile $kbuild_options \ $modules fi @@ -188,7 +189,7 @@ copy_dtbs() { local dtb local target_dir=$1 - for dtb in $DTBS ; do + for dtb in $dtbs ; do local src=${dtb/:*/} local dst=${dtb/*:/} dst=${dst/*\//} @@ -197,21 +198,27 @@ copy_dtbs() { done } -mkdir -p $BOOT_DIR -cp $image_file $BOOT_DIR/ +mkdir -p $boot_dir +cp $image_file $boot_dir/ if [[ $image != FIT && $image != CrOS ]] ; then - copy_dtbs $BOOT_DIR/ + copy_dtbs $boot_dir/ fi if [[ x$modules = xmodules ]] ; then $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile INSTALL_MOD_PATH=$target_dir modules_install - echo "Kernel modules installed to $target_dir/lib/modules/$version" fi if [[ $do_package_deb = 1 ]] ; then $pmake ARCH=$arch O=$output_dir CROSS_COMPILE=$cross_compile bindeb-pkg fi +# +# Print status and terminate +# + echo "Kernel image available in $image_file" +if [[ x$modules = xmodules ]] ; then + echo "Kernel modules installed to $target_dir/lib/modules/$version" +fi echo "Build $version completed at $(date)" |