Update current status in README.
[fedora-riscv.git] / Makefile
index f8dd949..09f8d22 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,9 @@ stage2: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-1374381e.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 \
-       stamp-riscv-gnu-toolchain-installed
+       stamp-riscv-gnu-toolchain-installed \
+       stage2-riscv-pk/riscv-pk-927979c5.tar.gz \
+       stamp-riscv-pk-installed
 
 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-1374381e.tar.gz:
        rm -f $@ $@-t
@@ -85,11 +87,53 @@ stamp-riscv-gnu-toolchain-installed:
        }
        touch $@
 
+stage2-riscv-pk/riscv-pk-927979c5.tar.gz:
+       rm -f $@ $@-t
+       wget -O $@-t https://github.com/lowRISC/riscv-pk/archive/927979c5af6a69360b5dd61d3b17cd06ae73d1ac/riscv-pk-927979c5.tar.gz
+       mv $@-t $@
+
+stamp-riscv-pk-installed:
+       rm -f $@
+       @rpm -q riscv-pk >/dev/null || { \
+         echo "ERROR: You must install riscv-pk:"; \
+         echo; \
+         echo "       dnf copr enable rjones/riscv"; \
+         echo "       dnf install riscv-pk"; \
+         echo; \
+         echo "OR: you can build it yourself from the stage2-riscv-pk directory."; \
+         echo; \
+         exit 1; \
+       }
+       touch $@
+
 # 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