The following are the steps performed for this purpose.
Download a fresh copy of Kernel 2.4.18 from http://www.kernel.org/pub/linux/kernel/v2.4.
The kernel that is downloaded from the site does not have support for the M-Systems driver so we need to add this functionality. This is done by adding a patch to the kernel.
The steps to conduct patching are as follows:
Untar the kernel source file and the M-systems TrueFFS Linux driver version 5.14. If the source code is in
.tar.gz format, use
If the source code is in
.tar.bz2 format, use
After using bunzip2, you will get a file named
linux-2.4.18.tar. Untar it using the command
Unarchiving the driver is done using the command
This results in the creation of two directories:
The TrueFFS Linux driver package contains three different folders:
Documentation: this contains a PDF document describing the various functions of TrueFFS.
dformat_5_1_4_37: this contains a utility dformat, which is used to update the firmware on the DiskOnChip (DOC) and to create low level partitions on the DOC.
doc-linux-5_1_4_20: this contains patches,
initrd scripts and other utilities.
Now apply the patch to the kernel. We will use the
linux-2_4_7-patch file that is present in
linux_binary.5_1_4/doc-linux-5_1_4_20/driver. The following commands are used for this purpose:
This will create a directory named
doc in the
The patch created the
doc directory, but did not copy the source files of the M-Systems driver, which are necessary in order to build the driver, into this directory. So execute the following command:
The patch will fail for kernels other than 2.4.18 since the source files where the patch is to be applied may be somewhat different in different kernels. The patch has been provided specifically for kernel 2.4.18.
Before moving on to Step 2, do the following:
Login as root.
Make sure that gcc version is 2.95.3 else the build will fail. Use gcc
--version to check this. If your gcc version is different compile gcc-2.95.3. Refer to http://xlife.zuarvra.net.columns/20020316 for this purpose.
Complete the following tasks for compiling the kernel:
Check for the following options:
In the “Block devices menu”, select:
M-Systems driver as module i.e. (M)
Loopback device support as built-in i.e. (*)
RAM disk support as built-in i.e. (*)
Initial RAM disk (initrd) support as built .in i.e. (*)
In the “Processor type and features menu”, select “Disable Symmetric Multiprocessor Support”.
In the “filesystem menu”, select:
Ext3 journaling file system support as built-in
DOS FAT fs support as built-ina
MSDOS fs support as built-inb
VFAT (Windows-95) fs support as built-inc
a,b,c options should be activated if you want to mount your MS Windows partition, else they can be left out. It is, however, generally recommended to use them.
An excellent resource on kernel compilation is the Kernel Rebuild Guide.
The configuration file,
linux/.config should essentially contain the following lines (only a part of the config file has been given):
# # Loadable module support # CONFIG_MODULES=y CONFIG_MODVERSIONS=y CONFIG_KMOD=y # # Processor type and features # # CONFIG_SMP is not set # # Memory Technology Devices (MTD) # # CONFIG_MTD is not set # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_MSYS_DOC=m # # File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set CONFIG_EXT3_FS=y CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set # CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set CONFIG_TMPFS=y # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y
Copy the newly created
bzImage to the
/bott directory and name it
vmlinuz-2.4.18, using this command:
lib/modules/2.4.18/kernel/drivers/block/doc.o. This is the M-Systems driver that we need to access DiskOnChip.
Now we will create block devices, which are required to access the DOC
These block devices will use the M-Systems driver that was built in Section 4.2, “Step 2: Compile the Kernel” to access the DOC. The script mknod_fl in
linux_binary.5_1_4/doc-linux-5_1_4_20/driver is used for this purpose.
We need to create the block devices with the major number of 62. For this purpose we will pass the argument 62 while creating the nodes:
This will create the following devices in
/dev/msys with major number 62:
fla...fla4 flb...flb4 flc...flc4 fld...fld4
In order to have the DiskOnChip recognized by Linux OS, we need to insert the DOC driver module into the kernel. Since the currently running kernel doesn't have support for the M-Systems Driver, we need to boot into new kernel we just compiled in Section 4.2, “Step 2: Compile the Kernel”.
For this purpose we need to add the following entries in the
title Debian GNU/Linux,Kernel 2.4.18 root (hd0,7) kernel /boot/vmlinuz-2.4.18 root=/dev/hda8 safedefault boot
Where (hd0,7) is the partition holding the kernel image
/dev/hda8 is the partition holding the root filesystem. These partitions may vary from one system to another. Now reboot and choose the kernel 2.4.18 option (the kernel that has been compiled in Step 2) in the grub menu to boot into the new kernel.
The M-Systems driver by default gets loaded with major number 100, but our newly created nodes (see Section 4.3, “Step 3: Create Nodes”) have a major number 62. Therefore we need to insert this module with a major number 62. This can be done in either of two ways:
While inserting the module using insmod also mention the major number for the module which needs to be assigned to it otherwise it will take the default major number of 100:
Add the following line to
options doc major=62
Then use modprobe
doc to insert the modules.
Check for the correct loading of the module using the lsmod command without options.
Before we can start using DiskOnChip we need to create a filesystem on it. We will create an ext2 filesystem since it is small in size.
This involves a hidden step of making partitions on the DOC using fdisk. The actual steps are as follows:
This command will ask to create partitions. Create a primary partition number 1 with start cylinder as 1 and final cylinder as 1002.
Check the partition table, which should look like this:
Device Boot Start End Blocks ID System /dev/msys/fla1 1 1002 255984 83 Linux
Make the filesystem on
/dev/msys/fla1 with the command
fla1 is the first primary partition on the DOC. (We have created only one partition in order to avoid unnecessary complexity.)
Create a new mount point for the DiskOnChip in the
Mount the DOC partition on the newly created directory:
You will now be able to read and write to the DOC as an additional storage drive.
When you reboot your system, make the DOC available by inserting the driver into the kernel (see Section 4.5, “Step 5: Insert M-Systems Driver/Module in the new Kernel”) and mounting the device.