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 libmpc-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 xz-devel gawk \
49 # Versions of cross-compiled packages.
50 NCURSES_VERSION = 6.0-20160730
51 READLINE_VERSION = 6.3
53 COREUTILS_VERSION = 8.25
57 BINUTILS_X_VERSION = 2.26
59 UTIL_LINUX_VERSION = 2.28
63 # Needs to match the version of 'file' installed (on host), otherwise:
64 # "Cannot use the installed version of file (xx) to cross-compile file yy"
65 # Also note that 5.25 is definitely broken (segfaults in libmagic:magic_close).
68 BEECRYPT_VERSION = 4.2.1
69 RPM_COMMIT = 95712183458748ea6cafebac1bdd5daa097d9bee
70 RPM_SHORT_COMMIT = 9571218
75 STRACE_COMMIT = f320e1897832fd07a62e18ed288e75d8e79f4c5b
76 STRACE_SHORT_COMMIT = f320e189
79 DIFFUTILS_VERSION = 3.4
80 FINDUTILS_VERSION = 4.6.0
83 HOSTNAME_VERSION = 3.15
84 GETTEXT_VERSION = 0.19
90 all: stage1 stage2 stage3 stage4
94 stage1: stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz \
95 stage1-riscv-qemu/riscv-qemu.spec \
96 stamp-riscv-qemu-installed \
97 stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz \
98 stage1-riscv-fesvr/riscv-fesvr.spec \
99 stamp-riscv-fesvr-installed \
100 stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz \
101 stage1-riscv-isa-sim/riscv-isa-sim.spec \
102 stamp-riscv-isa-sim-installed
104 stage1-riscv-qemu/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz:
106 wget -O $@-t 'https://github.com/riscv/riscv-qemu/archive/$(RISCV_QEMU_COMMIT)/riscv-qemu-$(RISCV_QEMU_SHORTCOMMIT).tar.gz'
109 stage1-riscv-qemu/riscv-qemu.spec: stage1-riscv-qemu/riscv-qemu.spec.in
110 sed -e 's/@COMMIT@/$(RISCV_QEMU_COMMIT)/g' \
111 -e 's/@SHORTCOMMIT@/$(RISCV_QEMU_SHORTCOMMIT)/g' \
115 stamp-riscv-qemu-installed:
117 @rpm -q riscv-qemu >/dev/null || { \
118 echo "ERROR: You must install riscv-qemu:"; \
120 echo " dnf copr enable rjones/riscv"; \
121 echo " dnf install riscv-qemu"; \
123 echo "OR: you can build it yourself from the stage1-riscv-qemu directory."; \
127 @qemu-system-riscv --version || { \
128 echo "ERROR: qemu-system-riscv is not working."; \
129 echo "Make sure you installed the riscv-qemu package."; \
134 stage1-riscv-fesvr/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz:
136 wget -O $@-t 'https://github.com/riscv/riscv-fesvr/archive/$(RISCV_FESVR_COMMIT)/riscv-fesvr-$(RISCV_FESVR_SHORTCOMMIT).tar.gz'
139 stage1-riscv-fesvr/riscv-fesvr.spec: stage1-riscv-fesvr/riscv-fesvr.spec.in
140 sed -e 's/@COMMIT@/$(RISCV_FESVR_COMMIT)/g' \
141 -e 's/@SHORTCOMMIT@/$(RISCV_FESVR_SHORTCOMMIT)/g' \
145 stamp-riscv-fesvr-installed:
147 @rpm -q riscv-fesvr >/dev/null || { \
148 echo "ERROR: You must install riscv-fesvr:"; \
150 echo " dnf copr enable rjones/riscv"; \
151 echo " dnf install riscv-fesvr"; \
153 echo "OR: you can build it yourself from the stage1-riscv-fesvr directory."; \
159 stage1-riscv-isa-sim/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz:
161 wget -O $@-t 'https://github.com/riscv/riscv-isa-sim/archive/$(RISCV_ISA_SIM_COMMIT)/riscv-isa-sim-$(RISCV_ISA_SIM_SHORTCOMMIT).tar.gz'
164 stage1-riscv-isa-sim/riscv-isa-sim.spec: stage1-riscv-isa-sim/riscv-isa-sim.spec.in
165 sed -e 's/@COMMIT@/$(RISCV_ISA_SIM_COMMIT)/g' \
166 -e 's/@SHORTCOMMIT@/$(RISCV_ISA_SIM_SHORTCOMMIT)/g' \
170 stamp-riscv-isa-sim-installed:
172 @rpm -q riscv-isa-sim >/dev/null || { \
173 echo "ERROR: You must install riscv-isa-sim:"; \
175 echo " dnf copr enable rjones/riscv"; \
176 echo " dnf install riscv-isa-sim"; \
178 echo "OR: you can build it yourself from the stage1-riscv-isa-sim directory."; \
186 stage2: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz \
187 stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz \
188 stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz \
189 stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz \
190 stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz \
191 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec \
192 stamp-riscv-gnu-toolchain-installed \
193 stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz \
194 stage2-riscv-pk/riscv-pk.spec \
195 stamp-riscv-pk-installed
197 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz:
199 wget -O $@-t https://github.com/lowRISC/riscv-gnu-toolchain/archive/$(RISCV_GNU_TOOLCHAIN_COMMIT)/riscv-gnu-toolchain-$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT).tar.gz
202 stage2-riscv-gnu-toolchain/binutils-$(BINUTILS_VERSION).tar.gz:
204 wget -O $@-t http://mirrors.kernel.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.gz
207 # GCC 5 no longer compiles with GCC 6 unless we patch it.
208 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959
209 stage2-riscv-gnu-toolchain/gcc-$(GCC_VERSION).tar.gz:
211 wget -O $@-t http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.gz
213 cd gcc-$(GCC_VERSION) && patch -p0 < ../stage2-riscv-gnu-toolchain/gcc-5-fix-compilation-with-gcc-6.patch
214 tar zcf $@-t gcc-$(GCC_VERSION)
215 rm -r gcc-$(GCC_VERSION)
218 stage2-riscv-gnu-toolchain/glibc-$(GLIBC_VERSION).tar.gz:
220 wget -O $@-t http://mirrors.kernel.org/gnu/glibc/glibc-$(GLIBC_VERSION).tar.gz
223 stage2-riscv-gnu-toolchain/newlib-$(NEWLIB_VERSION).tar.gz:
225 wget -O $@-t ftp://sourceware.org/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz
228 stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec: stage2-riscv-gnu-toolchain/riscv-gnu-toolchain.spec.in
229 sed -e 's/@COMMIT@/$(RISCV_GNU_TOOLCHAIN_COMMIT)/g' \
230 -e 's/@SHORTCOMMIT@/$(RISCV_GNU_TOOLCHAIN_SHORTCOMMIT)/g' \
231 -e 's/@BINUTILS_VERSION@/$(BINUTILS_VERSION)/g' \
232 -e 's/@GCC_VERSION@/$(GCC_VERSION)/g' \
233 -e 's/@GLIBC_VERSION@/$(GLIBC_VERSION)/g' \
234 -e 's/@NEWLIB_VERSION@/$(NEWLIB_VERSION)/g' \
238 stamp-riscv-gnu-toolchain-installed:
240 @rpm -q riscv-gnu-toolchain >/dev/null || { \
241 echo "ERROR: You must install riscv-gnu-toolchain:"; \
243 echo " dnf copr enable rjones/riscv"; \
244 echo " dnf install riscv-gnu-toolchain"; \
246 echo "OR: you can build it yourself from the stage2-riscv-gnu-toolchain directory."; \
250 @riscv64-unknown-elf-gcc --version || { \
251 echo "ERROR: riscv64-unknown-elf-gcc (cross compiler) is not working."; \
252 echo "Make sure you installed the riscv-gnu-toolchain package."; \
257 stage2-riscv-pk/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz:
259 wget -O $@-t https://github.com/lowRISC/riscv-pk/archive/$(RISCV_PK_COMMIT)/riscv-pk-$(RISCV_PK_SHORTCOMMIT).tar.gz
262 stage2-riscv-pk/riscv-pk.spec: stage2-riscv-pk/riscv-pk.spec.in
263 sed -e 's/@COMMIT@/$(RISCV_PK_COMMIT)/g' \
264 -e 's/@SHORTCOMMIT@/$(RISCV_PK_SHORTCOMMIT)/g' \
268 stamp-riscv-pk-installed:
270 @rpm -q riscv-pk >/dev/null || { \
271 echo "ERROR: You must install riscv-pk:"; \
273 echo " dnf copr enable rjones/riscv"; \
274 echo " dnf install riscv-pk"; \
276 echo "OR: you can build it yourself from the stage2-riscv-pk directory."; \
284 stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
285 stage3-chroot-original/etc/fedora-release \
286 stage3-chroot/etc/fedora-release \
287 stage3-chroot/lib64/libc.so.6 \
288 stage3-chroot/usr/bin/tic \
289 stage3-chroot/usr/lib64/libhistory.so.6 \
290 stage3-chroot/bin/bash \
291 stage3-chroot/bin/ls \
292 stage3-chroot/usr/lib64/libgmp.so.10 \
293 stage3-chroot/usr/lib64/libmpfr.so.4 \
294 stage3-chroot/usr/lib64/libmpc.so.3 \
295 stage3-chroot/usr/bin/as \
296 stage3-chroot/usr/bin/gcc \
297 stage3-chroot/usr/bin/mount \
298 stage3-chroot/usr/bin/tar \
299 stage3-chroot/usr/bin/gzip \
300 stage3-chroot/usr/lib64/libz.so \
301 stage3-chroot/usr/bin/file \
302 stage3-chroot/usr/lib64/libpopt.so \
303 stage3-chroot/usr/lib64/libbeecrypt.so \
304 stage3-chroot/usr/bin/nano \
305 stage3-chroot/usr/bin/grep \
306 stage3-chroot/usr/bin/less \
307 stage3-chroot/usr/bin/strace \
308 stage3-chroot/usr/bin/bzip2 \
309 stage3-chroot/usr/bin/make \
310 stage3-chroot/usr/bin/diff \
311 stage3-chroot/usr/bin/find \
312 stage3-chroot/usr/bin/sed \
313 stage3-chroot/usr/bin/patch \
314 stage3-chroot/usr/bin/hostname \
315 stage3-chroot/usr/bin/gettext \
316 stage3-chroot/usr/bin/lua \
317 stage3-chroot/usr/bin/rpm \
318 stage3-chroot/usr/bin/xz \
319 stage3-chroot/usr/bin/gawk \
320 stage3-chroot/usr/bin/vim \
324 stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux:
325 rm -rf stage3-kernel/linux-$(KERNEL_VERSION)
326 cp -a $(LOCAL_LINUX_GIT_COPY) stage3-kernel/linux-$(KERNEL_VERSION) || { \
327 mkdir stage3-kernel/linux-$(KERNEL_VERSION) && \
328 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
331 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
332 git remote add riscv https://github.com/riscv/riscv-linux && \
334 git checkout -f linux-4.1.y-riscv && \
336 make ARCH=riscv defconfig
337 echo CONFIG_CMDLINE=\"root=/dev/htifblk0 init=/init\" >> stage3-kernel/linux-$(KERNEL_VERSION)/.config
338 echo CONFIG_CROSS_COMPILE=riscv64-unknown-elf- >> stage3-kernel/linux-$(KERNEL_VERSION)/.config
339 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
340 make ARCH=riscv olddefconfig
341 cd stage3-kernel/linux-$(KERNEL_VERSION) && \
342 make ARCH=riscv vmlinux
345 # Build an original (x86-64) chroot using supermin. We then aim to
346 # rebuild (using cross-compiled versions) every ELF binary in this
348 stage3-chroot-original/etc/fedora-release:
349 rm -rf stage3-chroot-original tmp-supermin.d
350 supermin --prepare $(STAGE3_PACKAGES) -o tmp-supermin.d
351 supermin --build -f chroot tmp-supermin.d -o stage3-chroot-original
353 @echo -n "Total files in chroot: "
354 @find stage3-chroot-original -type f | wc -l
355 @echo -n "ELF files to be rebuilt: "
356 @find stage3-chroot-original -type f | xargs file -N | grep -E '\bELF.*LSB\b' | wc -l
358 # Copy the original chroot to the final chroot, remove all the ELF
360 stage3-chroot/etc/fedora-release: stage3-chroot-original/etc/fedora-release
362 cp -a stage3-chroot-original stage3-chroot
363 find stage3-chroot -type d -print0 | xargs -0 chmod u+w
364 find stage3-chroot -type f -print0 | xargs -0 chmod u+w
365 find stage3-chroot -type f -print0 | xargs -0 file -N | grep -E '\bELF.*LSB\b' | awk -F: '{print $$1}' | xargs rm -f
366 rm -f stage3-chroot/lib64/libc.so.6
368 # Copy in compiled glibc from the riscv-gnu-toolchain sysroot. Only
369 # copy files and symlinks, leave the target directory structure
371 stage3-chroot/lib64/libc.so.6:
372 mkdir -p stage3-chroot/usr/lib/audit
373 mkdir -p stage3-chroot/usr/lib/gconv
374 for f in `cd /usr/sysroot && find -type f -o -type l`; do \
375 cp -d /usr/sysroot/$$f stage3-chroot/$$f; \
377 cd stage3-chroot/lib64 && for f in ../lib/*; do ln -sf $$f; done
379 # Cross-compile ncurses.
380 stage3-chroot/usr/bin/tic: ncurses-$(NCURSES_VERSION).tgz
382 cd ncurses-$(NCURSES_VERSION) && \
383 PATH=$(ROOT)/fixed-gcc:$$PATH \
384 ./configure --host=riscv64-unknown-linux-gnu \
385 --prefix=/usr --libdir=/usr/lib64 \
387 --with-termlib=tinfo \
389 cd ncurses-$(NCURSES_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
390 cd ncurses-$(NCURSES_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
392 ncurses-$(NCURSES_VERSION).tgz:
394 wget -O $@-t ftp://invisible-island.net/ncurses/current/ncurses-$(NCURSES_VERSION).tgz
397 # Cross-compile readline.
398 stage3-chroot/usr/lib64/libhistory.so.6: readline-$(READLINE_VERSION).tar.gz
400 cd readline-$(READLINE_VERSION) && \
401 PATH=$(ROOT)/fixed-gcc:$$PATH \
402 bash_cv_wcwidth_broken=no \
403 ./configure --host=riscv64-unknown-linux-gnu \
404 --prefix=/usr --libdir=/usr/lib64
405 cd readline-$(READLINE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
406 cd readline-$(READLINE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
407 rm -f stage3-chroot/usr/lib64/*.la
409 readline-$(READLINE_VERSION).tar.gz:
411 wget -O $@-t ftp://ftp.gnu.org/gnu/readline/readline-$(READLINE_VERSION).tar.gz
414 # Cross-compile bash.
415 stage3-chroot/bin/bash: bash-$(BASH_VERSION).tar.gz
417 cd bash-$(BASH_VERSION) && \
418 PATH=$(ROOT)/fixed-gcc:$$PATH \
419 ./configure --host=riscv64-unknown-linux-gnu \
420 --prefix=/usr --libdir=/usr/lib64
421 cd bash-$(BASH_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
422 cd bash-$(BASH_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
424 bash-$(BASH_VERSION).tar.gz:
426 wget -O $@-t ftp://ftp.gnu.org/gnu/bash/bash-$(BASH_VERSION).tar.gz
429 # Cross-compile coreutils. Bleah, coreutils cross-compilation is
430 # known-broken and upstream don't care, hence the 'touch' command.
432 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
434 stage3-chroot/bin/ls: coreutils-$(COREUTILS_VERSION).tar.xz
435 rm -rf coreutils-$(COREUTILS_VERSION)
437 cd coreutils-$(COREUTILS_VERSION) && \
438 PATH=$(ROOT)/fixed-gcc:$$PATH \
439 ./configure --host=riscv64-unknown-linux-gnu \
440 --prefix=/usr --libdir=/usr/lib64
441 -cd coreutils-$(COREUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
442 cd coreutils-$(COREUTILS_VERSION)/man && \
443 for f in $(COREUTILS_PROGRAMS); do touch $$f.1; done
444 cd coreutils-$(COREUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
445 cd coreutils-$(COREUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
447 coreutils-$(COREUTILS_VERSION).tar.xz:
449 wget -O $@-t ftp://ftp.gnu.org/gnu/coreutils/coreutils-$(COREUTILS_VERSION).tar.xz
452 # Cross-compile binutils.
453 stage3-chroot/usr/bin/as: binutils-$(BINUTILS_X_VERSION).tar.gz
454 rm -rf riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)
456 mkdir riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build
457 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && \
458 PATH=$(ROOT)/fixed-gcc:$$PATH \
460 --host=riscv64-unknown-linux-gnu \
461 --prefix=/usr --libdir=/usr/lib64
462 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make
463 cd riscv-binutils-gdb-riscv-binutils-$(BINUTILS_X_VERSION)/build && make DESTDIR=$(ROOT)/stage3-chroot install
465 binutils-$(BINUTILS_X_VERSION).tar.gz:
467 wget -O $@-t https://github.com/riscv/riscv-binutils-gdb/archive/riscv-binutils-$(BINUTILS_X_VERSION).tar.gz
470 # Cross-compile GMP, MPFR and MPC (deps of GCC).
471 stage3-chroot/usr/lib64/libgmp.so.10: gmp-$(GMP_VERSION).tar.lz
472 rm -rf gmp-$(GMP_VERSION)
473 tar --lzip -xf gmp-$(GMP_VERSION).tar.lz
474 cd gmp-$(GMP_VERSION) && \
475 PATH=$(ROOT)/fixed-gcc:$$PATH \
476 ./configure --host=riscv64-unknown-linux-gnu \
477 --prefix=/usr --libdir=/usr/lib64
478 cd gmp-$(GMP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
479 cd gmp-$(GMP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
480 cd stage3-chroot/usr/lib && ln -s ../lib64/libgmp.so
482 gmp-$(GMP_VERSION).tar.lz:
484 wget -O $@-t https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.lz
487 stage3-chroot/usr/lib64/libmpfr.so.4: mpfr-$(MPFR_VERSION).tar.gz
488 rm -rf mpfr-$(MPFR_VERSION)
489 tar -zxf mpfr-$(MPFR_VERSION).tar.gz
490 cd mpfr-$(MPFR_VERSION) && \
491 PATH=$(ROOT)/fixed-gcc:$$PATH \
492 ./configure --host=riscv64-unknown-linux-gnu \
493 --prefix=/usr --libdir=/usr/lib64 \
494 --with-gmp=$(ROOT)/stage3-chroot/usr
495 cd mpfr-$(MPFR_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
496 cd mpfr-$(MPFR_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
497 cd stage3-chroot/usr/lib && ln -s ../lib64/libmpfr.so
498 rm -f stage3-chroot/usr/lib64/*.la
500 mpfr-$(MPFR_VERSION).tar.gz:
502 wget -O $@-t http://www.mpfr.org/mpfr-current/mpfr-$(MPFR_VERSION).tar.gz
505 stage3-chroot/usr/lib64/libmpc.so.3: mpc-$(MPC_VERSION).tar.gz
506 rm -rf mpc-$(MPC_VERSION)
507 tar -zxf mpc-$(MPC_VERSION).tar.gz
508 cd mpc-$(MPC_VERSION) && \
509 PATH=$(ROOT)/fixed-gcc:$$PATH \
510 ./configure --host=riscv64-unknown-linux-gnu \
511 --prefix=/usr --libdir=/usr/lib64 \
512 --with-gmp=$(ROOT)/stage3-chroot/usr \
513 --with-mpfr=$(ROOT)/stage3-chroot/usr
514 cd mpc-$(MPC_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
515 cd mpc-$(MPC_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
516 cd stage3-chroot/usr/lib && ln -s ../lib64/libmpc.so
517 rm -f stage3-chroot/usr/lib64/*.la
519 mpc-$(MPC_VERSION).tar.gz:
521 wget -O $@-t ftp://ftp.gnu.org/gnu/mpc/mpc-$(MPC_VERSION).tar.gz
525 stage3-chroot/usr/bin/gcc: gcc-$(GCC_X_VERSION).tar.gz
526 rm -rf riscv-gcc-riscv-gcc-$(GCC_X_VERSION)
528 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION) && \
529 patch -p1 < ../0001-HACKS-TO-GET-GCC-TO-COMPILE.patch
530 mkdir riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build
531 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && \
532 gcc_cv_as_leb128=no \
533 PATH=$(ROOT)/fixed-gcc:$$PATH \
535 --host=riscv64-unknown-linux-gnu \
536 --prefix=/usr --libdir=/usr/lib64 \
539 --enable-languages=c,c++ \
540 --disable-libmudflap \
542 --disable-libquadmath \
545 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && gcc_cv_as_leb128=no PATH=$(ROOT)/fixed-gcc:$$PATH make
546 cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && make install DESTDIR=$(ROOT)/stage3-chroot
547 rm -f stage3-chroot/usr/lib64/*.la
549 gcc-$(GCC_X_VERSION).tar.gz:
551 wget -O $@-t https://github.com/riscv/riscv-gcc/archive/riscv-gcc-$(GCC_X_VERSION).tar.gz
554 # Cross-compile util-linux.
555 stage3-chroot/usr/bin/mount: util-linux-$(UTIL_LINUX_VERSION).tar.xz
556 rm -rf util-linux-$(UTIL_LINUX_VERSION)
558 cd util-linux-$(UTIL_LINUX_VERSION) && \
559 PATH=$(ROOT)/fixed-gcc:$$PATH \
560 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
562 --host=riscv64-unknown-linux-gnu \
563 --prefix=/usr --libdir=/usr/lib64 \
566 --disable-makeinstall-chown \
567 --enable-static-programs=mount
568 cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
569 cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
570 rm -f stage3-chroot/usr/lib64/*.la
572 util-linux-$(UTIL_LINUX_VERSION).tar.xz:
574 wget -O $@-t ftp://ftp.kernel.org/pub/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)/util-linux-$(UTIL_LINUX_VERSION).tar.xz
577 # Cross-compile GNU tar.
578 stage3-chroot/usr/bin/tar: tar-$(TAR_VERSION).tar.xz
579 rm -rf tar-$(TAR_VERSION)
581 cd tar-$(TAR_VERSION) && \
582 PATH=$(ROOT)/fixed-gcc:$$PATH \
584 --host=riscv64-unknown-linux-gnu \
585 --prefix=/usr --libdir=/usr/lib64
586 cd tar-$(TAR_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
587 cd tar-$(TAR_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
589 tar-$(TAR_VERSION).tar.xz:
591 wget -O $@-t https://ftp.gnu.org/gnu/tar/tar-$(TAR_VERSION).tar.xz
594 # Cross-compile GNU gzip.
595 stage3-chroot/usr/bin/gzip: gzip-$(GZIP_VERSION).tar.gz
596 rm -rf gzip-$(GZIP_VERSION)
598 cd gzip-$(GZIP_VERSION) && \
599 PATH=$(ROOT)/fixed-gcc:$$PATH \
601 --host=riscv64-unknown-linux-gnu \
602 --prefix=/usr --libdir=/usr/lib64
603 cd gzip-$(GZIP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
604 cd gzip-$(GZIP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
606 gzip-$(GZIP_VERSION).tar.gz:
608 wget -O $@-t https://ftp.gnu.org/gnu/gzip/gzip-$(GZIP_VERSION).tar.gz
611 # Cross-compile zlib.
612 stage3-chroot/usr/lib64/libz.so: zlib-$(ZLIB_VERSION).tar.gz
613 rm -rf zlib-$(ZLIB_VERSION)
615 cd zlib-$(ZLIB_VERSION) && \
616 PATH=$(ROOT)/fixed-gcc:$$PATH \
617 CC=riscv64-unknown-linux-gnu-gcc \
618 CFLAGS="-I$(ROOT)/stage3-chroot/usr/include -L$(ROOT)/stage3-chroot/usr/lib" \
620 --prefix=/usr --libdir=/usr/lib64
621 cd zlib-$(ZLIB_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make shared
622 cd zlib-$(ZLIB_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
624 zlib-$(ZLIB_VERSION).tar.gz:
626 wget -O $@-t http://zlib.net/zlib-$(ZLIB_VERSION).tar.gz
629 # Cross-compile file/libmagic.
630 stage3-chroot/usr/bin/file: file-$(FILE_VERSION).tar.gz
631 rm -rf file-$(FILE_VERSION)
633 cd file-$(FILE_VERSION) && \
634 PATH=$(ROOT)/fixed-gcc:$$PATH \
635 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
637 --host=riscv64-unknown-linux-gnu \
638 --prefix=/usr --libdir=/usr/lib64 \
639 --disable-static --enable-shared
640 cd file-$(FILE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
641 cd file-$(FILE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
642 rm -f stage3-chroot/usr/lib64/*.la
644 file-$(FILE_VERSION).tar.gz:
646 wget -O $@-t ftp://ftp.astron.com/pub/file/file-$(FILE_VERSION).tar.gz
649 # Cross-compile popt.
650 stage3-chroot/usr/lib64/libpopt.so: popt-$(POPT_VERSION).tar.gz
651 rm -rf popt-$(POPT_VERSION)
653 cd popt-$(POPT_VERSION) && \
654 PATH=$(ROOT)/fixed-gcc:$$PATH \
655 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
657 --host=riscv64-unknown-linux-gnu \
658 --prefix=/usr --libdir=/usr/lib64 \
659 --disable-static --enable-shared
660 cd popt-$(POPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
661 cd popt-$(POPT_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
662 rm -f stage3-chroot/usr/lib64/*.la
664 popt-$(POPT_VERSION).tar.gz:
666 wget -O $@-t http://rpm5.org/files/popt/popt-$(POPT_VERSION).tar.gz
669 # Cross-compile beecrypt.
670 stage3-chroot/usr/lib64/libbeecrypt.so: beecrypt-$(BEECRYPT_VERSION).tar.gz
671 rm -rf beecrypt-$(BEECRYPT_VERSION)
673 cd beecrypt-$(BEECRYPT_VERSION) && patch -p0 < ../beecrypt-disable-cplusplus.patch
674 cd beecrypt-$(BEECRYPT_VERSION) && autoreconf -i
675 cd beecrypt-$(BEECRYPT_VERSION) && \
676 PATH=$(ROOT)/fixed-gcc:$$PATH \
677 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
679 --host=riscv64-unknown-linux-gnu \
680 --prefix=/usr --libdir=/usr/lib64 \
681 --without-cplusplus \
686 cd beecrypt-$(BEECRYPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
687 cd beecrypt-$(BEECRYPT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot V=1
688 chrpath -d stage3-chroot/usr/lib64/libbeecrypt.so.*
689 rm -f stage3-chroot/usr/lib64/*.la
691 beecrypt-$(BEECRYPT_VERSION).tar.gz:
693 wget -O $@-t http://downloads.sourceforge.net/sourceforge/beecrypt/beecrypt-$(BEECRYPT_VERSION).tar.gz
696 # Cross-compile GNU nano (editor).
697 stage3-chroot/usr/bin/nano: nano-$(NANO_VERSION).tar.gz
698 rm -rf nano-$(NANO_VERSION)
700 cd nano-$(NANO_VERSION) && \
701 PATH=$(ROOT)/fixed-gcc:$$PATH \
702 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
704 --host=riscv64-unknown-linux-gnu \
705 --prefix=/usr --libdir=/usr/lib64
706 cd nano-$(NANO_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
707 cd nano-$(NANO_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
709 nano-$(NANO_VERSION).tar.gz:
711 wget -O $@-t https://www.nano-editor.org/dist/v2.6/nano-$(NANO_VERSION).tar.gz
714 # Cross-compile GNU grep.
715 stage3-chroot/usr/bin/grep: grep-$(GREP_VERSION).tar.xz
716 rm -rf grep-$(GREP_VERSION)
718 cd grep-$(GREP_VERSION) && \
719 PATH=$(ROOT)/fixed-gcc:$$PATH \
721 --host=riscv64-unknown-linux-gnu \
722 --prefix=/usr --libdir=/usr/lib64
723 cd grep-$(GREP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
724 cd grep-$(GREP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
726 grep-$(GREP_VERSION).tar.xz:
728 wget -O $@-t https://ftp.gnu.org/gnu/grep/grep-$(GREP_VERSION).tar.xz
731 # Cross-compile less.
732 stage3-chroot/usr/bin/less: less-$(LESS_VERSION).tar.gz
733 rm -rf less-$(LESS_VERSION)
735 cd less-$(LESS_VERSION) && \
736 PATH=$(ROOT)/fixed-gcc:$$PATH \
737 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
739 --host=riscv64-unknown-linux-gnu \
740 --prefix=/usr --libdir=/usr/lib64
741 cd less-$(LESS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
742 cd less-$(LESS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
744 less-$(LESS_VERSION).tar.gz:
746 wget -O $@-t http://www.greenwoodsoftware.com/less/less-$(LESS_VERSION).tar.gz
749 # Cross-compile strace.
750 # XXX This does not work.
751 stage3-chroot/usr/bin/strace: strace-$(STRACE_SHORT_COMMIT).tar.gz
752 rm -rf strace-$(STRACE_SHORT_COMMIT)
754 cd riscv-strace-$(STRACE_COMMIT) && patch -p1 < ../0001-Update-riscv_regs-for-ptrace.h-from-Linux-4.1.x.patch
755 cd riscv-strace-$(STRACE_COMMIT) && \
756 PATH=$(ROOT)/fixed-gcc:$$PATH \
757 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
759 --host=riscv64-unknown-linux-gnu \
760 --prefix=/usr --libdir=/usr/lib64
761 cd riscv-strace-$(STRACE_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make
762 cd riscv-strace-$(STRACE_COMMIT) && make install DESTDIR=$(ROOT)/stage3-chroot
764 strace-$(STRACE_SHORT_COMMIT).tar.gz:
766 wget -O $@-t 'https://github.com/riscv/riscv-strace/archive/$(STRACE_COMMIT)/riscv-strace-$(STRACE_SHORTCOMMIT).tar.gz'
769 # Cross-compile bzip2.
770 stage3-chroot/usr/bin/bzip2: bzip2-$(BZIP2_VERSION).tar.gz
771 rm -rf bzip2-$(BZIP2_VERSION)
773 cd bzip2-$(BZIP2_VERSION) && \
774 PATH=$(ROOT)/fixed-gcc:$$PATH \
775 make libbz2.a bzip2 bzip2recover \
777 CC=riscv64-unknown-linux-gnu-gcc \
778 AR=riscv64-unknown-linux-gnu-ar \
779 RANLIB=riscv64-unknown-linux-gnu-ranlib \
780 CFLAGS="-Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -fPIC"
781 cd bzip2-$(BZIP2_VERSION) && \
782 make install PREFIX=$(ROOT)/stage3-chroot/usr
784 bzip2-$(BZIP2_VERSION).tar.gz:
786 wget -O $@-t http://www.bzip.org/1.0.6/bzip2-$(BZIP2_VERSION).tar.gz
789 # Cross-compile GNU make.
790 stage3-chroot/usr/bin/make: make-$(MAKE_VERSION).tar.gz
791 rm -rf make-$(MAKE_VERSION)
793 cd make-$(MAKE_VERSION) && \
794 PATH=$(ROOT)/fixed-gcc:$$PATH \
796 --host=riscv64-unknown-linux-gnu \
797 --prefix=/usr --libdir=/usr/lib64
798 cd make-$(MAKE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
799 cd make-$(MAKE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
801 make-$(MAKE_VERSION).tar.gz:
803 wget -O $@-t https://ftp.gnu.org/gnu/make/make-$(MAKE_VERSION).tar.gz
806 # Cross-compile GNU diffutils.
807 stage3-chroot/usr/bin/diff: diffutils-$(DIFFUTILS_VERSION).tar.xz
808 rm -rf diffutils-$(DIFFUTILS_VERSION)
810 cd diffutils-$(DIFFUTILS_VERSION) && \
811 PATH=$(ROOT)/fixed-gcc:$$PATH \
813 --host=riscv64-unknown-linux-gnu \
814 --prefix=/usr --libdir=/usr/lib64
815 cd diffutils-$(DIFFUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
816 cd diffutils-$(DIFFUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
818 diffutils-$(DIFFUTILS_VERSION).tar.xz:
820 wget -O $@-t https://ftp.gnu.org/gnu/diffutils/diffutils-$(DIFFUTILS_VERSION).tar.xz
823 # Cross-compile GNU findutils.
824 stage3-chroot/usr/bin/find: findutils-$(FINDUTILS_VERSION).tar.gz
825 rm -rf findutils-$(FINDUTILS_VERSION)
827 cd findutils-$(FINDUTILS_VERSION) && \
828 PATH=$(ROOT)/fixed-gcc:$$PATH \
830 --host=riscv64-unknown-linux-gnu \
831 --prefix=/usr --libdir=/usr/lib64
832 cd findutils-$(FINDUTILS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
833 cd findutils-$(FINDUTILS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
835 findutils-$(FINDUTILS_VERSION).tar.gz:
837 wget -O $@-t https://ftp.gnu.org/gnu/findutils/findutils-$(FINDUTILS_VERSION).tar.gz
840 # Cross-compile GNU sed.
841 stage3-chroot/usr/bin/sed: sed-$(SED_VERSION).tar.gz
842 rm -rf sed-$(SED_VERSION)
844 cd sed-$(SED_VERSION) && \
845 PATH=$(ROOT)/fixed-gcc:$$PATH \
847 --host=riscv64-unknown-linux-gnu \
848 --prefix=/usr --libdir=/usr/lib64
849 cd sed-$(SED_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
850 cd sed-$(SED_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
852 sed-$(SED_VERSION).tar.gz:
854 wget -O $@-t https://ftp.gnu.org/gnu/sed/sed-$(SED_VERSION).tar.gz
857 # Cross-compile patch.
858 stage3-chroot/usr/bin/patch: patch-$(PATCH_VERSION).tar.gz
859 rm -rf patch-$(PATCH_VERSION)
861 cd patch-$(PATCH_VERSION) && \
862 PATH=$(ROOT)/fixed-gcc:$$PATH \
864 --host=riscv64-unknown-linux-gnu \
865 --prefix=/usr --libdir=/usr/lib64
866 cd patch-$(PATCH_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
867 cd patch-$(PATCH_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
869 patch-$(PATCH_VERSION).tar.gz:
871 wget -O $@-t https://ftp.gnu.org/gnu/patch/patch-$(PATCH_VERSION).tar.gz
874 # Cross-compile hostname.
875 stage3-chroot/usr/bin/hostname: hostname-$(HOSTNAME_VERSION).tar.gz
876 rm -rf hostname-$(HOSTNAME_VERSION)
878 cd hostname && patch -p1 < ../hostname-rh.patch
880 PATH=$(ROOT)/fixed-gcc:$$PATH \
882 CC=riscv64-unknown-linux-gnu-gcc \
884 cd hostname && make install BASEDIR=$(ROOT)/stage3-chroot
886 hostname-$(HOSTNAME_VERSION).tar.gz:
888 wget -O $@-t http://ftp.de.debian.org/debian/pool/main/h/hostname/hostname_$(HOSTNAME_VERSION).tar.gz
891 # Cross-compile GNU gettext.
892 stage3-chroot/usr/bin/gettext: gettext-$(GETTEXT_VERSION).tar.gz
893 rm -rf gettext-$(GETTEXT_VERSION)
895 cd gettext-$(GETTEXT_VERSION) && \
896 PATH=$(ROOT)/fixed-gcc:$$PATH \
898 --host=riscv64-unknown-linux-gnu \
899 --prefix=/usr --libdir=/usr/lib64
900 cd gettext-$(GETTEXT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
901 cd gettext-$(GETTEXT_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
902 rm -f stage3-chroot/usr/lib64/*.la
904 gettext-$(GETTEXT_VERSION).tar.gz:
906 wget -O $@-t https://ftp.gnu.org/gnu/gettext/gettext-$(GETTEXT_VERSION).tar.gz
910 stage3-chroot/usr/bin/lua: lua-$(LUA_VERSION).tar.gz
911 rm -rf lua-$(LUA_VERSION)
913 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"
914 cd lua-$(LUA_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install INSTALL_TOP=$(ROOT)/stage3-chroot/usr INSTALL_LIB=$(ROOT)/stage3-chroot/usr/lib64
916 lua-$(LUA_VERSION).tar.gz:
918 wget -O $@-t https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz
922 stage3-chroot/usr/bin/xz: xz-$(XZ_VERSION).tar.gz
923 rm -rf xz-$(XZ_VERSION)
925 cd xz-$(XZ_VERSION) && \
926 PATH=$(ROOT)/fixed-gcc:$$PATH \
928 --host=riscv64-unknown-linux-gnu \
929 --prefix=/usr --libdir=/usr/lib64
930 cd xz-$(XZ_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
931 cd xz-$(XZ_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
932 rm -f stage3-chroot/usr/lib64/*.la
934 xz-$(XZ_VERSION).tar.gz:
936 wget -O $@-t http://tukaani.org/xz/xz-$(XZ_VERSION).tar.gz
939 # Cross-compile GNU awk.
940 stage3-chroot/usr/bin/gawk: gawk-$(GAWK_VERSION).tar.gz
941 rm -rf gawk-$(GAWK_VERSION)
943 cd gawk-$(GAWK_VERSION) && \
944 PATH=$(ROOT)/fixed-gcc:$$PATH \
946 --host=riscv64-unknown-linux-gnu \
947 --prefix=/usr --libdir=/usr/lib64
948 cd gawk-$(GAWK_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
949 cd gawk-$(GAWK_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
951 gawk-$(GAWK_VERSION).tar.gz:
953 wget -O $@-t https://ftp.gnu.org/gnu/gawk/gawk-$(GAWK_VERSION).tar.gz
957 stage3-chroot/usr/bin/vim: vim-$(VIM_VERSION).tar.gz
958 rm -rf vim-$(VIM_VERSION)
961 PATH=$(ROOT)/fixed-gcc:$$PATH \
962 vim_cv_memmove_handles_overlap=yes \
963 vim_cv_stat_ignores_slash=no \
964 vim_cv_getcwd_broken=no \
965 vim_cv_tty_group=world \
966 vim_cv_terminfo=yes \
967 vim_cv_toupper_broken=no \
968 LDFLAGS=-L/home/rjones/d/fedora-riscv/stage3-chroot/usr/lib64 \
970 --host=riscv64-unknown-linux-gnu \
971 --prefix=/usr --libdir=/usr/lib64 \
973 cd vim74/src && PATH=$(ROOT)/fixed-gcc:$$PATH make
974 cd vim74/src && make install DESTDIR=$(ROOT)/stage3-chroot STRIP=riscv64-unknown-linux-gnu-strip
976 vim-$(VIM_VERSION).tar.gz:
978 wget -O $@-t ftp://ftp.vim.org/pub/vim/unix/vim-$(VIM_VERSION).tar.bz2
981 # Cross-compile RPM / rpmbuild.
982 # We build this from a git commit, with a few hacks to the configure
984 stage3-chroot/usr/bin/rpm: rpm-$(RPM_SHORT_COMMIT).tar.gz db-$(BDB_VERSION).tar.gz
985 rm -rf rpm-$(RPM_SHORT_COMMIT)
986 tar -zxf rpm-$(RPM_SHORT_COMMIT).tar.gz
987 tar -zxf db-$(BDB_VERSION).tar.gz -C rpm-$(RPM_SHORT_COMMIT)
988 cd rpm-$(RPM_SHORT_COMMIT) && ln -s db-$(BDB_VERSION) db
989 cd rpm-$(RPM_SHORT_COMMIT) && \
990 patch -p1 < ../0001-RISCV-64-bit-riscv64-support.patch && \
991 patch -p1 < ../0002-rpmrc-Convert-uname.machine-riscv-to-riscv32-riscv64.patch && \
992 patch -p1 < ../0003-build-fgetc-returns-int-not-char.patch && \
993 patch -p1 < ../0004-HACKS-TO-GET-RPM-TO-CROSS-COMPILE.patch
994 cd rpm-$(RPM_SHORT_COMMIT) && autoreconf -i
995 cd rpm-$(RPM_SHORT_COMMIT) && \
996 PATH=$(ROOT)/fixed-gcc:$$PATH \
997 LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
999 --host=riscv64-unknown-linux-gnu \
1000 --prefix=/usr --libdir=/usr/lib64 \
1002 --with-vendor=redhat \
1003 --without-libarchive \
1007 --without-external-db \
1010 cd rpm-$(RPM_SHORT_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1
1011 cd rpm-$(RPM_SHORT_COMMIT) && PATH=$(ROOT)/fixed-gcc:$$PATH make install DESTDIR=$(ROOT)/stage3-chroot
1012 rm -f stage3-chroot/usr/lib64/*.la
1014 rpm-$(RPM_SHORT_COMMIT).tar.gz:
1016 wget -O $@-t 'http://rpm.org/gitweb?p=rpm.git;a=snapshot;h=$(RPM_COMMIT);sf=tgz'
1019 db-$(BDB_VERSION).tar.gz:
1021 wget -O $@-t http://download.oracle.com/berkeley-db/db-$(BDB_VERSION).tar.gz
1024 # Create an /init script.
1025 stage3-chroot/init: init.sh
1026 install -m 0755 $^ $@
1028 # Create the stage3 disk image.
1029 # Note `-s +...' adds spare space to the disk image.
1030 stage3-disk.img: stage3-chroot
1031 cd stage3-chroot && virt-make-fs . ../$@ -t ext2 -F raw -s +4G
1033 # Upload the compressed disk image.
1034 upload-stage3: stage3-disk.img.xz
1035 scp $^ tick:public_html/riscv/
1036 stage3-disk.img.xz: stage3-disk.img
1040 # Helper which boots stage3 disk image in spike.
1041 boot-stage3-in-spike: stage3-disk.img stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
1042 spike +disk=stage3-disk.img \
1043 /usr/bin/bbl stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
1045 # Helper which boots stage3 disk image in qemu.
1046 boot-stage3-in-qemu: stage3-disk.img stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux
1047 qemu-system-riscv -kernel /usr/bin/bbl \
1048 -append ./stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
1049 -drive file=stage3-disk.img,format=raw -nographic