The Milk-V Duo (CV1800B, 64MB) does not enable CONFIG_BOOTSTD_DEFAULTS
and has no environment file, so U-Boot has no bootcmd and none of the
kernel_addr_r, fdt_addr_r, ramdisk_addr_r, ... variables required by
the extlinux bootmeth.

Enable CONFIG_BOOTSTD_DEFAULTS and add a milkv_duo.env with a memory
layout that fits into the 64MB of DRAM:

  0x80200000  kernel_addr_r       (16MB)
  0x81200000  kernel_comp_addr_r  (16MB, Image.gz decompression)
  0x82200000  fdt_addr_r
  0x82300000  scriptaddr
  0x82400000  pxefile_addr_r
  0x82500000  ramdisk_addr_r

Also reduce CONFIG_STACK_SIZE to 1MB. LMB reserves CONFIG_STACK_SIZE
below the relocated stack pointer, and the default 16MB left only about
1.4MB between ramdisk_addr_r and the reserved region. With 1MB, about
16MB are available for an initrd.

This series depends on Zhuxu Ran's "riscv: sophgo: Use upstream
devicetrees for CV18xx boards" (v5), which sets CONFIG_DEFAULT_DEVICE_TREE
to sophgo/<board>, so that fdtfile matches the Linux devicetree install
path (sophgo/cv1800b-milkv-duo.dtb and sophgo/sg2002-milkv-duo256m.dtb).

Link: 
https://lore.kernel.org/all/[email protected]/

Tested on Milk-V Duo, booting Linux through "bootflow scan" and an
extlinux.conf on the SD card.

Signed-off-by: Hiago De Franco <[email protected]>
---
Changes in v2:
- Set CONFIG_BOOTMETH_EFI_BOOTMGR to y, as the default value.
- Updated the commit description of patch 2.
- Collected Yao Zi reviewed-by tags. 
- Link to v1: 
https://patch.msgid.link/[email protected]

To: [email protected]
Cc: Kongyang Liu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Hiago De Franco <[email protected]>
Cc: Yao Zi <[email protected]>

---
Hiago De Franco (3):
      board: sophgo: milkv_duo: add environment for standard boot
      configs: milkv_duo: enable BOOTSTD_DEFAULTS
      configs: milkv_duo: reduce CONFIG_STACK_SIZE to 1MB

 board/sophgo/milkv_duo/milkv_duo.env |  8 ++++++++
 configs/milkv_duo_defconfig          | 12 +++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
---
base-commit: f8eb3469e1a17c79b047b3fd38ae820e8816a115
change-id: 20260929-milkv-duo-bootstd-14de5e4e03ef
prerequisite-change-id: 20260702-milkv-duo-upstream-dts-b54aed41fc61:v5
prerequisite-patch-id: b8e6815314b7881a02de0066232864d522c4a26c
prerequisite-patch-id: 0df1fa5db1b2bff402b429809796bad99a517483
prerequisite-patch-id: 49e1e8263cf0a5ba8d63c8b598b6382cde5284b2
prerequisite-patch-id: 86dd30e784f022f0a7bb6fbf125c9699467176d4
prerequisite-patch-id: 49070c05ecf58331ec519a57d1b82f8b2b835a89
prerequisite-patch-id: 6b6881e45cc6de6544aaa4509db21611158f4fa1
prerequisite-patch-id: 7198127d4602eeb14212087ce9bb694d84e71a4c
prerequisite-patch-id: 3a58bd8a061707ff27b8538d4897def3b595dc36
prerequisite-patch-id: 9055ea941b73e35d1e825787d7eca14ffceb8e8b
prerequisite-patch-id: 554c1487e8d596e0099677ca88eee0021b1ffbae

Best regards,
--  
Hiago

Reply via email to