Booting to emmc by default

I’m trying to do automated testing of some new images on BBB. The current solution I’m looking at is to keep a stable image on the emmc (default debian image at the moment, but I’m not too picky here), and use it to flash the new image on the sd card, then trigger a reboot into the new image. I cannot assume at any time that the new image I’m flashing to the sd works well, or even boots at all, so I need a way to get back to the image on the emmc.

Fortunately, I’ve got pretty good access to network controllable relays and power. So I can automate the process of powering off the device, instrument the s2 button with a relay, and even check in uboot that s2 is pressed and force booting to the sd card. The problem I’m having is that for some reason, even when I boot without pressing s2, it winds up booting the image that’s on the sd card - I suspect maybe because it finds a uEnv.txt there when searching the mmc? I’ve also noticed that I cannot saveenv when I boot from the emmc and get into uboot there, but I can when I boot with s2 held and boot into the uboot from my image on the sdcard. If I set things in the environment and save them from there though, they don’t show up in printenv when I boot off the emmc.

So that was a bit of a mouth full… if I were to distill it down to a single question - is there a something I can do to the debian or ubuntu image running off the emmc to ensure that when s2 is not pressed, it will boot the image on the emmc regardless of what’s on the sd card?

Thanks,
Paul Larson

Paul,
If I’m not mistaken, emmc has priority over the sd card during normal boot.

Yes, and the version of uboot that loads is the same if I boot with no SD, or with the SD and don’t press the s2 button. But something about the default unit convoy causes it to bit the is image on the SD card even when I do not hold down s2 during boot.

You could try forcing it to boot from emmc with an argument in your uEnv.txt, I believe it’s mmcroot.

Are you power cycling between reboots?
I just read that if the s2 button is pressed during boot up the board will always start booting from the SD card until the power is recycled.
But judging from your test setup description you probably use power cycling as the means to do a reboot.