Using the clean script for busybox seem to cause a rebuild of the build environment(, and fails with compilation of e2fsprogs).
(same for using the clean script for e2fsprogs)
Initial state:
Initially I successfully compiled an 'stock' 8.0.2 image (see [Fixed] Compile error LE 8.0.1, xz: (stdin): File format not recognized), following the wiki page: index.php?title=Compile
Re-compile busybox
To re-compile busybox (e.g. without any config changes made yet) I expected the following would be the required steps:
PROJECT=RPi2 ARCH=arm scripts/clean busybox
PROJECT=RPi2 ARCH=arm make image
I hoped the script more to behave like:
cd ~/LibreELEC.tv/build.LibreELEC-RPi2.arm-8.0.1/busybox-1.25.1/
make clean
cd ~/LibreELEC.tv/build.LibreELEC-RPi2.arm-8.0.1/.stamps
rm -r busybox
 
Questions
1) Is it expected behaviour that 'scripts/clean busybox' cause so many packages to be rebuild?
2) What are the advised steps to re-compile busybox for the target (PRi2)?
3) Is it possible/needed to properly fix the 'Permission denied' failures for re-compiling e2fsprogs?
4) Is there a fix for the second make error "Could NOT find FreeType (missing: FREETYPE_INCLUDE_DIR) (found version "18.5.12")"?
Resulting steps
(long list just to give in idea how many packages are rebuild)
CLEAN    busybox
  Buildoptions:
   CLEAN    configtools
   UNPACK   configtools
   BUILD    configtools (host)
   CLEAN    make
   UNPACK   make
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/make/patches/make-3.82-011-noclock_gettime.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/make/patches/make-3.82-016-weird-shell.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/make-4.2.1/config/
   BUILD    make (host)
   CLEAN    xz
   UNPACK   xz
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/xz-5.2.2/build-aux/
   CLEAN    ccache
   UNPACK   ccache
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/ccache-3.3.3/
   BUILD    ccache (host)
   BUILD    xz (host)
   CLEAN    sed
   UNPACK   sed
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/sed-4.2.2/build-aux/
   BUILD    sed (host)
   CLEAN    pkg-config
   UNPACK   pkg-config
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/pkg-config/patches/pkg-config-0001-use-sysroot-path.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/pkg-config-0.29.1/
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/pkg-config-0.29.1/glib/
   CLEAN    gettext
   UNPACK   gettext
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/gettext/patches/gettext-0.18.2-non_interactive.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/gettext/patches/gettext-dont_build_docs_and_examples.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gettext-0.19.8.1/gettext-tools/examples/hello-c++-kde/admin/
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gettext-0.19.8.1/build-aux/
   BUILD    gettext (host)
   BUILD    pkg-config (host)
   CLEAN    autoconf
   UNPACK   autoconf
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/autoconf/patches/autoconf-autoreconf-exclude.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/autoconf-2.69/build-aux/
   CLEAN    m4
   UNPACK   m4
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/m4-1.4.17/build-aux/
   BUILD    m4 (host)
   BUILD    autoconf (host)
   CLEAN    automake
   UNPACK   automake
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/automake/patches/automake-01-fix-help2man.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/automake-1.15/lib/
   BUILD    automake (host)
   CLEAN    libtool
   UNPACK   libtool
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/libtool/patches/libtool-01_dont_relink_against_host.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/libtool/patches/libtool-02-use_ld.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/libtool/patches/libtool-03-remove-help2man-dependency.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/libtool-2.4.6/build-aux/
   BUILD    libtool (host)
   CLEAN    intltool
   UNPACK   intltool
   BUILD    intltool (host)
   CLEAN    autoconf-archive
   UNPACK   autoconf-archive
   BUILD    autoconf-archive (host)
   CLEAN    gcc
   UNPACK   gcc
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/lang/gcc/patches/gcc-4.8.2-disable_multilib_i386_linux64.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/lang/gcc/patches/gcc-allow-newer-autoconf.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/lang/gcc/patches/gcc-crosscompile-badness.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/lang/gcc/patches/gcc-reduce-genautomata-memory-footprint-for-arm-bug-70473.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gcc-6.2.0/
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gcc-6.2.0/libjava/libltdl/
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gcc-6.2.0/libjava/classpath/
   CLEAN    binutils
   UNPACK   binutils
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/binutils/patches/binutils-01-warn-for-uses-of-system-directories-when-link.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/binutils-2.27/
   CLEAN    bison
   UNPACK   bison
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/bison-3.0.4/build-aux/
   BUILD    bison (host)
   CLEAN    flex
   UNPACK   flex
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/flex/patches/flex-001-plex.malloc.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/flex-2.5.39/
   BUILD    flex (host)
   CLEAN    linux
   UNPACK   linux
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/linux/patches/linux-004_lower_undefined_mode_timeout.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/linux/patches/linux-007_die_floppy_die.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/linux/patches/linux-009_disable_i8042_check_on_apple_mac.patch
   BUILD    linux (host)
   BUILD    binutils (host)
   CLEAN    gmp
   UNPACK   gmp
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/gmp-6.1.1/
   BUILD    gmp (host)
   CLEAN    mpfr
   UNPACK   mpfr
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/mpfr-3.1.5/
   BUILD    mpfr (host)
   CLEAN    mpc
   UNPACK   mpc
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/mpc-1.0.3/
   BUILD    mpc (host)
   CLEAN    glibc
   UNPACK   glibc
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/glibc/patches/glibc-fix-dns-with-broken-routers.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/glibc-2.24/scripts/
   BUILD    autotools (host)
   BUILD    gcc (bootstrap)
   BUILD    glibc (target)
   BUILD    gcc (host)
   CLEAN    cmake
   UNPACK   cmake
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/cmake/patches/cmake-000-disable-sslv3.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/devel/cmake/patches/cmake-001-disable-free-comp-methods.patch
   CLEAN    libressl
   UNPACK   libressl
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/security/libressl/patches/libressl-trusted-first.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/libressl-2.4.4/scripts/
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/libressl-2.4.4/
   BUILD    libressl (host)
       AUTORECONF   libressl
   BUILD    cmake (host)
   CLEAN    yasm
   UNPACK   yasm
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/yasm-1.3.0/config/
   BUILD    yasm (host)
   BUILD    toolchain (target)
   CLEAN    squashfs
   UNPACK   squashfs
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/sysutils/squashfs/patches/squashfs-4.2-defaults-0.1.patch
   CLEAN    zlib
   UNPACK   zlib
   BUILD    zlib (host)
   CLEAN    lzo
   UNPACK   lzo
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/lzo-2.09/autoconf/
   BUILD    lzo (host)
   BUILD    squashfs (host)
   CLEAN    dosfstools
   UNPACK   dosfstools
   BUILD    dosfstools (host)
   CLEAN    fakeroot
   UNPACK   fakeroot
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/fakeroot-1.20.2/
   CLEAN    libcap
   UNPACK   libcap
   BUILD    libcap (host)
   BUILD    fakeroot (host)
   CLEAN    kmod
   UNPACK   kmod
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/sysutils/kmod/patches/kmod-02_fix-pkgconf.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/kmod-23/build-aux/
   BUILD    kmod (host)
   CLEAN    mtools
   UNPACK   mtools
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/tools/mtools/patches/mtools-01-fix-creation-of-dot-directories.patch
       APPLY PATCH (common)   ~/LibreELEC.tv.test/packages/tools/mtools/patches/mtools-05-fix-install.patch
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/mtools-4.0.18/
   BUILD    mtools (host)
       AUTORECONF   mtools
   CLEAN    populatefs
   UNPACK   populatefs
   CLEAN    e2fsprogs
   UNPACK   e2fsprogs
       FIXCONFIG   build.LibreELEC-RPi2.arm-8.0.2/e2fsprogs-1.43.3/config/
   BUILD    e2fsprogs (host)
              
(rebuild of e2fsprogs fails, due to two files not removed by the clean script.)Error e2fsprogs:
make[1]: Leaving directory '~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/e2fsprogs-1.43.3/.x86_64-linux-gnu/lib/ext2fs'
cp: cannot create regular file '~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libcom_err.a': Permission denied
cp: cannot create regular file '~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libext2fs.a': Permission denied
Makefile:12: recipe for target 'image' failed
make: *** [image] Error 1Workaround for 'Permission denied' failure
ls -la ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libcom_err.a
ls -la ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libext2fs.a
mv ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libcom_err.a ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libcom_err.a.orig
mv ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libext2fs.a ~/LibreELEC.tv.test/build.LibreELEC-RPi2.arm-8.0.2/toolchain/lib/libext2fs.a.orig
PROJECT=RPi2 ARCH=arm scripts/clean e2fsprogs
PROJECT=RPi2 ARCH=arm make imag 
		