Emmc should work, on R3 and R4 you have only to flash and activate the emmc bl2 in boot0 and replace fip (for uboot devicetree) after flashing image to emmc user partition.
On older boards (R2,R64) you have ro change mmc controller number in uboot and /etc/fstab to target the right device.
This is not needed on R3/R4 because there is only one mmc controller and uboot should apply the right settings through devicetree overlay. This is done in my image and i guess also on bpi image.
As i said in other thread ubuntu in nand could be tricky because of filesystem and size (nand is only 128mb,ubuntu base install is afair 600mb).
Like Frank said, it is too small. However it is large enough for U-Boot + kernel + initrd-image, so it can contain a linux rescue system. From this you can for example chroot into the normal system rootfs (on nvme or emmc) and fix it. The U-Boot on nand is also needed to boot a rootfs on nvme (and could possibly also boot rootfs on emmc, but that is not needed, as U-Boot can be on emmc).
Do not mix openwrt and my image. You can bootup my image from sdcard and install to nand like described in my wiki,bootup from nand with initrd and install to emmc.
I suppose to have a SD card with official R3 ubuntu image installed. And I want to flash the customized u-boot and kernel (will build from your Github repo) into NAND then eMMC, as said the way SD → NAND → eMMC.
Bl2 are different versions like with ubi support and 8gb,so you have to choose the right file here. Fip should only be one.
My uboot have basic usb,network and pcie/nvme support. But to boot system you may have to set variables to let my builtin scripts know which file from which source to load. Emmc is also supported in the nand fip,but you have no access to sdmmc from there as only one can be targeted in dts.
If this is complicated, there are different ways to do this:
Booting from my archlinuxarm sd-image, with only 1 command you can setup a rescue linux initrd on nand. Then boot from nand and easily connect to the internet easily. From there most common linux commands are available to setup any linux distro (Ubuntu) using different ways. You can use debootstrap or any tool you prefer. Only add linux kernel and devicetree (and optionally initrd).
Also you will have a distroboot-uboot version on nand, that means that anywhere on emmc or nvme you can format a partition (fat32 or btrfs), set the bootflag and add (/boot)/extlinux/extlinux.conf file. So you leave the switches to boot nand and there is no need to worry about atf/bl2/bl31/u-boot anymore, since you can keep using the bootchain on nand.
Not to add to the confusion, this is different from what Frank is writing, but to let you know there are more options to do this.
Those operations would be complicated for me without the exact commands to follow since I am a beginner for Linux system.
My plan and imagination:
I have a SD card with R3 ubuntu image installed, and have already built Linux from Frank’s R3 Linux repo but no further actions.
Next step I’m thinking is to see which the meaningful output files are, what their usages are and prepare to build u-boot from Frank’s R3 u-boot repo. (Btw I found Frank’s wiki and README are hard to follow for beginners like me.)
Little Goal:
My little goal is to boot up with SD card and flash the NAND with customized u-boot and Linux (so I would like to build them from Frank’s repo by myself first). And the next will be flashing eMMC with customized u-boot and Linux from NAND boot.
Uncertainty:
My R3 board currently has bootable Openwrt images installed in NOR, NAND and eMMC. As I want to replace them with my customized u-boot and Linux, can I just flash them in-place (e.g. boot NAND and flash NAND, boot eMMC and flash eMMC)? If so, may I have your instructions and commands? I am trying hard to follow Frank’s wiki and README.
Could you advise on my plan and goal? I guess there are easier ways to achieve. It would be nice to have the your commands for me to follow.
SD card contains the default ubuntu bl2_nand.img and fip_nand.bin for NAND. It should be able to flash them to NAND then it will also become bootable ubuntu u-boot and kernel.
There are pre-built bpi-r3_spim-nand_bl2.img and bpi-r3_spim-nand_fip.bin released on https://github.com/frank-w/u-boot/releases. So it is allowed to copy them into a FAT32 formatted USB device, boot SD card along with the USB-stick inserted and flash the NAND bl2 and fip by those 2 files from USB rather than SD card.
Other than that, the bpi-r3_spim-nand_bl2.img and bpi-r3_spim-nand_fip.bin can be built and generated (for customization) from Frank’s u-boot repo. If so, I can build them by myself and flash to NAND bl2 and fip through the USB way (like the above point).
Flash NAND bl2 and fip with SD card built-in files:
Sdcard contains only sd related parts…bl2 and fip for other devices can be downloaded from my uboot repo in releases for all devices. Put it on your sdcard to continue like described in my wiki. Or use the usb way…does not need to remove sdcard from board,but basicly same only usb have to be initialized first and use changed subsystem and partition (0:1 is first device first partition).
How to load the bl2_nand.img and fip_nand.bin into SD card with ubuntu installed? According to the #nand_flash section of wiki, which seems like the files already exist in the ubuntu image of SD card.
Or do you mean even the card has ubuntu installed, it can still be storing files via computer access like how I put files in USB device?
Instead of downloading the bl2 and fip from your u-boot releases section, can I just build them by using your u-boot repo, so I could customize the code by needs? (I’m considering the possibility of u-boot and kernel customization)
I also copied the files to sdcard bpi-boot partition…ist is not part of image,but image contains 2 visible partitions (bpi-boot with kernel and ubootconfig and bpi-root with ubuntu/debian rootfs and kernel modules,firmware).
Building uboot is more complex than just flash the existing files.
Are you running any linux on your PC/laptop? Usually you would build from source on that, although it is possible to do it on bpi-board, but not recommend.
ubuntu@afe0fd51a26a:~/u-boot$ ./build.sh install
ver:2025.04,ubranch:bpi
bpi-r64/bpi-r3 with new ATF needs uboot packed into fip!
ubuntu@afe0fd51a26a:~/u-boot$
How to make use of these output files? I am considering to generate u-boot and kernel images but not to install files to SD card.
I just figured out how to put and flash bl2 and fip from SD card to NAND. However it cannot boot the NAND kernel directly. Do you know how to fix this?