diff options
Diffstat (limited to 'kbuild.sh')
-rwxr-xr-x | kbuild.sh | 63 |
1 files changed, 44 insertions, 19 deletions
@@ -6,6 +6,7 @@ set -e kbuild_root=$(dirname $(readlink -f "$0")) declare -A cross_compile +declare -A target_root if [[ -r $kbuild_root/config.sh ]] ; then source $kbuild_root/config.sh || exit 1 @@ -15,9 +16,6 @@ fi #kbuild_options='C=1' kbuild_options="KALLSYMS_EXTRA_PASS=0" -nfs_root=$HOME/src/netboot -tftp_root=$HOME/tftpboot - # # Options parsing # @@ -119,8 +117,15 @@ fi source "${kbuild_root}/arch/$arch.sh" || exit 1 -target_dir=${target_dir:-${target_root[$arch]}} -output_dir=$PWD/output/$arch_dir +# Override the output directory for ARM for historical reasons +case $arch in + arm) + output_dir=$PWD/output/arm32 + ;; + *) + output_dir=$PWD/output/$arch + ;; +esac # # Build environment and tools @@ -141,7 +146,7 @@ if [[ -n "$opt_defconfig" ]] ; then rm $output_dir/arch/$arch/configs/build_defconfig fi -if [[ $do_menu_config = 1 ]] ; then +if [[ $do_menu_config == 1 ]] ; then $make menuconfig exit 0 fi @@ -150,7 +155,7 @@ fi # Compile documentation if requested # -if [[ $do_compile_doc = 1 ]] ; then +if [[ $do_compile_doc == 1 ]] ; then $pmake DOCBOOKS='' htmldocs fi @@ -185,38 +190,58 @@ else fi # -# Copy the files to their destination directories +# Copy the files to their destination directories. +# +# The kernel image and DTBs are copied to both $target_dir/boot and $tftp_dir +# (if available). When the image format is CrOS, installation to $tftp_dir is +# skipped as Chrome OS devices can't boot from TFTP. # +# The modules are installed to $target_dir if available, or to +# $output_dir/modules otherwise. +# + +target_dir=${target_dir:-${target_root[$arch]}} +tftp_dir=${tftp_dir:-$tftp_root/$platform} copy_dtbs() { + local dest_dir=$1 local dtb - local target_dir=$1 + + if [[ $image == FIT || $image == CrOS ]] ; then + return + fi for dtb in $dtbs ; do local src=${dtb/:*/} local dst=${dtb/*:/} dst=${dst/*\//} - cp $output_dir/arch/${ARCH}/boot/dts/$src* $target_dir/$dst + cp $output_dir/arch/${ARCH}/boot/dts/$src* $dest_dir/$dst done } -mkdir -p $boot_dir -cp $image_file $boot_dir/ +if [[ -d "$target_dir" ]] ; then + mkdir -p $target_dir/boot + cp $image_file $target_dir/boot/ + copy_dtbs $target_dir/boot/ +fi -if [[ $image != FIT && $image != CrOS ]] ; then - copy_dtbs $boot_dir/ +if [[ $image != CrOS && -d "$tftp_dir" ]] ; then + cp $image_file $tftp_dir/ + copy_dtbs $tftp_dir/ fi -if [[ x$modules = xmodules ]] ; then - $pmake INSTALL_MOD_PATH=$target_dir modules_install +if [[ x$modules == xmodules ]] ; then + mod_path=${target_dir:-$output_dir/modules} + mkdir -p $mod_path + $pmake INSTALL_MOD_PATH=$mod_path modules_install fi # # Create the Debian package if requested # -if [[ $do_package_deb = 1 ]] ; then +if [[ $do_package_deb == 1 ]] ; then $pmake bindeb-pkg fi @@ -225,7 +250,7 @@ fi # echo "Kernel image available in $image_file" -if [[ x$modules = xmodules ]] ; then - echo "Kernel modules installed to $target_dir/lib/modules/$version" +if [[ x$modules == xmodules ]] ; then + echo "Kernel modules installed to $mod_path/lib/modules/$version" fi echo "Build $version completed at $(date)" |