Latest u-boot.bin containing MUSB gadget mode code for U-Boot

38 views
Skip to first unread message

Atin Malaviya

unread,
Jan 22, 2009, 1:03:18 PM1/22/09
to beagl...@googlegroups.com
All,

Anyone who cares to test usb gadget mode in u-boot, can try the
gzipped image at:

http://groups.google.com/group/beagleboard/web/musb_gadget-u-boot.bin.gz

This image was built using the latest code on the omap3-dev-usb branch
+ the latest patches on the mailing list (that should get added to the
branch soon). To read a little more about what this is doing, read: http://elinux.org/U-boot_musb_gadget_support
- specifically the setting of the stdin, out, err.

-Atin

--
Atin Malaviya
atin.m...@gmail.com

kapare

unread,
Jan 23, 2009, 3:06:08 PM1/23/09
to Beagle Board
Hi,

I just try to test your u-boot.bin but seem to have miss something...
because my board is not booting any more.

Here what I have done

Old version at bootup:
U-Boot 1.3.3 (Jul 10 2008 - 16:33:09)

First switch beagleboard power, remove SD and insert into SD slot of
your PC. The SD partition are mounted:
cd ~/u-boot-omap3
cp u-boot.bin /media/boot/
ls -lh /media/boot/
total 3.4M
-rwx------ 1 kapare root 701K 2008-12-18 22:36 flash-uboot.bin
-rwx------ 1 kapare root 17K 2008-12-18 22:26 MLO
-rwx------ 1 kapare root 172K 2009-01-23 14:39 u-boot.bin
-rwx------ 1 kapare root 2.5M 2009-01-19 18:16 uImage
-rwx------ 1 kapare root 20K 2008-12-18 22:30 x-load.bin.ift

sudo umount /media/boot /media/rootfs

Second remove SD from PC and insert it into beagle board.

minicom

Plug beagle board power.

OMAP3 beagleboard.org # nand unlock
device 0 whole chip
nand_unlock: start: 00000000, length: 268435456!
NAND flash successfully unlocked
OMAP3 beagleboard.org # nand erase 80000 160000

NAND erase: device 0 offset 0x80000, size 0x160000
Erasing at 0x1c0000 -- 100% complete.
OK
OMAP3 beagleboard.org # nand write.i 80000000 80000 160000

NAND write: device 0 offset 0x80000, size 0x160000

Writing data at 0x1df800 -- 100% complete.
1441792 bytes written: OK
OMAP3 beagleboard.org #

Reboot

Texas Instruments X-Loader 1.41
Starting OS Bootloader...
......NOTHING HAPPEN!

""Reboot your board and keep the user button pressed while applying
power (see Known bugs). ""

