diff --git a/.gitignore b/.gitignore index fd19d85..0f6b33d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ linux-*.tar.xz work/ toolchain -riscv-tools/ diff --git a/.gitmodules b/.gitmodules index 11c65b9..34442de 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "riscv-pk"] path = riscv-pk url = https://github.com/sifive/riscv-pk.git +[submodule "riscv-gnu-toolchain"] + path = riscv-gnu-toolchain + url = https://github.com/riscv/riscv-gnu-toolchain.git diff --git a/Makefile b/Makefile index c1d60d3..e4f11d7 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ srcdir := $(srcdir:/=) confdir := $(srcdir)/conf wrkdir := $(CURDIR)/work +toolchain_srcdir := $(srcdir)/riscv-gnu-toolchain +toolchain_wrkdir := $(wrkdir)/riscv-gnu-toolchain +toolchain_dest := $(CURDIR)/toolchain + buildroot_srcdir := $(srcdir)/buildroot buildroot_wrkdir := $(wrkdir)/buildroot buildroot_tar := $(buildroot_wrkdir)/images/rootfs.tar @@ -37,18 +41,14 @@ all: $(hex) @echo Program it with: dd if=work/bbl.bin of=/dev/sd-your-card bs=1M @echo -$(CURDIR)/toolchain/bin/$(target)-gcc: - @echo - @echo WARNING: You have no RISC-V toolchain installed. - @echo A toolchain will be downloaded and built in 5 seconds... - @echo - @sleep 5 - test -d riscv-tools || git clone -b freedom-unleashed-v0.1 --recursive https://github.com/ucb-bar/riscv-tools.git - cd riscv-tools; RISCV=$(RISCV) ./build.sh +$(toolchain_dest)/bin/$(target)-gcc: $(toolchain_srcdir) + mkdir -p $(toolchain_wrkdir) + cd $(toolchain_wrkdir); $(toolchain_srcdir)/configure --prefix=$(toolchain_dest) + $(MAKE) -C $(toolchain_wrkdir) linux $(buildroot_tar): $(buildroot_srcdir) $(RISCV)/bin/$(target)-gcc - $(MAKE) -C $< O=$(buildroot_wrkdir) riscv64_defconfig - $(MAKE) -C $< O=$(buildroot_wrkdir) + $(MAKE) -C $< RISCV=$(RISCV) PATH=$(PATH) O=$(buildroot_wrkdir) riscv64_defconfig + $(MAKE) -C $< RISCV=$(RISCV) PATH=$(PATH) O=$(buildroot_wrkdir) .PHONY: buildroot-menuconfig buildroot-menuconfig: $(buildroot_srcdir) @@ -104,4 +104,4 @@ bbl: $(bbl) .PHONY: clean clean: - rm -rf -- $(wrkdir) + rm -rf -- $(wrkdir) $(toolchain_dest) diff --git a/riscv-gnu-toolchain b/riscv-gnu-toolchain new file mode 160000 index 0000000..2ffda4e --- /dev/null +++ b/riscv-gnu-toolchain @@ -0,0 +1 @@ +Subproject commit 2ffda4e4653a5b8d55b86e26019deea5aaa1bb96 diff --git a/riscv-pk b/riscv-pk index f25234c..6eec87b 160000 --- a/riscv-pk +++ b/riscv-pk @@ -1 +1 @@ -Subproject commit f25234c1979f36ad25374f82b84a554e1fbc3158 +Subproject commit 6eec87b472320eee37deafa88c1f9aebe7db749d