X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Makefile;h=2852a39a84450a784109b2170977dc3c19e4f7f1;hb=db051fadf34b809fd470918c1a2befc741940c19;hp=ba07225f32df5faf536b1a00d60050f754505576;hpb=f0f399ca3b98137408ae97d4ce8b7ac12f3e523c;p=fedora-riscv.git diff --git a/Makefile b/Makefile index ba07225..2852a39 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,17 @@ STAGE3_PACKAGES = gcc rpm-build # Versions of cross-compiled packages. NCURSES_VERSION = 6.0-20160730 -BASH_VERSION = 4.3 -COREUTILS_VERSION = 8.25 -GMP_VERSION = 6.1.1 -MPFR_VERSION = 3.1.4 -MPC_VERSION = 1.0.3 -GCC_X_VERSION = 6.1.0 +BASH_VERSION = 4.3 +COREUTILS_VERSION = 8.25 +GMP_VERSION = 6.1.1 +MPFR_VERSION = 3.1.4 +MPC_VERSION = 1.0.3 +BINUTILS_X_VERSION = 2.26 +GCC_X_VERSION = 6.1.0 +UTIL_LINUX_VERSION = 2.28 +TAR_VERSION = 1.29 +GZIP_VERSION = 1.8 +ZLIB_VERSION = 1.2.8 all: stage1 stage2 stage3 stage4 @@ -251,7 +256,12 @@ stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \ stage3-chroot/usr/lib64/libgmp.so.10 \ stage3-chroot/usr/lib64/libmpfr.so.4 \ stage3-chroot/usr/lib64/libmpc.so.3 \ + stage3-chroot/usr/bin/as \ stage3-chroot/usr/bin/gcc \ + stage3-chroot/usr/bin/mount \ + stage3-chroot/usr/bin/tar \ + stage3-chroot/usr/bin/gzip \ + stage3-chroot/usr/lib64/libz.so \ stage3-chroot/init \ stage3-disk.img @@ -365,6 +375,24 @@ coreutils-$(COREUTILS_VERSION).tar.xz: wget -O $@-t ftp://ftp.gnu.org/gnu/coreutils/coreutils-$(COREUTILS_VERSION).tar.xz mv $@-t $@ +# Cross-compile binutils. +stage3-chroot/usr/bin/as: binutils-$(BINUTILS_X_VERSION).tar.gz + rm -rf binutils-$(BINUTILS_X_VERSION) + zcat $^ | tar xf - + mkdir riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build + cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + ../configure \ + --host=riscv64-unknown-linux-gnu \ + --prefix=/usr --libdir=/usr/lib64 + cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make + cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && make DESTDIR=$(ROOT)/stage3-chroot install + +binutils-$(BINUTILS_X_VERSION).tar.gz: + rm -f $@ $@-t + wget -O $@-t https://github.com/riscv/riscv-binutils-gdb/archive/riscv-binutils-$(BINUTILS_X_VERSION).tar.gz + mv $@-t $@ + # Cross-compile GMP, MPFR and MPC (deps of GCC). stage3-chroot/usr/lib64/libgmp.so.10: gmp-$(GMP_VERSION).tar.lz rm -rf gmp-$(GMP_VERSION) @@ -435,6 +463,8 @@ stage3-chroot/usr/bin/gcc: gcc-$(GCC_X_VERSION).tar.gz --disable-libquadmath \ --disable-nls \ --disable-multilib +# XXX use make all & make install here. However building libgcc +# fails, see 'broken-gcc.log'. cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make all-gcc cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && make install-gcc DESTDIR=$(ROOT)/stage3-chroot @@ -443,6 +473,82 @@ gcc-$(GCC_X_VERSION).tar.gz: wget -O $@-t https://github.com/riscv/riscv-gcc/archive/riscv-gcc-$(GCC_X_VERSION).tar.gz mv $@-t $@ +# Cross-compile util-linux. +# XXX Be nice to fix ncurses/tinfo support which in theory should work. +stage3-chroot/usr/bin/mount: util-linux-$(UTIL_LINUX_VERSION).tar.xz + rm -rf util-linux-$(UTIL_LINUX_VERSION) + tar -Jxf $^ + cd util-linux-$(UTIL_LINUX_VERSION) && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + ./configure \ + --host=riscv64-unknown-linux-gnu \ + --prefix=/usr --libdir=/usr/lib64 \ + --without-python \ + --without-tinfo \ + --without-ncurses \ + --without-systemd \ + --disable-makeinstall-chown + cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make +# libtool fucks something up here, ignore the failure and continue. + -cd util-linux-$(UTIL_LINUX_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot -j1 -k V=1 + +util-linux-$(UTIL_LINUX_VERSION).tar.xz: + rm -f $@ $@-t + wget -O $@-t ftp://ftp.kernel.org/pub/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)/util-linux-$(UTIL_LINUX_VERSION).tar.xz + mv $@-t $@ + +# Cross-compile GNU tar. +stage3-chroot/usr/bin/tar: tar-$(TAR_VERSION).tar.xz + rm -rf tar-$(TAR_VERSION) + tar -Jxf $^ + cd tar-$(TAR_VERSION) && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + ./configure \ + --host=riscv64-unknown-linux-gnu \ + --prefix=/usr --libdir=/usr/lib64 + cd tar-$(TAR_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make + cd tar-$(TAR_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot + +tar-$(TAR_VERSION).tar.xz: + rm -f $@ $@-t + wget -O $@-t https://ftp.gnu.org/gnu/tar/tar-$(TAR_VERSION).tar.xz + mv $@-t $@ + +# Cross-compile GNU gzip. +stage3-chroot/usr/bin/gzip: gzip-$(GZIP_VERSION).tar.gz + rm -rf gzip-$(GZIP_VERSION) + tar -zxf $^ + cd gzip-$(GZIP_VERSION) && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + ./configure \ + --host=riscv64-unknown-linux-gnu \ + --prefix=/usr --libdir=/usr/lib64 + cd gzip-$(GZIP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make + cd gzip-$(GZIP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot + +gzip-$(GZIP_VERSION).tar.gz: + rm -f $@ $@-t + wget -O $@-t https://ftp.gnu.org/gnu/gzip/gzip-$(GZIP_VERSION).tar.gz + mv $@-t $@ + +# Cross-compile zlib. +stage3-chroot/usr/lib64/libz.so: zlib-$(ZLIB_VERSION).tar.gz + rm -rf zlib-$(ZLIB_VERSION) + tar -zxf $^ + cd zlib-$(ZLIB_VERSION) && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + CC=riscv64-unknown-linux-gnu-gcc \ + CFLAGS="-I/home/rjones/d/fedora-riscv/stage3-chroot/usr/include -L/home/rjones/d/fedora-riscv/stage3-chroot/usr/lib" \ + ./configure \ + --prefix=/usr --libdir=/usr/lib64 + cd zlib-$(ZLIB_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make shared + cd zlib-$(ZLIB_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot + +zlib-$(ZLIB_VERSION).tar.gz: + rm -f $@ $@-t + wget -O $@-t http://zlib.net/zlib-$(ZLIB_VERSION).tar.gz + mv $@-t $@ + # Create an /init script. stage3-chroot/init: init.sh install -m 0755 $^ $@