Skip to contentSkip to conversation

USB booting...

U-Boot-Users Neil Bryan 2 participants 2 messages Jul 6, 2005

lore
Share & tools
lore

Neil Bryan

author
#0 lore raw

I am attempting to boot Linux on a target platform using a USB mass storage device (flash disk) to hold the kernel and the root filesystem.

I thought it may be a good idea to replicate the same steps used when booting from a tftp server, i.e. I copy the root filesystem (using an initrd image) to an address in RAM, then copy the kernel to a different address in RAM. Finally bootm with the start address of the kernel. Bootargs will be set during this process.

So I created two partitions on the USB flash disk, partion 1 holds the kernel image and partition 2 holds the initrd image.

The partition table looks like this:

Disk /dev/sdb: 32 MB, 32768000 bytes
2 heads, 32 sectors/track, 1000 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1       154      4912   83  Linux
/dev/sdb2           155       308      4928   83  Linux

My file sizes are:

initrd: 1203800 bytes.
uImage: 2285056 bytes.

The command I want to use to copy the initrd is:

usb read 20800000 x y.

Where 20800000 is the address for the initrd to be copied to, x will be the block-offest to the start of partition 2 and y will be the size in blocks of the initrd image.

Now I need to calculate the block-size based on cylinders, heads, units etc.

My questions are, am I making this too complex, is there an easier way to achieve the same result of booting using a USB flash disk with seperate kernel/initrd images?

Appologies for the long-winded pre-amble, but I don't know how to ask a question like this without describing the problem.

Thanks for any insight,

Neil.

#1 lore raw
Quoted 10 lines · In message <1120664027.6064.99.camel@daroca> you wrote:

I am attempting to boot Linux on a target platform using a USB mass storage device (flash disk) to hold the kernel and the root filesystem.

I thought it may be a good idea to replicate the same steps used when booting from a tftp server, i.e. I copy the root filesystem (using an initrd image) to an address in RAM, then copy the kernel to a different address in RAM. Finally bootm with the start address of the kernel. Bootargs will be set during this process.

You can do it this way, but it is a waste of system RAM. Why don't you use a (read-only) file system mounted on the USB device?

Quoted 2 lines

So I created two partitions on the USB flash disk, partion 1 holds the kernel image and partition 2 holds the initrd image.

This is possible, but seems overly complicated to me. For alternative approaches please see the DULG, especially
http://www.denx.de/twiki/bin/view/DULG/RootFileSystemDesignAndBuilding

Quoted 8 lines

usb read 20800000 x y.

Where 20800000 is the address for the initrd to be copied to, x will be the block-offest to the start of partition 2 and y will be the size in blocks of the initrd image.

Now I need to calculate the block-size based on cylinders, heads, units etc.

No, you don't. The block size is always a constant - 512 bytes per block.

Quoted 3 lines

My questions are, am I making this too complex, is there an easier way to achieve the same result of booting using a USB flash disk with seperate kernel/initrd images?

Yes, there is. Just read the manual.

Quoted 2 lines

Appologies for the long-winded pre-amble, but I don't know how to ask a question like this without describing the problem.

RTFM first?

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
1000 pains                                              = 1 Megahertz