Topic DiskOnChip not in WebOrder Using Disk On Chip "Drives"
Before you can use a new, uninitialized
Disk-On-Chip (DOC) flash disk, you must
initialize it. In this process you can reserve a certain area of the
disk for a binary image, and create normal partitions and filesystems
on the remaining space - like you would do on a harddisk drive.
The separate binary image partition is visible from U-Boot, but
cannot (easily) be accessed from within Linux. Such a binary
partition is intended to hold boot images - U-Boot can use it to
load a Linux kernel image, so we recommend to create such a partition
if you intend to boot from the DOC drive.
First you have to make sure that no conflicting data is present on
the DOC drive. Under Linux, the
eraseall command
can be used to completely erase the whole drive. Please note that
eraseall operates on the
MTD character device.
In the second step the
nftl_format command is used
to write the necessary administrative information and (optionally) to
reserve a certain amount of the DOC drive as binary partition - the
size is given as third argument to the
nftl_format
command.
The next step is to create standard partitions on the DOC drive; as
with normal harddisk drives the
fdisk command is
called for this purpose. In most cases you will create only a single
(primary) partition on the DOC drive.
Note: Included topic
DULGData_canyonlands.LinuxDocFormat? does not exist yet
Now we have to create a filesystem on the DOC partition, and populate
it with the files necessary for a Linux root filesystem. We use the
mke2fs command to create a standard
EXT2 Linux filesystem on the device - we reserve
no space ro the root user here (Option "-m0") as this makes little
sense in an embedded system.
We use a trick here to populate the filesystem: we use the contents
of the known-to-work ramdisk image from DENX'
SELF
package: first we use
tftp to download the image
from our
TFTP server, then we skip the 64 bytes U-Boot header with a
dd command with the appropriate options and
uncompress the image with
gunzip, writing the
output into one of the Linux ramdisk devices
(
/dev/ram1). Then we mount both the ramdisk and
the DOC drive, and copy the contents with a combination of
find and
cpio commands:
Note: Included topic
DULGData_canyonlands.LinuxDocPopulate? does not exist yet
After unmounting the filesystems (don't forget this!), we can reboot
the system and verify in U-Boot that our new format is present. This
can be done with the
doc info:
Note: Included topic
DULGData_canyonlands.UBootDocMisc? does not exist yet
Now we are ready to store a Linux kernel image in the binary
partition of the DOC drive. First we make sure that the binary
partition is empty using the
doc erase command,
then we
TFTP a kernel image from the
TFTP server, and store it on the
DOC drive using the
doc write command.
For our convenience later we also define a new environment variable
"docargs" which sets kernel boot arguments to mount the root
filesystem from the DOC drive, and save it to the persistent storage:
Note: Included topic
DULGData_canyonlands.UBootDocInstall? does not exist yet
Finally, we demonstrate how to boot from the DOC drive: with
docboot we load the Linux kernel drom the DOC
device, then we initialize the
bootargs
environment variable by running the commands stored in the "docargs"
(set root device) and "addip" (append network configuration)
variables, before we boot the kernel with
bootm:
Note: Included topic
DULGData_canyonlands.UBootDocBoot? does not exist yet