5. Build A JavaStation-Ready FileSystem

This chapter describes how one constructs a filesystem suitable for use on the Linux-running JavaStations .

5.1. Preparing Yourself to Build Your Own Filesystem

Building a filesystem for use with the JavaStations is a time-consuming, but rewarding task for those who undertake it. You will learn more about library dependencies than you ever thought you could, all the time while trying to keep the overall image size as small as possible.

WARNING: This is not an easy task. Creating a lasting filesystem is not for novices. If you seriously consider undertaking this step, prepare to budget a bit of time to get things just right, particularly if you plan to make an embedded-root filesystem which fits in the 8MB limit. You have now been properly warned.

There are two common approaches one can take when rolling a new JavaStation-ready filesystem.

  1. Start with an established distribution's filesystem and whittle down to the core.

  2. Start with an established distribution's "rescue disk" filesystem and add desired functionality.

Which path you take, of course, is entirely up to you. The "rescue disk" build procedure seems to work best though, as more base commands in a rescue disk are statically linked, increasing the starting image size but causing less initial library headaches. Commands included on a rescue disk also happen to be bare-bones, with many extraneous options not compiled in.

Obviously when building a filesystem in the context of the JavaStation, you will be basing off of an existing Linux/SPARC filesystem. The filesystems that come with the RedHat, SuSE or Debian distributions are good starting points.

Warning

In the future, you will also need to make sure you base off a filesystem built with compiled 32-bit mode executables, as a 64-bit userland project is presently in progress for 64-bit SPARC Linux kernels. As of Oct. 2001, this is still a ways away, but it is being mentioned now for the future.

5.2. Contents of the "/etc/fstab" File

The configuration lines placed into "/etc/fstab" depend on whether you will be using the "NFS-Root" or "Embedded-Root" filesystem configuration.

5.2.1. "NFS-Root" Filesystem fstab

Here is an example of an "/etc/fstab" for an "NFS-Root" boot option.


###
#
your.nfs.server:/path/to/filesystem  /  nfs defaults,rsize=8192,wsize=8192 1 1
#
none                    /proc                   proc    defaults        0 0
###

5.2.2. "Embedded-Root" Filesystem fstab

Here is an example of an "/etc/fstab" for an "Embedded-Root" boot option.


###
#
/dev/ram /     ext2  defaults
#
/proc    /proc    proc  defaults
###

5.3. The "Embedded-Root" Image Creation Procedure

Prepping up the "Embedded-Root" boot image requires a number of extra steps. Due to these extra steps, the "NFS-Root" filesystem option is recommended for beginners to Linux on the JavaStation. You might also try the samples pointed to in this document. Should you still wish to build and embedded image on your own, this section outlines the basic instructions.

Creating the "Embedded-Root" boot image is a 5-Step Procedure:

  1. Prototype Your Filesystem

    This whole chapter deals with rolling your own filesystem. In this step, it is assumed you create your own filesystem, perhaps by prototyping one on a working "NFS-Root" filesystem configuration.

    One thing to keep in mind is that unlike your "NFS-Root" filesystem, the "Embedded-Root" filesystem must fit within the confines of your allocated RAMdisk, generally 4-16 MB. Your maximum size is dependant on the setting of the RAMdisk driver.

  2. Create an Empty File for Your FileSystem

    You now need to create a file-based filesystem "container". This is just a file that is the size of your RAMdisk.

    To create this, try the dd command:

    
dd if=/dev/zero of=./fs_test.img bs=1k count=8000 
    

    Using this example, you now should have an 8 MB file named "fs_test.img". Note: Be sure the count you use matches the RAMdisk size you allocated for in the kernel's RAMdisk driver!

  3. Format your Filesystem "Container"

    Now that you have a "container" for your filesystem, it is time to format it and place a bare filesystem on it.

    In our kernel phase, we added in support for the ext2 filesystem. We'll now format our "container" with this filesystem type.

    
mkfs.ext2 ./fs_test.img
    

    Ignore any warnings about the file not being a block device, and proceed anyway. This is an expected warning message.

  4. Mount the Filesystem "Container" and Write to It

    Now that you have your filesystem container, you can mount it and load your prototyped filesystem on it.

    To mount the container, use the kernel loopback device. Make sure your server's kernel has loopback support enabled and issue a:

    
