X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Makefile;h=edf97862b855e5af19ed73409621240c51717ec8;hb=67d2ef5b900e97d527838d5a622fd15754db8460;hp=7a577ae87ef96b104c2ccf4fdef646aa96c3e485;hpb=390ad290602f87c6516eb4ba4ce426ee0c37d190;p=fedora-riscv.git diff --git a/Makefile b/Makefile index 7a577ae..edf9786 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,51 @@ # Refer to the README file to understand how Fedora on RISC-V is # bootstrapped. +# Note these are chosen very specifically to ensure the different +# versions work together. Don't blindly update to the latest +# versions. See also: +# https://github.com/riscv/riscv-pk/issues/18#issuecomment-206115996 +RISCV_QEMU_COMMIT = 94f5eb73091fb4fe272db3e943f173ecc0f78ffd +RISCV_QEMU_SHORTCOMMIT = 94f5eb73 +RISCV_FESVR_COMMIT = 0f34d7ad311f78455a674224225f5b3056efba1d +RISCV_FESVR_SHORTCOMMIT = 0f34d7ad +RISCV_ISA_SIM_COMMIT = 3bfc00ef2a1b1f0b0472a39a866261b00f67027e +RISCV_ISA_SIM_SHORTCOMMIT = 3bfc00ef +RISCV_GNU_TOOLCHAIN_COMMIT = 728afcddcb0526a0f6560c4032da82805f054d58 +RISCV_GNU_TOOLCHAIN_SHORTCOMMIT = 728afcdd +RISCV_PK_COMMIT = 85ae17aa149b9ea114bdd70cc30ea7e73813fb48 +RISCV_PK_SHORTCOMMIT = 85ae17aa + +# For the correct versions, see +# riscv-gnu-toolchain/Makefile.in *_version variables +BINUTILS_VERSION = 2.25.1 +GLIBC_VERSION = 2.22 +GCC_VERSION = 5.3.0 +NEWLIB_VERSION = 2.2.0 + all: stage1 stage2 stage3 stage4 # Stage 1 -stage1: stage1-riscv-qemu/riscv-qemu-94f5eb73.tar.gz \ - stamp-riscv-qemu-installed - -stage1-riscv-qemu/riscv-qemu-94f5eb73.tar.gz: +stage1: stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz \ + stage1-riscv-qemu/riscv-qemu.spec \ + stamp-riscv-qemu-installed \ + stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz \ + stage1-riscv-fesvr/riscv-fesvr.spec \ + stamp-riscv-fesvr-installed \ + stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz \ + stage1-riscv-isa-sim/riscv-isa-sim.spec \ + stamp-riscv-isa-sim-installed + +stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz: rm -f $@ $@-t - wget -O $@-t 'https://github.com/riscv/riscv-qemu/archive/94f5eb73091fb4fe272db3e943f173ecc0f78ffd/riscv-qemu-94f5eb73.tar.gz' + wget -O $@-t 'https://github.com/riscv/riscv-qemu/archive/$(RISCV_QEMU_COMMIT)/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz' + mv $@-t $@ + +stage1-riscv-qemu/riscv-qemu.spec: stage1-riscv-qemu/riscv-qemu.spec.in + sed -e 's/@COMMIT@/$(RISCV_QEMU_COMMIT)/g' \ + -e 's/@SHORTCOMMIT@/$(RISCV_QEMU_SHORTCOMMIT)/g' \ + < $^ > $@-t mv $@-t $@ stamp-riscv-qemu-installed: @@ -32,40 +67,108 @@ stamp-riscv-qemu-installed: } touch $@ +stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz: + rm -f $@ $@-t + wget -O $@-t 'https://github.com/riscv/riscv-fesvr/archive/$(RISCV_FESVR_COMMIT)/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz' + mv $@-t $@ + +stage1-riscv-fesvr/riscv-fesvr.spec: stage1-riscv-fesvr/riscv-fesvr.spec.in + sed -e 's/@COMMIT@/$(RISCV_FESVR_COMMIT)/g' \ + -e 's/@SHORTCOMMIT@/$(RISCV_FESVR_SHORTCOMMIT)/g' \ + < $^ > $@-t + mv $@-t $@ + +stamp-riscv-fesvr-installed: + rm -f $@ + @rpm -q riscv-fesvr >/dev/null || { \ + echo "ERROR: You must install riscv-fesvr:"; \ + echo; \ + echo " dnf copr enable rjones/riscv"; \ + echo " dnf install riscv-fesvr"; \ + echo; \ + echo "OR: you can build it yourself from the stage1-riscv-fesvr directory."; \ + echo; \ + exit 1; \ + } + touch $@ + +stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz: + rm -f $@ $@-t + wget -O $@-t 'https://github.com/riscv/riscv-isa-sim/archive/$(RISCV_ISA_SIM_COMMIT)/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz' + mv $@-t $@ + +stage1-riscv-isa-sim/riscv-isa-sim.spec: stage1-riscv-isa-sim/riscv-isa-sim.spec.in + sed -e 's/@COMMIT@/$(RISCV_ISA_SIM_COMMIT)/g' \ + -e 's/@SHORTCOMMIT@/$(RISCV_ISA_SIM_SHORTCOMMIT)/g' \ + < $^ > $@-t + mv $@-t $@ + +stamp-riscv-isa-sim-installed: + rm -f $@ + @rpm -q riscv-isa-sim >/dev/null || { \ + echo "ERROR: You must install riscv-isa-sim:"; \ + echo; \ + echo " dnf copr enable rjones/riscv"; \ + echo " dnf install riscv-isa-sim"; \ + echo; \ + echo "OR: you can build it yourself from the stage1-riscv-isa-sim directory."; \ + echo; \ + exit 1; \ + } + touch $@ + # Stage 2 -stage2: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-1374381e.tar.gz \ - stage2-riscv-gnu-toolchain/binutils-2.26.tar.gz \ - stage2-riscv-gnu-toolchain/gcc-6.1.0.tar.gz \ - stage2-riscv-gnu-toolchain/glibc-2.23.tar.gz \ - stage2-riscv-gnu-toolchain/newlib-2.2.0.tar.gz \ +stage2: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz \ + stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz \ + stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz \ + stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz \ + stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz \ + stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec \ stamp-riscv-gnu-toolchain-installed \ - stage2-riscv-pk/riscv-pk-927979c5.tar.gz \ + stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz \ + stage2-riscv-pk/riscv-pk.spec \ stamp-riscv-pk-installed -stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-1374381e.tar.gz: +stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz: rm -f $@ $@-t - wget -O $@-t https://github.com/lowRISC/riscv-gnu-toolchain/archive/1374381e01b30832581d65a56219388fe7d47584/riscv-gnu-toolchain-1374381e.tar.gz + wget -O $@-t https://github.com/lowRISC/riscv-gnu-toolchain/archive/$(RISCV_GNU_TOOLCHAIN_COMMIT)/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz mv $@-t $@ -stage2-riscv-gnu-toolchain/binutils-2.26.tar.gz: +stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz: rm -f $@ $@-t - wget -O $@-t http://mirrors.kernel.org/gnu/binutils/binutils-2.26.tar.gz + wget -O $@-t http://mirrors.kernel.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.gz mv $@-t $@ -stage2-riscv-gnu-toolchain/gcc-6.1.0.tar.gz: +# GCC 5 no longer compiles with GCC 6 unless we patch it. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959 +stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz: rm -f $@ $@-t - wget -O $@-t http://mirrors.kernel.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gz + wget -O $@-t http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.gz + zcat $@-t | tar xf - + cd gcc-$(GCC_VERSION) && patch -p0 < ../stage2-riscv-gnu-toolchain/gcc-5-fix-compilation-with-gcc-6.patch + tar zcf $@-t gcc-$(GCC_VERSION) + rm -r gcc-$(GCC_VERSION) mv $@-t $@ -stage2-riscv-gnu-toolchain/glibc-2.23.tar.gz: +stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz: rm -f $@ $@-t - wget -O $@-t http://mirrors.kernel.org/gnu/glibc/glibc-2.23.tar.gz + wget -O $@-t http://mirrors.kernel.org/gnu/glibc/glibc-$(GLIBC_VERSION).tar.gz mv $@-t $@ -stage2-riscv-gnu-toolchain/newlib-2.2.0.tar.gz: +stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz: rm -f $@ $@-t - wget -O $@-t ftp://sourceware.org/pub/newlib/newlib-2.2.0.tar.gz + wget -O $@-t ftp://sourceware.org/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz + mv $@-t $@ + +stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in + sed -e 's/@COMMIT@/$(RISCV_GNU_TOOLCHAIN_COMMIT)/g' \ + -e 's/@SHORTCOMMIT@/$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT)/g' \ + -e 's/@BINUTILS_VERSION@/$(BINUTILS_VERSION)/g' \ + -e 's/@GCC_VERSION@/$(GCC_VERSION)/g' \ + -e 's/@GLIBC_VERSION@/$(GLIBC_VERSION)/g' \ + -e 's/@NEWLIB_VERSION@/$(NEWLIB_VERSION)/g' \ + < $^ > $@-t mv $@-t $@ stamp-riscv-gnu-toolchain-installed: @@ -87,9 +190,15 @@ stamp-riscv-gnu-toolchain-installed: } touch $@ -stage2-riscv-pk/riscv-pk-927979c5.tar.gz: +stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz: rm -f $@ $@-t - wget -O $@-t https://github.com/lowRISC/riscv-pk/archive/927979c5af6a69360b5dd61d3b17cd06ae73d1ac/riscv-pk-927979c5.tar.gz + wget -O $@-t https://github.com/lowRISC/riscv-pk/archive/$(RISCV_PK_COMMIT)/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz + mv $@-t $@ + +stage2-riscv-pk/riscv-pk.spec: stage2-riscv-pk/riscv-pk.spec.in + sed -e 's/@COMMIT@/$(RISCV_PK_COMMIT)/g' \ + -e 's/@SHORTCOMMIT@/$(RISCV_PK_SHORTCOMMIT)/g' \ + < $^ > $@-t mv $@-t $@ stamp-riscv-pk-installed: @@ -108,9 +217,32 @@ stamp-riscv-pk-installed: # Stage 3 -stage3: - echo "XXX TO DO" - exit 1 +stage3: stage3-kernel/linux-4.6.2.tar.xz \ + stage3-kernel/linux-4.6.2/vmlinux + +stage3-kernel/linux-4.6.2.tar.xz: + rm -f $@ $@-t + wget -O $@-t https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.6.2.tar.xz + mv $@-t $@ + +stage3-kernel/linux-4.6.2/vmlinux: + rm -rf stage3-kernel/linux-4.6.2 + cat stage3-kernel/linux-4.6.2.tar.xz | tar -x --xz -C stage3-kernel + cd stage3-kernel/linux-4.6.2 && \ + git init + cd stage3-kernel/linux-4.6.2 && \ + git remote add origin https://github.com/lowrisc/riscv-linux.git + cd stage3-kernel/linux-4.6.2 && \ + git fetch + cd stage3-kernel/linux-4.6.2 && \ + git checkout -f -t origin/debug-v0.3 + cd stage3-kernel/linux-4.6.2 && \ + patch -p1 < spi_sd_power_hack.patch + cd stage3-kernel/linux-4.6.2 && \ + make ARCH=riscv defconfig + cd stage3-kernel/linux-4.6.2 && \ + make ARCH=riscv CONFIG_CROSS_COMPILE=riscv64-unknown-elf- vmlinux + ls -l $@ # Stage 4