DULG

Topic UsingPCCard not in WebOrder Using PC Card "disks" with U-Boot and Linux

U-Boot provides only basic functionality to access PC Card based
"disks": you can print the partition table and read and write blocks
(addressed by absolute block number), but there is no support to
create new partitions or to read files from any type of filesystem.

[Such features could be easily added as U-Boot extensions aka
"standalone programs", but so far it has not been implemented yet.]

As usual, you can get some information about the available IDE
commands using the help command in U-Boot:

That means you will have to partition the "disk" on your host system;
U-Boot can be configured for DOS and MacOS? type partition tables.
Since U-Boot cannot read files from a filesystem you should create
one (or more) small partitions (maybe 1 MB or so) if you want to boot
from the "disk".

For example on a 128 MB CompactFlash card we could create the
following partiton table under Linux:

Here we have two small boot partitions (/dev/hda1 and /dev/hda2, 2
MB each), one big partition to hold a filesystem (/dev/hda3, 99 MB),
and a swap partition (/dev/hda4, 22 MB). We also initialized
/dev/hda4 as swap space.

This requires a little more explanation: as you can see from the
output of the help ide command, the
write subcommand takes 3 arguments: a memory
address from where the data are read, an (absolute) block number on
the disk where the writing starts, and a number of disk blocks.

Since U-Boot expects all input in hex notation we have to perform
some calculation: partition 1 starts at block (or sector) number 32,
which is 0x20; partition 2 starts at block number 4352 = 0x1100.

We used a block count of 0x800 = 2048 in both cases - this means we
wrote 2048 block of 512 bytes each, or a 1024 kB - much more than the
actual size of the LInux kernel image - but the partition is big
enough and we are on the safe side, so we didn't bother to calculate
the exact block count.

To boot from a disk you can use the diskboot command:

=> help diskboot
diskboot loadAddr dev:part

The diskboot command (or short disk) expects a load address in
RAM, and a combination of device and partition numbers, separated by a
colon. It then reads the image from disk and stores it in memory. We
can now boot it using the bootm command [to automatically boot the
image define the U-Boot environment autostart with the value =yes=].

We can use the same method that we used to store a Linux kernel image
to a disk partition to load a filesystem image into another partiton
- as long as the image fits into physical RAM - but usually it's
easier to initialize the filesystem either on the host system
(swapping the PC Card between host and target is easy enough), or you
can use the configuration with root filesystem over NFS to populate
the filesystem on the target.

You only have to set the bootargs variable to boot
Linux with root filesystem on disk, for instance: