BPI-F3:Booting u-boot - kernel etc

Booting the system, learning u-boot. Trying alternate boot methods like TFTP. So muck work and so little progress.

At this point I’ve tried so many things.

Franco

This is not how it goes with (new) development boards … If you want to have less troubles, try Armbian build framework, where compilations are integrated and changing kernels is relatively simple (installing new deb package). But beware that target is very fresh (days) and there are issues. Not with Armbian - low level support is not that much different then what you are experiencing. I only boot device once, from SD card. From eMMC doesn’t work (yet).

Well I have mine booting from Emmc right now. That’s never been a problem, once I DD the FSBL and the EMMC bin to boot0 everything works…

The more digging I do the more I find. In the U-Boot documents it clearly shows that booting from other devices is supported even SSD.

I am trying to wipe the slate clean, not rely on bianbu or anything else for that matter.

The fact the documentation is horrible doesn’t help.

Franco

Booting an OS on NVMe is easier to achieve using SYSLINUX/EXTLINUX.

Patches I use: debian-image-builder/patches/uboot/v2022.10/bananapif3 at feature · pyavitz/debian-image-builder · GitHub

I suppose this can be done many ways, what I do is boot from SD, transfer the install from the SD to NVMe. Erase the eMMC and flash u-boot to it. Power down, pop out the SD and power back on.

patrick@bananapif3:~$ lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mmcblk2      179:0    0  14.6G  0 disk 
└─mmcblk2p1  179:1    0  14.5G  0 part 
mmcblk2boot0 179:8    0     4M  1 disk 
mmcblk2boot1 179:16   0     4M  1 disk 
zram0        250:0    0     1G  0 disk [SWAP]
nvme0n1      259:0    0 238.5G  0 disk 
├─nvme0n1p1  259:1    0   412M  0 part /boot
└─nvme0n1p2  259:2    0   238G  0 part /

The boot order: SD MMC NVME.

Thank you very much. I realize the docs have issues.

One think it doesn’t do for you when you image your SD card with bianbu or Armbian is expand the root partition to the full size.

That causes another issue because you can’t update patches because you have no space. All you need to do is run one simple command to fix that. Also the long explanation about mount a USB and getting the FSBL and EMMC files from there is really messed up.

I think I’ll make a youtube video on how to boot from emmc for those who can’t get it to work.

Also what my goal is to install Ubuntu 24.04 - That would be awesome!

Franco

Since when does Armbian not expand the ROOTFS?

Well when I’ve imaged from their website, booted from MicroSD card the first thing it says is that it has no space.

I was looking at your patches, I’ve been documenting everything on my github. Specifcally the k1-x file and how many options are not enabled. When reading the the documentation for u-boot there’s a lot that’s not there like:

CONFIG_USE_PREBOOT=y CONFIG_PREBOOT=“pci enum; usb start; scsi scan; nvme scan; virtio scan”

Franco

If you use the extlinux patch it won’t require the k1-x env file. It will basically make the unit boot like any other board and also adds overlay support. Of course there are things I haven’t tested U-BOOT wise, so I can’t speak to every feature that may be available in that ENV file.

Thanks.

Here’s the docs from this link: Booting from TPL/SPL — Das U-Boot unknown version documentation

NVMe

This methods load the image from an NVMe drive. Required configuration settings include:

  • CONFIG_SPL_PCI=y
  • CONFIG_SPL_PCI_PNP=y
  • CONFIG_SPL_NVME=y
  • CONFIG_SPL_NVME_PCI=y
  • CONFIG_SPL_NVME_BOOT_DEVICE (number of the NVMe device)
  • CONFIG_SYS_NVME_BOOT_PARTITION (partition to read from)

To load from a file system use:

  • CONFIG_SPL_FS_FAT=y or CONFIG_SPL_FS_EXT=y
  • CONFIG_SPL_FS_LOAD_PAYLOAD_NAME=””

I wanted to know if this worked, that’s the path I was going down.

Franco

I have no clue. Best I was able to do using the ENV file was boot from a partition on a SD or EMMC and have the ROOTFS located on the NVMe.

From what I can tell there is no way to just straight boot the NVMe using that file. Maybe it requires flashing to SPI? Which is something I haven’t figured out yet.

Thank you so much for your help. I just wanted to clarify some things. I can understand the changes to the source that are in the patches. So when you re-compile u-boot with the changes it will give you the files again like bootinfo_emmc.bin and FSBL.bin.