mount -o loop ./fs_test.img /mnt
    

    Copy your files to the filesystem, and make sure "/etc/fstab " has the RAMdisk entries as described elsewhere in this document.

    To avoid symbolic links being changed into actual copies of files, use a copy tool like "tar" or "cpio" instead of a "cp".

  5. Unmount and Compress the Root Filesystem

    Unmount the root filesystem you just created.

    
umount /mnt
    

    Compress the filesystem file with maximum "gzip" compression levels.

    
gzip -v9 ./fs_test.img
    

    You should now have "fs_test.img.gz" file.

  6. Hook the Root-Filesystem Onto the Back of Your Kernel Image

    Now you must append the filesystem image onto your kernel.

    You do this with a utility program called "piggyback". The piggyback program takes care of the task of appending the two and letting the kernel know where both it and the filesystem begins and ends.

    The "piggyback" program is found in your kernel source tree under <LINUXROOT>/arch/sparc/boot. It might also be found on your favorite ftp.kernel.org site.

    For piggyback to work, it needs your AOUT format kernel image, the System.map file from your kernel source root directory, and the compressed root-filesystem you just created.

    We put it all together with a:

    
piggyback vmlinux.aout System.map fs_test.img.gz
    

    Be sure to backup your kernel image first, as piggyback used the same "vmlinux.aout" filename for output. Check the filesize of your "vmlinux.aout" file after giving this command and you can verify the filesystem has indeed been appended.

Congratulations! You've created an "Embedded-Root" kernel/filesystem boot image.

5.4. Sample FileSystems

Here are some sample filesystems for you to start with. They have been contributed by various JavaStation users.

Warning: Some of these filesystem images may be considered out of date, and should be avoided in a production environment. It is up to you to decide how much of a liability you feel running them holds. The document author and filesystem contributors cannot be held liable for any damage caused by the use of these files. They are provided with absolutely no warranties.

5.4.1. jsroot_varol_19991221

filesystem (md5sum 450669bc5f3f8a4006fdc75471c0454b): http://dubinski-family.org/~jshowto/Files/filesystems/jsroot_varol/jsroot_varol_19991221.tar.bz2

Description:

This image, created by Varol Kapton , was based on RedHat 6/SPARC. It has the Xfree 3.3.5 framebuffer server dated 19990823, but only works with Krups. If you are working with a Mr. Coffee unit, you must substitute the other X server discussed later in this HOWTO.

As the network settings included are configured for Varol's network, you must first mount this image, and edit /etc/hosts and /etc/resolv.conf accordingly.

Confirmed OK: YES

Good for Mr. Coffee: YES

Good for Krups: NO

Good for Espresso: NO

5.5. Sample X Servers

One of the most frequently asked questions users have is where to get an X server from. Here are some sample X servers for you to start with. They have been contributed by various JavaStation users.

Warning: Some of these files may be considered out of date, and should be avoided in a production environment. It is up to you to decide how much of a liability you feel running them holds. The document author and filesystem contributors cannot be held liable for any damage caused by the use of these files. They are provided with absolutely no warranties.

5.5.1. XF86_FBDev_3.3.3.1_19990104

X server (md5sum 88b49bbbfa1c36a5049b62b44c54ed81): http://dubinski-family.org/~jshowto/Files/xfree/XF86_FBDev_3.3.3.1_19990104.bz2

XF86Config file (md5sum d9fa291efbd178812b3bd253dffb1893): http://dubinski-family.org/~jshowto/Files/xfree/XF86Config_FBDev_3.3.3.1_19990104.txt

Description:

This is a server for XFree 3.3.3.1 with support for the framebuffers of Mr. Coffee and Krups.

Confirmed OK: YES

Good for Mr. Coffee: YES

Good for Krups: YES

Good for Espresso: NO

5.6. Outside Sample Filesystems

Of course, other filesystems and tools exist outside this document, and have been used by JavaStation users. Here are a few files that were reported on the sparclinux mailing list as having been used.

  1. http://busybox.lineo.com (a single executable which has dozens of common unix tool functions built in)

  2. http://www.ultralinux.org/js (Jim Mintha's filesystems)

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:31