Can RevC4 U-Boot start from MMC if available or NAND if not?

I don’t fully understand what options are available in the u-boot environment. I’ve read a bunch of the documentation, but got confused, and then saw things in the environment that led me to believe that it might have more operation possible.

Is it possible to set up the u-boot environment so that the unattended beagleboard will boot a particular set of parameters if an MMC is in the mmc slot, and a different set if there is no MMC?

I set up the NAND so that it has the standard partitions of

~ # cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 “X-Loader”
mtd1: 001e0000 00020000 “U-Boot”
mtd2: 00020000 00020000 “U-Boot Env”
mtd3: 00400000 00020000 “Kernel”
mtd4: 0f980000 00020000 “File System”

and I properly populate the kernel and file system partitions. Right now I’ve got the environment set so that it boots from my MMC,

What I’d like is that if there is no MMC card, the root filesystem is loaded from the NAND, but if there’s a MMC card inserted, I’d like it to load the root file system from the MMC. I’ve installed the u-boot utilities in the current running angstrom system, and can examine the and modify the current boot environment as shown below.

~ # opkg info u-boot-fw-utils
Package: u-boot-fw-utils
Version: 2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6
Depends: libc6
Provides:
Status: unknown ok not-installed
Section: bootloaders
Architecture: beagleboard
MD5Sum: 032998614beb8a2ab4c9d79e3c5ab6e4
Size: 10334
Filename: u-boot-fw-utils_2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6_beagleboard.ipk
Description: U-Boot - the Universal Boot Loader

~ # opkg install u-boot-fw-utils
Installing u-boot-fw-utils (2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6) to root…
Downloading http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/machine/beagleboard/u-boot-fw-utils_2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6_beagleboard.ipk.
Configuring u-boot-fw-utils.
~ # opkg info u-boot-fw-utils
Package: u-boot-fw-utils
Version: 2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6
Depends: libc6
Provides:
Status: install user installed
Section: bootloaders
Architecture: beagleboard
MD5Sum: 032998614beb8a2ab4c9d79e3c5ab6e4
Size: 10334
Filename: u-boot-fw-utils_2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6_beagleboard.ipk
Description: U-Boot - the Universal Boot Loader
Installed-Time: 1289051817

~ # opkg files u-boot-fw-utils
Package u-boot-fw-utils (2010.03+r65+gitrca6e1c136ddb720c3bb2cc043b99f7f06bc46c55-r65.6) is installed on root and has the following files:
/sbin/fw_setenv
/etc/fw_env.config
/sbin/fw_printenv
~ # fw_printenv
bootdelay=3
baudrate=115200
loadaddr=0x80200000
rdaddr=0x81600000
usbtty=cdc_acm
console=ttyS2,115200n8
optargs=
bootscr=boot.scr
camera=lbcm3m1
vram=12M
dvimode=640x480MR-16@60
defaultdisplay=dvi
mmcdev=1
mmcroot=/dev/mmcblk0p2 rw
mmcrootfstype=ext3 rootwait
nandroot=/dev/mtdblock4 rw
nandrootfstype=jffs2
ramroot=/dev/ram0 rw
ramrootfstype=ext2
mmcargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} camera=${camera} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype}
nandargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} camera=${camera} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${nandroot} rootfstype=${nandrootfstype}
loadbootscript=fatload mmc ${mmcdev} ${loadaddr} ${bootscr}
ramargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} camera=${camera} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${ramroot} rw ramdisk_size=65536 initrd=${rdaddr},64M rootfstype=${ramrootfstype}
loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz
bootscript=echo Running bootscript from mmc …; source ${loadaddr}
loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage
mmcboot=echo Booting from mmc …; run mmcargs; bootm ${loadaddr}
nandboot=echo Booting from nand …; run nandargs; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}
ramboot=echo Booting from ramdisk …; run ramargs; bootm ${loadaddr}
dieid#=53560004000000000403730514012009
buddy=none
beaglerev=Cx
mpurate=720
bootargs=console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait
bootcmd=mmc init;fatload mmc 0 80300000 uImage;bootm 80300000



— On Sat, 11/6/10, William C Bonner wbonner@wimsworld.com wrote:

http://omapzoom.org/wiki/Bootloader_Project

I have C4 it came with x-loader and uboot in NAND no SD



|

I’d think you could do this from u-boot. Use an if statement to see if mmc can initialize, and if there is a uImage there, use it, if not then boot from the one you have in NAND. This is just off the top of my head - sounds like an interesting exercise, though.

My understanding from http://www.elinux.org/BeagleBoard#User_button is that my normal running mode, where I don’t have to press the USER button, but my board still boots up and runs the system on my SD flash card, is actually loading the X-Loader and U-Boot and its environment from the NAND, and then loading my linux kernel and root filesystem from the SD card.

I have updated the X-Loader and U-Boot that are in my NAND from what it originally shipped with.

Is it the bootcmd environment variable that gets run? And I might be able to string an “if” statement into it, based on using “mmcinit” ?

You mean like the default environment already has?

U-boot runs bootcmd stored in nand

type printenv from u-boot prompt

other systems use U-boot to initialize the RAM etc

For OMAP they use X-loader and relocate to OMAP 64K ram then transfer
to SDRAM

I asked why this is so complex I was told for flexibility

Really need to study that link to get the process

I do agree you should not need to hit a button it should just look for image in NAND then automatically check SD

It does? The nand on my C4 is completely empty and amazingly enough it still boots!

William could you please provide some pointers on how you went above
setting up partitions for the nand ?

Thanks,
VIjay