Custom `fip.bin` with `U-Boot 2025.01-rc4-00046-g429d4846ea2d` that boots to UEFI GRUB, for anyone interested

I have managed to compile a custom fip.bin for the CV1800B (64MB) Milk-V Duo boards, and have attached them below.

These binaries are part of my quest to get proper Gentoo running on the Milk-V boards.

The images look for /EFI/gentoo/grubriscv64.efi on the same partition, and loads them.

milkv-duo-64mb-boot-partition.tar.gz - hosted on file.io

I will write instructions (and hopefully a script) on how to make one yourself. Enjoy!

3 Likes

Thank you, I’m waiting your script or instructions.

1 Like

Unfortunately, I have encountered a roadblock…

The board will load GRUB via the U-boot bootefi command successfully, however GRUB will refuse to load anything into memory…

It throws the following error:

ERROR: Failed to allocate 0x203ac bytes below 0xffffffff.
Error: out of memory
Press any key to continue...

I have tried multiple kernels that should fit into the memory buffers defined by the standard Milk-V Duo fdt.

What I have discovered so far:

  • U-boot will happily load anything into memory between 0x80060000 and 0xffffff00
    • If you’re not used to reading hexadecimal memory addresses:
      • 0x80060000 = The 2,147,876,864th byte of RAM = 2,147,876,864
  • Loading anything outside of this range will cause an illegal read/write and reset the board
  • It doesn’t matter how small or large the kernel is, GRUB will refuse to load even a single byte

The output of bdinfo:

milkv_duo# bdinfo
boot_params = 0x0000000000000000
DRAM bank   = 0x0000000000000000
-> start    = 0x0000000080000000
-> size     = 0x0000000003f40000
flashstart  = 0x0000000000000000
flashsize   = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate    = 115200 bps
relocaddr   = 0x0000000083eba000
reloc off   = 0x0000000003cba000
Build       = 64-bit
Enable clock-controller@3002000 failed
failed to enable clock 0
Enable clock-controller@3002000 failed
failed to enable clock 0
Enable clock-controller@3002000 failed
failed to enable clock 0
Enable clock-controller@3002000 failed
failed to enable clock 0
current eth = unknown
eth-1addr   = (not set)
IP addr     = <NULL>
fdt_blob    = 0x0000000083677500
lmb_dump_all:
 memory.count = 0x1
 memory[0]	[0x80000000-0x83f3ffff], 0x3f40000 bytes, flags: none
 reserved.count = 0x3
 reserved[0]	[0x80000000-0x8005ffff], 0x60000 bytes, flags: no-map
 reserved[1]	[0x82674000-0x82676fff], 0x3000 bytes, flags: no-notify, no-overwrite
 reserved[2]	[0x826774f0-0x83f3ffff], 0x18c8b10 bytes, flags: no-overwrite
devicetree  = separate
serial addr = 0x0000000004140000
 width      = 0x0000000000000004
 shift      = 0x0000000000000002
 offset     = 0x0000000000000000
 clock      = 0x00000000017d7840
boot hart   = 0x0000000000000000
firmware fdt= 0x0000000080080000

I will keep experimenting, but in the meantime, does anyone know what to do here (to save me some time)?

1 Like