EMMC/SD Boot switch software override?

Is there a way to override the EMMC/SD boot selector switch? I assume it would be through the u-boot console. For example, if the switch is on the SD setting, can u-boot still boot from EMMC?

Uboot should be loaded from emmc if preloader was loaded from it…uboot is first position you can modify.

You can boot kernel from emmc with sd-uboot…just change first value in partition variable (0=emmc,1=sd) used in fatload.

1 Like

Hello, After install u-boot, my bpi-r2 ask me password, but password is not configured, I try all passwords and still ask me a password only in web interface. somebody can help me pls? Screenshot%20from%202021-12-11%2017-12-11

you need to tell us which image you are using…

Thank you for answer, do no matter image, it do it the same on any , this is my image https://downloads.openwrt.org/snapshots/targets/mediatek/mt7623/openwrt-mediatek-mt7623-bananapi_bpi-r2-sdcard.img.gz

and u-boot image https://downloads.openwrt.org/releases/21.02.1/targets/mediatek/mt7623/u-boot-mt7623n_bpir2/u-boot.bin

BusyBox v1.34.1 (2021-12-10 10:33:49 UTC) built-in shell (ash)


| |.-----.-----.-----.| | | |.----.| |_ | - || _ | -| || | | || || | |_____|| |||||___||| |____| || W I R E L E S S F R E E D O M

OpenWrt SNAPSHOT, r18302-ea49690ff4

=== WARNING! ===================================== There is no root password defined on this device! Use the “passwd” command to set up a new password in order to prevent unauthorized SSH logins.

How can I do a factory reset ?

do you get a prompt on serial console? so you can try setting password using passwd command like it is printed. but no idea about lucy…but it should be possible too if you have access via serial or ssh

I can Access by ssh, I change password but it always ask me login and password.

Ok, afaik ssh without pass is not possible…and openwrt uses no ext4 rootfs (squashfs or similar) and sometimes mtd which makes it hrd to chroot to it and run passwd outside running system. Maybe @dangowrt knows a way to set root password and make ssh login possible

Thank you for your help, I will try my self to find a solution, thank you again Frank

This doesn’t even look like OpenWrt’s UI…? Did you install a custom LuCI theme or maybe this is a different device or something still stuck in your browser cache?

As you got access via SSH you can run firstboot to reset everything to factory defaults. However, as there is no password set, you should also be able to access the web-ui by just submitting an empty password.

Thank you for your reply , I know is not necessary password to login. I can connect with ssh without password, I think the web isn’t complete, something loos.

I found it, if that help someone, this is the solution, the packages were incomplete,

opkg update

opkg install luci

opkg update

opkg install luci-ssl

/etc/init.d/uhttpd restart

Solved

1 Like

I am having an problem with the original question - I have my image on eMMC, but cannot get the R2 to boot from eMMC when there is an SD card inserted.

There is no preloader on my SD card, it is only on eMMC. But it is still trying to boot from SD.

I guess you have something on your sdcard that bootrom recognizes as bootable. Why not remove the sdcard if you don’t want to boot from it?

I wiped it from /dev/zero. The card is blank in every way. I’ve tried several cards now and the same issue. The boot select switch position has no effect either.

Could it be an issue with the preloader? The preloader I used I downloaded from https://downloads.openwrt.org/releases/21.02.2/targets/mediatek/mt7623/openwrt-21.02.2-mediatek-mt7623-bpi_bananapi-r2-preloader.bin

I don’t want to lose access to sd card slot because I’m booting from emmc.

EDIT: I put a bootable image on the SD card and changed its uboot default menu item to select loading the kernel from eMMC. But I am really confused as to what the boot select switch actually does. As far as I can tell, if there is an SD card inserted, the R2 will always boot from SD card.

I made the same experience with the binary preloader on the R2. U-Boot tries to figure the bootdevice by reading comparing a memory location with the string eMMC the preloader has left behind there. Unfortunately this doesn’t work reliably. Solutions can be to

  • use different U-Boot builds with hard-coded boot device for eMMC and SD Card (like we do on the R64)
  • beg people who have the sourcecode to fix the Preloader (or clarify if there is a better way for U-Boot to know which media it has just been loaded from)

Afaik there is no better way as uboot is relocated in memory and needs any flag in memory (like current emmc string) to check bootdevice. Using hardcoded bootdevice makes images only work for the specific device. The detection used on r2 allows to use same image on both devices

Yes, sure, it’s nice to have to build U-Boot only once and let it work on both. However, I also see that problem that as soon as the preloader is written to eMMC boot0 hw-partition the boot-switch is de-facto ignored and if an SD card is inserted at boot, the preloader will prefer to load things from there…