From cf55e1b176bd9e718b4530567619f89f27fd10ca Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 9 Aug 2016 13:32:19 +0100 Subject: [PATCH] Add file / libmagic to stage3 chroot. --- .gitignore | 1 + Makefile | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.gitignore b/.gitignore index 3fa44a0..dd70165 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ stamp-* /bash-4.3/ /coreutils-8.25/ +/file-5.25/ /gmp-6.1.1/ /gzip-1.8/ /mpc-1.0.3/ diff --git a/Makefile b/Makefile index 2852a39..30b2c83 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,9 @@ UTIL_LINUX_VERSION = 2.28 TAR_VERSION = 1.29 GZIP_VERSION = 1.8 ZLIB_VERSION = 1.2.8 +# Needs to match the installed (on host) version, otherwise: +# "Cannot use the installed version of file (xx) to cross-compile file yy" +FILE_VERSION = 5.25 all: stage1 stage2 stage3 stage4 @@ -262,6 +265,7 @@ stage3: stage3-kernel/linux-$(KERNEL_VERSION)/vmlinux \ stage3-chroot/usr/bin/tar \ stage3-chroot/usr/bin/gzip \ stage3-chroot/usr/lib64/libz.so \ + stage3-chroot/usr/bin/file \ stage3-chroot/init \ stage3-disk.img @@ -549,6 +553,25 @@ zlib-$(ZLIB_VERSION).tar.gz: wget -O $@-t http://zlib.net/zlib-$(ZLIB_VERSION).tar.gz mv $@-t $@ +# Cross-compile file/libmagic. +stage3-chroot/usr/bin/file: file-$(FILE_VERSION).tar.gz + rm -rf file-$(FILE_VERSION) + tar -zxf $^ + cd file-$(FILE_VERSION) && \ + PATH=$(ROOT)/fixed-gcc:$$PATH \ + LDFLAGS=-L/home/rjones/d/fedora-riscv/stage3-chroot/usr/lib64 \ + ./configure \ + --host=riscv64-unknown-linux-gnu \ + --prefix=/usr --libdir=/usr/lib64 \ + --disable-static --enable-shared + cd file-$(FILE_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make V=1 + cd file-$(FILE_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot + +file-$(FILE_VERSION).tar.gz: + rm -f $@ $@-t + wget -O $@-t ftp://ftp.astron.com/pub/file/file-$(FILE_VERSION).tar.gz + mv $@-t $@ + # Create an /init script. stage3-chroot/init: init.sh install -m 0755 $^ $@ -- 1.8.3.1