Configuring the Kernel to Support RAM Disks in LinuxLink Classic

To create a kernel that uses an initial RAM disk, the kernel must be configured to support RAM disks in general, and an initial RAM disk in particular. To include the initial RAM disk in the compiled kernel image, you will also need to build the initrd image and recompile the kernel.

Note

All TimeSys reference distribution kernels are preconfigured to support RAM disks, so if you are using a distribution from TimeSys, you do not have to set these values.

To configure the kernel to support initial RAM disks:

  1. On your host system, start the kernel configuration utility of your choice. If you are using TimeStorm, do this by right-clicking on your kernel project in the Navigator view and selecting Configure.
  2. Under Block devices, enable the RAM disk support option. This sets CONFIG_BLK_DEV_RAM=y in the kernel configuration file.
  3. Depending on yuor kernel version, do one of the following:
  • 2.6.17 and later kernels: Under Block devices, enable the Initial RAM filesystem and RAM disk (initramfs/initrd) support option.
  • 2.6.16 and earlier kernels: Under Block device drivers, enable the Initial RAM disk (initrd) support option.

This sets CONFIG_BLK_DEV_INITRD=y in the kernel configuration file.

  • Depending on the amount of memory available on your target hardware and the size of the RAM disk you plan to create, you might also want to modify the Default RAM disk size option. This sets CONFIG_BLK_DEV_RAM_SIZE=<n_KBytes> in the kernel configuration file. The size can be overridden on the kernel command line (for example, ramdisk_size=16384).
  • To use a loopback device, loopback filesystem support must be compiled into the kernel (or be available as a loadable kernel module) on the Linux system on which you are building the initrd. If the losetup command fails, make sure that the Loopback device support option under Block devices is enabled. This sets CONFIG_BLK_DEV_LOOP=y in your kernel configuration file.
  • If you want to configure only part of your RAM as a block device, enable RAM disk support and set the options for the RAM disk. These options include the number, size, and block size of the RAM disk. Refer to the losetup method for creating an ext2 filesystem image for more information about these options when used with ext2.
  • If you are creating an initramfs, you can specify a cpio archive or a list of directories that contain the filesystem, and will be used when including the filesystem in the kernel. This option is included as Initramfs source file(s) under General setup. The file Documentation/early-userspace/README contains more information about this option.

  • For more information, refer to the following kernel source documentation, which can be found in the kernel of any TimeSys reference distribution:

    • Documentation/ramdisk.txt
    • Documentation/initrd.txt
    • Documentation/early-userspace/README

    The Linux Kernel Configuration Archive, maintained by Jason Wies, is also a valuable resource for kernel configuration options.