Skip to content

24_System_Customization

Marc A. Smith edited this page Mar 3, 2017 · 2 revisions

Modifying Files on the Root File System

As you may or may not already know, changes made to anything other than the ESOS configuration (files in /etc/ and /var/lib/) do not persist across reboots. ESOS creates the root file system at boot which is a tmpfs file system, which appears as a typical mounted file system, but is stored in volatile memory instead of a persistent storage device. This means any changes made to files/directories under the '/' path will be lost across reboots. Configuration files located in the /etc/ and /var/lib/ directories are sync'd to the ESOS USB flash drive periodically (or on command), but nothing else is saved.

You can make changes to the ESOS root file system, but there is a specific method that must employed to accomplish this. ESOS uses compressed cpio archives to store the root file system images on the 'esos_root' file system. The 'esos_root' file system label is a ext2 file system located on the physical USB flash drive. This should not be confused with the '/' (root) tmpfs file system which is used on a running ESOS system.

There can be at most two images in installation "slots" on a ESOS boot drive. There is a PRIMARY slot image, and possibly a SECONDARY slot image. To make modifications to the root file system of the PRIMARY slot image, follow these steps to access the image:

mount /mnt/root
mkdir /tmp/cpio_image
archivemount /mnt/root/PRIMARY-root.cpio.bz2 /tmp/cpio_image

You'll now have the root file system image mounted live under the '/tmp/cpio_image' directory. You can then traverse this directory and edit or change any files you like. After you're finished, you must unmount the image, and ensure it unmounts cleanly otherwise your changes might not be saved:

cd ~
umount /tmp/cpio_image

At this point you should wait for archivemount to finish if you made changes to the archive -- the whole archive has to be recreated, which requires time and space. When unmounting a FUSE file system, it is not necessarily completed when the umount command returns. FUSE backgrounds the process and lets the umount command return early. Check to see if it's finished by checking your process list for the archivemount process, and when its gone, it's complete and safe to continue.

After the archivemount command no longer shows in your process list (ps ax | grep archivemount) you can then unmount the 'esos_root' file system:

umount /mnt/root

Your changes to the ESOS root file system archive should now persist. You'll need to reboot for those changes to take effect.


Modifying ESOS Source and Building

A better option may be to modify the ESOS source code directly, and then compile/build ESOS to create your own custom images. It may certainly be safer and save time, especially if you need to make custom changes to more than one system.

The process is straightforward: Fetch the ESOS sources, make your changes, and then build ESOS as normal. Checkout the 11_Building document for information on pulling down the latest ESOS sources and building ESOS.


Enabling Kernel Drivers

A common request is adding kernel drivers for a specific piece of hardware. To do this, first grab the ESOS source code as described above. Next, you'll need to find out which kernel version is being used in the source code. Look at the Makefile.in file, and towards the top of the file, you'll see the list of archives (tarballs) which are all of the packages ESOS uses.

Find the "linux-X.Y.Z.tar.xz" file and X.Y.Z denotes the kernel version used. You can then look under the 'misc/' directory the root of the ESOS sources directory for a "linux-X.Y.Z.config" file. This is the kernel configuration file.

As an example, lets say you have a Adaptec AIC-9410W SAS controller. You perform a Google search and discover this hardware uses the 'CONFIG_SCSI_AIC94XX' driver. You notice the hardware is not detected in ESOS, and you then look in the kernel configuration file (as described above) and look for a line that contains 'CONFIG_SCSI_AIC94XX' and find this:

# CONFIG_SCSI_AIC94XX is not set

This indicates the driver is not enabled in the ESOS kernel configuration file. You can enable the driver by changing the line found above to this:

CONFIG_SCSI_AIC94XX=y

You can now continue building ESOS from source as usual, following the 11_Building directions, and this will enable the 'CONFIG_SCSI_AIC94XX' driver in your ESOS kernels.