Duel Booting Android and Debian (Help)

I have just received my Radxa Zero and have got it up and running with Debian. I am new to all of this and was wondering if it is possible to set up a uSD that will duel boat the officially supported android and Debian. Please note I do not have eMMC. So the setup will need to be completely on the uSD from a Windows 10 host.

Thanks in advance for your help. Really looking forward to playing around with this amazing bit of tech.

Hello bazzaro,
one way I think you could do this is by thinkering with u-boot. I do not know anything about android boot flow, but I currently have a dual boot setup with ubuntu 20.04 and arch on my device, if it is similar then maybe this can help you.
What you have to do is similar to what you’d do on a PC: you setup 3 partitions in your sd card, one for /boot, one for debian and another for android. The tricky part is separating what is needed to boot debian and android in 2 different folders under /boot, then telling u-boot where to look for what you want to boot. U-boot (the bootloader) reads the files boot.scr and uEnv.txt file in /boot. If you try to read them, you can somewhat see that boot.scr is executed and uEnv instead contains the variables that set what is booted after u-boot.
You will need a Linux VM or maybe you can use WSL2 but you will have to figure out how to pass-through the sd card to WSL.
If you check what is currently in your /boot partition, you will see quite a few files: boot.cmd, boot.scr, uEnv.txt are used by u-boot, extlinux can be used by u-boot (but it currently is not with radxa’s u-boot fork) the dtbs folder is somewhat “related” to Debian. Everything else should be related to debian. With some care, you can move everything debian related to a sub-folder, then you will have to do something similar for android, and then you’ll and up with a /boot partitiotion with u-boot files and /boot/debian and /boot/android directories.
By changing the uEnv.txt file then you are able to select what will be booted on the next reboot, the variables that you will change at least are rootuuid, initrdsize, kernelversion, initrdimg, kernelimg.
Maybe also fdtfile, overlays, depending on what you do with the dtbs directory.
It is quite a manual setup.

If you hook a serial adapter to the correct pins on the board you will get a console and it will help you a lot troubleshooting.
If you want to better understand what is u-boot doing at startup, read the sources: meson64.h and follow the header config_distro_bootcmd.h. It took me quite some time to figure it out because of all the #defines there. Official docs are here: https://u-boot.readthedocs.io/en/latest/develop/bootstd.html and https://u-boot.readthedocs.io/en/latest/develop/distro.html

it involves ore then that above is not gonna work

it is possible you have to adapt android build look at how it is done for the odroid m1 board

Hey fmiz!

Thanks a lot for getting back to me with this information! I am going to give this a try.

As of now, I am having issues getting Android to even boot off the uSD. I flash the zip file to the uSD with balenaEtcher but nothing happens when I try to boot. But once, I have that sorted, I will try your recommendations.

Is there a boot menu for Zero where I can pick between booting from uSD or eMMC?

Have not tried it myself, but this might get you pointed in the right direction: https://forum.odroid.com/viewtopic.php?t=8740

If you manage to get syslinux/extboot working with u-boot (easier if you build from source upstream uboot, instead of using radxa’s fork) then it is easy to have a boot menu. But radxa’s fork of uboot has some fixes that are related to hardware issues specific to the radxa zero board (look at the commit history), so maybe there will be issues. I’ve built uboot (upstream version 22.07) and had both ubuntu and arch on the same SD for testing purposes with a menu to select between the two.