Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Linux, Current Trends 1 feedback »
Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

The following notes are but a fragment of a larger personal effort to include a Reiser4-patched Linux kernel into the Debian Installer (d-i) netboot. After uncountable stumbles, I realized that I needed to create UDEBs -- which are slimmed down versions of Debian package DEBs -- and this applied especially to creating a UDEB of the Reiser4 kernel module needed by the Debian Installer procedure. I also had to create UDEBs for Reiser4Progs utilities -- to format and check Reiser4 partitions and filesystems during a Debian installation. Notwithstanding, my Reiser4 Debian Installer effort was halted due to the non-existence of a Reiser4 patch for GNU Parted; this is needed as it is the base for Debian Installer libparted. Hence, this post is also a call to action for anyone who may be interested in creating and contributing a Reiser4 patch for GNU Parted. At least one member of the Debian Installer team is willing to include the Reiser4 patch for GNU Parted into the Debian packaging -- and I would much appreciate it!&#59;)


Update 12/18/2015: I have successfully created Initial Reiser4 'patch against git://git.sv.gnu.org/parted.git master that adds the ability to detect existing reiser4 partitions' based on Bart Hakvoort 2004 work.

Reiser4 patch against GNU Parted from git may also be obtained at Reiser4 file system for Linux OS repository -- although with a Parted 3.2 specific version label.


Mictlantecuhtli and Quetzalcoatl-Ehecatl: Making Some Sense Out of 'The Debian Way' Chaos.

First, we need to download utilities and fulfill kernel build dependencies to achieve our task:

Shell

apt-get update
apt-get install build-essential fakeroot rsync git devscripts kernel-wedge
apt-get build-dep linux

Subsequently, we download the Debian packaging:

Shell

git clone -b sid --single-branch https://anonscm.debian.org/git/kernel/linux.git

Please note that I selected to clone Debian Unstable, a.k.a. Sid. After the process finishes, you will find -- at your current filesystem location -- a linux directory with a single subdirectory, thus: linux/debian

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

I proceed to download linux upstream source and patches:

Shell

apt-get source -d linux

We see that, in addition to our linux directory, we have three(3) new files. Please make a note of Linux kernel source version (in strong italics) below:idea::

  • linux_4.2.5-1.debian.tar.xz
  • linux_4.2.5-1.dsc
  • linux_4.2.5.orig.tar.xz

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

We change into the linux directory:

Shell

cd linux

And unpack the upstream source (i.e., the recently downloaded resources) and merge it with the existing Debian Packaging, by typing the following directive:

Shell

debian/rules orig

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Now, we need to add and/or edit the following file system resources to generate the additional UDEB for the Reiser4 module that is needed for our Debian Installer (d-i):

  1. Add debian/installer/amd64/modules/amd64/reiser4-modules
  2. Add debian/installer/modules/reiser4-modules
  3. Edit /usr/share/kernel-wedge/package-list
  4. Edit debian/installer/amd64/package-list
  5. Edit debian/installer/package-list
  6. Edit debian/config/amd64/defines
  7. Make sure downloaded Linux kernel source version MATCHES the version listed in debian/changelog :idea:

We are going to follow the above numbered sequence in guidelines below: Accordingly, the first two are additional files that we will create and edit; whereas the remaining ones are edits of already existing files.

Use a text editor like vi or a vi-clone like elvis, vim, etc. to create the following file:

Shell

elvis debian/installer/amd64/modules/amd64/reiser4-modules

and write this single directive as the very first entry:
#include <reiser4-modules>

Save your newly created file and proceed to create the next one:

Shell

elvis debian/installer/modules/reiser4-modules

again as the very first entry, write this other directive: reiser4

Save your changes to this other newly created file.

Now we will edit the remaining four(4) above-listed files. Please note that next file to be edited is outside of your current filesystem location thus I use an absolute path; truly, you may also need root permission to open and modify:

Shell

elvis /usr/share/kernel-wedge/package-list

After the jfs-modules block entry, add the following Reiser4-specific lines:

