* [U-Boot-Users] booting from USB
@ 2005-02-01 16:55 Jonas Dietsche
2005-02-01 18:38 ` Wolfgang Denk
0 siblings, 1 reply; 9+ messages in thread
From: Jonas Dietsche @ 2005-02-01 16:55 UTC (permalink / raw)
To: u-boot
Hello List,
I'm interested in booting a linux image from a USB memory stick.
I configured u-boot (version 1.1.2) to provide me with the usb commands.
I try to load the image with the following commands.
usb rest
usb scan
usbboot 10000 0:1
The usbboot command ends up with
Loading from USB device 0, partition 1: Name: usbda1
Type: U-Boot
First Block: 32, # of blocks: 255456, Block Size: 512
** Bad Magic Number **
The image is the same I download with the tftp command. Should I create
the image in a different way?
Thanks for your hints.
Jonas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-01 16:55 Jonas Dietsche
@ 2005-02-01 18:38 ` Wolfgang Denk
2005-02-02 15:15 ` Jonas Dietsche
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2005-02-01 18:38 UTC (permalink / raw)
To: u-boot
Hallo Jonas,
in message <41FFB499.1060804@fsforth.de> you wrote:
>
> I'm interested in booting a linux image from a USB memory stick.
> I configured u-boot (version 1.1.2) to provide me with the usb commands.
> I try to load the image with the following commands.
> usb rest
rest or reset?
> usb scan
> usbboot 10000 0:1
>
> The usbboot command ends up with
> Loading from USB device 0, partition 1: Name: usbda1
> Type: U-Boot
> First Block: 32, # of blocks: 255456, Block Size: 512
>
> ** Bad Magic Number **
Ummm... the number of blocks is obviously bogus - 255456 blocks is
124 MB; I don't think that's the real size of your kernel image.
Probably you made some error when storing the image to the USB stick.
> The image is the same I download with the tftp command. Should I create
> the image in a different way?
How did you write the image to the USB stick?
You can also try looking at the image data, something like this:
=> tft 100000 uImage
=> md 100000
=> usb read 200000 20 10
=> md 200000
Do you see any difference?
Viele Gr??e,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It may be bad manners to talk with your mouth full, but it isn't too
good either if you speak when your head is empty.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-01 18:38 ` Wolfgang Denk
@ 2005-02-02 15:15 ` Jonas Dietsche
2005-02-02 17:10 ` Wolfgang Denk
0 siblings, 1 reply; 9+ messages in thread
From: Jonas Dietsche @ 2005-02-02 15:15 UTC (permalink / raw)
To: u-boot
Hallo Wolfgang,
>>I'm interested in booting a linux image from a USB memory stick.
>>I configured u-boot (version 1.1.2) to provide me with the usb commands.
>>I try to load the image with the following commands.
>>usb rest
>
>
> rest or reset?
reset, of course. Just a typo ;-)
>>Loading from USB device 0, partition 1: Name: usbda1
>> Type: U-Boot
>>First Block: 32, # of blocks: 255456, Block Size: 512
>>
>>** Bad Magic Number **
>
>
> Ummm... the number of blocks is obviously bogus - 255456 blocks is
> 124 MB; I don't think that's the real size of your kernel image.
> Probably you made some error when storing the image to the USB stick.
Just played around with my usb stick and reduced the size of the first
partition. When I now try the usbboot command the number of blocks is
exact the size of the partition.
Is there a special way of creating the image or can I use the same I use
with the tftp command?
> How did you write the image to the USB stick?
I tried to follow DULG -booting from IDE, Compact Flash. Maybe it was
not a good idea...
Copied it from my host to the stick. This is not the proper way?
Can you tell me which fs to use? I tried it with dos.
Mit freundlichem Gru?,
Jonas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-02 15:15 ` Jonas Dietsche
@ 2005-02-02 17:10 ` Wolfgang Denk
2005-02-03 11:27 ` Jonas Dietsche
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2005-02-02 17:10 UTC (permalink / raw)
To: u-boot
Hallo Jonas,
in message <4200EE8D.3020901@fsforth.de> you wrote:
>
> Just played around with my usb stick and reduced the size of the first
> partition. When I now try the usbboot command the number of blocks is
> exact the size of the partition.
This doesn't make sense.
> Is there a special way of creating the image or can I use the same I use
> with the tftp command?
You use the very same image.
Does the "usbboot" command print the image header? Does the data look
correct, especially the image size?
> > How did you write the image to the USB stick?
> I tried to follow DULG -booting from IDE, Compact Flash. Maybe it was
> not a good idea...
Actually this should work.
> Copied it from my host to the stick. This is not the proper way?
It is.
> Can you tell me which fs to use? I tried it with dos.
DOS, VFAT and ext2 have been tested by myself; never tried reiser
yet.
Try adding some debug prints to "common/cmd_usb.c"; like here:
396 hdr = (image_header_t *)addr;
397
398 if (hdr->ih_magic == IH_MAGIC) {
399 print_image_hdr (hdr);
400 cnt = (hdr->ih_size + sizeof(image_header_t));
401 cnt += info.blksz - 1;
402 cnt /= info.blksz;
403 cnt -= 1;
404 } else {
405 printf("\n** Bad Magic Number **\n");
406 return 1;
407 }
Check if the value of "cnt" looks sane to you. Verify that
hdr->ih_size and info.blksz hold correct values.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I've seen it. It's rubbish." - Marvin the Paranoid Android
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-02 17:10 ` Wolfgang Denk
@ 2005-02-03 11:27 ` Jonas Dietsche
2005-02-03 12:02 ` Wolfgang Denk
0 siblings, 1 reply; 9+ messages in thread
From: Jonas Dietsche @ 2005-02-03 11:27 UTC (permalink / raw)
To: u-boot
Hallo Wolfgang,
>>Just played around with my usb stick and reduced the size of the first
>>partition. When I now try the usbboot command the number of blocks is
>>exact the size of the partition.
>
>
> This doesn't make sense.
>
>
I did the following steps:
A9M9750 # usb part
print_part of 0
Partition Map for USB device 0 -- Partition Type: DOS
Partition Start Sector Num Sectors Type
1 1 10239 83
2 10240 10240 83
3 20480 235520 83
A9M9750 # usbboot 10000 0:1
Loading from USB device 0, partition 1: Name: usbda1
Type: U-Boot
First Block: 1, # of blocks: 10239, Block Size: 512
** Bad Magic Number **
Ok, let me see if the image on the stick is corrupt. I loaded it with
the fatload command.
A9M9750 # fatload usb 0:1 10000 uImage
reading uImage
...............................................................................................................
1144120 bytes read
A9M9750 # bootm
## Booting image at 00010000 ...
Image Name: Linux-2.6.10-fs1
Created: 2005-02-02 13:23:01 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1144056 Bytes = 1.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
And it works. Nice. But whats going/I'm doing wrong with the usbboot
command?
> Does the "usbboot" command print the image header? Does the data look
> correct, especially the image size?
Not at all. So
> Try adding some debug prints to "common/cmd_usb.c"; like here:
>
> 396 hdr = (image_header_t *)addr;
> 397
> 398 if (hdr->ih_magic == IH_MAGIC) {
> 399 print_image_hdr (hdr);
> 400 cnt = (hdr->ih_size + sizeof(image_header_t));
> 401 cnt += info.blksz - 1;
> 402 cnt /= info.blksz;
> 403 cnt -= 1;
> 404 } else {
> 405 printf("\n** Bad Magic Number **\n");
> 406 return 1;
> 407 }
I put the print_image_hdr() before the if clause, but as expected I only
get garbage.
Image Name:
Created: 2024-06-19 15:57:52 UTC
Image Type: Invalid CPU Invalid OS Invalid Image (uncompressed)
Data Size: 33816832 Bytes = 32.3 MB
Load Address: 020002fe
Entry Point: 27f80800
Gru?,
Jonas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-03 11:27 ` Jonas Dietsche
@ 2005-02-03 12:02 ` Wolfgang Denk
2005-02-03 15:12 ` Jonas Dietsche
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2005-02-03 12:02 UTC (permalink / raw)
To: u-boot
Hallo Jonas,
in message <42020ABB.2010106@fsforth.de> you wrote:
>
> A9M9750 # usbboot 10000 0:1
>
> Loading from USB device 0, partition 1: Name: usbda1
> Type: U-Boot
> First Block: 1, # of blocks: 10239, Block Size: 512
>
> ** Bad Magic Number **
>
> Ok, let me see if the image on the stick is corrupt. I loaded it with
> the fatload command.
fatload? FATLOAD??? You mean you have a FAT filesystem on that partition???
Than why do you try using usbboot? usbboot like diskboot try to load
an U-Boot image from a RAW partition, i. e. without any filesystem on
it.
> A9M9750 # fatload usb 0:1 10000 uImage
If you have a FAT filesystem you should use fatload to load your image.
If you have an ext2 filesystem you should use ext2load to load your image.
If you have a foo filesystem you should use fooload to load your image.
> And it works. Nice. But whats going/I'm doing wrong with the usbboot
> command?
You used the command without having a valid image IN THE RAW PARTITION.
The "First Block: 1, # of blocks: 10239, Block Size: 512" message
should not be printed at all; it is actually debug code only. I'll
change this in the code. I'll also make the code verify the header
checksum - just relying on the magic number is probably a bit too
weak.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The high cost of living hasn't affected its popularity.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-03 12:02 ` Wolfgang Denk
@ 2005-02-03 15:12 ` Jonas Dietsche
2005-02-03 15:24 ` Wolfgang Denk
0 siblings, 1 reply; 9+ messages in thread
From: Jonas Dietsche @ 2005-02-03 15:12 UTC (permalink / raw)
To: u-boot
Hallo Wolfgang,
>>A9M9750 # usbboot 10000 0:1
>>
>>Loading from USB device 0, partition 1: Name: usbda1
>> Type: U-Boot
>>First Block: 1, # of blocks: 10239, Block Size: 512
>>
>>** Bad Magic Number **
>>
>>Ok, let me see if the image on the stick is corrupt. I loaded it with
>>the fatload command.
>
>
> fatload? FATLOAD??? You mean you have a FAT filesystem on that partition???
:-O hope you havn't got a heart attack...
> Than why do you try using usbboot? usbboot like diskboot try to load
> an U-Boot image from a RAW partition, i. e. without any filesystem on
> it.
I thought you told me that you tested it with a FS.... Maybe I
misunderstood something.
Ok, put my image to the RAW partiton and executed usbboot again. Still
the same problem like above...
Copied the image into RAM with usb read (hope it is correct) and then
bootm. That works.
Then I removed the "if (hdr->ih_magic == IH_MAGIC)" in common/cmd_usb.c,
set cnt to a suitable value and tested usbboot again. This works, too.
Perhaps I find out how to solve that.
Thanks for your help!
Regards,
Jonas
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
2005-02-03 15:12 ` Jonas Dietsche
@ 2005-02-03 15:24 ` Wolfgang Denk
0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2005-02-03 15:24 UTC (permalink / raw)
To: u-boot
In message <42023F73.3090209@fsforth.de> you wrote:
>
> I thought you told me that you tested it with a FS.... Maybe I
> misunderstood something.
Probably.
> Ok, put my image to the RAW partiton and executed usbboot again. Still
> the same problem like above...
I think you must be doing something wrong.
Which exact commands did you use to put the image into the boot
partition?
> Copied the image into RAM with usb read (hope it is correct) and then
> bootm. That works.
usbboot is nothing else but a clever version of usb read (which
auto-determines the number of blocks to read).
> Perhaps I find out how to solve that.
If you just posted the exact commands you use, and the output you
get, I had a much better chance to help you.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The number of Unix installations has grown to 10, with more
expected." - The Unix Programmer's Manual, 2nd Edition, June, 1972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot-Users] booting from USB
@ 2005-02-04 8:10 Jonas Dietsche
0 siblings, 0 replies; 9+ messages in thread
From: Jonas Dietsche @ 2005-02-04 8:10 UTC (permalink / raw)
To: u-boot
> I think you must be doing something wrong.
Probably...
>
> Which exact commands did you use to put the image into the boot
> partition?
dd if=/tftpboot/uImage of=/dev/sda1
2234+1 records in
2234+1 records out
1144016 bytes transferred in 0.585176 seconds (1954995 bytes/sec)
A9M9750 # usb reset
(Re)start USB...
USB: scanning bus for devices... 2 USB Devices found
A9M9750 # usb scan
Scan for storage device:
scanning bus for storage devices...
Device 0: Vendor: USB 2.0 Prod.: Mobile Disk Rev: 2.00
Type: Removable Hard Disk
Capacity: 125.0 MB = 0.1 GB (256000 x 512)
A9M9750 # usbboot 10000 0:1
Loading from USB device 0, partition 1: Name: usbda1
Type: U-Boot
First Block: 32, # of blocks: 10208, Block Size: 512
** Bad Magic Number **
And with usb read it looks like:
A9M9750 # usb read 10000 20 8BB
USB read: device 0 block # 32, count 2235 ...
...............................................................................................................
2235 blocks read: OK
A9M9750 # bootm
## Booting image at 00010000 ...
Image Name: Linux-2.6.10-fs1
Created: 2005-02-02 13:23:01 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1144056 Bytes = 1.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
Starting kernel ...
Regards,
Jonas
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-02-04 8:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-04 8:10 [U-Boot-Users] booting from USB Jonas Dietsche
-- strict thread matches above, loose matches on Subject: below --
2005-02-01 16:55 Jonas Dietsche
2005-02-01 18:38 ` Wolfgang Denk
2005-02-02 15:15 ` Jonas Dietsche
2005-02-02 17:10 ` Wolfgang Denk
2005-02-03 11:27 ` Jonas Dietsche
2005-02-03 12:02 ` Wolfgang Denk
2005-02-03 15:12 ` Jonas Dietsche
2005-02-03 15:24 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox