Add nano (editor), grep and less to the stage3 chroot, for usability.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 9 Aug 2016 17:59:32 +0000 (18:59 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 9 Aug 2016 18:43:15 +0000 (19:43 +0100)
.gitignore
Makefile

index 39e4989..a4f9e2e 100644 (file)
@@ -21,9 +21,12 @@ stamp-*
 /coreutils-8.25/
 /file-5.25/
 /gmp-6.1.1/
+/grep-2.25/
 /gzip-1.8/
+/less-481/
 /mpc-1.0.3/
 /mpfr-3.1.4/
+/nano-2.6.2/
 /ncurses-6.0-20160730/
 /popt-1.16/
 /riscv-binutils-gdb-riscv-binutils-2.26/
index e953bcb..b41befd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ LOCAL_LINUX_GIT_COPY = $(HOME)/d/linux
 # The root packages (plus their dependencies) that we want to
 # cross-compile into the stage 3 chroot.
 # beecrypt-devel is required to build RPM.
-STAGE3_PACKAGES = gcc rpm-build beecrypt-devel
+# Packages for usability: nano, grep, less
+STAGE3_PACKAGES = gcc rpm-build beecrypt-devel nano grep less
 
 # Versions of cross-compiled packages.
 NCURSES_VERSION    = 6.0-20160730
@@ -60,6 +61,9 @@ BEECRYPT_VERSION   = 4.2.1
 RPM_COMMIT         = 95712183458748ea6cafebac1bdd5daa097d9bee
 RPM_SHORT_COMMIT   = 9571218
 BDB_VERSION        = 4.5.20
+NANO_VERSION       = 2.6.2
+GREP_VERSION       = 2.25
+LESS_VERSION       = 481
 
 all: stage1 stage2 stage3 stage4
 
@@ -275,6 +279,9 @@ stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \
        stage3-chroot/usr/lib64/libpopt.so \
        stage3-chroot/usr/lib64/libbeecrypt.so \
        stage3-chroot/usr/bin/rpm \
+       stage3-chroot/usr/bin/nano \
+       stage3-chroot/usr/bin/grep \
+       stage3-chroot/usr/bin/less \
        stage3-chroot/init \
        stage3-disk.img
 
@@ -672,6 +679,59 @@ db-$(BDB_VERSION).tar.gz:
        wget -O $@-t http://download.oracle.com/berkeley-db/db-$(BDB_VERSION).tar.gz
        mv $@-t $@
 
+# Cross-compile GNU nano (editor).
+stage3-chroot/usr/bin/nano: nano-$(NANO_VERSION).tar.gz
+       rm -rf nano-$(NANO_VERSION)
+       tar -zxf $^
+       cd nano-$(NANO_VERSION) && \
+       PATH=$(ROOT)/fixed-gcc:$$PATH \
+       LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
+       ./configure \
+           --host=riscv64-unknown-linux-gnu \
+           --prefix=/usr --libdir=/usr/lib64
+       cd nano-$(NANO_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
+       cd nano-$(NANO_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
+
+nano-$(NANO_VERSION).tar.gz:
+       rm -f $@ $@-t
+       wget -O $@-t https://www.nano-editor.org/dist/v2.6/nano-$(NANO_VERSION).tar.gz
+       mv $@-t $@
+
+# Cross-compile GNU grep.
+stage3-chroot/usr/bin/grep: grep-$(GREP_VERSION).tar.xz
+       rm -rf grep-$(GREP_VERSION)
+       tar -Jxf $^
+       cd grep-$(GREP_VERSION) && \
+       PATH=$(ROOT)/fixed-gcc:$$PATH \
+       ./configure \
+           --host=riscv64-unknown-linux-gnu \
+           --prefix=/usr --libdir=/usr/lib64
+       cd grep-$(GREP_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
+       cd grep-$(GREP_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
+
+grep-$(GREP_VERSION).tar.xz:
+       rm -f $@ $@-t
+       wget -O $@-t https://ftp.gnu.org/gnu/grep/grep-$(GREP_VERSION).tar.xz
+       mv $@-t $@
+
+# Cross-compile less.
+stage3-chroot/usr/bin/less: less-$(LESS_VERSION).tar.gz
+       rm -rf less-$(LESS_VERSION)
+       tar -zxf $^
+       cd less-$(LESS_VERSION) && \
+       PATH=$(ROOT)/fixed-gcc:$$PATH \
+       LDFLAGS=-L$(ROOT)/stage3-chroot/usr/lib64 \
+       ./configure \
+           --host=riscv64-unknown-linux-gnu \
+           --prefix=/usr --libdir=/usr/lib64
+       cd less-$(LESS_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
+       cd less-$(LESS_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot
+
+less-$(LESS_VERSION).tar.gz:
+       rm -f $@ $@-t
+       wget -O $@-t http://www.greenwoodsoftware.com/less/less-$(LESS_VERSION).tar.gz
+       mv $@-t $@
+
 # Create an /init script.
 stage3-chroot/init: init.sh
        install -m 0755 $^ $@