Package: reiser4-modules
Depends: kernel-image, crc-modules
Priority: extra
Description: Reiser4 filesystem support
 This package contains the Reiser4 filesystem module for the kernel.

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Save your modifications to the file. And proceed to edit similar-named file but this time relative to your current filesystem location:

Shell

elvis debian/installer/amd64/package-list

Add the following two directives before the Package: fat-modules directive:
Package: reiser4-modules
Priority: standard

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Proceed to open to modify the next file:

Shell

elvis debian/installer/package-list

insert the following lines just one blank line below the Package: jfs-modules

Package: reiser4-modules
Depends: kernel-image, crc-modules
Priority: extra
Description: Reiser4 filesystem support
 This package contains the Reiser4 filesystem module for the kernel.

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

(Indeed, similar as the modification for the kernel-wedge resource). Save your file modifications.

The next edit is to turn debug to false; otherwise we will use more than 10Gb during the kernel build:

Shell

elvis debian/config/amd64/defines

Modify the default setting from true to:
debug-info: false

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

We are done with sequence of steps listed above; thus we proceed along to the next phase.

Applying Reiser4 Port To The Linux 4.2 Kernel

Shell

debian/rules debian/control

We may expect a couple of errors -- just this time -- as debian/control.md5sum has just been created for the first time:

[...]
This target is made to fail intentionally, to make sure
that it is NEVER run during the automated build. Please
ignore the following error, the debian/control file has
been generated SUCCESSFULLY.

exit 1
debian/rules:89: recipe for target 'debian/control-real' failed
make[1]: *** [debian/control-real] Error 1
make[1]: Leaving directory '/mnt/sda8-tekitl/usr/src/linux'
debian/rules:79: recipe for target 'debian/control' failed
make: *** [debian/control] Error 2

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

NOTE: If you get similar error:

make[1]: Entering directory '/usr/src/linux'
debian/bin/gencontrol.py
Traceback (most recent call last):
File "debian/bin/gencontrol.py", line 523, in <module>
Gencontrol()()
File "debian/lib/python/debian_linux/gencontrol.py", line 89, in __call__
self.do_main(packages, makefile)
File "debian/lib/python/debian_linux/gencontrol.py", line 109, in do_main
self.do_main_recurse(packages, makefile, vars, makeflags, extra)
File "debian/lib/python/debian_linux/gencontrol.py", line 123, in do_main_recurse
self.do_arch(packages, makefile, arch, vars.copy(), makeflags.copy(), extra)
File "debian/lib/python/debian_linux/gencontrol.py", line 151, in do_arch
self.do_arch_packages(packages, makefile, arch, vars, makeflags, extra)
File "debian/bin/gencontrol.py", line 181, in do_arch_packages
udeb_packages = read_control(io.TextIOWrapper(kw_proc.stdout, 'utf-8'))
File "debian/lib/python/debian_linux/utils.py", line 72, in read_control
e[last] = '\n'.join(lines)
File "debian/lib/python/debian_linux/debian.py", line 416, in __setitem__
value = cls(value)
File "debian/lib/python/debian_linux/debian.py", line 213, in __init__
short, long = value.split(u"\n", 1)
ValueError: need more than 1 value to unpack
debian/rules:89: recipe for target 'debian/control-real' failed
make[1]: *** [debian/control-real] Error 1
make[1]: Leaving directory '/usr/src/linux'
debian/rules:79: recipe for target 'debian/control' failed
make: *** [debian/control] Error 2

go back to editing 10 and 12, above, and make sure to insert a space
before directive (reprinted below for illustrative purposes):
This package contains the Reiser4 filesystem module for the kernel.
End of NOTE.

The next directive may be redundant, but apply anyhow:

Shell

fakeroot debian/rules source

Now we are ready to appy our currently available Reiser4-patch; download appropriate port version from Reiser4 file system for GNU/Linux OS
assuming we have it at our home directory, we apply the patch thus:

Shell

gzip -dc ~/reiser4-for-4.2.2.patch.gz  quilt fold

Needless to say, the procedure should end with no errors.

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Now we edit:

  • debian/config/defines &#58;&#105;&#100;&#101;&#97;&#58;

Shell

elvis -R debian/config/defines

WRITE DOWN and increase the abi directive -- in this specific case from 1 to 2 -- and save our modification.

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

