Add GNU make to the stage3 chroot.
authorRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Aug 2016 14:27:22 +0000 (15:27 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Wed, 10 Aug 2016 14:27:22 +0000 (15:27 +0100)
.gitignore
Makefile

index a274f3c..1ca9a8b 100644 (file)
@@ -25,6 +25,7 @@ stamp-*
 /grep-2.25/
 /gzip-1.8/
 /less-481/
+/make-4.1/
 /mpc-1.0.3/
 /mpfr-3.1.4/
 /nano-2.6.2/
index d69846e..56d330a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -67,6 +67,7 @@ LESS_VERSION       = 481
 STRACE_COMMIT      = f320e1897832fd07a62e18ed288e75d8e79f4c5b
 STRACE_SHORT_COMMIT = f320e189
 BZIP2_VERSION      = 1.0.6
+MAKE_VERSION       = 4.1
 
 all: stage1 stage2 stage3 stage4
 
@@ -287,6 +288,7 @@ stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
        stage3-chroot/usr/bin/less \
        stage3-chroot/usr/bin/strace \
        stage3-chroot/usr/bin/bzip2 \
+       stage3-chroot/usr/bin/make \
        stage3-chroot/init \
        stage3-disk.img
 
@@ -776,6 +778,23 @@ bzip2-$(BZIP2_VERSION).tar.gz:
        wget -O $@-t http://www.bzip.org/1.0.6/bzip2-$(BZIP2_VERSION).tar.gz
        mv $@-t $@
 
+# Cross-compile GNU make.
+stage3-chroot/usr/bin/make: make-$(MAKE_VERSION).tar.gz
+       rm -rf make-$(MAKE_VERSION)
+       tar -zxf $^
+       cd make-$(MAKE_VERSION) && \
+       PATH=$(ROOT)/fixed-gcc:$$PATH \
+       ./configure \
+           --host=riscv64-unknown-linux-gnu \
+           --prefix=/usr --libdir=/usr/lib64
+       cd make-$(MAKE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
+       cd make-$(MAKE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
+
+make-$(MAKE_VERSION).tar.gz:
+       rm -f $@ $@-t
+       wget -O $@-t https://ftp.gnu.org/gnu/make/make-$(MAKE_VERSION).tar.gz
+       mv $@-t $@
+
 # Create an /init script.
 stage3-chroot/init: init.sh
        install -m 0755 $^ $@