From 1e31e6e871205f7f684c6f726e493cf607bd8982 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 26 Feb 2015 14:47:49 -0800 Subject: [PATCH 1/3] Don't use a failing build step for gcc-stage1 We used to allow GCC to fail the stage1 build because it's impossible to build the full GCC without glibc. This builds just the parts we need ("all-gcc" and "all-target-libgcc") and then install them. This should make build failures a bit easier to debug, as now nothing should fail. --- Makefile.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 831e2253..ee9a6db1 100755 --- a/Makefile.in +++ b/Makefile.in @@ -102,8 +102,10 @@ stamps/build-gcc-linux-stage1: src/gcc stamps/build-binutils-linux --disable-nls \ --disable-multilib \ --disable-bootstrap - -$(MAKE) -C $(notdir $@) inhibit-libc=true - $(MAKE) -C $(notdir $@) install + $(MAKE) -C $(notdir $@) inhibit-libc=true all-gcc + $(MAKE) -C $(notdir $@) inhibit-libc=true install-gcc + $(MAKE) -C $(notdir $@) inhibit-libc=true all-target-libgcc + $(MAKE) -C $(notdir $@) inhibit-libc=true install-target-libgcc mkdir -p $(dir $@) && touch $@ stamps/build-gcc-linux-stage2: src/gcc stamps/build-glibc-linux From de00a614ebc3bc5b72e5450ba1f5cd24ad8b8ab3 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 26 Feb 2015 14:49:56 -0800 Subject: [PATCH 2/3] Install the glibc and linux headers before stage1 I thought this was a problem with the build, but it turns out that was actually related to my bad (and now reverted) patch from earlier this week. Regardless, this is the canonical way to build a cross compiler so now that it's done I don't see a reason not to use it. --- Makefile.in | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index ee9a6db1..f781ec6d 100755 --- a/Makefile.in +++ b/Makefile.in @@ -63,11 +63,31 @@ stamps/build-binutils-linux: src/binutils $(MAKE) -C $(notdir $@) install mkdir -p $(dir $@) && touch $@ +stamps/build-linux-headers: + mkdir -p $(SYSROOT)/usr/ + cp -R $(srcdir)/linux-headers/include $(SYSROOT)/usr/ + mkdir -p $(dir $@) && touch $@ + +stamps/build-glibc-linux-headers: src/glibc + rm -rf $@ $(notdir $@) + mkdir $(notdir $@) + mkdir -p $(SYSROOT)/usr/lib $(SYSROOT)/lib + cd $(notdir $@) && CC= $(CURDIR)/$ Date: Thu, 26 Feb 2015 15:07:03 -0800 Subject: [PATCH 3/3] Look for already downloaded files in DISTDIR (/var/cache/destfiles) buildbot.dabbelt.com recently failed because it was unable to fetch the downloaded files fast enough because mirrors.kernel.org was being slow. This patch allows me to cache the downloaded files somewhere to avoid these sorts of network problems. This should also be generally useful for other people who build the toolchain regularly. --- Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index f781ec6d..a6f2687e 100755 --- a/Makefile.in +++ b/Makefile.in @@ -8,6 +8,7 @@ binutils_version := 2.25 glibc_version := 2.21 newlib_version := 1.18.0 +DISTDIR ?= /var/cache/distfiles GNU_MIRROR := http://mirrors.kernel.org/gnu gcc_url := $(GNU_MIRROR)/gcc/gcc-$(gcc_version)/gcc-$(gcc_version).tar.gz binutils_url := $(GNU_MIRROR)/binutils/binutils-$(binutils_version).tar.gz @@ -32,7 +33,7 @@ linux: stamps/build-gcc-linux-stage2 $(addprefix src/original-,$(PACKAGES)): mkdir -p src rm -rf $@ $(subst original-,,$@)-* - cd src && @FETCHER@ $($(subst src/original-,,$@)_url) | tar zxf - + cd src && (cat $(DISTDIR)/$(subst src/original-,,$@)-$($(subst src/original-,,$@)_version).tar.gz || @FETCHER@ $($(subst src/original-,,$@)_url)) | tar zxf - mv $(subst original-,,$@)-$($(subst src/original-,,$@)_version) $@ $(addprefix src/,$(PACKAGES)): src/%: src/original-%