&#58;&#105;&#100;&#101;&#97;&#58; Note: When we modify abi, i.e., this last resource above, we must execute command:

Shell

fakeroot debian/rules debian/control-real

It is normal to expect only one error:

[...]
This target is made to fail intentionally, to make sure
that it is NEVER run during the automated build. Please
ignore the following error, the debian/control file has
been generated SUCCESSFULLY.

exit 1
debian/rules:89: recipe for target 'debian/control-real' failed
make: *** [debian/control-real] Error 1

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

IMPORTANT! Now go back to shell command 17, edit debian/config/defines by changing the abi directive back to its original value -- in this specific case from 2 back to 1 -- and save our modification. Repeat shell command 18 above and disregard single error.

We continue by changing the configuration for our AMD64 target:

Shell

fakeroot make -f debian/rules.gen setup_amd64_none_amd64

We open the menu driven .config editor/manipulator:

Shell

make -C debian/build/build_amd64_none_amd64 menuconfig

And enable Reiser4 support for our kernel as a U/DEB module from File systems menu: M

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Totally optional but you may want to enable IBM OS/2 HPFS filesystem support &#59;&#41;
File systems -> Miscellaneous filesystems:

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Save modifications to the .config file as you exit menuconfig.

We then I build all architecture-dependent packages by running:

Shell

fakeroot debian/rules binary-arch

The procedure takes a while to complete. You may want to enjoy an oldie song by Gregory Abbott embodied in Мария Букшеванная [Maria Bukshevannaya]: Nenetl -- which means Girl in Nahuatl, Mexico's language par excellence.

...just suggesting, of course, but you might as well get busy doing some other tasks...

NOTWITHSTANDING on certain occasions it may stop in the last phase of the routine with similar error as the following:

debian/rules.real:165: recipe for target 'debian/stamps/build_amd64_none_amd64_plain' failed
make[2]: Leaving directory '/mnt/sda8-tekitl/usr/src/linux'
debian/rules.gen:25: recipe for target 'binary-arch_amd64_none_amd64_real' failed
make[1]: Leaving directory '/mnt/sda8-tekitl/usr/src/linux'
debian/rules:42: recipe for target 'binary-arch' failed

In that case, and observing the nature of the error in our logging file, we may nudge the procedure along with the following:

Shell

touch debian/stamps/build_amd64_none_amd64_plain

And then repeat the build directive:

Shell

fakeroot debian/rules binary-arch

After the procedure successfully comes to completion, you will find -- amongst the generated Debian Installer resources -- the elusive but valued additional Reiser4 UDEB:
../reiser4-modules-4.2.0-1-amd64-di_4.2.5-1_amd64.udeb

Building A Reiser4-Patched Development Linux Kernel Package 'The Debian Way'.

Huelmati [Enjoy]!


References:
1. Mictlantecuhtli & Quetzalcoatl Glyph by Princess Shadyk
2. 4.3 Building a development version of the Debian kernel package
3. Integrate fully partman-reiser4 into d-i
4. "No kernel modules were found" netboot d-i with custom reiser4 kernel.
5. Building kernel the Debian way fails
6. The elvis vi-clone (written by Steve Kirkendall)
7. Github: mbert/Elvis

DISCLAIMER&#58;&#80; although due diligence has been applied, this resource is made available for testing/evaluation purposes on an AS IS basis. The procedure only reflects my own modifications, my limited testing, and the potential user who executes the procedures assumes all risks.

Please do not hold me or Metztli Information Technology (and/or its associates) responsible if the information provided here does not achieve the desired result. The information is provided AS IS and with the hope that it may be useful to the Internet community --especially those interested in Reiser4 support on Debian Installer (d-i).

Notwithstanding, There is no implicit or explicit guarantee that the information presented here is accurate --even though due diligence was exercised during the procedure. Accordingly, if an user(s) decide to implement the procedure or shell commands described here she, he, or them, do so at her, his, or their own risk. You have been forewarned.

Contact / Help. ©2016 by Jose. Run your own website!.
Design & icons by N.Design Studio. Skin by Tender Feelings / Skin Faktory.