# Linux Kernel Module Cheat

### 38.18. Update a forked submodule

This is a template update procedure for submodules for which we have some patches on on top of mainline.

This example is based on the Linux kernel, for which we used to have patches, but have since moved to mainline:

    # Last point before out patches.
    last_mainline_revision=v4.15
    next_mainline_revision=v4.16
    cd "$(./getvar linux_source_dir)"

    # Create a branch before the rebase in case things go wrong.
    git checkout -b "lkmc-${last_mainline_revision}"
    git remote set-url origin git@github.com:cirosantilli/linux.git
    git push
    git checkout master

    git fetch up
    git rebase --onto "$next_mainline_revision" "$last_mainline_revision"

    # And update the README to show off.
    git commit -m "linux: update to ${next_mainline_revision}"