u-boot default bootcmd and boot order

I was reading http://groups.google.com/group/beagleboard/browse_thread/thread/e97fb9895c09a98c and it showed what the u-boot default command used to be.

It now appears to be:

bootcmd=

if mmc init ${mmcdev}; then

if userbutton; then

setenv bootscr user.scr;

if run loadbootscript; then

run bootscript;

else

if run loaduimage; then

if run loadramdisk; then

run ramboot;

else

run mmcboot;

fi;

fi;

fi;

else

setenv bootscr boot.scr;

if run loadbootscript; then

run bootscript;

else

if run loaduimage; then

run mmcboot;

else

run nandboot;

fi;

fi;

fi;

else

run nandboot;

fi

I’m not sure I got the indenting correct when I converted from a single line to multiple lines for readability.

I’m still not sure I understand how the beagleboard boots. I’ve got a C4 beagleboard, so I’ve got NAND. I’ve configured my nand with a valid kernel in mtd3, and a filesystem in mtd4. If I remove the SD card, it boots properly into my minimal system.

I’ve read http://www.elinux.org/BeagleBoard#User_button and it seems to say that when the button is not being pressed, the NAND will be the first item booted from. I’m assuming that means that the X-Loader will be read from the NAND. It also says that when the button is being pressed the MMC is booted before the NAND. That says to me that the X-Loader would be loaded from the MMC if the button is pressed. Am I correct about both of these?

This also leads me to believe that if I’ve got a functioning X-Loader in my NAND, and am not pressing the button at powerup, the MLO file on my SD card will never actually be read. Is this correct?

I’m assuming that the -XM version of the beagleboard actually has the same boot sequence, with the simple understanding that the NAND does not exist on the XM board, so it’s sequence is simply USB → UART → MMC, and does not change boot sequence dependent on the user button. Is this correct?

I get a warning about a bad CRC or NAND from the U-Boot program.

Texas Instruments X-Loader 1.4.4ss (Jul 28 2010 - 16:59:13)

Beagle Rev C4

Loading u-boot.bin from nand

U-Boot 2010.03 (Aug 06 2010 - 11:28:56)

OMAP3530-GP ES3.1, CPU-OPP2, L3-165MHz, Max clock-720Mhz

OMAP3 Beagle board + LPDDR/NAND

I2C: ready

DRAM: 256 MB

NAND: 256 MiB

*** Warning - bad CRC or NAND, using default environment

In: serial

Out: serial

Err: serial

Probing for expansion boards, if none are connected you’ll see a harmless I2C error.

No EEPROM on expansion board

Beagle Rev C4

Die ID #53560004000000000403730514012009

Hit any key to stop autoboot: 0

No MMC card found

Booting from nand …

NAND read: device 0 offset 0x280000, size 0x400000

4194304 bytes read: OK

Booting kernel from Legacy Image at 80200000 …

Image Name: Linux-2.6.36

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2353676 Bytes = 2.2 MB

Load Address: 80008000

Entry Point: 80008000

Verifying Checksum … OK

Loading Kernel Image … OK

OK

Starting kernel …

Uncompressing Linux… done, booting the kernel.

[ 0.000000] Linux version 2.6.36 (wim@sandisk4gb) (gcc version 4.3.3 (GCC) ) #14 PREEMPT Thu Dec 2 00:45:21 UTC 2010

[ 0.000000] CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c53c7f

[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

[ 0.000000] Machine: OMAP3 Beagle Board

[ 0.000000] Memory policy: ECC disabled, Data cache writeback

[ 0.000000] OMAP3430/3530 ES3.1 (l2cache iva sgx neon isp )

[ 0.000000] SRAM: Mapped pa 0x40208000 to va 0xfe408000 size: 0x8000

[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024

[ 0.000000] Kernel command line: console=ttyS2,115200n8 mpurate=720 buddy=none camera=lbcm3m1 vram=12M omapfb.mode=dvi:640x480MR-16@60 omapdss.def_disp=dvi root=/dev/mtdblock4 rw rootfstype=jffs2

I’m not pressing the user button, so I assume that both with and without the SD card the X-Loader is being loaded from the NAND, and the U-Boot is being loaded from the NAND, and the U-Boot loads its environment from the NAND, or in my case, it’s using a built in default environment because the NAND blocks at MTD3 don’t have a valid environment to load.

If I look at the bootcmd that I listed above, It appears to me that everything is inside the “if mmc init” clause, and so I don’t understand how it’s even getting to the nandboot routine. Can someone please point out my error, or explain it to me?

When I put my SD card in, the boot sequence is very similar:

Texas Instruments X-Loader 1.4.4ss (Jul 28 2010 - 16:59:13)

Beagle Rev C4

Reading boot sector

Loading u-boot.bin from mmc

U-Boot 2010.03 (Aug 06 2010 - 11:28:56)

OMAP3530-GP ES3.1, CPU-OPP2, L3-165MHz, Max clock-720Mhz

OMAP3 Beagle board + LPDDR/NAND

I2C: ready

DRAM: 256 MB

NAND: 256 MiB

*** Warning - bad CRC or NAND, using default environment

In: serial

Out: serial

Err: serial

Probing for expansion boards, if none are connected you’ll see a harmless I2C error.

No EEPROM on expansion board

Beagle Rev C4

Die ID #53560004000000000403730514012009

Hit any key to stop autoboot: 0

mmc1 is available

The user button is currently NOT pressed.

reading boot.scr

** Unable to read “boot.scr” from mmc 1:1 **

reading uImage

2353740 bytes read

Booting from mmc …

Booting kernel from Legacy Image at 80200000 …

Image Name: Linux-2.6.36

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 2353676 Bytes = 2.2 MB

Load Address: 80008000

Entry Point: 80008000

Verifying Checksum … OK

Loading Kernel Image … OK

OK

Starting kernel …

Uncompressing Linux… done, booting the kernel.

[ 0.000000] Linux version 2.6.36 (wim@sandisk4gb) (gcc version 4.3.3 (GCC) ) #14 PREEMPT Thu Dec 2 00:45:21 UTC 2010

[ 0.000000] CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c53c7f

[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache

[ 0.000000] Machine: OMAP3 Beagle Board

[ 0.000000] Memory policy: ECC disabled, Data cache writeback

[ 0.000000] OMAP3430/3530 ES3.1 (l2cache iva sgx neon isp )

[ 0.000000] SRAM: Mapped pa 0x40208000 to va 0xfe408000 size: 0x8000

[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024

[ 0.000000] Kernel command line: console=ttyS2,115200n8 mpurate=720 buddy=none camera=lbcm3m1 vram=12M omapfb.mode=dvi:640x480MR-16@60 omapdss.def_disp=dvi root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait

Thanks for any feedback on this rather convoluted set of questions.

Wim.