Oups I was pressing user button and I remove the power cable :(

So what should I do to fix that ?

Regards

kap

On Jan 22, 1:03 pm, Atin Malaviya <atin.malav...@gmail.com> wrote:
> All,
>
> Anyone who cares to test usb gadget mode inu-boot, can try the  
> This image was built using thelatestcode on the omap3-dev-usb branch  
> + thelatestpatches on the mailing list (that should get added to the  
> branch soon). To read a little more about what this is doing, read:http://elinux.org/U-boot_musb_gadget_support
>   - specifically the setting of the stdin, out, err.
>
> -Atin
>
> --
> Atin Malaviya
> atin.malav...@gmail.com

Diego Dompe

unread,
Jan 24, 2009, 10:52:34 PM1/24/09
to beagl...@googlegroups.com, Diego Dompe
Hi Kapare,

This happen to me once, and was that for some configuration my board
was loading the code at 82000000 instead of 80000000 as the
instructions assume. Please try to do recovery with the MMC recovery
procedure documented here:

http://elinux.org/BeagleBoardRecovery

Atin

unread,
Jan 25, 2009, 8:10:56 AM1/25/09
to Beagle Board
I have actually been loading this u-boot off the MMC rather than
writing it into NAND since I keep modifying the u-boot code. I have
only written MLO (x-load) to nand, and let u-boot load off the MMC.
This gets me around the times when I do something bad to the code and
the beagle doesn't boot anymore!

-Atin

kapare

unread,
Jan 27, 2009, 10:22:01 AM1/27/09
to Beagle Board, Atin
Hi,

This is what I have achieved until now!

1- Nothing changed the board is stock trying to start the Bootloader.
2- I create a script that shows the steps that I have done, see
attachment update_sd.sh
3- MLO_restore I used the one from http://elinux.org/BeagleBoardRecovery
4- I could try http://elinux.org/BeagleBoardRecovery#USB_recovery ?
But I will wait for your suggestions.

Regards

kap

OUTPUT FROM SERIAL:

Welcome to minicom 2.3

OPTIONS: I18n
Compiled on Oct 24 2008, 06:37:44.
Port /dev/ttyUSB0

Press CTRL-A Z for help on special
keys

40T

Texas Instruments X-Loader
1.41
Starting OS Bootloader...


Texas Instruments X-Loader 1.41
Starting OS Bootloader...
40T

Texas Instruments X-Loader 1.41
Starting OS Bootloader...


----------------------------------------> start update_sd.sh

#!/bin/sh -x

# Environment variables
SD_PATH="/dev/mmcblk0"
SD_P1_PATH="/dev/mmcblk0p1"
SD_P2_PATH="/dev/mmcblk0p2"

# SD validation.
SD_INSERT="SD insert test: "

if [ -e $SD_PATH ]
then
echo "--> ${SD_INSERT} OK"
else
echo "--> ${SD_INSERT} FAILED"
echo "--> SD not inserted!"
exit $?
fi

# Mount validation for p1.
MOUNT_P1="SD P1 mount test: "

if [ -n "`mount | grep /dev/mmcblk0p1`" ]
then
echo "--> ${MOUNT_P1} FAILED"
echo "--> sudo umount ${SD_P1_PATH}"
sudo umount $SD_P1_PATH
else
echo "--> ${MOUNT_P1} OK"
fi

# Mount validation for p1.
MOUNT_P2="SD P2 mount test: "

if [ -n "`mount | grep /dev/mmcblk0p2`" ]
then
echo "--> ${MOUNT_P2} FAILED"
echo "--> sudo umount ${SD_P2_PATH}"
sudo umount $SD_P2_PATH
else
echo "--> ${MOUNT_P2} OK"
fi

# Disk /dev/mmcblk0: 1977 MB, 1977614336 bytes
# 1977614336/255/63/512 = 240.431248055 = FLOOR = 240
# Create partition backup: sfdisk -H 255 -S 63 -C 240 --d /dev/mmcblk0
> sd-beagleboard-partition.out

# Create partition
echo "--> Create SD partition: sfdisk -H 255 -S 63 -C 240 --force /dev/
mmcblk0 < sd-beagleboard-partition.out"
sfdisk -H 255 -S 63 -C 240 --force /dev/mmcblk0 < sd-beagleboard-
partition.out

# Format the partitions
echo "--> Format SD P1 into FAT32: sudo mkfs.msdos -F 32 /dev/
mmcblk0p1 -n boot"
sudo mkfs.msdos -F 32 /dev/mmcblk0p1 -n boot

echo "--> Format SD P2 into ext3: sudo mkfs.ext3 -L rootfs /dev/
mmcblk0p2"
sudo mkfs.ext3 -L rootfs /dev/mmcblk0p2

# Mount newly formated partition:
echo "--> Mount newly formated partition"
sudo mount /dev/mmcblk0p1 /media/boot
sudo mount /dev/mmcblk0p2 /media/rootfs

# IMPORTANT TO DO THIS BEFORE ANY OTHER FILES ARE COPIED:
# Copy the MLO file that you downloaded to the Beagle_Boot partition.
# The MLO file must be the first file copied to the partition after re-
formatting.
cp /home/kapare/beagleboard/sd/boot/MLO_restore /media/boot/MLO
cp /home/kapare/beagleboard/sd/boot/musb_gadget-u-boot.bin /media/boot/
u-boot.bin

----------------------------------------> end update_sd.sh

On Mon, Jan 26, 2009 at 6:25 AM, Atin Malaviya
<atin.m...@gmail.com> wrote:

The problem was with the instructions to copy to the NAND. You
most probably have a configuration where the load address is set to
something other than 80000000 (usually 82000000) and so when xload
tried to find u-boot, it didn't and hung. You should be able to
recover the board by following the instructions on http://elinux.org/BeagleBoardRecovery
and then trying again, this time with u-boot.bin written to the
address that you have set as the load address. You should be able to
see the loadaddress once you have recovered your board. The same
instructions that you use to write the original version of u-boot.bin
to your board would work with this version of u-boot.bin.

-Atin

--
Atin Malaviya
atin.m...@gmail.com

kapare

unread,
Jan 27, 2009, 1:32:44 PM1/27/09
to Beagle Board, atin.m...@gmail.com
Hi Again,

I try multiple variation with those event just the MLO_restore only.

I didnt used my script doing step by step
http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat
http://elinux.org/BeagleBoardRecovery#USB_recovery

After Partitionning, formating, reinserting the SD, coping MLO_restore
+ flash-uboot.bin etc...
sudo cp /home/kapare/beagleboard/sd/boot/MLO_restore /media/boot/MLO
sudo cp /home/kapare/beagleboard/sd/boot/MLO_revb /media/boot/MLO
sudo cp /home/kapare/beagleboard/sd/boot/musb_gadget-u-boot.bin /media/
boot/u-boot.bin
sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin.Angstrom /media/
boot/u-boot.bin
sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin_autoflash /media/
boot/u-boot.bin
sudo cp /home/kapare/beagleboard/sd/boot/flash-uboot.bin /media/boot/u-
boot.bin

I see the ...40T... but no output about MMC like in the
http://elinux.org/BeagleBoardRecovery#MMC_recovery

Like this::::

...40T.........

Texas Instruments X-Loader 1.41
Starting on with MMC
Reading boot sector

150832 Bytes Read from MMC
Starting OS Bootloader from MMC...

-------
So you said that "You need to make sure your beagle boots off SD since
the version in NAND is written into the wrong spot for your config."
This mean that my beagleboard is not booting like

USB -> UART -> MMC -> NAND

but always

NAND -> USB -> UART -> MMC

I think I'm missing something and it is very stupid! Or maybe that my
MLO_restore that I copy was not ok!?

From my other attempts I found that after Formatting I need to
"Unplug, and replug in your SD card, and it should now automount the
two partitions that you created. "

kap

-----------------
I would first go back to the original u-boot.bin and write that to SD
and try to boot from that. You need to make sure your beagle boots off
SD since the version in NAND is written into the wrong spot for your
config. Once it boots off SD, you can write the u-boot.bin to NAND
again, this time making sure you use the appropriate start address.

Recovering the beagleboard is a standard process, I think we gave you
the link for that - just use the standard u-boot.bin instead of the
gadget mode one until you've recovered your board. Then you can write
the gadget mode u-boot to the same address instead.
--
Atin Malaviya
(617)899-2353
atin.m...@gmail.com

Sent via Blackberry
> <atin.malav...@gmail.com> wrote:
>
>     The problem was with the instructions to copy to the NAND. You
> most probably have a configuration where the load address is set to
> something other than 80000000 (usually 82000000) and so when xload
> tried to findu-boot, it didn't and hung. You should be able to
> recover the board by following the instructions onhttp://elinux.org/BeagleBoardRecovery
> and then trying again, this time withu-boot.bin written to the
> address that you have set as the load address. You should be able to
> see the loadaddress once you have recovered your board. The same
> instructions that you use to write the original version ofu-boot.bin
> to your board would work with this version ofu-boot.bin.
>
>     -Atin
>
>     --
>     Atin Malaviya
>     atin.malav...@gmail.com
>
> On Jan 25, 8:10 am, Atin <atin.malav...@gmail.com> wrote:
>
> > I have actually been loading thisu-bootoff the MMC rather than
> > writing it into NAND since I keep modifying theu-bootcode. I have
> > only written MLO (x-load) to nand, and letu-bootload off the MMC.
> > This gets me around the times when I do something bad to the code and
> > the beagle doesn't boot anymore!
>
> > -Atin
>
> > On Jan 24, 10:52 pm, Diego Dompe <diego.do...@ridgerun.com> wrote:
>
> > > Hi Kapare,
>
> > > This happen to me once, and was that for some configuration my board  
> > > was loading the code at 82000000 instead of 80000000 as the  
> > > instructions assume. Please try to do recovery with the MMC recovery  
> > > procedure documented here:
>
> > >http://elinux.org/BeagleBoardRecovery
>
> > > On Jan 23, 2009, at 2:06 PM, kapare wrote:
>
> > > > Hi,
>
> > > > I just try to test youru-boot.bin but seem to have miss something...
> > > > because my board is not booting any more.
>
> > > > Here what I have done
>
> > > > Old version at bootup:
> > > >U-Boot1.3.3 (Jul 10 2008 - 16:33:09)
>
> > > > First switch beagleboard power, remove SD and insert into SD slot of
> > > > your PC. The SD partition are mounted:
> > > > cd ~/u-boot-omap3
> > > > cpu-boot.bin /media/boot/

Jason Kridner

unread,
Jan 27, 2009, 9:13:38 PM1/27/09
to Beagle Board
On Jan 27, 12:32 pm, kapare <kevyn.alexandre.p...@gmail.com> wrote:
> Hi Again,

I encourage you to sign-up on the mailing list to avoid having all of
your messages moderated. You can sign-up and opt for no e-mail.

>
> I try multiple variation with those event just the MLO_restore only.
>
> I didnt used my script doing step by stephttp://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormathttp://elinux.org/BeagleBoardRecovery#USB_recovery
>
> After Partitionning, formating, reinserting the SD, coping MLO_restore
> + flash-uboot.bin etc...
> sudo cp /home/kapare/beagleboard/sd/boot/MLO_restore /media/boot/MLO
> sudo cp /home/kapare/beagleboard/sd/boot/MLO_revb /media/boot/MLO

If you overwrite the MLO_restore, then it won't work. MLO must be the
first file copied after freshly formatting the SD card per the
instructions. You cannot alter it after you copy it or it won't
work. You'd need to start over again by formatting the card again.

> sudo cp /home/kapare/beagleboard/sd/boot/musb_gadget-u-boot.bin /media/
> boot/u-boot.bin
> sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin.Angstrom /media/
> boot/u-boot.bin
> sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin_autoflash /media/
> boot/u-boot.bin

I think you only want to copy the _autoflash version if you are trying
to recover your board.

> sudo cp /home/kapare/beagleboard/sd/boot/flash-uboot.bin /media/boot/u-
> boot.bin
>
> I see the ...40T... but no output about MMC like in thehttp://elinux.org/BeagleBoardRecovery#MMC_recovery
>
> Like this::::
>
> ...40T.........
>
> Texas Instruments X-Loader 1.41
> Starting on with MMC
> Reading boot sector
>
> 150832 Bytes Read from MMC
> Starting OS Bootloader from MMC...

If you aren't seeing something like the above, then the MLO setup
didn't work or you aren't holding the USER button when you apply
power.

>
> -------
> So you said that "You need to make sure your beagle boots off SD since
> the version in NAND is written into the wrong spot for your config."
> This mean that my beagleboard is not booting like
>
> USB -> UART -> MMC -> NAND
>
> but always
>
> NAND -> USB -> UART -> MMC

Actually, the 40T tells you that UART boot was attempted, so you
aren't booting directly from NAND flash.

>
> I think I'm missing something and it is very stupid! Or maybe that my
> MLO_restore that I copy was not ok!?
>
> From my other attempts I found that after Formatting I need to
> "Unplug, and replug in your SD card, and it should now automount the
> two partitions that you created. "

You should only do that after performing a 'sync' to make sure the
cache is flushed on your system.

>
> kap
>
> -----------------
> I would first go back to the original u-boot.bin and write that to SD
> and try to boot from that. You need to make sure your beagle boots off
> SD since the version in NAND is written into the wrong spot for your
> config. Once it boots off SD, you can write the u-boot.bin to NAND
> again, this time making sure you use the appropriate start address.
>
> Recovering the beagleboard is a standard process, I think we gave you
> the link for that - just use the standard u-boot.bin instead of the
> gadget mode one until you've recovered your board. Then you can write
> the gadget mode u-boot to the same address instead.
> --
> Atin Malaviya
> (617)899-2353
> atin.malav...@gmail.com
> ...
>
> read more »

kapare

unread,
Jan 28, 2009, 12:58:37 PM1/28/09
to Beagle Board
Hi,

On Jan 27, 9:13 pm, Jason Kridner <jkrid...@beagleboard.org> wrote:
> On Jan 27, 12:32 pm, kapare <kevyn.alexandre.p...@gmail.com> wrote:
>
> > Hi Again,
>
> I encourage you to sign-up on the mailing list to avoid having all of
> your messages moderated.  You can sign-up and opt for no e-mail.
>

I will, it was just easier for me to do this by email.

>
>
> > I try multiple variation with those event just the MLO_restore only.
>
> > I didnt used my script doing step by stephttp://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormathttp://e...
>
> > After Partitionning, formating, reinserting the SD, coping MLO_restore
> > + flash-uboot.bin etc...
> > sudo cp /home/kapare/beagleboard/sd/boot/MLO_restore /media/boot/MLO
> > sudo cp /home/kapare/beagleboard/sd/boot/MLO_revb /media/boot/MLO
>
> If you overwrite the MLO_restore, then it won't work.  MLO must be the
> first file copied after freshly formatting the SD card per the
> instructions.  You cannot alter it after you copy it or it won't
> work.  You'd need to start over again by formatting the card again.
>

I always copy MLO_restore first and did not overwrite it. I just cut
paste the command that I used to show what I have tryand only one MLO
each try.

> > sudo cp /home/kapare/beagleboard/sd/boot/musb_gadget-u-boot.bin /media/
> > boot/u-boot.bin
> > sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin.Angstrom /media/
> > boot/u-boot.bin
> > sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin_autoflash /media/
> > boot/u-boot.bin
>
> I think you only want to copy the _autoflash version if you are trying
> to recover your board.
>
> > sudo cp /home/kapare/beagleboard/sd/boot/flash-uboot.bin /media/boot/u-> boot.bin
>
> > I see the ...40T... but no output about MMC like in thehttp://elinux.org/BeagleBoardRecovery#MMC_recovery
>
> > Like this::::
>
> > ...40T.........
>
> > Texas Instruments X-Loader 1.41
> > Starting on with MMC
> > Reading boot sector
>
> > 150832 Bytes Read from MMC
> > Starting OS Bootloader from MMC...
>
> If you aren't seeing something like the above, then the MLO setup
> didn't work or you aren't holding the USER button when you apply
> power.
>
>

Ok The USER button was pressed and hold each time, so this is what I
am now thinking that my setup did not work. But the question is what I
did wrong?

>
> > -------
> > So you said that "You need to make sure your beagle boots off SD since
> > the version in NAND is written into the wrong spot for your config."
> > This mean that my beagleboard is not booting like
>
> > USB -> UART -> MMC -> NAND
>
> > but always
>
> > NAND -> USB -> UART -> MMC
>
> Actually, the 40T tells you that UART boot was attempted, so you
> aren't booting directly from NAND flash.
>
>
>
> > I think I'm missing something and it is very stupid! Or maybe that my
> > MLO_restore that I copy was not ok!?
>
> > From my other attempts I found that after Formatting I need to
> > "Unplug, and replug in your SD card, and it should now automount the
> > two partitions that you created. "
>
> You should only do that after performing a 'sync' to make sure the
> cache is flushed on your system.

So you mean that I should do a sync just before doing sync, umount
then unplug? to be sure that file systems buffer are flush. If I don't
call sync before calling umount can this be a cause of my problem?

I will go on the chat to continue that discussion....

Regards

kap

kapare

unread,
Jan 28, 2009, 7:44:42 PM1/28/09
to Beagle Board
Finally I fixed the board and had the chance to test the Atin u-
boot.bin with usb :))

