milkv-mars / mars-buildroot-sdk

Milk-V Mars Official buildroot SDK
19 stars 8 forks source link

Run Ubuntu 23.10 on Milk-V #1

Open ww898 opened 9 months ago

ww898 commented 9 months ago

Hi there, Is there manual to install Ubuntu 23.10 (see https://ubuntu.com/download/risc-v) on Milk-V? I tried "StarFive VisionFive 2" image (ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img) and the boot process failed. Can anybody help me with it?

U-Boot SPL 2021.10 (Oct 08 2023 - 17:13:43 +0800)
LPDDR4: 2G version: g8ad50857.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|___/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : ---
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Platform Suspend Device   : ---
Firmware Base             : 0x40000000
Firmware Size             : 392 KB
Firmware RW Offset        : 0x40000
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01          : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02          : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03          : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes
Domain0 SysSuspend        : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109

U-Boot 2021.10 (Oct 08 2023 - 17:13:43 +0800)

CPU:   rv64imacu_zba_zbb
Model: StarFive VisionFive V2
DRAM:  2 GiB
cdns3_bind: unsupported dr_mode
MMC:   sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : MILK-V
Product full SN: MARC-V10-2340-D002E032-0000067A
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:82:49
Ethernet MAC1 address: 6c:cf:39:00:82:4a
--------EEPROM INFO--------

In:    serial
Out:   serial
Err:   serial
Model: StarFive VisionFive V2
Net:   eth0: ethernet@16030000, eth1: ethernet@16040000
Hit any key to stop autoboot:  0
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc0(part 0) is current device
Try booting from MMC0 ...
** No partition table - mmc 0 **
Couldn't find partition mmc 0:3
Can't set block device
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
## Error: "boot2" not defined
starfive_pcie pcie@2B000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10

Device 0: unknown device

Device 0: unknown device
Tring booting distro ...
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc0(part 0) is current device
Try booting from MMC0 ...
** No partition table - mmc 0 **
Couldn't find partition mmc 0:3
Can't set block device
## Warning: defaulting to text format
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
** No partition table - mmc 0 **
Couldn't find partition mmc 0:3
Can't set block device
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
** No partition table - mmc 0 **
Couldn't find partition mmc 0:3
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
fatwrite - write file into a dos filesystem

Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]
    - write file 'filename' from the address 'addr' in RAM
      to 'dev' on 'interface'
Retrieving file: /extlinux/extlinux.conf
** No partition table - mmc 0 **
Couldn't find partition mmc 0:3
Can't set block device
Error reading config file

Device 0: unknown device

Device 0: unknown device
StarFive #
eshattow commented 8 months ago

You might try the u-boot command efidebug bootmgr

I don't think it would work, but there is an EFI System Partition so... something might happen.

$ sfdisk -l -J ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img
{
   "partitiontable": {
      "label": "gpt",
      "id": "929FFB77-0985-440B-8E6C-BBB8269ABC09",
      "device": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img",
      "unit": "sectors",
      "firstlba": 34,
      "lastlba": 9437150,
      "sectorsize": 512,
      "partitions": [
         {
            "node": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img1",
            "start": 253952,
            "size": 9183199,
            "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
            "uuid": "7B68C7C2-8B08-4D31-AF6D-8F13127433D0",
            "attrs": "LegacyBIOSBootable"
         },{
            "node": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img2",
            "start": 8192,
            "size": 32768,
            "type": "7A097280-70D2-44BC-886C-FF5FFBB7B098",
            "uuid": "426463FE-B76E-44F4-9140-495535FFB516",
            "name": "loader2"
         },{
            "node": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img12",
            "start": 40960,
            "size": 8192,
            "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4",
            "uuid": "E218E23D-26F3-4924-9CCF-696D9C61118C",
            "name": "CIDATA"
         },{
            "node": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img13",
            "start": 4096,
            "size": 4096,
            "type": "2E54B353-1271-4842-806F-E436D6AF6985",
            "uuid": "960D1817-69C8-4CCC-9CAD-5812D7531FE7",
            "name": "loader1"
         },{
            "node": "ubuntu-23.10-preinstalled-server-riscv64+visionfive2.img15",
            "start": 49152,
            "size": 204800,
            "type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
            "uuid": "BCE19F78-2A2E-430D-8BE9-295842194994",
            "name": "ESP"
         }
      ]
   }
}
ww898 commented 7 months ago

I ran Ubuntu on another StarFive VisionFive 2 board. The only problem was with u-boot (see https://wiki.ubuntu.com/RISC-V/StarFive%20VisionFive%202):

Vendor U-Boot releases are available at https://github.com/starfive-tech/VisionFive2/releases/. Or you can build U-Boot from the upstream source as described in the online documentation.

As both for with some vendor U-Boot releases as well as with the upstream U-Boot v2023.10 we found some issues we have prebuilt a binary package u-boot-starfive available in ppa:ubuntu-risc-v-team/release.

Ubuntu 23.10 is better than Debian because it has the new versions of libc/libstdc++.