HOWTO Reiser4 With Gentoo-Sources

Introduction

This page is designed to help gentoo users install a custom ebuild which provides a version of the gentoo-sources kernel with reiser4 patches applied. The currently implemented version of this patchset is: Reiser4-Gentoo-Sources-2.6.14 (Genpatches patchlevel 2)

It was pointed out that we run a supposedly experimental (reiser4) filesystem on what would otherwise be a very stable patchset (gentoo-sources). The following quote seems appropriate: "We demand rigorously defined areas of doubt and uncertainty!" --Douglas Adams, "The Hitchhiker's Guide to the Galaxy"


News

The 2.6.13 release patches are no longer broken...working patches for 2.6.13 posted to namesys on 10/20/05. (ftp://ftp.namesys.com/pub/reiser4-for-2.6/2.6.13/reiser4-for-2.6.13-4.patch.gz). The ebuild below works fine when updated to reflect current versions and genpatches from the plain gentoo-sources-2.6.13-r5 release. llucas AT gladstone.uoregon.edu (10/27/05)

Here is the modified ebuild for the Gentoo's 2.6.14-r2 kernel with reiser4-2.6.14-1 patchset. agouny AT gmail.com (2005/11/15)

Community Participation rocks our world. I'm excited that people have jumped in, participating in the process, creating releases, working support in the forum - even updating the news! Way to go! - UberDumm (11/17/2005)


What is Reiser4?

The following was shamelessly ripped from the kernel menuconfig page:

Reiser4 is a filesystem that performs all filesystem operations as atomic transactions, which means that it either performs a write, or it does not, and in the event of a crash it does not partially perform it or corrupt it.

It stores files in dancing trees, which are like balanced trees but faster. It packs small files together so that they share blocks without wasting space. This means you can use it to store really small files. It also means that it saves you disk space. It avoids hassling you with anachronisms like having a maximum number of inodes, and wasting space if you use less than that number.

Reiser4 is a distinct filesystem type from reiserfs (V3). It's therefore not possible to use reiserfs file systems with reiser4. To learn more about reiser4, go to http://www.namesys.com


Genpatches info

If you want to find out about the genpatches patch series, check out their site. Additionally, information on which patches specifically are included in the current revision of the genpatches set are available here.


How do I implement Reiser4?

To implement reiser4 on a Linux system you will need the following:

  1. A Reiser4-Compatible kernel, ebuilt or otherwise.
  2. The reiser4progs package

If you want to install gentoo from scratch onto reiser4, check out Lxnay's Gentoo RR4 LiveCD HOWTO (DO NOT USE THE LXNAY CDs, they are too old and do not have backwards compatibility for newer kernels and patches) a few you can use would be, lxnay's rr4 DVD, or the conrad livecd

Alternatively you can use RIP (Recovery is Possible) bootdisc which includes latest reiser4progs, and loads entirely into ram. From there you can manually procede with a gentoo stage 1-3 install (but using the RIP environment inliu of gentoo's boot disc)... But be sure to have a r4 enabled kernel when building the kernel. Get RIP here : http://www.tux.org/pub/people/kent-robotti/looplinux/rip/


Installing The ebuild

To install reiser4-gentoo-sources, do the following: Create a local portage tree. In make.conf, make sure you've specified an overlay:

File: /etc/make.conf
PORTDIR_OVERLAY=/usr/local/portage

if it's not in there already

mkdir -p /usr/local/portage/sys-kernel/reiser4-gentoo-sources/

Copy the ebuild from the end of this page and paste it into your favorite text editor, saving the file in /usr/local/portage/sys-kernel/reiser4-gentoo-sources/

  • Note the filename at the top of the section! If you do not name it correctly, it will not merge correctly.

Digest the ebuild

ebuild /usr/local/portage/sys-kernel/reiser4-gentoo-sources/reiser4-gentoo-sources-2.6.* digest

If you want, include the symlink use flag to have it create/update the /usr/src/linux symlink for you:

echo "sys-kernel/reiser4-gentoo-sources symlink" >> /etc/portage/package.use

Now cross your fingers (optional) and emerge the ebuild!

echo "sys-kernel/reiser4-gentoo-sources" >> /etc/portage/package.keywords
emerge reiser4-gentoo-sources

Congratulations - your reiser4-compatible kernel source tree is ready to be configured & compiled. BUT - before you jump in, reiser4 has a few requirements:

  • You must use 8k stacks. 4k stacks will not work with reiser4!
  • You must enable (say Y to build it in) deflate under Cryptographic Options!
  • You must enable "Prompt for development and/or incomplete code/drivers" in the "Code maturity level" options

If you do not do that, you will not even have the option of enabling the reiser4 filesystem in the kernel config.

To configure, compile, and install the kernel, the standard process is used:

mount /boot (if you use a boot partition)
cd /usr/src/linux
make clean (failure to make clean before each kernel build can corrupt the kernel build)
make menuconfig
make && make modules_install && make install

If you need a few pointers on compiling a kernel, consider the following:

If you need some info on grub configuration, check out these handy resources:


Trouble?

There's currently a running thread at the Gentoo Forums which you may find very useful.


Resources and Credits

  • keyser_soze - THE man w/ the original 2.6.11 ebuild
    • My directions were based on his
    • I used his ebuild to help me create mine
  • the genpatches devel team
    • I used your gentoo-sources-2.6.12-r6 ebuild as a base.

Thanks.


The Ebuild Files

File: reiser4-gentoo-sources-2.6.14-r4.ebuild
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

ETYPE="sources"
K_WANT_GENPATCHES="base extras"
K_GENPATCHES_VER="5"
IUSE="ultra1"
inherit kernel-2
detect_version
detect_arch
R4V_MAJOR="14"
R4V=${R4V_MAJOR}-1
GPATCHVER=
KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"

HOMEPAGE="http://gentoo-wiki.com/HOWTO_Reiser4_With_Gentoo-Sources"
DESCRIPTION="Full sources including the gentoo patchset and the reiser4 patchset for the
${KV_MAJOR}.${KV_MINOR} kernel tree"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}
ftp://ftp.namesys.com/pub/reiser4-for-${KV_MAJOR}.${KV_MINOR}/${KV_MAJOR}.${KV_MINOR}.${R4V_MAJOR}/reiser4-for-${KV_MAJOR}.${KV_MINOR}.${R4V}.patch.gz"

UNIPATCH_LIST="${DISTDIR}/genpatches-${KV_MAJOR}.${KV_MINOR}.${R4V_MAJOR}-${K_GENPATCHES_VER}.base.tar.bz2
${DISTDIR}/genpatches-${KV_MAJOR}.${KV_MINOR}.${R4V_MAJOR}-${K_GENPATCHES_VER}.extras.tar.bz2
${DISTDIR}/reiser4-for-${KV_MAJOR}.${KV_MINOR}.${R4V}.patch.gz"


pkg_setup() {
if use sparc; then
# hme lockup hack on ultra1
use ultra1 || UNIPATCH_EXCLUDE="${UNIPATCH_EXCLUDE} 1399_sparc-U1-hme-lockup.patch"
fi
}

pkg_postinst() {
postinst_sources

echo

if [ "${ARCH}" = "sparc" ]; then
if [ x"`cat /proc/openprom/name 2>/dev/null`" \
= x"'SUNW,Ultra-1'" ]; then
einfo "For users with an Enterprise model Ultra 1 using the HME"
einfo "network interface, please emerge the kernel using the"
einfo "following command: USE=ultra1 emerge ${PN}"
fi
fi
einfo "This is experimental. Make sure you enable deflate algorithm in"
einfo "kernel encryption sub-section and make sure 8kb stacks are off in"
einfo "the kernel hacking section."
einfo "For more info on this patchset, and how to report problems, see:"
einfo "${HOMEPAGE}"
}

Please be aware that

Vladimir V. Saveliev from Namesys wrote: "Note that changes are substantial, please, be careful."

Refering to the latest 2.6.15-1 patch for reiser4. ie: Be extra careful with your sensitive data - backup.

 

File: reiser4-gentoo-sources-2.6.15-r1.ebuild
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

ETYPE="sources"
K_WANT_GENPATCHES="base extras"
K_GENPATCHES_VER="3"
IUSE="ultra1"
inherit kernel-2
detect_version
detect_arch
R4V="-1"

KEYWORDS="~alpha ~amd64 ~arm ~ppc ~sparc ~x86"

HOMEPAGE="http://gentoo-wiki.com/HOWTO_Reiser4_With_Gentoo-Sources"

DESCRIPTION="Full sources including the gentoo patchset for the
${KV_MAJOR}.${KV_MINOR} kernel tree and the reiser4 patchset from namesys"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}
ftp://ftp.namesys.com/pub/reiser4-for-${KV_MAJOR}.${KV_MINOR}/${PV}/reiser4-for-${PV}${R4V}.patch.gz"
UNIPATCH_LIST="${DISTDIR}/reiser4-for-${PV}${R4V}.patch.gz"

pkg_setup() {
if use sparc; then
# hme lockup hack on ultra1
use ultra1 || UNIPATCH_EXCLUDE="${UNIPATCH_EXCLUDE} 1399_sparc-U1-hme-lockup.patch"
fi
}

pkg_postinst() {
postinst_sources

echo

if [ "${ARCH}" = "sparc" ]; then
if [ x"`cat /proc/openprom/name 2>/dev/null`" \
= x"'SUNW,Ultra-1'" ]; then
einfo "For users with an Enterprise model Ultra 1 using the HME"
einfo "network interface, please emerge the kernel using the"
einfo "following command: USE=ultra1 emerge ${PN}"
fi
fi
ewarn "This is experimental and NOT supported by gentoo."
ewarn "Ensure you do not have 4Kb stacks on in the kernel hacking section"
ewarn "of the kernel config."
echo
einfo "For more info on this patchset, and how to report problems, see:"
einfo "${HOMEPAGE}"
}

Added by Keyser_Soze 23/01/06

 

File: reiser4-gentoo-sources-2.6.16.ebuild
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

ETYPE="sources"
K_WANT_GENPATCHES="base extras"
K_GENPATCHES_VER="1"
IUSE="ultra1"
R4V="-1"
inherit kernel-2
detect_version
detect_arch

KEYWORDS="~amd64 ~x86"
HOMEPAGE="http://gentoo-wiki.com/HOWTO_Reiser4_With_Gentoo-Sources"

DESCRIPTION="Full sources including the gentoo patchset for the
${KV_MAJOR}.${KV_MINOR} kernel tree and the reiser4 patchset from namesys"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}
ftp://ftp.namesys.com/pub/reiser4-for-${KV_MAJOR}.${KV_MINOR}/${PV}/reiser4-for-${PV}${R4V}.patch.gz"
UNIPATCH_LIST="${DISTDIR}/reiser4-for-${PV}${R4V}.patch.gz"

pkg_postinst() {
postinst_sources

echo

einfo "For more info on this patchset, see:"
einfo "${HOMEPAGE}"
}

Added by Keyser_Soze 09/04/06

 

File: reiser4-gentoo-sources-2.6.16-r2.ebuild
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

ETYPE="sources"
K_WANT_GENPATCHES="base extras"
K_GENPATCHES_VER="2"
IUSE="ultra1"
R4V="-2"
inherit kernel-2
detect_version
detect_arch

KEYWORDS="~amd64 ~x86"
HOMEPAGE="http://gentoo-wiki.com/HOWTO_Reiser4_With_Gentoo-Sources"

DESCRIPTION="Full sources including the gentoo patchset for the
${KV_MAJOR}.${KV_MINOR} kernel tree and the reiser4 patchset from namesys"
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}
ftp://ftp.namesys.com/pub/reiser4-for-${KV_MAJOR}.${KV_MINOR}/${PV}/reiser4-for-${PV}${R4V}.patch.gz"
UNIPATCH_LIST="${DISTDIR}/reiser4-for-${PV}${R4V}.patch.gz"

pkg_postinst() {
postinst_sources

echo

einfo "For more info on this patchset, see:"
einfo "${HOMEPAGE}"
}

Added by anacleto44 18/04/06


Upgrades

It may be worthy of note that as of genpatches 12-13, the genpatches level is in the name of the ebuild. For example, 2.6.12-r13 is genpatches 12-13. As of 2.6.15-r5 (and probably earlier), this is not correct - 2.6.15-r5 uses genpatches-2.6.15-8. To upgrade the ebuild, one simply needs to change the "K_GENPATCHES_V" variable to what is in the corresponding gentoo-sources ebuild. If you've used a previous version of this patchset, in order to upgrade, you need only do the following: Install the new ebuild, Digest it, and emerge it.

 

http://gentoo-wiki.com/HOWTO_Reiser4_With_Gentoo-Sources

 

install Grub support Reiser4:

emerge -C grub

echo ">=sys-boot/grub" >> /etc/portage/package.mask

wget "ftp://ftp.namesys.com/pub/reiser4progs/grub-0.97-reiser4-20050808.tar.gz"

( or new version from ftp://ftp.namesys.com/pub/reiser4progs/ )

tar xvfz grub-0.97-reiser4-20050808.tar.gz

cd grub-0.97

./configure --prefix=/usr --bindir=/bin --sbindir=/sbin

make

make install

 

install grub (on /dev/hda2):

grub

device (hd0) /dev/hda

root (hd0,1)

setup (hd0)

 

 


Performance

The fine patrons of the gentoo-wiki have collected some links on what reiser4 can get you in terms of performance. Note that independent testing seems to return different (and usually much more understandable) results than the official reiser4 page. Please, if you know of a site with reiser4 benchmarks/test results, post a link here!