kapare@vostro:~/beagleboard/sd$ ls /dev/ttyAC*
/dev/ttyACM0

dmesg | tail
[35388.720987] cdc_acm: This device cannot do calls on its own. It is
no modem.
[35388.721957] cdc_acm 7-3:1.0: ttyACM0: USB ACM device

and start minicom /dev/ttyACM0

The problem was that last cylinder of first partition was set to 50
and not to 51, hey!

Command (m for help): [n]
Command action
e extended
p primary partition (1-4)
[p]
Partition number (1-4): [1]
First cylinder (1-245, default 1): [(press Enter)]
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): [+50]

-----------script used----------
#!/bin/sh
# echo "--> Create SD partition: sfdisk -H 255 -S 63 -C 240 --force /
dev/mmcblk0 < sd-beagleboard-partition.out"
# sfdisk -H 255 -S 63 -C 240 --force /dev/mmcblk0 < sd-beagleboard-
partition.out

fdiskCommands()
{
echo d
echo 1
echo d
echo 2
echo n
echo p
echo 1
echo
echo 51
echo t
echo c
echo a
echo 1
echo n
echo p
echo 2
echo
echo
echo t
echo 2
echo 83
echo w
}

echo "--> Create partitions on SD card."
fdiskCommands | fdisk -C 240 -H 255 -S 63 /dev/mmcblk0

