From 22cd89cd80315d385e688ae2371787d5d1bbc88f Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Fri, 8 Jul 2016 16:29:55 -0700 Subject: [PATCH] auto-build toolchain for those without one --- .gitignore | 2 ++ Makefile | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 424b833..fd19d85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ linux-*.tar.xz work/ +toolchain +riscv-tools/ diff --git a/Makefile b/Makefile index 39fb3ae..c1d60d3 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +RISCV ?= $(CURDIR)/toolchain +PATH := $(RISCV)/bin:$(PATH) srcdir := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) srcdir := $(srcdir:/=) @@ -30,8 +32,21 @@ target := riscv64-unknown-linux-gnu .PHONY: all all: $(hex) + @echo + @echo Find the SD-card image in work/bbl.bin + @echo Program it with: dd if=work/bbl.bin of=/dev/sd-your-card bs=1M + @echo -$(buildroot_tar): $(buildroot_srcdir) +$(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 + +$(buildroot_tar): $(buildroot_srcdir) $(RISCV)/bin/$(target)-gcc $(MAKE) -C $< O=$(buildroot_wrkdir) riscv64_defconfig $(MAKE) -C $< O=$(buildroot_wrkdir)