Are they still written to dev/mmvcblk2boot0 as they are in the docs like below?

echo 0 | sudo tee /sys/block/mmcblk2boot0/force_ro sudo dd if=bootinfo_emmc.bin of=/dev/mmcblk2boot0 sudo dd if=FSBL.bin of=/dev/mmcblk2boot0 seek=512 bs=1 sync

Thanks Franco

There seems to be diff ways and combinations of flashing the bins, but this is how I do it.

EMMC

echo 0 > /sys/block/mmcblk2boot0/force_ro
sleep .50
dd if="bootinfo_emmc.bin" of="/dev/mmcblk2boot0" bs=512 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk2boot0" bs=512 seek=1 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk2boot0" bs=512 seek=512 conv=notrunc
dd if="fw_dynamic.itb" of="/dev/mmcblk2" bs=512 seek=1280 conv=notrunc
dd if="u-boot.itb" of="/dev/mmcblk2" bs=512 seek=2048 conv=notrunc
sync

SDCARD

dd if="bootinfo_emmc.bin" of="/dev/mmcblk0" bs=512 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk0" bs=512 seek=1 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk0" bs=512 seek=512 conv=notrunc
dd if="fw_dynamic.itb" of="/dev/mmcblk0" bs=512 seek=1280 conv=notrunc
dd if="u-boot.itb" of="/dev/mmcblk0" bs=512 seek=2048 conv=notrunc
sync

EDIT: and yes, it will produce the same files using those patches.

If you want ubuntu from nvme, you may take a recent bianbu (or build one using the instructions here, copy the bootloader to the emmc and replace the u-boot configuration with one that sets root=/nvme0n1p{} in the final bootargs.

Once the upstreaming efforts complete things will get more smooth.

Patrick I have a few questions.

  • the patching files, it seems some files are patched and some not. Are these already part of a build tree because I am having issues running the diff git commands. When I’ve dug down more I see there are other directories that were created like patches/spacemit and so on. Can I not download the changed files already?

Next thing is during my build it never creates FW_PAYLOAD I specify FW_PAYLOAD=y when make is run, is it because all the patches have not been applied?.

Your system, are you booting from EMMC and using NVME or are you booting from SD card and using NVME?

Sorry for all the questions. Just need to understand it all.

Thanks Franco

My patches are meant to be patched against mainline; opensbi, u-boot and linux. If you are using the BPI or BL sources, you don’t need most of the patches I’m using. To make ur life easier I would either pull mainline u-boot v2022.10 or git clone the BL sources and only apply patches 020 thru 023.

BL: https://gitee.com/bianbu-linux

I have the eMMC partitioned with a 100MB offset and flashed with u-boot.

sudo patrick@bananapif3:~$ sudo fdisk -l
Disk /dev/mmcblk2: 14.56 GiB, 15634268160 bytes, 30535680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4787fb22

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk2p1      204800 30535679 30330880 14.5G 83 Linux

Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: KBG40ZNS256G NVMe KIOXIA 256GB          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7ffb5003

Device         Boot   Start       End   Sectors  Size Id Type
/dev/nvme0n1p1       204800   1048575    843776  412M 83 Linux
/dev/nvme0n1p2      1048576 500117503 499068928  238G 83 Linux

Thanks for the info!

Much appreciated. Franco

Precompiled bins if you want them; https://github.com/pyavitz/binary/releases/download/060420/bpi-f3-u-boot-syslinux.tar.xz

Thanks you’re awesome! Franco

Hi,

I’ve been trying to do that but not having any luck. I’m trying to boot a kernel from TFTP. Even though I’ve make the uImage from the kernel with mkimage it says it can’t read the kernel format. The kernel is not compressed. I really wish I didn’t have to deal with all this keys stuff for secure boot. I could care less about the box being hacked since I’m doing all the work.

I just want to the box to boot, SUPER EASY! I don’t care how I force the boot to work the way I want. When I see the partition structure of bianbu it just makes me mad. Who the heck make their partition in that way? No One!

I should just be able to run the installer from micro sd card and install what ever I want where I want to. Not have to deal with the constant issues that I’d dealing with.

Franco

Hi again,

I’m making progress on booting and it shows my nvme partitions. I think my env files wrong.

Can you share what’s in your file? Thanks Franco