1 # Refer to the README file to understand how Fedora on RISC-V is
4 # Absolute path to the current directory.
7 # Note these are chosen very specifically to ensure the different
8 # versions work together. Don't blindly update to the latest
10 # https://github.com/riscv/riscv-pk/issues/18#issuecomment-206115996
11 RISCV_QEMU_COMMIT = 94f5eb73091fb4fe272db3e943f173ecc0f78ffd
12 RISCV_QEMU_SHORTCOMMIT = 94f5eb73
13 RISCV_FESVR_COMMIT = 0f34d7ad311f78455a674224225f5b3056efba1d
14 RISCV_FESVR_SHORTCOMMIT = 0f34d7ad
15 RISCV_ISA_SIM_COMMIT = 3bfc00ef2a1b1f0b0472a39a866261b00f67027e
16 RISCV_ISA_SIM_SHORTCOMMIT = 3bfc00ef
17 RISCV_GNU_TOOLCHAIN_COMMIT = 728afcddcb0526a0f6560c4032da82805f054d58
18 RISCV_GNU_TOOLCHAIN_SHORTCOMMIT = 728afcdd
19 RISCV_PK_COMMIT = 85ae17aa149b9ea114bdd70cc30ea7e73813fb48
20 RISCV_PK_SHORTCOMMIT = 85ae17aa
22 # For the correct versions, see
23 # riscv-gnu-toolchain/Makefile.in *_version variables
24 BINUTILS_VERSION = 2.25.1
27 NEWLIB_VERSION = 2.2.0
29 # See linux-4.1.y-riscv branch of
30 # https://github.com/riscv/riscv-linux
31 KERNEL_VERSION = 4.1.26
33 # A local copy of Linux git repo so you don't have to keep downloading
34 # git commits (optional).
35 LOCAL_LINUX_GIT_COPY = $(HOME)/d/linux
37 # The root packages (plus their dependencies) that we want to in the
38 # stage 3 chroot. This must include all the cross-compiled packages
39 # below, and may also include any noarch package we like.
40 STAGE3_PACKAGES = iso-codes \
41 ncurses-devel readline-devel bash coreutils gmp-devel \
42 mpfr-devel mpc-devel binutils gcc gcc-c++ util-linux tar \
43 gzip zlib-devel file-devel popt-devel beecrypt-devel \
44 rpm rpm-build rpm-devel libdb-utils libdb-devel nano \
45 grep less strace bzip2-devel make diffutils findutils \
46 sed patch hostname gettext-devel lua-devel
48 # Versions of cross-compiled packages.
49 NCURSES_VERSION = 6.0-20160730
50 READLINE_VERSION = 6.3
52 COREUTILS_VERSION = 8.25
56 BINUTILS_X_VERSION = 2.26
58 UTIL_LINUX_VERSION = 2.28
62 # Needs to match the version of 'file' installed (on host), otherwise:
63 # "Cannot use the installed version of file (xx) to cross-compile file yy"
64 # Also note that 5.25 is definitely broken (segfaults in libmagic:magic_close).
67 BEECRYPT_VERSION = 4.2.1
68 RPM_COMMIT = 95712183458748ea6cafebac1bdd5daa097d9bee
69 RPM_SHORT_COMMIT = 9571218
74 STRACE_COMMIT = f320e1897832fd07a62e18ed288e75d8e79f4c5b
75 STRACE_SHORT_COMMIT = f320e189
78 DIFFUTILS_VERSION = 3.4
79 FINDUTILS_VERSION = 4.6.0
82 HOSTNAME_VERSION = 3.15
83 GETTEXT_VERSION = 0.19
86 all: stage1 stage2 stage3 stage4
90 stage1: stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz \
91 stage1-riscv-qemu/riscv-qemu.spec \
92 stamp-riscv-qemu-installed \
93 stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz \
94 stage1-riscv-fesvr/riscv-fesvr.spec \
95 stamp-riscv-fesvr-installed \
96 stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz \
97 stage1-riscv-isa-sim/riscv-isa-sim.spec \
98 stamp-riscv-isa-sim-installed
100 stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz:
102 wget -O $@-t 'https://github.com/riscv/riscv-qemu/archive/$(RISCV_QEMU_COMMIT)/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz'
105 stage1-riscv-qemu/riscv-qemu.spec: stage1-riscv-qemu/riscv-qemu.spec.in
106 sed -e 's/@COMMIT@/$(RISCV_QEMU_COMMIT)/g' \
107 -e 's/@SHORTCOMMIT@/$(RISCV_QEMU_SHORTCOMMIT)/g' \
111 stamp-riscv-qemu-installed:
113 @rpm -q riscv-qemu >/dev/null || { \
114 echo "ERROR: You must install riscv-qemu:"; \
116 echo " dnf copr enable rjones/riscv"; \
117 echo " dnf install riscv-qemu"; \
119 echo "OR: you can build it yourself from the stage1-riscv-qemu directory."; \
123 @qemu-system-riscv --version || { \
124 echo "ERROR: qemu-system-riscv is not working."; \
125 echo "Make sure you installed the riscv-qemu package."; \
130 stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz:
132 wget -O $@-t 'https://github.com/riscv/riscv-fesvr/archive/$(RISCV_FESVR_COMMIT)/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz'
135 stage1-riscv-fesvr/riscv-fesvr.spec: stage1-riscv-fesvr/riscv-fesvr.spec.in
136 sed -e 's/@COMMIT@/$(RISCV_FESVR_COMMIT)/g' \
137 -e 's/@SHORTCOMMIT@/$(RISCV_FESVR_SHORTCOMMIT)/g' \
141 stamp-riscv-fesvr-installed:
143 @rpm -q riscv-fesvr >/dev/null || { \
144 echo "ERROR: You must install riscv-fesvr:"; \
146 echo " dnf copr enable rjones/riscv"; \
147 echo " dnf install riscv-fesvr"; \
149 echo "OR: you can build it yourself from the stage1-riscv-fesvr directory."; \
155 stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz:
157 wget -O $@-t 'https://github.com/riscv/riscv-isa-sim/archive/$(RISCV_ISA_SIM_COMMIT)/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz'
160 stage1-riscv-isa-sim/riscv-isa-sim.spec: stage1-riscv-isa-sim/riscv-isa-sim.spec.in
161 sed -e 's/@COMMIT@/$(RISCV_ISA_SIM_COMMIT)/g' \
162 -e 's/@SHORTCOMMIT@/$(RISCV_ISA_SIM_SHORTCOMMIT)/g' \
166 stamp-riscv-isa-sim-installed:
168 @rpm -q riscv-isa-sim >/dev/null || { \
169 echo "ERROR: You must install riscv-isa-sim:"; \
171 echo " dnf copr enable rjones/riscv"; \
172 echo " dnf install riscv-isa-sim"; \
174 echo "OR: you can build it yourself from the stage1-riscv-isa-sim directory."; \
182 stage2: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz \
183 stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz \
184 stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz \
185 stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz \
186 stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz \
187 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec \
188 stamp-riscv-gnu-toolchain-installed \
189 stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz \
190 stage2-riscv-pk/riscv-pk.spec \
191 stamp-riscv-pk-installed
193 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz:
195 wget -O $@-t https://github.com/lowRISC/riscv-gnu-toolchain/archive/$(RISCV_GNU_TOOLCHAIN_COMMIT)/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz
198 stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz:
200 wget -O $@-t http://mirrors.kernel.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.gz
203 # GCC 5 no longer compiles with GCC 6 unless we patch it.
204 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959
205 stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz:
207 wget -O $@-t http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.gz
209 cd gcc-$(GCC_VERSION) && patch -p0 < ../stage2-riscv-gnu-toolchain/gcc-5-fix-compilation-with-gcc-6.patch
210 tar zcf $@-t gcc-$(GCC_VERSION)
211 rm -r gcc-$(GCC_VERSION)
214 stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz:
216 wget -O $@-t http://mirrors.kernel.org/gnu/glibc/glibc-$(GLIBC_VERSION).tar.gz
219 stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz:
221 wget -O $@-t ftp://sourceware.org/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz
224 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in
225 sed -e 's/@COMMIT@/$(RISCV_GNU_TOOLCHAIN_COMMIT)/g' \
226 -e 's/@SHORTCOMMIT@/$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT)/g' \
227 -e 's/@BINUTILS_VERSION@/$(BINUTILS_VERSION)/g' \
228 -e 's/@GCC_VERSION@/$(GCC_VERSION)/g' \
229 -e 's/@GLIBC_VERSION@/$(GLIBC_VERSION)/g' \
230 -e 's/@NEWLIB_VERSION@/$(NEWLIB_VERSION)/g' \
234 stamp-riscv-gnu-toolchain-installed:
236 @rpm -q riscv-gnu-toolchain >/dev/null || { \
237 echo "ERROR: You must install riscv-gnu-toolchain:"; \
239 echo " dnf copr enable rjones/riscv"; \
240 echo " dnf install riscv-gnu-toolchain"; \
242 echo "OR: you can build it yourself from the stage2-riscv-gnu-toolchain directory."; \
246 @riscv64-unknown-elf-gcc --version || { \
247 echo "ERROR: riscv64-unknown-elf-gcc (cross compiler) is not working."; \
248 echo "Make sure you installed the riscv-gnu-toolchain package."; \
253 stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz:
255 wget -O $@-t https://github.com/lowRISC/riscv-pk/archive/$(RISCV_PK_COMMIT)/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz
258 stage2-riscv-pk/riscv-pk.spec: stage2-riscv-pk/riscv-pk.spec.in
259 sed -e 's/@COMMIT@/$(RISCV_PK_COMMIT)/g' \
260 -e 's/@SHORTCOMMIT@/$(RISCV_PK_SHORTCOMMIT)/g' \
264 stamp-riscv-pk-installed:
266 @rpm -q riscv-pk >/dev/null || { \
267 echo "ERROR: You must install riscv-pk:"; \
269 echo " dnf copr enable rjones/riscv"; \
270 echo " dnf install riscv-pk"; \
272 echo "OR: you can build it yourself from the stage2-riscv-pk directory."; \
280 stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
281 stage3-chroot-original/etc/fedora-release \
282 stage3-chroot/etc/fedora-release \
283 stage3-chroot/lib64/libc.so.6 \
284 stage3-chroot/usr/bin/tic \
285 stage3-chroot/usr/lib64/libhistory.so.6 \
286 stage3-chroot/bin/bash \
287 stage3-chroot/bin/ls \
288 stage3-chroot/usr/lib64/libgmp.so.10 \
289 stage3-chroot/usr/lib64/libmpfr.so.4 \
290 stage3-chroot/usr/lib64/libmpc.so.3 \
291 stage3-chroot/usr/bin/as \
292 stage3-chroot/usr/bin/gcc \
293 stage3-chroot/usr/bin/mount \
294 stage3-chroot/usr/bin/tar \
295 stage3-chroot/usr/bin/gzip \
296 stage3-chroot/usr/lib64/libz.so \
297 stage3-chroot/usr/bin/file \
298 stage3-chroot/usr/lib64/libpopt.so \
299 stage3-chroot/usr/lib64/libbeecrypt.so \
300 stage3-chroot/usr/bin/nano \
301 stage3-chroot/usr/bin/grep \
302 stage3-chroot/usr/bin/less \
303 stage3-chroot/usr/bin/strace \
304 stage3-chroot/usr/bin/bzip2 \
305 stage3-chroot/usr/bin/make \
306 stage3-chroot/usr/bin/diff \
307 stage3-chroot/usr/bin/find \
308 stage3-chroot/usr/bin/sed \
309 stage3-chroot/usr/bin/patch \
310 stage3-chroot/usr/bin/hostname \
311 stage3-chroot/usr/bin/gettext \
312 stage3-chroot/usr/bin/lua \
313 stage3-chroot/usr/bin/rpm \
317 stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux:
318 rm -rf stage3-kernel/linux-$(KERNEL_VERSION)
319 cp -a $(LOCAL_LINUX_GIT_COPY) stage3-kernel/linux-$(KERNEL_VERSION) || { \
320 mkdir stage3-kernel/linux-$(KERNEL_VERSION) && \
321 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
324 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
325 git remote add riscv https://github.com/riscv/riscv-linux && \
327 git checkout -f linux-4.1.y-riscv && \
329 make ARCH=riscv defconfig
330 echo CONFIG_CMDLINE=\"root=/dev/htifblk0 init=/init\" >> stage3-kernel/linux-$(KERNEL_VERSION)/.config
331 echo CONFIG_CROSS_COMPILE=riscv64-unknown-elf- >> stage3-kernel/linux-$(KERNEL_VERSION)/.config
332 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
333 make ARCH=riscv olddefconfig
334 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
335 make ARCH=riscv vmlinux
338 # Build an original (x86-64) chroot using supermin. We then aim to
339 # rebuild (using cross-compiled versions) every ELF binary in this
341 stage3-chroot-original/etc/fedora-release:
342 rm -rf stage3-chroot-original tmp-supermin.d
343 supermin --prepare $(STAGE3_PACKAGES) -o tmp-supermin.d
344 supermin --build -f chroot tmp-supermin.d -o stage3-chroot-original
346 @echo -n "Total files in chroot: "
347 @find stage3-chroot-original -type f | wc -l
348 @echo -n "ELF files to be rebuilt: "
349 @find stage3-chroot-original -type f | xargs file -N | grep -E '\bELF.*LSB\b' | wc -l
351 # Copy the original chroot to the final chroot, remove all the ELF
353 stage3-chroot/etc/fedora-release: stage3-chroot-original/etc/fedora-release
355 cp -a stage3-chroot-original stage3-chroot
356 find stage3-chroot -type d -print0 | xargs -0 chmod u+w
357 find stage3-chroot -type f -print0 | xargs -0 chmod u+w
358 find stage3-chroot -type f -print0 | xargs -0 file -N | grep -E '\bELF.*LSB\b' | awk -F: '{print $$1}' | xargs rm -f
359 rm -f stage3-chroot/lib64/libc.so.6
361 # Copy in compiled glibc from the riscv-gnu-toolchain sysroot. Only
362 # copy files and symlinks, leave the target directory structure
364 stage3-chroot/lib64/libc.so.6:
365 mkdir -p stage3-chroot/usr/lib/audit
366 mkdir -p stage3-chroot/usr/lib/gconv
367 for f in `cd /usr/sysroot && find -type f -o -type l`; do \
368 cp -d /usr/sysroot/$$f stage3-chroot/$$f; \
370 cd stage3-chroot/lib64 && for f in ../lib/*; do ln -sf $$f; done
372 # Cross-compile ncurses.
373 stage3-chroot/usr/bin/tic: ncurses-$(NCURSES_VERSION).tgz
375 cd ncurses-$(NCURSES_VERSION) && \
376 PATH=$(ROOT)/fixed-gcc:$$PATH \
377 ./configure --host=riscv64-unknown-linux-gnu \
378 --prefix=/usr --libdir=/usr/lib64 \
380 --with-termlib=tinfo \
382 cd ncurses-$(NCURSES_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
383 cd ncurses-$(NCURSES_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
385 ncurses-$(NCURSES_VERSION).tgz:
387 wget -O $@-t ftp://invisible-island.net/ncurses/current/ncurses-$(NCURSES_VERSION).tgz
390 # Cross-compile readline.
391 stage3-chroot/usr/lib64/libhistory.so.6: readline-$(READLINE_VERSION).tar.gz
393 cd readline-$(READLINE_VERSION) && \
394 PATH=$(ROOT)/fixed-gcc:$$PATH \
395 bash_cv_wcwidth_broken=no \
396 ./configure --host=riscv64-unknown-linux-gnu \
397 --prefix=/usr --libdir=/usr/lib64
398 cd readline-$(READLINE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
399 cd readline-$(READLINE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
400 rm -f stage3-chroot/usr/lib64/*.la
402 readline-$(READLINE_VERSION).tar.gz:
404 wget -O $@-t ftp://ftp.gnu.org/gnu/readline/readline-$(READLINE_VERSION).tar.gz
407 # Cross-compile bash.
408 stage3-chroot/bin/bash: bash-$(BASH_VERSION).tar.gz
410 cd bash-$(BASH_VERSION) && \
411 PATH=$(ROOT)/fixed-gcc:$$PATH \
412 ./configure --host=riscv64-unknown-linux-gnu \
413 --prefix=/usr --libdir=/usr/lib64
414 cd bash-$(BASH_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
415 cd bash-$(BASH_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
417 bash-$(BASH_VERSION).tar.gz:
419 wget -O $@-t ftp://ftp.gnu.org/gnu/bash/bash-$(BASH_VERSION).tar.gz
422 # Cross-compile coreutils. Bleah, coreutils cross-compilation is
423 # known-broken and upstream don't care, hence the 'touch' command.
425 COREUTILS_PROGRAMS = arch base32 base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold ginstall groups head hostid hostname id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
427 stage3-chroot/bin/ls: coreutils-$(COREUTILS_VERSION).tar.xz
428 rm -rf coreutils-$(COREUTILS_VERSION)
430 cd coreutils-$(COREUTILS_VERSION) && \
431 PATH=$(ROOT)/fixed-gcc:$$PATH \
432 ./configure --host=riscv64-unknown-linux-gnu \
433 --prefix=/usr --libdir=/usr/lib64
434 -cd coreutils-$(COREUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
435 cd coreutils-$(COREUTILS_VERSION)/man && \
436 for f in $(COREUTILS_PROGRAMS); do touch $$f.1; done
437 cd coreutils-$(COREUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
438 cd coreutils-$(COREUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
440 coreutils-$(COREUTILS_VERSION).tar.xz:
442 wget -O $@-t ftp://ftp.gnu.org/gnu/coreutils/coreutils-$(COREUTILS_VERSION).tar.xz
445 # Cross-compile binutils.
446 stage3-chroot/usr/bin/as: binutils-$(BINUTILS_X_VERSION).tar.gz
447 rm -rf riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)
449 mkdir riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build
450 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && \
451 PATH=$(ROOT)/fixed-gcc:$$PATH \
453 --host=riscv64-unknown-linux-gnu \
454 --prefix=/usr --libdir=/usr/lib64
455 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make
456 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && make DESTDIR=$(ROOT)/stage3-chroot install
458 binutils-$(BINUTILS_X_VERSION).tar.gz:
460 wget -O $@-t https://github.com/riscv/riscv-binutils-gdb/archive/riscv-binutils-$(BINUTILS_X_VERSION).tar.gz
463 # Cross-compile GMP, MPFR and MPC (deps of GCC).
464 stage3-chroot/usr/lib64/libgmp.so.10: gmp-$(GMP_VERSION).tar.lz
465 rm -rf gmp-$(GMP_VERSION)
466 tar --lzip -xf gmp-$(GMP_VERSION).tar.lz
467 cd gmp-$(GMP_VERSION) && \
468 PATH=$(ROOT)/fixed-gcc:$$PATH \
469 ./configure --host=riscv64-unknown-linux-gnu \
470 --prefix=/usr --libdir=/usr/lib64
471 cd gmp-$(GMP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
472 cd gmp-$(GMP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
473 cd stage3-chroot/usr/lib && ln -s ../lib64/libgmp.so
475 gmp-$(GMP_VERSION).tar.lz:
477 wget -O $@-t https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.lz
480 stage3-chroot/usr/lib64/libmpfr.so.4: mpfr-$(MPFR_VERSION).tar.gz
481 rm -rf mpfr-$(MPFR_VERSION)
482 tar -zxf mpfr-$(MPFR_VERSION).tar.gz
483 cd mpfr-$(MPFR_VERSION) && \
484 PATH=$(ROOT)/fixed-gcc:$$PATH \
485 ./configure --host=riscv64-unknown-linux-gnu \
486 --prefix=/usr --libdir=/usr/lib64 \
487 --with-gmp=$(ROOT)/stage3-chroot/usr
488 cd mpfr-$(MPFR_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
489 cd mpfr-$(MPFR_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
490 cd stage3-chroot/usr/lib && ln -s ../lib64/libmpfr.so
491 rm -f stage3-chroot/usr/lib64/*.la
493 mpfr-$(MPFR_VERSION).tar.gz:
495 wget -O $@-t http://www.mpfr.org/mpfr-current/mpfr-$(MPFR_VERSION).tar.gz
498 stage3-chroot/usr/lib64/libmpc.so.3: mpc-$(MPC_VERSION).tar.gz
499 rm -rf mpc-$(MPC_VERSION)
500 tar -zxf mpc-$(MPC_VERSION).tar.gz
501 cd mpc-$(MPC_VERSION) && \
502 PATH=$(ROOT)/fixed-gcc:$$PATH \
503 ./configure --host=riscv64-unknown-linux-gnu \
504 --prefix=/usr --libdir=/usr/lib64 \
505 --with-gmp=$(ROOT)/stage3-chroot/usr \
506 --with-mpfr=$(ROOT)/stage3-chroot/usr
507 cd mpc-$(MPC_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
508 cd mpc-$(MPC_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
509 cd stage3-chroot/usr/lib && ln -s ../lib64/libmpc.so
510 rm -f stage3-chroot/usr/lib64/*.la
512 mpc-$(MPC_VERSION).tar.gz:
514 wget -O $@-t ftp://ftp.gnu.org/gnu/mpc/mpc-$(MPC_VERSION).tar.gz
518 stage3-chroot/usr/bin/gcc: gcc-$(GCC_X_VERSION).tar.gz
519 rm -rf riscv-gcc-riscv-gcc-$(GCC_X_VERSION)
521 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION) && \
522 patch -p1 < ../0001-HACKS-TO-GET-GCC-TO-COMPILE.patch
523 mkdir riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build
524 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && \
525 PATH=$(ROOT)/fixed-gcc:$$PATH \
527 --host=riscv64-unknown-linux-gnu \
528 --prefix=/usr --libdir=/usr/lib64 \
531 --enable-languages=c,c++ \
532 --disable-libmudflap \
534 --disable-libquadmath \
537 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make
538 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && make install DESTDIR=$(ROOT)/stage3-chroot
539 rm -f stage3-chroot/usr/lib64/*.la
541 gcc-$(GCC_X_VERSION).tar.gz:
543 wget -O $@-t https://github.com/riscv/riscv-gcc/archive/riscv-gcc-$(GCC_X_VERSION).tar.gz
546 # Cross-compile util-linux.
547 stage3-chroot/usr/bin/mount: util-linux-$(UTIL_LINUX_VERSION).tar.xz
548 rm -rf util-linux-$(UTIL_LINUX_VERSION)
550 cd util-linux-$(UTIL_LINUX_VERSION) && \
551 PATH=$(ROOT)/fixed-gcc:$$PATH \
552 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
554 --host=riscv64-unknown-linux-gnu \
555 --prefix=/usr --libdir=/usr/lib64 \
558 --disable-makeinstall-chown \
559 --enable-static-programs=mount
560 cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
561 cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
562 rm -f stage3-chroot/usr/lib64/*.la
564 util-linux-$(UTIL_LINUX_VERSION).tar.xz:
566 wget -O $@-t ftp://ftp.kernel.org/pub/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)/util-linux-$(UTIL_LINUX_VERSION).tar.xz
569 # Cross-compile GNU tar.
570 stage3-chroot/usr/bin/tar: tar-$(TAR_VERSION).tar.xz
571 rm -rf tar-$(TAR_VERSION)
573 cd tar-$(TAR_VERSION) && \
574 PATH=$(ROOT)/fixed-gcc:$$PATH \
576 --host=riscv64-unknown-linux-gnu \
577 --prefix=/usr --libdir=/usr/lib64
578 cd tar-$(TAR_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
579 cd tar-$(TAR_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
581 tar-$(TAR_VERSION).tar.xz:
583 wget -O $@-t https://ftp.gnu.org/gnu/tar/tar-$(TAR_VERSION).tar.xz
586 # Cross-compile GNU gzip.
587 stage3-chroot/usr/bin/gzip: gzip-$(GZIP_VERSION).tar.gz
588 rm -rf gzip-$(GZIP_VERSION)
590 cd gzip-$(GZIP_VERSION) && \
591 PATH=$(ROOT)/fixed-gcc:$$PATH \
593 --host=riscv64-unknown-linux-gnu \
594 --prefix=/usr --libdir=/usr/lib64
595 cd gzip-$(GZIP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
596 cd gzip-$(GZIP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
598 gzip-$(GZIP_VERSION).tar.gz:
600 wget -O $@-t https://ftp.gnu.org/gnu/gzip/gzip-$(GZIP_VERSION).tar.gz
603 # Cross-compile zlib.
604 stage3-chroot/usr/lib64/libz.so: zlib-$(ZLIB_VERSION).tar.gz
605 rm -rf zlib-$(ZLIB_VERSION)
607 cd zlib-$(ZLIB_VERSION) && \
608 PATH=$(ROOT)/fixed-gcc:$$PATH \
609 CC=riscv64-unknown-linux-gnu-gcc \
610 CFLAGS="-I$(ROOT)/stage3-chroot/usr/include -L$(ROOT)/stage3-chroot/usr/lib" \
612 --prefix=/usr --libdir=/usr/lib64
613 cd zlib-$(ZLIB_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make shared
614 cd zlib-$(ZLIB_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
616 zlib-$(ZLIB_VERSION).tar.gz:
618 wget -O $@-t http://zlib.net/zlib-$(ZLIB_VERSION).tar.gz
621 # Cross-compile file/libmagic.
622 stage3-chroot/usr/bin/file: file-$(FILE_VERSION).tar.gz
623 rm -rf file-$(FILE_VERSION)
625 cd file-$(FILE_VERSION) && \
626 PATH=$(ROOT)/fixed-gcc:$$PATH \
627 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
629 --host=riscv64-unknown-linux-gnu \
630 --prefix=/usr --libdir=/usr/lib64 \
631 --disable-static --enable-shared
632 cd file-$(FILE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
633 cd file-$(FILE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
634 rm -f stage3-chroot/usr/lib64/*.la
636 file-$(FILE_VERSION).tar.gz:
638 wget -O $@-t ftp://ftp.astron.com/pub/file/file-$(FILE_VERSION).tar.gz
641 # Cross-compile popt.
642 stage3-chroot/usr/lib64/libpopt.so: popt-$(POPT_VERSION).tar.gz
643 rm -rf popt-$(POPT_VERSION)
645 cd popt-$(POPT_VERSION) && \
646 PATH=$(ROOT)/fixed-gcc:$$PATH \
647 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
649 --host=riscv64-unknown-linux-gnu \
650 --prefix=/usr --libdir=/usr/lib64 \
651 --disable-static --enable-shared
652 cd popt-$(POPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
653 cd popt-$(POPT_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
654 rm -f stage3-chroot/usr/lib64/*.la
656 popt-$(POPT_VERSION).tar.gz:
658 wget -O $@-t http://rpm5.org/files/popt/popt-$(POPT_VERSION).tar.gz
661 # Cross-compile beecrypt.
662 stage3-chroot/usr/lib64/libbeecrypt.so: beecrypt-$(BEECRYPT_VERSION).tar.gz
663 rm -rf beecrypt-$(BEECRYPT_VERSION)
665 cd beecrypt-$(BEECRYPT_VERSION) && patch -p0 < ../beecrypt-disable-cplusplus.patch
666 cd beecrypt-$(BEECRYPT_VERSION) && autoreconf -i
667 cd beecrypt-$(BEECRYPT_VERSION) && \
668 PATH=$(ROOT)/fixed-gcc:$$PATH \
669 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
671 --host=riscv64-unknown-linux-gnu \
672 --prefix=/usr --libdir=/usr/lib64 \
673 --without-cplusplus \
678 cd beecrypt-$(BEECRYPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
679 cd beecrypt-$(BEECRYPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot V=1
680 chrpath -d stage3-chroot/usr/lib64/libbeecrypt.so.*
681 rm -f stage3-chroot/usr/lib64/*.la
683 beecrypt-$(BEECRYPT_VERSION).tar.gz:
685 wget -O $@-t http://downloads.sourceforge.net/sourceforge/beecrypt/beecrypt-$(BEECRYPT_VERSION).tar.gz
688 # Cross-compile GNU nano (editor).
689 stage3-chroot/usr/bin/nano: nano-$(NANO_VERSION).tar.gz
690 rm -rf nano-$(NANO_VERSION)
692 cd nano-$(NANO_VERSION) && \
693 PATH=$(ROOT)/fixed-gcc:$$PATH \
694 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
696 --host=riscv64-unknown-linux-gnu \
697 --prefix=/usr --libdir=/usr/lib64
698 cd nano-$(NANO_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
699 cd nano-$(NANO_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
701 nano-$(NANO_VERSION).tar.gz:
703 wget -O $@-t https://www.nano-editor.org/dist/v2.6/nano-$(NANO_VERSION).tar.gz
706 # Cross-compile GNU grep.
707 stage3-chroot/usr/bin/grep: grep-$(GREP_VERSION).tar.xz
708 rm -rf grep-$(GREP_VERSION)
710 cd grep-$(GREP_VERSION) && \
711 PATH=$(ROOT)/fixed-gcc:$$PATH \
713 --host=riscv64-unknown-linux-gnu \
714 --prefix=/usr --libdir=/usr/lib64
715 cd grep-$(GREP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
716 cd grep-$(GREP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
718 grep-$(GREP_VERSION).tar.xz:
720 wget -O $@-t https://ftp.gnu.org/gnu/grep/grep-$(GREP_VERSION).tar.xz
723 # Cross-compile less.
724 stage3-chroot/usr/bin/less: less-$(LESS_VERSION).tar.gz
725 rm -rf less-$(LESS_VERSION)
727 cd less-$(LESS_VERSION) && \
728 PATH=$(ROOT)/fixed-gcc:$$PATH \
729 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
731 --host=riscv64-unknown-linux-gnu \
732 --prefix=/usr --libdir=/usr/lib64
733 cd less-$(LESS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
734 cd less-$(LESS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
736 less-$(LESS_VERSION).tar.gz:
738 wget -O $@-t http://www.greenwoodsoftware.com/less/less-$(LESS_VERSION).tar.gz
741 # Cross-compile strace.
742 # XXX This does not work.
743 stage3-chroot/usr/bin/strace: strace-$(STRACE_SHORT_COMMIT).tar.gz
744 rm -rf strace-$(STRACE_SHORT_COMMIT)
746 cd riscv-strace-$(STRACE_COMMIT) && patch -p1 < ../0001-Update-riscv_regs-for-ptrace.h-from-Linux-4.1.x.patch
747 cd riscv-strace-$(STRACE_COMMIT) && \
748 PATH=$(ROOT)/fixed-gcc:$$PATH \
749 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
751 --host=riscv64-unknown-linux-gnu \
752 --prefix=/usr --libdir=/usr/lib64
753 cd riscv-strace-$(STRACE_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make
754 cd riscv-strace-$(STRACE_COMMIT) && make install DESTDIR=$(ROOT)/stage3-chroot
756 strace-$(STRACE_SHORT_COMMIT).tar.gz:
758 wget -O $@-t 'https://github.com/riscv/riscv-strace/archive/$(STRACE_COMMIT)/riscv-strace-$(STRACE_SHORTCOMMIT).tar.gz'
761 # Cross-compile bzip2.
762 stage3-chroot/usr/bin/bzip2: bzip2-$(BZIP2_VERSION).tar.gz
763 rm -rf bzip2-$(BZIP2_VERSION)
765 cd bzip2-$(BZIP2_VERSION) && \
766 PATH=$(ROOT)/fixed-gcc:$$PATH \
767 make libbz2.a bzip2 bzip2recover \
769 CC=riscv64-unknown-linux-gnu-gcc \
770 AR=riscv64-unknown-linux-gnu-ar \
771 RANLIB=riscv64-unknown-linux-gnu-ranlib \
772 CFLAGS="-Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -fPIC"
773 cd bzip2-$(BZIP2_VERSION) && \
774 make install PREFIX=$(ROOT)/stage3-chroot/usr
776 bzip2-$(BZIP2_VERSION).tar.gz:
778 wget -O $@-t http://www.bzip.org/1.0.6/bzip2-$(BZIP2_VERSION).tar.gz
781 # Cross-compile GNU make.
782 stage3-chroot/usr/bin/make: make-$(MAKE_VERSION).tar.gz
783 rm -rf make-$(MAKE_VERSION)
785 cd make-$(MAKE_VERSION) && \
786 PATH=$(ROOT)/fixed-gcc:$$PATH \
788 --host=riscv64-unknown-linux-gnu \
789 --prefix=/usr --libdir=/usr/lib64
790 cd make-$(MAKE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
791 cd make-$(MAKE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
793 make-$(MAKE_VERSION).tar.gz:
795 wget -O $@-t https://ftp.gnu.org/gnu/make/make-$(MAKE_VERSION).tar.gz
798 # Cross-compile GNU diffutils.
799 stage3-chroot/usr/bin/diff: diffutils-$(DIFFUTILS_VERSION).tar.xz
800 rm -rf diffutils-$(DIFFUTILS_VERSION)
802 cd diffutils-$(DIFFUTILS_VERSION) && \
803 PATH=$(ROOT)/fixed-gcc:$$PATH \
805 --host=riscv64-unknown-linux-gnu \
806 --prefix=/usr --libdir=/usr/lib64
807 cd diffutils-$(DIFFUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
808 cd diffutils-$(DIFFUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
810 diffutils-$(DIFFUTILS_VERSION).tar.xz:
812 wget -O $@-t https://ftp.gnu.org/gnu/diffutils/diffutils-$(DIFFUTILS_VERSION).tar.xz
815 # Cross-compile GNU findutils.
816 stage3-chroot/usr/bin/find: findutils-$(FINDUTILS_VERSION).tar.gz
817 rm -rf findutils-$(FINDUTILS_VERSION)
819 cd findutils-$(FINDUTILS_VERSION) && \
820 PATH=$(ROOT)/fixed-gcc:$$PATH \
822 --host=riscv64-unknown-linux-gnu \
823 --prefix=/usr --libdir=/usr/lib64
824 cd findutils-$(FINDUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
825 cd findutils-$(FINDUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
827 findutils-$(FINDUTILS_VERSION).tar.gz:
829 wget -O $@-t https://ftp.gnu.org/gnu/findutils/findutils-$(FINDUTILS_VERSION).tar.gz
832 # Cross-compile GNU sed.
833 stage3-chroot/usr/bin/sed: sed-$(SED_VERSION).tar.gz
834 rm -rf sed-$(SED_VERSION)
836 cd sed-$(SED_VERSION) && \
837 PATH=$(ROOT)/fixed-gcc:$$PATH \
839 --host=riscv64-unknown-linux-gnu \
840 --prefix=/usr --libdir=/usr/lib64
841 cd sed-$(SED_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
842 cd sed-$(SED_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
844 sed-$(SED_VERSION).tar.gz:
846 wget -O $@-t https://ftp.gnu.org/gnu/sed/sed-$(SED_VERSION).tar.gz
849 # Cross-compile patch.
850 stage3-chroot/usr/bin/patch: patch-$(PATCH_VERSION).tar.gz
851 rm -rf patch-$(PATCH_VERSION)
853 cd patch-$(PATCH_VERSION) && \
854 PATH=$(ROOT)/fixed-gcc:$$PATH \
856 --host=riscv64-unknown-linux-gnu \
857 --prefix=/usr --libdir=/usr/lib64
858 cd patch-$(PATCH_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
859 cd patch-$(PATCH_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
861 patch-$(PATCH_VERSION).tar.gz:
863 wget -O $@-t https://ftp.gnu.org/gnu/patch/patch-$(PATCH_VERSION).tar.gz
866 # Cross-compile hostname.
867 stage3-chroot/usr/bin/hostname: hostname-$(HOSTNAME_VERSION).tar.gz
868 rm -rf hostname-$(HOSTNAME_VERSION)
870 cd hostname && patch -p1 < ../hostname-rh.patch
872 PATH=$(ROOT)/fixed-gcc:$$PATH \
874 CC=riscv64-unknown-linux-gnu-gcc \
876 cd hostname && make install BASEDIR=$(ROOT)/stage3-chroot
878 hostname-$(HOSTNAME_VERSION).tar.gz:
880 wget -O $@-t http://ftp.de.debian.org/debian/pool/main/h/hostname/hostname_$(HOSTNAME_VERSION).tar.gz
883 # Cross-compile GNU gettext.
884 stage3-chroot/usr/bin/gettext: gettext-$(GETTEXT_VERSION).tar.gz
885 rm -rf gettext-$(GETTEXT_VERSION)
887 cd gettext-$(GETTEXT_VERSION) && \
888 PATH=$(ROOT)/fixed-gcc:$$PATH \
890 --host=riscv64-unknown-linux-gnu \
891 --prefix=/usr --libdir=/usr/lib64
892 cd gettext-$(GETTEXT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
893 cd gettext-$(GETTEXT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
894 rm -f stage3-chroot/usr/lib64/*.la
896 gettext-$(GETTEXT_VERSION).tar.gz:
898 wget -O $@-t https://ftp.gnu.org/gnu/gettext/gettext-$(GETTEXT_VERSION).tar.gz
902 stage3-chroot/usr/bin/lua: lua-$(LUA_VERSION).tar.gz
903 rm -rf lua-$(LUA_VERSION)
905 cd lua-$(LUA_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make PLAT=linux INSTALL_TOP=/usr CC=riscv64-unknown-linux-gnu-gcc AR="riscv64-unknown-linux-gnu-ar rcu" RANLIB="riscv64-unknown-linux-gnu-ranlib" MYLDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 MYLIBS=-ltinfo MYCFLAGS="-fPIC -DLUA_COMPAT_5_1"
906 cd lua-$(LUA_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install INSTALL_TOP=$(ROOT)/stage3-chroot/usr INSTALL_LIB=$(ROOT)/stage3-chroot/usr/lib64
908 lua-$(LUA_VERSION).tar.gz:
910 wget -O $@-t https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz
913 # Cross-compile RPM / rpmbuild.
914 # We build this from a git commit, with a few hacks to the configure
916 stage3-chroot/usr/bin/rpm: rpm-$(RPM_SHORT_COMMIT).tar.gz db-$(BDB_VERSION).tar.gz
917 rm -rf rpm-$(RPM_SHORT_COMMIT)
918 tar -zxf rpm-$(RPM_SHORT_COMMIT).tar.gz
919 tar -zxf db-$(BDB_VERSION).tar.gz -C rpm-$(RPM_SHORT_COMMIT)
920 cd rpm-$(RPM_SHORT_COMMIT) && ln -s db-$(BDB_VERSION) db
921 cd rpm-$(RPM_SHORT_COMMIT) && \
922 patch -p1 < ../0001-RISCV-64-bit-riscv64-support.patch && \
923 patch -p1 < ../0002-build-fgetc-returns-int-not-char.patch && \
924 patch -p1 < ../0003-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
925 cd rpm-$(RPM_SHORT_COMMIT) && autoreconf -i
926 cd rpm-$(RPM_SHORT_COMMIT) && \
927 PATH=$(ROOT)/fixed-gcc:$$PATH \
928 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
930 --host=riscv64-unknown-linux-gnu \
931 --prefix=/usr --libdir=/usr/lib64 \
933 --without-libarchive \
937 --without-external-db \
940 cd rpm-$(RPM_SHORT_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
941 cd rpm-$(RPM_SHORT_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
942 rm -f stage3-chroot/usr/lib64/*.la
944 rpm-$(RPM_SHORT_COMMIT).tar.gz:
946 wget -O $@-t 'http://rpm.org/gitweb?p=rpm.git;a=snapshot;h=$(RPM_COMMIT);sf=tgz'
949 db-$(BDB_VERSION).tar.gz:
951 wget -O $@-t http://download.oracle.com/berkeley-db/db-$(BDB_VERSION).tar.gz
954 # Create an /init script.
955 stage3-chroot/init: init.sh
956 install -m 0755 $^ $@
958 # Create the stage3 disk image.
959 # Note `-s +...' adds spare space to the disk image.
960 stage3-disk.img: stage3-chroot
961 cd stage3-chroot && virt-make-fs . ../$@ -t ext2 -F raw -s +4G
963 # Upload the compressed disk image.
964 upload-stage3: stage3-disk.img.xz
965 scp $^ tick:public_html/riscv/
966 stage3-disk.img.xz: stage3-disk.img
970 # Helper which boots stage3 disk image in spike.
971 boot-stage3-in-spike: stage3-disk.img stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
972 spike +disk=stage3-disk.img \
973 /usr/bin/bbl stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
975 # Helper which boots stage3 disk image in qemu.
976 boot-stage3-in-qemu: stage3-disk.img stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
977 qemu-system-riscv -kernel /usr/bin/bbl \
978 -append ./stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
979 -drive file=stage3-disk.img,format=raw -nographic