# Linux Kernel Module Cheat

### 38.7. Clean the build

You did something crazy, and nothing seems to work anymore?

All our build outputs are stored under `out/`, so the coarsest and most effective thing you can do is:

    rm -rf out

This implies a full rebuild for all archs however, so you might first want to explore finer grained cleans first.

All our individual `build-*` scripts have a `--clean` option to completely nuke their builds:

    ./build-gem5 --clean
    ./build-qemu --clean
    ./build-buildroot --clean

Verify with:

    ls "$(./getvar qemu_build_dir)"
    ls "$(./getvar gem5_build_dir)"
    ls "$(./getvar buildroot_build_dir)"

Note that host tools like QEMU and gem5 store all archs in a single directory to factor out build objects, so cleaning one arch will clean all of them.

To only nuke only one Buildroot package, we can use the `-dirclean` Buildroot target:

    ./build-buildroot --no-all -- <package-name>-dirclean

e.g.:

    ./build-buildroot --no-all -- sample_package-dirclean

Verify with:

    ls "$(./getvar buildroot_build_build_dir)"