# Format the partitions
echo "--> Format SD P1 into FAT32: sudo mkfs.msdos -F 32 /dev/
mmcblk0p1 -n boot"
sudo mkfs.msdos -F 32 /dev/mmcblk0p1 -n boot

echo "--> Format SD P2 into ext3: sudo mkfs.ext3 -L rootfs /dev/
mmcblk0p2"
sudo mkfs.ext3 -L rootfs /dev/mmcblk0p2

# Mount newly formated partition:
echo "--> Mount newly formated partition"
sudo mount /dev/mmcblk0p1 /mnt/boot
sudo mount /dev/mmcblk0p2 /mnt/rootfs

# IMPORTANT TO DO THIS BEFORE ANY OTHER FILES ARE COPIED:
# Copy the MLO file that you downloaded to the Beagle_Boot partition.
# The MLO file must be the first file copied to the partition after re-
formatting.
echo "--> Copy MLO to boot partition."
sudo cp /home/kapare/beagleboard/sd/boot/MLO_restore /mnt/boot/MLO

echo "--> Copy u-boot to boot partition."
# sudo cp /home/kapare/beagleboard/sd/boot/u-boot.bin_autoflash /mnt/
boot/u-boot.bin
sudo cp /home/kapare/beagleboard/sd/boot/musb_gadget-u-boot.bin /mnt/
boot/u-boot.bin

echo "--> umount partitions."
sync
sudo umount /dev/mmcblk0p1 /dev/mmcblk0p2



On Jan 27, 9:13 pm, Jason Kridner <jkrid...@beagleboard.org> wrote:
> On Jan 27, 12:32 pm, kapare <kevyn.alexandre.p...@gmail.com> wrote:
>
> > Hi Again,
>
> I encourage you to sign-up on the mailing list to avoid having all of
> your messages moderated.  You can sign-up and opt for no e-mail.
>
>
>
> > I try multiple variation with those event just the MLO_restore only.
>
> > I didnt used my script doing step by stephttp://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormathttp://e...
> > I would first go back to the originalu-boot.bin and write that to SD
> > and try to boot from that. You need to make sure your beagle boots off
> > SD since the version in NAND is written into the wrong spot for your
> > config. Once it boots off SD, you can write theu-boot.bin to NAND
> > again, this time making sure you use the appropriate start address.
>
> > Recovering the beagleboard is a standard process, I think we gave you
> > the link for that - just use the standardu-boot.bin instead of the
> > gadget mode one until you've recovered your board. Then you can write
> > the gadget modeu-bootto the same address instead.
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages