<Armbian-Discord> <D​arrilla> Hello. I am using a banana pi p2 zero, and I have a fully working Armbian build on my SD card. I have been trying for days to get this loaded into the emmc, but it will simply not boot. I have tried nand-sata-install, and good old dd, but when I try to boot from the emmc, I get: ```U-Boot SPL 2022.07-armbian (Dec 05 2022 - 18:53:42 +0000)
<Armbian-Discord> <D​arrilla> DRAM: 512 MiB
<Armbian-Discord> <D​arrilla> Trying to boot from MMC2
<Armbian-Discord> <D​arrilla> MMC Device 1 not found
<Armbian-Discord> <D​arrilla> spl: could not find mmc device 1. error: -19
<Armbian-Discord> <D​arrilla> SPL: failed to boot from all boot devices
<Armbian-Discord> <D​arrilla> ### ERROR ### Please RESET the board ###
<Armbian-Discord> <D​arrilla> ```
<Armbian-Discord> <D​arrilla> So I think I am starting to understand what is going on. I think, by default, the BPI emmc has two partitions. One is a boot partition and the other is the the OS partition. I think the SD card combines the boot and OS into one. By doing the bpi-copy command the way I did, I wiped out the default two partitions on the emmc and now it won't boot. I think also the partition information in the boot files points to
<Armbian-Discord> the wrong partition. sudo fdisk -l shows that the mmcblk2 is visible but not mounted. Does anyone have any ideas?
<Armbian-Discord> <I​gorPec> this is incompatible emmc, wrong u-boot settings, not enabled emmc in u-boot settings, bad emmc chip ...
<Armbian-Discord> <M​anoftheSea> eMMC has 4 hardware partitions (not all may exist on your instance): boot0, boot1, RPMB, and user.
<Armbian-Discord> <M​anoftheSea> it may ALSO have software partitions in the hardware partitions.
<Armbian-Discord> <M​anoftheSea> I think the ideal of it is that the boot0 and boot1 partitions are used for the platform firmware (u-boot). However, I have no idea what it's supposed to be on any given device.
<Armbian-Discord> <D​arrilla> ok - for context, I can take an image from raspbian (it has two partitions), and directly copy it into emmc, and the board will boot with raspbian.
<Armbian-Discord> <D​arrilla> this same process does not work for armbian
<Armbian-Discord> <I​gorPec> boot loader is outside partitions and raspbian has probably some proprietary boot loader from allwinner
<Armbian-Discord> <M​anoftheSea> I'm confused at "raspbian" and "BPi". Raspbian is only for Raspi, no
<Armbian-Discord> <I​gorPec> yeah, but those vendors try to provide fake Raspbian
<Armbian-Discord> <M​anoftheSea> ugh.
<Armbian-Discord> <I​gorPec> like "its the same"
<Armbian-Discord> <M​anoftheSea> So, is the partition table MBR or GPT; Is there bootloader code in slack space; does the initrd or kernel need patches to boot?
<Armbian-Discord> <I​gorPec> i think @Darrilla needs to add support to u-boot as "banana pi p2 zero" might be a bit different then bananapi zero
<Armbian-Discord> <I​gorPec> i don't know what is the actual difference, but if u-boot config is not correct, its quite normal that it won't boot from eMMC
<Armbian-Discord> <I​gorPec> especially if support is disabled in u-boot, which is almost certainly the case
<Armbian-Discord> <I​gorPec> ofc it could be worse, like some strange eMMC that is not supported in u-boot (mainline, raspbian have allwinner boot loader)
<Armbian-Discord> <c​0rnelius> Thats because Raspbian is an actual distro. The RPI Foundation uses it, they aren't the developers for it. Which is why they changed the OS they use to raspios "or whatever its called now" because the Raspbian devs don't support arm64.
<Armbian-Discord> <D​arrilla> I just don't understand why it will boot from the SD card partition, but won't boot from emmc. I mentioned raspbian, but I also have used a debian image and even a buildroot image, and both of those also booted from emmc
<Armbian-Discord> <D​arrilla> Armbian has everything I need except I can't boot from emmc
<Armbian-Discord> <D​arrilla> Maybe I don't understand how uboot is installed
<Armbian-Discord> <M​anoftheSea> do the other ones use GPT
<Armbian-Discord> <M​anoftheSea> do you have access to serial, to check messages from u-boot?
<Armbian-Discord> <M​anoftheSea> Cuz I'm interested enough in u-boot to try and help, even if it's not armbian related
<Armbian-Discord> <I​gorPec> "I just don't understand why it will boot from the SD card partition, but won't boot from emmc" For this small difference https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-sunxi/board_nanopim1plus2/add-nanopi-m1-plus2-emmc.patch#L147
<Armbian-Discord> <I​gorPec> if u-boot is not compiled with support for eMMC, it will simply not boot from it
<Armbian-Discord> <D​arrilla> ok - but if it does boot from emmc for other images, doesn't that mean it has support for emmc?
<Armbian-Discord> <I​gorPec> u-boot on "raspbian" is 100% not the same as on armbian
<Armbian-Discord> <D​arrilla> Isn't uboot installed on the board itself, not part of whatever image?
<Armbian-Discord> <M​anoftheSea> depends on the compiled in u-boot, which is written where?
<Armbian-Discord> <I​gorPec> armbian provides everything
<Armbian-Discord> <M​anoftheSea> Do the other ones boot from emmc without an SD card?
<Armbian-Discord> <I​gorPec> from the moment you power the board
<Armbian-Discord> <I​gorPec> here https://u-boot.readthedocs.io/en/latest/board/allwinner/sunxi.html you can ready something about allwinner way
<Armbian-Discord> <M​anoftheSea> armbian writes u-boot to the SD card
<Armbian-Discord> <M​anoftheSea> for allwinner
<Armbian-Discord> <I​gorPec> and when you install it to emmc , it flashes the same binary files to emmc
<Armbian-Discord> <c​0rnelius> it appears someone submitted a patch for that to u-boot sometime ago, but it wasn't merged because the dts was not submitted to the kernel.
<Armbian-Discord> <M​anoftheSea> either version, SD or eMMC, if you have serial console you can see if u-boot can see the emmc. If it can't, it can't load the kernel/initrd from emmc. If it can, look for a problem elsewhere.
<Armbian-Discord> <M​anoftheSea> Get a serial console
<Armbian-Discord> <D​arrilla> ok - full disclosure, I had to patch armbian to see the emmc when booting from SD. +CONFIG_VIDEO_DE2=n
<Armbian-Discord> <D​arrilla> +CONFIG_MMC_SUNXI_SLOT_EXTRA=2
<Armbian-Discord> <D​arrilla> +CONFIG_SUN8I_EMAC=y
<Armbian-Discord> <D​arrilla> also, I had to patch the dts file sun8i-h2-plus-bananapi-m2-zero.dts
<Armbian-Discord> <D​arrilla> then, someone provided a dtb file sun8i-h2-plus-bananapi-m2-zero.dtb, which I copy to /boot/dtb after booting. Once I reboot, only then can I see the emmc
<Armbian-Discord> <D​arrilla> I guess this may explain it...
<Armbian-Discord> <I​gorPec> armbian is a build system and we don't have this hw listed as supported i think
<Armbian-Discord> <I​gorPec> which means nobody did those things you are doing right now
<Armbian-Discord> <D​arrilla> I would like to get this added, but I'm not really qualified (meaning I have no idea what I'm doing 😉
<Armbian-Discord> <I​gorPec> you are close 😉
<Armbian-Discord> <I​gorPec> those which are qualified don't have time 😦
<Armbian-Discord> <c​0rnelius> a lot of guess work but is somewhere to start. i can tell you u-boot compiled and the linux dtb is created without error.
<Armbian-Discord> <D​arrilla> I ashamed to admit I don't know what to do with these patch files.
<Armbian-Discord> <D​arrilla> I have been trying to apply, but it isn't working
<Armbian-Discord> <M​anoftheSea> there's a "patch" directory, which is controlled by armbian and has a list of patches to apply in a file controlled by git; and a userpatches directory which applies whatever it can find.
<Armbian-Discord> <M​anoftheSea> If your patches work in userpatches, then you add to github and the series file in a pull request.
<Armbian-Discord> <M​anoftheSea> I think I'm reading that the old DTB says there's no emmc, which Armbian's kernel believes and therefore doesn't load the driver to find eMMC and therefore doesn't find rootFS. While with the correct DTB (with sdhci status = okay) tells the linux kernel that there is an emmc. You could drop in the DTB to the written Armbian image, and see if that's the only change needed.
<Armbian-Discord> <M​anoftheSea> Also, if the "p2" DTB is only a change on the emmc, you might want to do a dtsi instead of a full copy.
<Armbian-Discord> <D​arrilla> thank you everyone. I must admit I have very little idea what most of this means. This is all new territory for me, so knowing what a DTB is, or dts, I can't really understand. I have not found anything that really explains any of this.
<Armbian-Discord> <M​anoftheSea> dts is a "device tree source", dtb is the compiled binary version. the -i extension is an incremental and includes the dts... and I want to say there's a dtbo that is an overlay, which patches the binary dtb.
<Armbian-Discord> <M​anoftheSea> These files are used to describe the hardware of a given board, because it cannot be auto-detected.