+# Cross-compile util-linux.
+# XXX Be nice to fix ncurses/tinfo support which in theory should work.
+stage3-chroot/usr/bin/mount: util-linux-$(UTIL_LINUX_VERSION).tar.xz
+ rm -rf util-linux-$(UTIL_LINUX_VERSION)
+ tar -Jxf $^
+ cd util-linux-$(UTIL_LINUX_VERSION) && \
+ PATH=$(ROOT)/fixed-gcc:$$PATH \
+ ./configure \
+ --host=riscv64-unknown-linux-gnu \
+ --prefix=/usr --libdir=/usr/lib64 \
+ --without-python \
+ --without-tinfo \
+ --without-ncurses \
+ --without-systemd \
+ --disable-makeinstall-chown
+ cd util-linux-$(UTIL_LINUX_VERSION) && PATH=$(ROOT)/fixed-gcc:$$PATH make
+# libtool fucks something up here, ignore the failure and continue.
+ -cd util-linux-$(UTIL_LINUX_VERSION) && make install DESTDIR=$(ROOT)/stage3-chroot -j1 -k V=1
+
+util-linux-$(UTIL_LINUX_VERSION).tar.xz:
+ rm -f $@ $@-t
+ wget -O $@-t ftp://ftp.kernel.org/pub/linux/utils/util-linux/v$(UTIL_LINUX_VERSION)/util-linux-$(UTIL_LINUX_VERSION).tar.xz
+ mv $@-t $@
+