docker: Check for qemu outside only
The tests for qemu-aarch64 and qemu-user-static is being done both outside and
inside the container. This isn't correct -- we should only do this once, and
only outside.
Change-Id: I827c08fe751baf222a6a77ac3a6668dfbbe9e78b
(cherry picked from commit c6120fdd89e8101646e03ce612d2e64749f439e2)
diff --git a/Makefile b/Makefile
index a20d113..8f5949e 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@
# limitations under the License.
SHELL := $(shell which /bin/bash)
+INSIDE_DOCKER := $(shell [[ -f /.dockerenv ]] && echo yes)
HAVE_QEMU := $(shell [[ -f /var/lib/binfmts/qemu-aarch64 ]] && echo yes)
HAVE_FIXATED_QEMU := $(shell [[ -f /var/lib/binfmts/qemu-aarch64 ]] && tail -n1 /var/lib/binfmts/qemu-aarch64)
@@ -20,18 +21,20 @@
$(error $$ROOTDIR IS NOT DEFINED -- don\'t forget to source setup.sh)
endif
-ifeq ($(HAVE_QEMU),)
-$(error qemu-user-static is either not installed or not configured properly.)
-endif
+ifeq ($(INSIDE_DOCKER),)
+ ifeq ($(HAVE_QEMU),)
+ $(error qemu-user-static is either not installed or not configured properly.)
+ endif
-ifeq ($(HAVE_FIXATED_QEMU),)
-$(warning Your version of qemu-user-static is too old and does not support)
-$(warning fixated binaries. On Debian-based systems, you can run)
-$(warning `build/fix_aarch64_binfmts.sh` to update your system binfmts)
-$(warning to fixate the aarch64 interpreter in kernel space.)
-$(warning )
-$(warning NOTE: This will modify the global state of your system!)
-$(error Build cannot continue)
+ ifeq ($(HAVE_FIXATED_QEMU),)
+ $(warning Your version of qemu-user-static is too old and does not support)
+ $(warning fixated binaries. On Debian-based systems, you can run)
+ $(warning `build/fix_aarch64_binfmts.sh` to update your system binfmts)
+ $(warning to fixate the aarch64 interpreter in kernel space.)
+ $(warning )
+ $(warning NOTE: This will modify the global state of your system!)
+ $(error Build cannot continue)
+ endif
endif
include $(ROOTDIR)/build/preamble.mk