From 8a745cd28cf55dbc253648c0c8ba0a1f00f588b9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 4 Aug 2016 10:45:08 +0100 Subject: [PATCH] Add commits to the Makefile and generate spec files from there. Also choose a working set of commits based on RISCV priv 1.7. --- .gitignore | 3 + Makefile | 85 ++++++++++++++++------ .../{riscv-qemu.spec => riscv-qemu.spec.in} | 9 +-- ...-toolchain.spec => riscv-gnu-toolchain.spec.in} | 19 ++--- .../{riscv-pk.spec => riscv-pk.spec.in} | 9 +-- 5 files changed, 81 insertions(+), 44 deletions(-) rename stage1-riscv-qemu/{riscv-qemu.spec => riscv-qemu.spec.in} (90%) rename stage2-riscv-gnu-toolchain/{riscv-gnu-toolchain.spec => riscv-gnu-toolchain.spec.in} (84%) rename stage2-riscv-pk/{riscv-pk.spec => riscv-pk.spec.in} (77%) diff --git a/.gitignore b/.gitignore index 3751760..cae19c4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ *.tar.gz stamp-* +/stage1-riscv-qemu/riscv-qemu.spec +/stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec +/stage2-riscv-pk/riscv-pk.spec /stage3-kernel/linux-* diff --git a/Makefile b/Makefile index 09f8d22..041dfbc 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,41 @@ # 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_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 \ +stage1: stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz \ + stage1-riscv-qemu/riscv-qemu.spec \ stamp-riscv-qemu-installed -stage1-riscv-qemu/riscv-qemu-94f5eb73.tar.gz: +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: @@ -34,38 +59,50 @@ stamp-riscv-qemu-installed: # 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: +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 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 +124,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: diff --git a/stage1-riscv-qemu/riscv-qemu.spec b/stage1-riscv-qemu/riscv-qemu.spec.in similarity index 90% rename from stage1-riscv-qemu/riscv-qemu.spec rename to stage1-riscv-qemu/riscv-qemu.spec.in index 5ca0df7..647dd5b 100644 --- a/stage1-riscv-qemu/riscv-qemu.spec +++ b/stage1-riscv-qemu/riscv-qemu.spec.in @@ -1,16 +1,13 @@ %global debug_package %{nil} -%global commit 94f5eb73091fb4fe272db3e943f173ecc0f78ffd -%global shortcommit 94f5eb73 - Name: riscv-qemu Version: 2.5.0 -Release: 0.1.git%{shortcommit}%{?dist} +Release: 0.1.git@SHORTCOMMIT@%{?dist} Summary: RISC-V fork of QEMU License: GPLv2+ and LGPLv2+ and BSD URL: https://github.com/riscv/riscv-qemu -Source0: https://github.com/riscv/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +Source0: https://github.com/riscv/%{name}/archive/@COMMIT@/%{name}-@SHORTCOMMIT@.tar.gz # These were just copied from qemu.spec, they are probably not # all required. @@ -79,7 +76,7 @@ This is the RISC-V fork of QEMU. %prep -%setup -q -n %{name}-%{commit} +%setup -q -n %{name}-@COMMIT@ %build diff --git a/stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec b/stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in similarity index 84% rename from stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec rename to stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in index 0984a98..72cf611 100644 --- a/stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec +++ b/stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in @@ -6,22 +6,19 @@ # Strip breaks the libraries, don't do it. %global __strip /bin/true -%global commit 1374381e01b30832581d65a56219388fe7d47584 -%global shortcommit 1374381e - Name: riscv-gnu-toolchain Version: 0 -Release: 0.2.git%{shortcommit}%{?dist} +Release: 0.3.git@SHORTCOMMIT@%{?dist} Summary: RISC-V GNU cross-toolchain, containing binutils and GCC License: GPLv2+ and LGPLv2+ and BSD URL: https://github.com/riscv/riscv-qemu -Source0: https://github.com/riscv/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +Source0: https://github.com/riscv/%{name}/archive/@COMMIT@/%{name}-@SHORTCOMMIT@.tar.gz -Source1: http://mirrors.kernel.org/gnu/binutils/binutils-2.26.tar.gz -Source2: http://mirrors.kernel.org/gnu/glibc/glibc-2.23.tar.gz -Source3: http://mirrors.kernel.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gz -Source4: ftp://sourceware.org/pub/newlib/newlib-2.2.0.tar.gz +Source1: http://mirrors.kernel.org/gnu/binutils/binutils-@BINUTILS_VERSION@.tar.gz +Source2: http://mirrors.kernel.org/gnu/glibc/glibc-@GLIBC_VERSION@.tar.gz +Source3: http://mirrors.kernel.org/gnu/gcc/gcc-@GCC_VERSION@/gcc-@GCC_VERSION@.tar.gz +Source4: ftp://sourceware.org/pub/newlib/newlib-@NEWLIB_VERSION@.tar.gz # XXX These BuildRequires are just culled from the GCC spec # and probably overestimate the real requirements. @@ -51,7 +48,7 @@ includes binutils and GCC. %prep -%setup -q -n %{name}-%{commit} +%setup -q -n %{name}-@COMMIT@ %build @@ -104,7 +101,7 @@ rm $RPM_BUILD_ROOT%{_libdir}/libcc1.la #%{_prefix}/lib/gcc/riscv64-unknown-linux-gnu %{_prefix}/riscv64-unknown-elf #%{_prefix}/riscv64-unknown-linux-gnu -%{_datadir}/gcc-6.1.0 +%{_datadir}/gcc-@GCC_VERSION@ %changelog diff --git a/stage2-riscv-pk/riscv-pk.spec b/stage2-riscv-pk/riscv-pk.spec.in similarity index 77% rename from stage2-riscv-pk/riscv-pk.spec rename to stage2-riscv-pk/riscv-pk.spec.in index d6b26b0..97be443 100644 --- a/stage2-riscv-pk/riscv-pk.spec +++ b/stage2-riscv-pk/riscv-pk.spec.in @@ -1,16 +1,13 @@ %global debug_package %{nil} -%global commit 927979c5af6a69360b5dd61d3b17cd06ae73d1ac -%global shortcommit 927979c5 - Name: riscv-pk Version: 0 -Release: 0.1.git%{shortcommit}%{?dist} +Release: 0.2.git@SHORTCOMMIT@%{?dist} Summary: RISC-V proxy kernel (pk) and boot loader (bbl) License: BSD URL: https://github.com/lowRISC/riscv-pk -Source0: https://github.com/riscv/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +Source0: https://github.com/riscv/%{name}/archive/@COMMIT@/%{name}-@SHORTCOMMIT@.tar.gz BuildRequires: riscv-gnu-toolchain @@ -21,7 +18,7 @@ includes binutils and GCC. %prep -%setup -q -n %{name}-%{commit} +%setup -q -n %{name}-@COMMIT@ %build -- 1.8.3.1