Skip to main content.
Navigation:
DENX
>
DULG
>
DiskOnChip
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
DULG
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
DULG Home
BoardSelect
Manual
FAQ
Application Notes
Changes
Index
List of pages in DULG
Search
%SECTION0{name=DiskOnChip}% Using Disk On Chip "Drives" %IF{ "%HAVE_DISK_ON_CHIP%" ne true }% %X% The %BOARDNAME% board has no support for Disk On Chip! %ENDIF% 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<NOP>_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<NOP>_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. %INCLUDE{DULGData_%BOARD%.LinuxDocFormat}% 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 <emphasis>EXT2</emphasis> 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: %INCLUDE{DULGData_%BOARD%.LinuxDocPopulate}% 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=: %INCLUDE{DULGData_%BOARD%.UBootDocMisc}% 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: %INCLUDE{DULGData_%BOARD%.UBootDocInstall}% 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=: %INCLUDE{DULGData_%BOARD%.UBootDocBoot}%