1#!/bin/bash -e 2 3SCRIPTS_DIR="${SCRIPTS_DIR:-$(dirname "$(realpath "$0")")}" 4SDK_DIR="${SDK_DIR:-$SCRIPTS_DIR/../../../..}" 5BUILDROOT_DIR="$SDK_DIR/buildroot" 6 7# Buildroot brmake needs unbuffer 8if ! which unbuffer >/dev/null 2>&1; then 9 echo -e "\e[35m" 10 echo "Your unbuffer is missing" 11 echo "Please install it:" 12 echo "sudo apt-get install expect expect-dev" 13 echo -e "\e[0m" 14 exit 1 15fi 16 17# The new buildroot Makefile needs make (>= 4.0) 18if ! "$BUILDROOT_DIR/support/dependencies/check-host-make.sh" 4.0 make \ 19 > /dev/null; then 20 echo -e "\e[35m" 21 echo "Your make is too old: $(make -v | head -n 1)" 22 echo "Please update it:" 23 echo "git clone https://github.com/mirror/make.git --depth 1 -b 4.2" 24 echo "cd make" 25 echo "git am $BUILDROOT_DIR/package/make/*.patch" 26 echo "autoreconf -f -i" 27 echo "./configure" 28 echo "sudo make install -j8" 29 echo -e "\e[0m" 30 exit 1 31fi 32 33# The buildroot's e2fsprogs doesn't support new features like 34# metadata_csum_seed and orphan_file 35if grep -wq metadata_csum_seed /etc/mke2fs.conf; then 36 echo -e "\e[35m" 37 echo "Your mke2fs is too new: $(mke2fs -V 2>&1 | head -n 1)" 38 echo "Please downgrade it:" 39 "$SCRIPTS_DIR/install-e2fsprogs.sh" 40 echo -e "\e[0m" 41 exit 1 42fi 43