Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdc26cd5 authored by Khalid Zubair's avatar Khalid Zubair Committed by Ethan Chen
Browse files

mms: introduce a shortcut to quickly rebuild kernel/boot.img

Add a new shortcut to short circuit the long build process that walks
the entire tree collecting all Android.mks. The resulting dependency
list is sufficient to rebuild the kernel, copy product files and
repack the system image with updated modules.

This shortcut allows Kernel devs to rebuild just the boot.img and
kernel modules very quickly (20s vs 3min).

Change-Id: Ie0a69f241ea7b920859ff1e02c3542b79952462c
parent 2a709728
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -475,7 +475,12 @@ endif
ifneq ($(ONE_SHOT_MAKEFILE),)
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.

# No Makefiles to include if we are performing a mms/short-circuit build. Only
# the targets mentioned by main.mk and tasks/* are built (kernel, boot.img etc)
ifneq ($(ONE_SHOT_MAKEFILE),__none__)
include $(ONE_SHOT_MAKEFILE)
endif
# Change CUSTOM_MODULES to include only modules that were
# defined by this makefile; this will install all of those
# modules as a side-effect.  Do this after including ONE_SHOT_MAKEFILE
+26 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- mmp:     Builds all of the modules in the current directory and pushes them to the device.
- mmmp:    Builds all of the modules in the supplied directories and pushes them to the device.
- mmma:    Builds all of the modules in the supplied directories, and their dependencies.
- mms:     Short circuit builder. Quickly re-build the kernel, rootfs, boot and system images
           without deep dependencies. Requires the full build to have run before.
- cgrep:   Greps on all local C/C++ files.
- ggrep:   Greps on all local Gradle files.
- jgrep:   Greps on all local Java files.
@@ -2138,6 +2140,30 @@ function cmka() {
    fi
}

function mms() {
    local T=$(gettop)
    if [ -z "$T" ]
    then
        echo "Couldn't locate the top of the tree.  Try setting TOP."
        return 1
    fi

    case `uname -s` in
        Darwin)
            local NUM_CPUS=$(sysctl hw.ncpu|cut -d" " -f2)
            ONE_SHOT_MAKEFILE="__none__" \
                make -C $T -j $NUM_CPUS "$@"
            ;;
        *)
            local NUM_CPUS=$(cat /proc/cpuinfo | grep "^processor" | wc -l)
            ONE_SHOT_MAKEFILE="__none__" \
                mk_timer schedtool -B -n 1 -e ionice -n 1 \
                make -C $T -j $NUM_CPUS "$@"
            ;;
    esac
}


function repolastsync() {
    RLSPATH="$ANDROID_BUILD_TOP/.repo/.repo_fetchtimes.json"
    RLSLOCAL=$(date -d "$(stat -c %z $RLSPATH)" +"%e %b %Y, %T %Z")