All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
@ 2021-04-29  7:46 Thomas Petazzoni
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29  7:46 UTC (permalink / raw)
  To: buildroot

Hello,

The beta version of the Beagle-V RISC-V 64-bit platform has been
showing up at the front door of a few lucky people around the world in
the past days.

As I happen to be one of those lucky people, the obvious first thing
to do was to get a Buildroot defconfig for this platform, and so 48
hours after receiving the board, this is what this patch series does.

This patch series is also available at:

  https://github.com/tpetazzoni/buildroot/commits/beaglev

The first 3 patches are preparation patches for OpenSBI:

 - Add support for version configuration, very much like we have for
   the Linux kernel or U-Boot. Indeed, OpenSBI has platform-specific
   code, so it is very likely that people will need to use a
   non-upstream version.

 - Add support for using U-Boot as an OpenSBI payload, as an
   alternative to Linux.

 - Add support for enabling/disabling the installation of different
   OpenSBI image types, as the Beagle-V configuration doesn't build
   the fw_jump and fw_dynamic images.

The final patch obviously adds the Beagle-V defconfig and related
files themselves. A slight annoyance is that the bootloader
pre-flashed on the board doesn't work as-is, just due to an incorrect
fdt_addr_r environment variable value. So reflashing the bootloader
with what has been built by Buildroot is necessary (but is trivial to
do using Xmodem).

And to conclude, the complete boot log:

bootloader version:210209-4547a8d
ddr 0x00000000, 1M test
ddr 0x00100000, 2M test
DDR clk 2133M,Version: 210302-5aea32f
0 crc flash: 06a62dd7, crc ddr: 06a62dd7
crc check PASSED

bootloader.

OpenSBI v0.9
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : StarFive VIC7100
Platform Features         : timer,mfdeleg
Platform HART Count       : 2
Firmware Base             : 0x80000000
Firmware Size             : 92 KB
Runtime SBI Version       : 0.3

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*
Domain0 Region00          : 0x0000000080000000-0x000000008001ffff ()
Domain0 Region01          : 0x0000000000000000-0x0000007fffffffff (R,W,X)
Domain0 Next Address      : 0x0000000080200000
Domain0 Next Arg1         : 0x0000000088000000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART ISA             : rv64imafdcsux
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 36
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.04 (Apr 29 2021 - 00:09:33 +0200)

CPU:   rv64imafdc
DRAM:  8 GiB
MMC:   sdio0 at 10000000: 0, sdio1 at 10010000: 1
Net:   dwmac.10020000
Autoboot in 2 seconds
MMC CD is 0x0, force to True.
MMC CD is 0x0, force to True.
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
184 bytes read in 11 ms (15.6 KiB/s)
1:	linux
Retrieving file: /boot/Image
13403136 bytes read in 1488 ms (8.6 MiB/s)
append: console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
Retrieving file: /boot/starfive_vic7100_beagle_v.dtb
24782 bytes read in 12 ms (2 MiB/s)
Moving Image from 0x84000000 to 0x80200000, end=80f1b000
## Flattened Device Tree blob at 90000000
   Booting using the fdt blob at 0x90000000
   Using Device Tree in place at 0000000090000000, end 00000000900090cd

Starting kernel ...

[    0.000000] Linux version 5.10.6 (thomas at build1) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2021.02-881-g5fc534e0e7) 9.3.0, GNU ld (GNU Binutils) 2.35.2) #2 SMP Thu Apr 29 08:46:03 CEST 2021
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] efi: UEFI not found.
[    0.000000] Initial ramdisk at: 0x(____ptrval____) (99614720 bytes)
[    0.000000] OF: reserved mem: node linux,cma compatible matching fail
[    0.000000] Reserved memory: created DMA memory pool at 0x00000000f9000000, size 16 MiB
[    0.000000] OF: reserved mem: initialized node framebuffer at f9000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x00000000fb000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node framebuffer at fb000000, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000027fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x00000000f8ffffff]
[    0.000000]   node   0: [mem 0x00000000fa000000-0x00000000faffffff]
[    0.000000]   node   0: [mem 0x00000000fd000000-0x000000027fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] software IO TLB: mapped [mem 0x00000000c5000000-0x00000000c9000000] (64MB)
[    0.000000] SBI specification v0.3 detected
[    0.000000] SBI implementation ID=0x1 Version=0x9
[    0.000000] SBI v0.2 TIME extension detected
[    0.000000] SBI v0.2 IPI extension detected
[    0.000000] SBI v0.2 RFENCE extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] riscv: ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 17 pages/cpu s30952 r8192 d30488 u69632
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2055687
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 7312628K/8337408K available (4498K kernel code, 4429K rwdata, 2048K rodata, 222K init, 327K bss, 1024780K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]       fixmap : 0xffffffcefee00000 - 0xffffffceff000000   (2048 kB)
[    0.000000]       pci io : 0xffffffceff000000 - 0xffffffcf00000000   (  16 MB)
[    0.000000]      vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff   (4095 MB)
[    0.000000]      vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff   (65535 MB)
[    0.000000]       lowmem : 0xffffffe000000000 - 0xffffffe1ffe00000   (8190 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU debug extended QS entry/exit.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: disable L2 cache irq 128 in plic
[    0.000000] plic: disable L2 cache irq 131 in plic
[    0.000000] plic: disable L2 cache irq 129 in plic
[    0.000000] plic: disable L2 cache irq 130 in plic
[    0.000000] plic: disable L2 cache irq 128 in plic
[    0.000000] plic: disable L2 cache irq 131 in plic
[    0.000000] plic: disable L2 cache irq 129 in plic
[    0.000000] plic: disable L2 cache irq 130 in plic
[    0.000000] plic: plic at c000000: mapped 127 interrupts with 2 handlers for 4 contexts.
[    0.000000] random: get_random_bytes called from start_kernel+0x57c/0x6fa with crng_init=0
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x171024e6b, max_idle_ns: 440795202301 ns
[    0.000008] sched_clock: 64 bits at 6MHz, resolution 160ns, wraps every 4398046511040ns
[    0.000317] Console: colour dummy device 80x25
[    0.000418] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.50 BogoMIPS (lpj=62500)
[    0.000443] pid_max: default: 32768 minimum: 301
[    0.001254] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.001830] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.006048] rcu: Hierarchical SRCU implementation.
[    0.006698] EFI services will not be available.
[    0.007619] smp: Bringing up secondary CPUs ...
[    0.009401] smp: Brought up 1 node, 2 CPUs
[    0.012989] devtmpfs: initialized
[    0.019938] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.019990] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.021313] NET: Registered protocol family 16
[    0.036584] OF: /soc/i2c at 118b0000: could not find phandle
[    0.036738] OF: /soc/i2c at 118c0000: could not find phandle
[    0.036841] OF: /soc/i2c at 12450000: could not find phandle
[    0.040668] OF: /soc/i2c at 118b0000: could not find phandle
[    0.040954] OF: /soc/i2c at 118c0000: could not find phandle
[    0.041240] OF: /soc/i2c at 12450000: could not find phandle
[    0.052805] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.056547] starfive_gpio 11910000.gpio: SiFive GPIO chip registered 64 GPIOs
[    0.057534] SCSI subsystem initialized
[    0.058264] OF: /soc/i2c at 118b0000: could not find phandle
[    0.058305] i2c_designware 118b0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.058349] i2c_designware 118b0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.058368] i2c_designware 118b0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.058539] i2c_designware 118b0000.i2c: running with gpio recovery mode! scl,sda
[    0.059537] OF: /soc/i2c at 118c0000: could not find phandle
[    0.059580] i2c_designware 118c0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.059622] i2c_designware 118c0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.059641] i2c_designware 118c0000.i2c: Using 'clocks' : 49500000 / 1000
[    0.059853] i2c_designware 118c0000.i2c: running with gpio recovery mode! scl,sda
[    0.060534] OF: /soc/i2c at 12450000: could not find phandle
[    0.060580] i2c_designware 12450000.i2c: Using 'clocks' : 50000000 / 1000
[    0.060620] i2c_designware 12450000.i2c: Using 'clocks' : 50000000 / 1000
[    0.060638] i2c_designware 12450000.i2c: Using 'clocks' : 50000000 / 1000
[    0.060800] i2c_designware 12450000.i2c: running with gpio recovery mode! scl,sda
[    0.062763] clocksource: Switched to clocksource riscv_clocksource
[    0.083426] NET: Registered protocol family 2
[    0.084662] tcp_listen_portaddr_hash hash table entries: 4096 (order: 5, 163840 bytes, linear)
[    0.085495] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.088190] TCP bind hash table entries: 65536 (order: 9, 2097152 bytes, linear)
[    0.098334] TCP: Hash tables configured (established 65536 bind 65536)
[    0.099164] UDP hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.101065] UDP-Lite hash table entries: 4096 (order: 6, 393216 bytes, linear)
[    0.103406] NET: Registered protocol family 1
[    0.105381] RPC: Registered named UNIX socket transport module.
[    0.105407] RPC: Registered udp transport module.
[    0.105416] RPC: Registered tcp transport module.
[    0.105425] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.105820] Unpacking initramfs...
[    0.105863] Initramfs unpacking failed: invalid magic at start of compressed archive
[    0.543904] Freeing initrd memory: 97280K
[    0.545701] workingset: timestamp_bits=62 max_order=21 bucket_order=0
[    0.558816] NFS: Registering the id_resolver key type
[    0.558880] Key type id_resolver registered
[    0.558892] Key type id_legacy registered
[    0.559107] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.559183] ntfs: driver 2.1.32 [Flags: R/W].
[    0.560727] NET: Registered protocol family 38
[    0.560832] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.560848] io scheduler mq-deadline registered
[    0.560858] io scheduler kyber registered
[    0.571447] dw_axi_dmac_platform 100b0000.sgdma2p: DesignWare AXI DMA Controller, 4 channels
[    0.573770] dw_axi_dmac_platform 10500000.sgdma1p: DesignWare AXI DMA Controller, 16 channels
[    0.574591] L2CACHE: No. of Banks in the cache: 2
[    0.574614] L2CACHE: No. of ways per bank: 16
[    0.574622] L2CACHE: Sets per bank: 1024
[    0.574629] L2CACHE: Bytes per cache block: 64
[    0.574638] L2CACHE: Index of the largest way enabled: 0
[    0.708451] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.711619] printk: console [ttyS0] disabled
[    0.711756] 12440000.serial: ttyS0 at MMIO 0x12440000 (irq = 6, base_baud = 6250000) is a 16550A
[    1.531545] printk: console [ttyS0] enabled
[    1.538091] dw-apb-uart 11870000.hs_serial: detected caps 00000000 should be 00000100
[    1.546044] 11870000.hs_serial: ttyS1 at MMIO 0x11870000 (irq = 7, base_baud = 4640625) is a 16550
[    1.558915] vic-rng 118d0000.trng: Initialized
[    1.588146] loop: module loaded
[    1.593099] libphy: Fixed MDIO Bus: probed
[    1.598553] stmmaceth 10020000.gmac: IRQ eth_lpi not found
[    1.604297] stmmaceth 10020000.gmac: force_sf_dma_mode is ignored if force_thresh_dma_mode is set.
[    1.613390] stmmaceth 10020000.gmac: PTP uses main clock
[    1.618702] stmmaceth 10020000.gmac: no reset control found
[    1.624989] stmmaceth 10020000.gmac: User ID: 0x59, Synopsys ID: 0x37
[    1.631430] stmmaceth 10020000.gmac: 	DWMAC1000
[    1.636042] stmmaceth 10020000.gmac: DMA HW capability register supported
[    1.642865] stmmaceth 10020000.gmac: RX Checksum Offload Engine supported
[    1.649631] stmmaceth 10020000.gmac: COE Type 2
[    1.654184] stmmaceth 10020000.gmac: Wake-Up On Lan supported
[    1.659914] stmmaceth 10020000.gmac: Enhanced/Alternate descriptors
[    1.666189] stmmaceth 10020000.gmac: Enabled extended descriptors
[    1.672263] stmmaceth 10020000.gmac: Ring mode enabled
[    1.677415] stmmaceth 10020000.gmac: Enable RX Mitigation via HW Watchdog Timer
[    1.684761] stmmaceth 10020000.gmac: device MAC address 2c:f7:f1:1b:e3:4d
[    1.701766] libphy: stmmac: probed
[    1.705249] mdio_bus stmmac-0:07: attached PHY driver [unbound] (mii_bus:phy_addr=stmmac-0:07, irq=POLL)
[    1.717842] sdhci: Secure Digital Host Controller Interface driver
[    1.724091] sdhci: Copyright(c) Pierre Ossman
[    1.728509] Synopsys Designware Multimedia Card Interface Driver
[    1.734928] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.735451] dw_mmc 10000000.sdio0: IDMAC supports 32-bit address mode.
[    1.742472] NET: Registered protocol family 10
[    1.747382] dw_mmc 10000000.sdio0: Using internal DMA controller.
[    1.757755] dw_mmc 10000000.sdio0: Version ID is 290a
[    1.762995] dw_mmc 10000000.sdio0: DW MMC controller at irq 30,32 bit host data width,32 deep fifo
[    1.772087] mmc_host mmc0: card is polling.
[    1.773896] Segment Routing with IPv6
[    1.777086] dw_mmc 10010000.sdio1: IDMAC supports 32-bit address mode.
[    1.780076] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.786550] dw_mmc 10010000.sdio1: Using internal DMA controller.
[    1.793685] NET: Registered protocol family 17
[    1.798601] dw_mmc 10010000.sdio1: Version ID is 290a
[    1.803441] 9pnet: Installing 9P2000 support
[    1.808084] dw_mmc 10010000.sdio1: DW MMC controller at irq 31,32 bit host data width,32 deep fifo
[    1.812396] Key type dns_resolver registered
[    1.821368] mmc_host mmc1: card is non-removable.
[    1.825859] debug_vm_pgtable: [debug_vm_pgtable         ]: Validating architecture page table helpers
[    1.844465] dw-apb-uart 12440000.serial: forbid DMA for kernel console
[    1.992817] mmc_host mmc0: Bus speed (slot 0) = 100000000Hz (slot req 400000Hz, actual 400000HZ div = 125)
[    2.042794] mmc_host mmc1: Bus speed (slot 0) = 100000000Hz (slot req 400000Hz, actual 400000HZ div = 125)
[    2.245826] mmc0: Problem switching card into high-speed mode!
[    2.251679] mmc_host mmc0: Bus speed (slot 0) = 100000000Hz (slot req 10000000Hz, actual 10000000HZ div = 5)
[    2.261748] mmc0: new SDHC card at address 0001
[    2.270089] mmcblk0: mmc0:0001 SD16G 14.6 GiB 
[    2.294140] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    2.301344] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    2.308765] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    2.314886] GPT:Primary header thinks Alt. header is not at the end of the disk.
[    2.322271] GPT:122951 != 30547967
[    2.325741] GPT:Alternate GPT header not at the end of the disk.
[    2.331733] GPT:122951 != 30547967
[    2.335168] GPT: Use GNU Parted to correct GPT errors.
[    2.340460]  mmcblk0: p1
[    2.347067] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    2.355911] mmc1: queuing unknown CIS tuple 0x81 (9 bytes)
[    2.365061] EXT4-fs (mmcblk0p1): INFO: recovery required on readonly filesystem
[    2.372368] EXT4-fs (mmcblk0p1): write access will be enabled during recovery
[    2.389610] random: fast init done
[    2.441308] mmc_host mmc1: Bus speed (slot 0) = 100000000Hz (slot req 10000000Hz, actual 10000000HZ div = 5)
[    2.461770] mmc1: new high speed SDIO card@address 0001
[    2.613428] EXT4-fs (mmcblk0p1): recovery complete
[    2.627976] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[    2.636240] VFS: Mounted root (ext4 filesystem) readonly on device 179:1.
[    2.644948] devtmpfs: mounted
[    2.648879] Freeing unused kernel memory: 220K
[    2.653805] Run /sbin/init as init process
[    2.928090] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator: OK
Saving random seed: [    3.150191] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: OK

Welcome to Buildroot
buildroot login: root
# uname -a
Linux buildroot 5.10.6 #2 SMP Thu Apr 29 08:46:03 CEST 2021 riscv64 GNU/Linux
# cat /proc/cpuinfo 
processor	: 0
hart		: 1
isa		: rv64imafdc
mmu		: sv39
uarch		: starfive,rocket0

processor	: 1
hart		: 0
isa		: rv64imafdc
mmu		: sv39
uarch		: starfive,rocket0

# 

Thomas

Thomas Petazzoni (4):
  boot/opensbi: add support for version configuration
  boot/opensbi: allow using U-Boot as a payload
  boot/opensbi: add options to enable/disable image installation
  configs/beaglev_defconfig: new defconfig

 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 +++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 86 +++++++++++++++++++
 boot/opensbi/Config.in                        | 78 +++++++++++++++++
 boot/opensbi/opensbi.mk                       | 39 +++++++--
 configs/beaglev_defconfig                     | 35 ++++++++
 9 files changed, 307 insertions(+), 5 deletions(-)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig

-- 
2.30.2

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
@ 2021-04-29  7:46 ` Thomas Petazzoni
  2021-04-29 12:45   ` Bin Meng
                     ` (2 more replies)
  2021-04-29  7:46 ` [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload Thomas Petazzoni
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29  7:46 UTC (permalink / raw)
  To: buildroot

OpenSBI contains platform-specific code, so very much like Linux,
U-Boot or other bootloaders, using the upstream version of OpenSBI
will very often not be sufficient.

This commit therefore adds the possibility of specifying a custom
version of OpenSBI, either custom from upstream, custom tarball, or
custom from Git. Support for other version control systems has not
been implemented for now, but could be added later if needed.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 boot/opensbi/Config.in  | 51 +++++++++++++++++++++++++++++++++++++++++
 boot/opensbi/opensbi.mk | 19 ++++++++++++++-
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index b9b0ace8af..83f40f04fa 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -13,6 +13,57 @@ config BR2_TARGET_OPENSBI
 	  https://github.com/riscv/opensbi.git
 
 if BR2_TARGET_OPENSBI
+choice
+	prompt "OpenSBI Version"
+	help
+	  Select the specific OpenSBI version you want to use
+
+config BR2_TARGET_OPENSBI_LATEST_VERSION
+	bool "0.8"
+
+config BR2_TARGET_OPENSBI_CUSTOM_VERSION
+	bool "Custom version"
+	help
+	  This option allows to use a specific official versions
+
+config BR2_TARGET_OPENSBI_CUSTOM_TARBALL
+	bool "Custom tarball"
+
+config BR2_TARGET_OPENSBI_CUSTOM_GIT
+	bool "Custom Git repository"
+
+endchoice
+
+config BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE
+	string "OpenSBI version"
+	depends on BR2_TARGET_OPENSBI_CUSTOM_VERSION
+
+config BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION
+	string "URL of custom OpenSBI tarball"
+	depends on BR2_TARGET_OPENSBI_CUSTOM_TARBALL
+
+if BR2_TARGET_OPENSBI_CUSTOM_GIT
+
+config BR2_TARGET_OPENSBI_CUSTOM_REPO_URL
+	string "URL of custom repository"
+
+config BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION
+	string "Custom repository version"
+	help
+	  Revision to use in the typical format used by Git. E.G. a
+	  sha id, a tag, branch, ..
+
+endif
+
+config BR2_TARGET_OPENSBI_VERSION
+	string
+	default "0.8"	if BR2_TARGET_OPENSBI_LATEST_VERSION
+	default BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE \
+		if BR2_TARGET_OPENSBI_CUSTOM_VERSION
+	default "custom"	if BR2_TARGET_OPENSBI_CUSTOM_TARBALL
+	default BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION \
+		if BR2_TARGET_OPENSBI_CUSTOM_GIT
+
 config BR2_TARGET_OPENSBI_PLAT
 	string "OpenSBI Platform"
 	default ""
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index 60b87c268d..250a6078af 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -4,13 +4,30 @@
 #
 ################################################################################
 
-OPENSBI_VERSION = 0.8
+OPENSBI_VERSION = $(call qstrip,$(BR2_TARGET_OPENSBI_VERSION))
+
+ifeq ($(OPENSBI_VERSION),custom)
+# Handle custom OpenSBI tarballs as specified by the configuration
+OPENSBI_TARBALL = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION))
+OPENSBI_SITE = $(patsubst %/,%,$(dir $(OPENSBI_TARBALL)))
+OPENSBI_SOURCE = $(notdir $(OPENSBI_TARBALL))
+else ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_GIT),y)
+OPENSBI_SITE = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_REPO_URL))
+OPENSBI_SITE_METHOD = git
+else
+# Handle official OpenSBI versions
 OPENSBI_SITE = $(call github,riscv,opensbi,v$(OPENSBI_VERSION))
+endif
+
 OPENSBI_LICENSE = BSD-2-Clause
 OPENSBI_LICENSE_FILES = COPYING.BSD
 OPENSBI_INSTALL_TARGET = NO
 OPENSBI_INSTALL_STAGING = YES
 
+ifeq ($(BR2_TARGET_OPENSBI)$(BR2_TARGET_OPENSBI_LATEST_VERSION),y)
+BR_NO_CHECK_HASH_FOR += $(OPENSBI_SOURCE)
+endif
+
 OPENSBI_MAKE_ENV = \
 	CROSS_COMPILE=$(TARGET_CROSS)
 
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
@ 2021-04-29  7:46 ` Thomas Petazzoni
  2021-04-29 12:45   ` Bin Meng
  2021-04-30  7:49   ` Peter Korsgaard
  2021-04-29  7:46 ` [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29  7:46 UTC (permalink / raw)
  To: buildroot

The opensbi package already allows to use Linux as a payload for
OpenSBI, but in some cases, U-Boot as payload is useful. This commit
adds a BR2_TARGET_OPENSBI_UBOOT_PAYLOAD option, modeled after the
existing BR2_TARGET_OPENSBI_LINUX_PAYLOAD.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 boot/opensbi/Config.in  | 7 +++++++
 boot/opensbi/opensbi.mk | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index 83f40f04fa..236bf74a90 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -82,4 +82,11 @@ config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
 	help
 	  Build OpenSBI with the Linux kernel as a Payload.
 
+config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
+	bool "Include U-Boot as OpenSBI Payload"
+	depends on BR2_TARGET_OPENSBI_PLAT != ""
+	depends on BR2_TARGET_UBOOT
+	help
+	  Build OpenSBI with the U-Boot as a Payload.
+
 endif
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index 250a6078af..8ebe4566fd 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -41,6 +41,11 @@ OPENSBI_DEPENDENCIES += linux
 OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/Image"
 endif
 
+ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
+OPENSBI_DEPENDENCIES += uboot
+OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/u-boot.bin"
+endif
+
 define OPENSBI_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
@@ -51,6 +56,9 @@ OPENSBI_FW_IMAGES += jump dynamic
 ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
 OPENSBI_FW_IMAGES += payload
 endif
+ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
+OPENSBI_FW_IMAGES = payload
+endif
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
  2021-04-29  7:46 ` [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload Thomas Petazzoni
@ 2021-04-29  7:46 ` Thomas Petazzoni
  2021-04-29 12:39   ` Bin Meng
  2021-04-29  7:46 ` [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29  7:46 UTC (permalink / raw)
  To: buildroot

Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified,
opensbi.mk was assuming that both fw_jump and fw_dynamic would be
produced. However, this is not the case: the OpenSBI per-platform
config.mk can decide which image to build.

As an example, the config.mk for VIC7100-based BeagleV only enables
producing the fw_payload image.

This commit adds three options to enable the installation of images:
one for fw_jump, one for fw_dynamic, one for fw_payload.

The options for fw_jump and fw_dynamic are "default y" when
BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.

The option for fw_payload is forcefully selected when either Linux or
U-Boot are selected as payloads.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 boot/opensbi/Config.in  | 20 ++++++++++++++++++++
 boot/opensbi/opensbi.mk | 16 ++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
index 236bf74a90..fb7c86d398 100644
--- a/boot/opensbi/Config.in
+++ b/boot/opensbi/Config.in
@@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
 	  the platform specific static library libplatsbi.a and firmware
 	  examples are built.
 
+config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
+	bool "Install jump image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_jump image.
+
+config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
+	bool "Install fw_dynamic image"
+	default y if BR2_TARGET_OPENSBI_PLAT != ""
+	help
+	  This installs the fw_dynamic image.
+
+config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
+	bool "Install fw_payload image"
+	help
+	  This option enables the installation of the fw_paylaod
+	  image.
+
 config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
 	bool "Include Linux as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_LINUX_KERNEL_IMAGE
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the Linux kernel as a Payload.
 
@@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
 	bool "Include U-Boot as OpenSBI Payload"
 	depends on BR2_TARGET_OPENSBI_PLAT != ""
 	depends on BR2_TARGET_UBOOT
+	select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
 	help
 	  Build OpenSBI with the U-Boot as a Payload.
 
diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
index 8ebe4566fd..ee562dff53 100644
--- a/boot/opensbi/opensbi.mk
+++ b/boot/opensbi/opensbi.mk
@@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
 endef
 
-ifneq ($(OPENSBI_PLAT),)
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
 OPENSBI_INSTALL_IMAGES = YES
-OPENSBI_FW_IMAGES += jump dynamic
-ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
-OPENSBI_FW_IMAGES += payload
+OPENSBI_FW_IMAGES += jump
 endif
-ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
-OPENSBI_FW_IMAGES = payload
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += dynamic
 endif
+
+ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
+OPENSBI_INSTALL_IMAGES = YES
+OPENSBI_FW_IMAGES += payload
 endif
 
 define OPENSBI_INSTALL_IMAGES_CMDS
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2021-04-29  7:46 ` [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
@ 2021-04-29  7:46 ` Thomas Petazzoni
  2021-04-29 12:44   ` Bin Meng
  2021-05-01 14:37   ` Frank Hunleth
  2021-04-29 12:39 ` [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Erico Nunes
  2021-04-30  8:27 ` Drew Fustini
  5 siblings, 2 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29  7:46 UTC (permalink / raw)
  To: buildroot

This commit introduces support for the RISC-V based Beagle-V platform,
which uses a Starfive VIC-7100.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  2 +
 board/beaglev/extlinux.conf                   |  4 +
 board/beaglev/genimage.cfg                    | 12 +++
 ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 +++++++++
 board/beaglev/post-build.sh                   | 17 ++++
 board/beaglev/readme.txt                      | 86 +++++++++++++++++++
 configs/beaglev_defconfig                     | 35 ++++++++
 7 files changed, 195 insertions(+)
 create mode 100644 board/beaglev/extlinux.conf
 create mode 100644 board/beaglev/genimage.cfg
 create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
 create mode 100755 board/beaglev/post-build.sh
 create mode 100644 board/beaglev/readme.txt
 create mode 100644 configs/beaglev_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index 573d8d84de..cec63a3715 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2602,10 +2602,12 @@ F:	package/xorcurses/
 
 N:	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 F:	arch/Config.in.arm
+F:	board/beaglev/
 F:	board/stmicroelectronics/stm32mp157c-dk2/
 F:	boot/boot-wrapper-aarch64/
 F:	boot/grub2/
 F:	boot/gummiboot/
+F:	configs/beaglev_defconfig
 F:	configs/stm32mp157c_dk2_defconfig
 F:	package/android-tools/
 F:	package/b43-firmware/
diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
new file mode 100644
index 0000000000..c5444d094c
--- /dev/null
+++ b/board/beaglev/extlinux.conf
@@ -0,0 +1,4 @@
+label linux
+  kernel /boot/Image
+  devicetree /boot/starfive_vic7100_beagle_v.dtb
+  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
new file mode 100644
index 0000000000..f38bb7f86c
--- /dev/null
+++ b/board/beaglev/genimage.cfg
@@ -0,0 +1,12 @@
+image sdcard.img {
+  hdimage {
+    gpt = true
+  }
+
+  partition rootfs {
+    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
+    bootable = "true"
+    image = "rootfs.ext4"
+  }
+}
diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
new file mode 100644
index 0000000000..74d70f2721
--- /dev/null
+++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
@@ -0,0 +1,39 @@
+From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Wed, 28 Apr 2021 22:58:45 +0200
+Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
+
+The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
+boots. Using 0x90000000 works fine.
+
+Since it would overlap with the kernel_comp_addr_r area, this one is
+moved 16 MB further, at 0x91000000.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ include/configs/starfive-vic7100.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
+index 8c5915a73c..7150a23873 100644
+--- a/include/configs/starfive-vic7100.h
++++ b/include/configs/starfive-vic7100.h
+@@ -111,13 +111,13 @@
+ 	"fdt_high=0xffffffffffffffff\0" \
+ 	"initrd_high=0xffffffffffffffff\0" \
+ 	"kernel_addr_r=0x84000000\0" \
+-	"fdt_addr_r=0x88000000\0" \
++	"fdt_addr_r=0x90000000\0" \
+ 	"scriptaddr=0x88100000\0" \
+ 	"script_offset_f=0x1fff000\0" \
+ 	"script_size_f=0x1000\0" \
+ 	"pxefile_addr_r=0x88200000\0" \
+ 	"ramdisk_addr_r=0x88300000\0" \
+-	"kernel_comp_addr_r=0x90000000\0" \
++	"kernel_comp_addr_r=0x91000000\0" \
+ 	"kernel_comp_size=0x10000000\0" \
+ 	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
+ 	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
+-- 
+2.30.2
+
diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
new file mode 100755
index 0000000000..0e7337c96d
--- /dev/null
+++ b/board/beaglev/post-build.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+BOARD_DIR=$(dirname $0)
+
+# The DTB to use is provided within the U-Boot source tree, so we grab
+# it from there, and install it to TARGET_DIR/boot/.
+UBOOT_DIR=$(make --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
+install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
+	${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
+
+# Bring the extlinux.conf file in.
+install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
+	${TARGET_DIR}/boot/extlinux/extlinux.conf
+
+# To be reflashed through Xmodem, the bootloader needs to be prepended
+# with a 4-byte header that contains the total size of the file.
+perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.flash
+cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.flash
diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
new file mode 100644
index 0000000000..903dd7975e
--- /dev/null
+++ b/board/beaglev/readme.txt
@@ -0,0 +1,86 @@
+Beagle-V
+========
+
+Beagle-V is a low-cost RISC-V 64-bit based platform, powered by a
+Starfive VIC-7100 processor.
+
+How to build
+============
+
+$ make beaglev_defconfig
+$ make
+
+Build results
+=============
+
+After building, output/images contains:
+
++ Image
++ fw_payload.bin
++ fw_payload.bin.flash
++ fw_payload.elf
++ rootfs.ext2
++ rootfs.ext4
++ sdcard.img
++ u-boot.bin
+
+The two important files are:
+
+ - fw_payload.bin.flash, which is the bootloader image, containing
+   both OpenSBI and U-Boot.
+
+ - sdcard.img, the SD card image, which contains the root filesystem,
+   kernel image and Device Tree.
+
+Flashing the SD card image
+==========================
+
+$ sudo dd if=output/images/sdcard.img of=/dev/sdX
+
+Preparing the board
+===================
+
+Connect the Beagle-V fan to the 5V supply (pin 2 or 4 of the GPIO
+connector) and GND (pin 6 of the GPIO connector).
+
+Connect a TTL UART cable to pin 8 (TX), 10 (RX) and 14 (GND).
+
+Insert your SD card.
+
+Power-up the board using an USB-C cable.
+
+Flashing the bootloader
+=======================
+
+The bootloader pre-flashed on the Beagle-V has a non-working
+fdt_addr_r environment variable value, so it won't work
+as-is. Reflashing the bootloader with the bootloader image produced by
+Buildroot is necessary.
+
+When the board starts up, a pre-loader shows a count down of 2
+seconds, interrupt by pressing any key. You should reach a menu like
+this:
+
+--------8<----------
+
+bootloader version:210209-4547a8d
+ddr 0x00000000, 1M test
+ddr 0x00100000, 2M test
+DDR clk 2133M,Version: 210302-5aea32f
+0
+***************************************************
+*************** FLASH PROGRAMMING *****************
+***************************************************
+
+0:update uboot
+1:quit
+select the function:
+
+--------8<----------
+
+Press 0 and Enter. You will now see "C" characters being
+displayed. Ask your serial port communication program to send
+fw_payload.bin.flash using the Xmodem protocol.
+
+After reflashing is complete, restart the board, it will automatically
+start the system from the SD card, and reach the login prompt.
diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
new file mode 100644
index 0000000000..097d4c5302
--- /dev/null
+++ b/configs/beaglev_defconfig
@@ -0,0 +1,35 @@
+BR2_riscv=y
+BR2_riscv_custom=y
+BR2_RISCV_ISA_CUSTOM_RVM=y
+BR2_RISCV_ISA_CUSTOM_RVF=y
+BR2_RISCV_ISA_CUSTOM_RVD=y
+BR2_RISCV_ISA_CUSTOM_RVC=y
+BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"
+BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
+# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
+# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
+BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+# HEAD of the Fedora branch
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
+BR2_PACKAGE_HOST_GENIMAGE=y
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2021-04-29  7:46 ` [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
@ 2021-04-29 12:39 ` Erico Nunes
  2021-04-29 13:01   ` Thomas Petazzoni
  2021-04-30  0:35   ` Drew Fustini
  2021-04-30  8:27 ` Drew Fustini
  5 siblings, 2 replies; 23+ messages in thread
From: Erico Nunes @ 2021-04-29 12:39 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 9:47 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> slight annoyance is that the bootloader
> pre-flashed on the board doesn't work as-is, just due to an incorrect
> fdt_addr_r environment variable value. So reflashing the bootloader
> with what has been built by Buildroot is necessary (but is trivial to
> do using Xmodem).

I would like to try this but I have some questions:
Are you able to still boot the reference Fedora image after flashing
the custom bootloader?
Also, if it is just a matter of updating fdt_addr_r, could it just be
updated in the u-boot environment instead?
And finally, should that be reported as an issue in the starfive
u-boot so maybe they can release another build with that fixed?

Thanks

Erico

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation
  2021-04-29  7:46 ` [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
@ 2021-04-29 12:39   ` Bin Meng
  0 siblings, 0 replies; 23+ messages in thread
From: Bin Meng @ 2021-04-29 12:39 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:48 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Until now, whenever a BR2_TARGET_OPENSBI_PLAT value was specified,
> opensbi.mk was assuming that both fw_jump and fw_dynamic would be
> produced. However, this is not the case: the OpenSBI per-platform
> config.mk can decide which image to build.
>
> As an example, the config.mk for VIC7100-based BeagleV only enables
> producing the fw_payload image.
>
> This commit adds three options to enable the installation of images:
> one for fw_jump, one for fw_dynamic, one for fw_payload.
>
> The options for fw_jump and fw_dynamic are "default y" when
> BR2_TARGET_OPENSBI_PLAT is not empty, to preserve existing behavior.
>
> The option for fw_payload is forcefully selected when either Linux or
> U-Boot are selected as payloads.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  boot/opensbi/Config.in  | 20 ++++++++++++++++++++
>  boot/opensbi/opensbi.mk | 16 ++++++++++------
>  2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
> index 236bf74a90..fb7c86d398 100644
> --- a/boot/opensbi/Config.in
> +++ b/boot/opensbi/Config.in
> @@ -74,11 +74,30 @@ config BR2_TARGET_OPENSBI_PLAT
>           the platform specific static library libplatsbi.a and firmware
>           examples are built.
>
> +config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
> +       bool "Install jump image"

s/jump/fw_jump

> +       default y if BR2_TARGET_OPENSBI_PLAT != ""
> +       help
> +         This installs the fw_jump image.
> +
> +config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG

nits: I would list this config option before the JUMP one, to follow
alphabetical order

> +       bool "Install fw_dynamic image"
> +       default y if BR2_TARGET_OPENSBI_PLAT != ""
> +       help
> +         This installs the fw_dynamic image.
> +
> +config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
> +       bool "Install fw_payload image"
> +       help
> +         This option enables the installation of the fw_paylaod
> +         image.
> +
>  config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
>         bool "Include Linux as OpenSBI Payload"
>         depends on BR2_TARGET_OPENSBI_PLAT != ""
>         depends on BR2_LINUX_KERNEL
>         depends on BR2_LINUX_KERNEL_IMAGE
> +       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
>         help
>           Build OpenSBI with the Linux kernel as a Payload.
>
> @@ -86,6 +105,7 @@ config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
>         bool "Include U-Boot as OpenSBI Payload"
>         depends on BR2_TARGET_OPENSBI_PLAT != ""
>         depends on BR2_TARGET_UBOOT
> +       select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
>         help
>           Build OpenSBI with the U-Boot as a Payload.
>
> diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
> index 8ebe4566fd..ee562dff53 100644
> --- a/boot/opensbi/opensbi.mk
> +++ b/boot/opensbi/opensbi.mk
> @@ -50,15 +50,19 @@ define OPENSBI_BUILD_CMDS
>         $(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
>  endef
>
> -ifneq ($(OPENSBI_PLAT),)
> +ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
>  OPENSBI_INSTALL_IMAGES = YES
> -OPENSBI_FW_IMAGES += jump dynamic
> -ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
> -OPENSBI_FW_IMAGES += payload
> +OPENSBI_FW_IMAGES += jump
>  endif
> -ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
> -OPENSBI_FW_IMAGES = payload
> +
> +ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)

ditto

> +OPENSBI_INSTALL_IMAGES = YES
> +OPENSBI_FW_IMAGES += dynamic
>  endif
> +
> +ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
> +OPENSBI_INSTALL_IMAGES = YES
> +OPENSBI_FW_IMAGES += payload
>  endif
>
>  define OPENSBI_INSTALL_IMAGES_CMDS
> --
> 2.30.2

Regards,
Bin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig
  2021-04-29  7:46 ` [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
@ 2021-04-29 12:44   ` Bin Meng
  2021-05-01 14:37   ` Frank Hunleth
  1 sibling, 0 replies; 23+ messages in thread
From: Bin Meng @ 2021-04-29 12:44 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:48 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit introduces support for the RISC-V based Beagle-V platform,
> which uses a Starfive VIC-7100.

nits: the official name should be JH7100

>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  DEVELOPERS                                    |  2 +
>  board/beaglev/extlinux.conf                   |  4 +
>  board/beaglev/genimage.cfg                    | 12 +++
>  ...s-starfive-vic7100-adjust-fdt_addr_r.patch | 39 +++++++++
>  board/beaglev/post-build.sh                   | 17 ++++
>  board/beaglev/readme.txt                      | 86 +++++++++++++++++++
>  configs/beaglev_defconfig                     | 35 ++++++++
>  7 files changed, 195 insertions(+)
>  create mode 100644 board/beaglev/extlinux.conf
>  create mode 100644 board/beaglev/genimage.cfg
>  create mode 100644 board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
>  create mode 100755 board/beaglev/post-build.sh
>  create mode 100644 board/beaglev/readme.txt
>  create mode 100644 configs/beaglev_defconfig
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 573d8d84de..cec63a3715 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2602,10 +2602,12 @@ F:      package/xorcurses/
>
>  N:     Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  F:     arch/Config.in.arm
> +F:     board/beaglev/
>  F:     board/stmicroelectronics/stm32mp157c-dk2/
>  F:     boot/boot-wrapper-aarch64/
>  F:     boot/grub2/
>  F:     boot/gummiboot/
> +F:     configs/beaglev_defconfig
>  F:     configs/stm32mp157c_dk2_defconfig
>  F:     package/android-tools/
>  F:     package/b43-firmware/
> diff --git a/board/beaglev/extlinux.conf b/board/beaglev/extlinux.conf
> new file mode 100644
> index 0000000000..c5444d094c
> --- /dev/null
> +++ b/board/beaglev/extlinux.conf
> @@ -0,0 +1,4 @@
> +label linux
> +  kernel /boot/Image
> +  devicetree /boot/starfive_vic7100_beagle_v.dtb
> +  append console=ttyS0,115200 earlyprintk root=PARTUUID=0fef845a-c6e1-45bc-82f7-002fa720f958 rootwait
> diff --git a/board/beaglev/genimage.cfg b/board/beaglev/genimage.cfg
> new file mode 100644
> index 0000000000..f38bb7f86c
> --- /dev/null
> +++ b/board/beaglev/genimage.cfg
> @@ -0,0 +1,12 @@
> +image sdcard.img {
> +  hdimage {
> +    gpt = true
> +  }
> +
> +  partition rootfs {
> +    partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
> +    partition-uuid = 0fef845a-c6e1-45bc-82f7-002fa720f958
> +    bootable = "true"
> +    image = "rootfs.ext4"
> +  }
> +}
> diff --git a/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> new file mode 100644
> index 0000000000..74d70f2721
> --- /dev/null
> +++ b/board/beaglev/patches/uboot/0001-include-configs-starfive-vic7100-adjust-fdt_addr_r.patch
> @@ -0,0 +1,39 @@
> +From 2c4c813940c577590f3352cef0c49a8def17905d Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +Date: Wed, 28 Apr 2021 22:58:45 +0200
> +Subject: [PATCH] include/configs/starfive-vic7100: adjust fdt_addr_r
> +
> +The default fdt_addr_r of 0x88000000 doesn't work, the kernel never
> +boots. Using 0x90000000 works fine.
> +
> +Since it would overlap with the kernel_comp_addr_r area, this one is
> +moved 16 MB further, at 0x91000000.
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +---
> + include/configs/starfive-vic7100.h | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/include/configs/starfive-vic7100.h b/include/configs/starfive-vic7100.h
> +index 8c5915a73c..7150a23873 100644
> +--- a/include/configs/starfive-vic7100.h
> ++++ b/include/configs/starfive-vic7100.h
> +@@ -111,13 +111,13 @@
> +       "fdt_high=0xffffffffffffffff\0" \
> +       "initrd_high=0xffffffffffffffff\0" \
> +       "kernel_addr_r=0x84000000\0" \
> +-      "fdt_addr_r=0x88000000\0" \
> ++      "fdt_addr_r=0x90000000\0" \
> +       "scriptaddr=0x88100000\0" \
> +       "script_offset_f=0x1fff000\0" \
> +       "script_size_f=0x1000\0" \
> +       "pxefile_addr_r=0x88200000\0" \
> +       "ramdisk_addr_r=0x88300000\0" \
> +-      "kernel_comp_addr_r=0x90000000\0" \
> ++      "kernel_comp_addr_r=0x91000000\0" \
> +       "kernel_comp_size=0x10000000\0" \
> +       "type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
> +       "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
> +--
> +2.30.2
> +
> diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
> new file mode 100755
> index 0000000000..0e7337c96d
> --- /dev/null
> +++ b/board/beaglev/post-build.sh
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +BOARD_DIR=$(dirname $0)
> +
> +# The DTB to use is provided within the U-Boot source tree, so we grab
> +# it from there, and install it to TARGET_DIR/boot/.
> +UBOOT_DIR=$(make --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')
> +install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
> +       ${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
> +
> +# Bring the extlinux.conf file in.
> +install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
> +       ${TARGET_DIR}/boot/extlinux/extlinux.conf
> +
> +# To be reflashed through Xmodem, the bootloader needs to be prepended
> +# with a 4-byte header that contains the total size of the file.
> +perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.flash
> +cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.flash
> diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
> new file mode 100644
> index 0000000000..903dd7975e
> --- /dev/null
> +++ b/board/beaglev/readme.txt
> @@ -0,0 +1,86 @@
> +Beagle-V
> +========
> +
> +Beagle-V is a low-cost RISC-V 64-bit based platform, powered by a
> +Starfive VIC-7100 processor.
> +
> +How to build
> +============
> +
> +$ make beaglev_defconfig
> +$ make
> +
> +Build results
> +=============
> +
> +After building, output/images contains:
> +
> ++ Image
> ++ fw_payload.bin
> ++ fw_payload.bin.flash
> ++ fw_payload.elf
> ++ rootfs.ext2
> ++ rootfs.ext4
> ++ sdcard.img
> ++ u-boot.bin
> +
> +The two important files are:
> +
> + - fw_payload.bin.flash, which is the bootloader image, containing
> +   both OpenSBI and U-Boot.
> +
> + - sdcard.img, the SD card image, which contains the root filesystem,
> +   kernel image and Device Tree.
> +
> +Flashing the SD card image
> +==========================
> +
> +$ sudo dd if=output/images/sdcard.img of=/dev/sdX
> +
> +Preparing the board
> +===================
> +
> +Connect the Beagle-V fan to the 5V supply (pin 2 or 4 of the GPIO
> +connector) and GND (pin 6 of the GPIO connector).
> +
> +Connect a TTL UART cable to pin 8 (TX), 10 (RX) and 14 (GND).
> +
> +Insert your SD card.
> +
> +Power-up the board using an USB-C cable.
> +
> +Flashing the bootloader
> +=======================
> +
> +The bootloader pre-flashed on the Beagle-V has a non-working
> +fdt_addr_r environment variable value, so it won't work
> +as-is. Reflashing the bootloader with the bootloader image produced by
> +Buildroot is necessary.
> +
> +When the board starts up, a pre-loader shows a count down of 2
> +seconds, interrupt by pressing any key. You should reach a menu like
> +this:
> +
> +--------8<----------
> +
> +bootloader version:210209-4547a8d
> +ddr 0x00000000, 1M test
> +ddr 0x00100000, 2M test
> +DDR clk 2133M,Version: 210302-5aea32f
> +0
> +***************************************************
> +*************** FLASH PROGRAMMING *****************
> +***************************************************
> +
> +0:update uboot
> +1:quit
> +select the function:
> +
> +--------8<----------
> +
> +Press 0 and Enter. You will now see "C" characters being
> +displayed. Ask your serial port communication program to send
> +fw_payload.bin.flash using the Xmodem protocol.
> +
> +After reflashing is complete, restart the board, it will automatically
> +start the system from the SD card, and reach the login prompt.
> diff --git a/configs/beaglev_defconfig b/configs/beaglev_defconfig
> new file mode 100644
> index 0000000000..097d4c5302
> --- /dev/null
> +++ b/configs/beaglev_defconfig
> @@ -0,0 +1,35 @@
> +BR2_riscv=y
> +BR2_riscv_custom=y
> +BR2_RISCV_ISA_CUSTOM_RVM=y
> +BR2_RISCV_ISA_CUSTOM_RVF=y
> +BR2_RISCV_ISA_CUSTOM_RVD=y
> +BR2_RISCV_ISA_CUSTOM_RVC=y
> +BR2_GLOBAL_PATCH_DIR="board/beaglev/patches/"
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/beaglev/post-build.sh"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/beaglev/genimage.cfg"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
> +# HEAD of the Fedora branch
> +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_kernel_5.10,710cf052d6abda73584481d920b4b6befc7240ea)/linux-710cf052d6abda73584481d920b4b6befc7240ea.tar.gz"
> +BR2_LINUX_KERNEL_DEFCONFIG="starfive_vic7100_evb_sd_net"
> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_TARGET_OPENSBI=y
> +BR2_TARGET_OPENSBI_CUSTOM_TARBALL=y
> +# HEAD of the Fedora branch
> +BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_opensbi,2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5)/opensbi-2524b0ecd8684b42bc7a4c69794f40f11cbbe2a5.tar.gz"
> +BR2_TARGET_OPENSBI_PLAT="starfive/vic7100"
> +# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set
> +# BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG is not set
> +BR2_TARGET_OPENSBI_UBOOT_PAYLOAD=y
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
> +# HEAD of the Fedora branch
> +BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,starfive-tech,beagle_uboot-opensbi,3f3ac01a29ad1cd5fa519d86f81daead2447f1d4)/uboot-3f3ac01a29ad1cd5fa519d86f81daead2447f1d4.tar.gz"
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_vic7100_beagle_v_smode"
> +BR2_PACKAGE_HOST_GENIMAGE=y
> --
>

Otherwise LGTM:
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Regards,
Bin

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
@ 2021-04-29 12:45   ` Bin Meng
  2021-04-30  7:48   ` Peter Korsgaard
  2021-04-30  8:51   ` Drew Fustini
  2 siblings, 0 replies; 23+ messages in thread
From: Bin Meng @ 2021-04-29 12:45 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:48 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> OpenSBI contains platform-specific code, so very much like Linux,
> U-Boot or other bootloaders, using the upstream version of OpenSBI
> will very often not be sufficient.
>
> This commit therefore adds the possibility of specifying a custom
> version of OpenSBI, either custom from upstream, custom tarball, or
> custom from Git. Support for other version control systems has not
> been implemented for now, but could be added later if needed.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  boot/opensbi/Config.in  | 51 +++++++++++++++++++++++++++++++++++++++++
>  boot/opensbi/opensbi.mk | 19 ++++++++++++++-
>  2 files changed, 69 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload
  2021-04-29  7:46 ` [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload Thomas Petazzoni
@ 2021-04-29 12:45   ` Bin Meng
  2021-04-30  7:49   ` Peter Korsgaard
  1 sibling, 0 replies; 23+ messages in thread
From: Bin Meng @ 2021-04-29 12:45 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:47 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> The opensbi package already allows to use Linux as a payload for
> OpenSBI, but in some cases, U-Boot as payload is useful. This commit
> adds a BR2_TARGET_OPENSBI_UBOOT_PAYLOAD option, modeled after the
> existing BR2_TARGET_OPENSBI_LINUX_PAYLOAD.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  boot/opensbi/Config.in  | 7 +++++++
>  boot/opensbi/opensbi.mk | 8 ++++++++
>  2 files changed, 15 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 12:39 ` [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Erico Nunes
@ 2021-04-29 13:01   ` Thomas Petazzoni
  2021-04-29 13:26     ` Erico Nunes
  2021-04-30  0:35   ` Drew Fustini
  1 sibling, 1 reply; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29 13:01 UTC (permalink / raw)
  To: buildroot

Hello Erico,

On Thu, 29 Apr 2021 14:39:16 +0200
Erico Nunes <nunes.erico@gmail.com> wrote:

> I would like to try this but I have some questions:
> Are you able to still boot the reference Fedora image after flashing
> the custom bootloader?

I don't know, I have not tried to boot the reference Fedora image
before or after flashing the bootloader.

And the bootloader is not custom, I am using the exact same OpenSBI and
U-Boot source and configuration as the ones used for the reference
image. The only thing I am changing is fdt_addr_r. I am not even sure
it is used by the Fedora image, I don't know exactly how it is booted.

> Also, if it is just a matter of updating fdt_addr_r, could it just be
> updated in the u-boot environment instead?

There is no persistent U-Boot environment, at least in the default
configuration that is provided. The only environment is the one built
into the U-Boot binary, which is why this fdt_addr_t gets changed in
the U-Boot source code.

> And finally, should that be reported as an issue in the starfive
> u-boot so maybe they can release another build with that fixed?

I have already reported the issue "informally" on a private Slack
channel with Starfive people. I should probably report it more
formally, but I don't have a lot of details yet, I would need to test
the reference Fedora image, compare how it works, etc.

Thanks for your feedback!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 13:01   ` Thomas Petazzoni
@ 2021-04-29 13:26     ` Erico Nunes
  2021-04-29 13:48       ` Thomas Petazzoni
  0 siblings, 1 reply; 23+ messages in thread
From: Erico Nunes @ 2021-04-29 13:26 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:01 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Erico,
>
> On Thu, 29 Apr 2021 14:39:16 +0200
> Erico Nunes <nunes.erico@gmail.com> wrote:
>
> > I would like to try this but I have some questions:
> > Are you able to still boot the reference Fedora image after flashing
> > the custom bootloader?
>
> I don't know, I have not tried to boot the reference Fedora image
> before or after flashing the bootloader.
>
> And the bootloader is not custom, I am using the exact same OpenSBI and
> U-Boot source and configuration as the ones used for the reference
> image. The only thing I am changing is fdt_addr_r. I am not even sure
> it is used by the Fedora image, I don't know exactly how it is booted.

Ok, thanks, I will give it a try anyway.
I noticed that the manual build instructions in
https://wiki.seeedstudio.com/BeagleV-Make-File-System-Compile-uboot-Kernal/#compile-u-boot
suggest a CONFIG_SYS_TEXT_BASE=0x80020000 change and as far as I see
this is not in the build here, so maybe that could be related too.

Thanks

Erico

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 13:26     ` Erico Nunes
@ 2021-04-29 13:48       ` Thomas Petazzoni
  2021-04-29 13:52         ` Erico Nunes
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29 13:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 29 Apr 2021 15:26:06 +0200
Erico Nunes <nunes.erico@gmail.com> wrote:

> Ok, thanks, I will give it a try anyway.
> I noticed that the manual build instructions in
> https://wiki.seeedstudio.com/BeagleV-Make-File-System-Compile-uboot-Kernal/#compile-u-boot
> suggest a CONFIG_SYS_TEXT_BASE=0x80020000 change and as far as I see
> this is not in the build here, so maybe that could be related too.

The kernel is relocated to 80020000 by U-Boot before booting, in the
configuration I'm providing. See the boot log in the cover letter:

"""
Moving Image from 0x84000000 to 0x80200000, end=80f1b000
"""

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 13:48       ` Thomas Petazzoni
@ 2021-04-29 13:52         ` Erico Nunes
  2021-04-29 14:26           ` Thomas Petazzoni
  0 siblings, 1 reply; 23+ messages in thread
From: Erico Nunes @ 2021-04-29 13:52 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:48 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Thu, 29 Apr 2021 15:26:06 +0200
> Erico Nunes <nunes.erico@gmail.com> wrote:
>
> > Ok, thanks, I will give it a try anyway.
> > I noticed that the manual build instructions in
> > https://wiki.seeedstudio.com/BeagleV-Make-File-System-Compile-uboot-Kernal/#compile-u-boot
> > suggest a CONFIG_SYS_TEXT_BASE=0x80020000 change and as far as I see
> > this is not in the build here, so maybe that could be related too.
>
> The kernel is relocated to 80020000 by U-Boot before booting, in the
> configuration I'm providing. See the boot log in the cover letter:
>
> """
> Moving Image from 0x84000000 to 0x80200000, end=80f1b000
> """

This is 0x80200000, not 0x80020000.

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 13:52         ` Erico Nunes
@ 2021-04-29 14:26           ` Thomas Petazzoni
  2021-04-29 14:55             ` Erico Nunes
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-29 14:26 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 29 Apr 2021 15:52:14 +0200
Erico Nunes <nunes.erico@gmail.com> wrote:

> > > Ok, thanks, I will give it a try anyway.
> > > I noticed that the manual build instructions in
> > > https://wiki.seeedstudio.com/BeagleV-Make-File-System-Compile-uboot-Kernal/#compile-u-boot
> > > suggest a CONFIG_SYS_TEXT_BASE=0x80020000 change and as far as I see
> > > this is not in the build here, so maybe that could be related too.  
> >
> > The kernel is relocated to 80020000 by U-Boot before booting, in the
> > configuration I'm providing. See the boot log in the cover letter:
> >
> > """
> > Moving Image from 0x84000000 to 0x80200000, end=80f1b000
> > """  
> 
> This is 0x80200000, not 0x80020000.

Ah, you're right (of course). The U-Boot configuration I'm using from
the U-Boot defconfig provided by Starfive indeed has
CONFIG_SYS_TEXT_BASE=0x80200000 and not the 0x80020000 you're
mentioning. I'll give it a try.

But I just checked, and the image that was already flashed on my
Beagle-V was using 0x80200000 to load the kernel.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 14:26           ` Thomas Petazzoni
@ 2021-04-29 14:55             ` Erico Nunes
  0 siblings, 0 replies; 23+ messages in thread
From: Erico Nunes @ 2021-04-29 14:55 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 4:26 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Thu, 29 Apr 2021 15:52:14 +0200
> Erico Nunes <nunes.erico@gmail.com> wrote:
>
> > > > Ok, thanks, I will give it a try anyway.
> > > > I noticed that the manual build instructions in
> > > > https://wiki.seeedstudio.com/BeagleV-Make-File-System-Compile-uboot-Kernal/#compile-u-boot
> > > > suggest a CONFIG_SYS_TEXT_BASE=0x80020000 change and as far as I see
> > > > this is not in the build here, so maybe that could be related too.
> > >
> > > The kernel is relocated to 80020000 by U-Boot before booting, in the
> > > configuration I'm providing. See the boot log in the cover letter:
> > >
> > > """
> > > Moving Image from 0x84000000 to 0x80200000, end=80f1b000
> > > """
> >
> > This is 0x80200000, not 0x80020000.
>
> Ah, you're right (of course). The U-Boot configuration I'm using from
> the U-Boot defconfig provided by Starfive indeed has
> CONFIG_SYS_TEXT_BASE=0x80200000 and not the 0x80020000 you're
> mentioning. I'll give it a try.
>
> But I just checked, and the image that was already flashed on my
> Beagle-V was using 0x80200000 to load the kernel.

With the original u-boot and Fedora image I also got "Moving Image
from 0x84000000 to 0x80200000, end=81aff000", but that address shows
in "Domain0 Next Address : 0x0000000080020000" which is different than
with the Buildroot u-boot which currently shows "Domain0 Next Address
: 0x0000000080200000".
Anyway I don't know where this will make a difference, I just
mentioned it because the only manual change explicitly mentioned in
the wiki page is change 0x80200000 -> 0x80020000.

For the original question, this bootloader from Buildroot with your
patch also boots the reference Fedora image.
The Buildroot image also works well for me.
So either way, thanks for this work and for getting it here so quickly.

Erico

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29 12:39 ` [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Erico Nunes
  2021-04-29 13:01   ` Thomas Petazzoni
@ 2021-04-30  0:35   ` Drew Fustini
  1 sibling, 0 replies; 23+ messages in thread
From: Drew Fustini @ 2021-04-30  0:35 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 02:39:16PM +0200, Erico Nunes wrote:
> On Thu, Apr 29, 2021 at 9:47 AM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> > slight annoyance is that the bootloader
> > pre-flashed on the board doesn't work as-is, just due to an incorrect
> > fdt_addr_r environment variable value. So reflashing the bootloader
> > with what has been built by Buildroot is necessary (but is trivial to
> > do using Xmodem).
> 
> I would like to try this but I have some questions:
> Are you able to still boot the reference Fedora image after flashing
> the custom bootloader?
> Also, if it is just a matter of updating fdt_addr_r, could it just be
> updated in the u-boot environment instead?
> And finally, should that be reported as an issue in the starfive
> u-boot so maybe they can release another build with that fixed?

I think that is a good idea so I have opened an issue to track resolving
this in future production of BeagleV Starlight boards.

Thanks,
Drew

[1] https://github.com/starfive-tech/freelight-u-sdk/issues/18

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
  2021-04-29 12:45   ` Bin Meng
@ 2021-04-30  7:48   ` Peter Korsgaard
  2021-04-30  8:51   ` Drew Fustini
  2 siblings, 0 replies; 23+ messages in thread
From: Peter Korsgaard @ 2021-04-30  7:48 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > OpenSBI contains platform-specific code, so very much like Linux,
 > U-Boot or other bootloaders, using the upstream version of OpenSBI
 > will very often not be sufficient.

 > This commit therefore adds the possibility of specifying a custom
 > version of OpenSBI, either custom from upstream, custom tarball, or
 > custom from Git. Support for other version control systems has not
 > been implemented for now, but could be added later if needed.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > ---
 >  boot/opensbi/Config.in  | 51 +++++++++++++++++++++++++++++++++++++++++
 >  boot/opensbi/opensbi.mk | 19 ++++++++++++++-
 >  2 files changed, 69 insertions(+), 1 deletion(-)

 > diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
 > index b9b0ace8af..83f40f04fa 100644
 > --- a/boot/opensbi/Config.in
 > +++ b/boot/opensbi/Config.in
 > @@ -13,6 +13,57 @@ config BR2_TARGET_OPENSBI
 >  	  https://github.com/riscv/opensbi.git
 
 >  if BR2_TARGET_OPENSBI
 > +choice
 > +	prompt "OpenSBI Version"
 > +	help
 > +	  Select the specific OpenSBI version you want to use
 > +
 > +config BR2_TARGET_OPENSBI_LATEST_VERSION
 > +	bool "0.8"
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_VERSION
 > +	bool "Custom version"
 > +	help
 > +	  This option allows to use a specific official versions
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_TARBALL
 > +	bool "Custom tarball"
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_GIT
 > +	bool "Custom Git repository"
 > +
 > +endchoice
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE
 > +	string "OpenSBI version"
 > +	depends on BR2_TARGET_OPENSBI_CUSTOM_VERSION
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION
 > +	string "URL of custom OpenSBI tarball"
 > +	depends on BR2_TARGET_OPENSBI_CUSTOM_TARBALL
 > +
 > +if BR2_TARGET_OPENSBI_CUSTOM_GIT
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_REPO_URL
 > +	string "URL of custom repository"
 > +
 > +config BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION
 > +	string "Custom repository version"
 > +	help
 > +	  Revision to use in the typical format used by Git. E.G. a
 > +	  sha id, a tag, branch, ..
 > +
 > +endif
 > +
 > +config BR2_TARGET_OPENSBI_VERSION
 > +	string
 > +	default "0.8"	if BR2_TARGET_OPENSBI_LATEST_VERSION
 > +	default BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE \
 > +		if BR2_TARGET_OPENSBI_CUSTOM_VERSION
 > +	default "custom"	if BR2_TARGET_OPENSBI_CUSTOM_TARBALL
 > +	default BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION \
 > +		if BR2_TARGET_OPENSBI_CUSTOM_GIT
 > +
 >  config BR2_TARGET_OPENSBI_PLAT
 >  	string "OpenSBI Platform"
 >  	default ""
 > diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk
 > index 60b87c268d..250a6078af 100644
 > --- a/boot/opensbi/opensbi.mk
 > +++ b/boot/opensbi/opensbi.mk
 > @@ -4,13 +4,30 @@
 >  #
 >  ################################################################################
 
 > -OPENSBI_VERSION = 0.8
 > +OPENSBI_VERSION = $(call qstrip,$(BR2_TARGET_OPENSBI_VERSION))
 > +
 > +ifeq ($(OPENSBI_VERSION),custom)
 > +# Handle custom OpenSBI tarballs as specified by the configuration
 > +OPENSBI_TARBALL = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION))
 > +OPENSBI_SITE = $(patsubst %/,%,$(dir $(OPENSBI_TARBALL)))
 > +OPENSBI_SOURCE = $(notdir $(OPENSBI_TARBALL))
 > +else ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_GIT),y)
 > +OPENSBI_SITE = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_REPO_URL))
 > +OPENSBI_SITE_METHOD = git
 > +else
 > +# Handle official OpenSBI versions
 >  OPENSBI_SITE = $(call github,riscv,opensbi,v$(OPENSBI_VERSION))
 > +endif
 > +
 >  OPENSBI_LICENSE = BSD-2-Clause
 >  OPENSBI_LICENSE_FILES = COPYING.BSD

Maybe this should be inside the _LATEST_VERSION conditional in case the
license file ever changes, like we have done for the linux kernel?

But OK, that can be done later. Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload
  2021-04-29  7:46 ` [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload Thomas Petazzoni
  2021-04-29 12:45   ` Bin Meng
@ 2021-04-30  7:49   ` Peter Korsgaard
  1 sibling, 0 replies; 23+ messages in thread
From: Peter Korsgaard @ 2021-04-30  7:49 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > The opensbi package already allows to use Linux as a payload for
 > OpenSBI, but in some cases, U-Boot as payload is useful. This commit
 > adds a BR2_TARGET_OPENSBI_UBOOT_PAYLOAD option, modeled after the
 > existing BR2_TARGET_OPENSBI_LINUX_PAYLOAD.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 0/4] Support for the Beagle-V platform
  2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2021-04-29 12:39 ` [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Erico Nunes
@ 2021-04-30  8:27 ` Drew Fustini
  5 siblings, 0 replies; 23+ messages in thread
From: Drew Fustini @ 2021-04-30  8:27 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 09:46:31AM +0200, Thomas Petazzoni wrote:
> Hello,
> 
> The beta version of the Beagle-V RISC-V 64-bit platform has been
> showing up at the front door of a few lucky people around the world in
> the past days.

Thank you for getting this posted so fast! The primary goal of our beta
developer program for the BeagleV Starlight is to get the upstream
process going so we are in a good position when the production board
launches with distributors in September [1]. Anyone interested can join
our public BeagleV forum to stay updated [2].

This is the first upstream patch series for BeagleV Starlight which
made me realize I need to provide some clarification on naming guidance
for the boards and SoCs. I have added a new section to the README [3].

Small nit for this cover letter is that it should be BeagleV instead of
Beagle-V.  But more importantly I want to make everyone aware that there
there will eventually be two different BeagleV Starlight boards:

- BeagleV Starlight board with StarFive JH7100 SoC (2x SiFive U74)
- BeagleV Starlight board with StarFive JH7110 SoC (4x U74, PCIe, GPU)

The board that a limited number of beta developers like Thomas have just
received is the JH7100 version.

Thank you,
Drew Fustini
BeagleBoard.org Foundation

[1] https://github.com/beagleboard/beaglev-starlight
[2] https://forum.beagleboard.org/c/beaglev
[3] https://github.com/beagleboard/beaglev-starlight#guidance-on-naming-conventions

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration
  2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
  2021-04-29 12:45   ` Bin Meng
  2021-04-30  7:48   ` Peter Korsgaard
@ 2021-04-30  8:51   ` Drew Fustini
  2021-04-30  8:56     ` Thomas Petazzoni
  2 siblings, 1 reply; 23+ messages in thread
From: Drew Fustini @ 2021-04-30  8:51 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 09:46:32AM +0200, Thomas Petazzoni wrote:
> OpenSBI contains platform-specific code, so very much like Linux,
> U-Boot or other bootloaders, using the upstream version of OpenSBI
> will very often not be sufficient.
> 
> This commit therefore adds the possibility of specifying a custom
> version of OpenSBI, either custom from upstream, custom tarball, or
> custom from Git. Support for other version control systems has not
> been implemented for now, but could be added later if needed.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  boot/opensbi/Config.in  | 51 +++++++++++++++++++++++++++++++++++++++++
>  boot/opensbi/opensbi.mk | 19 ++++++++++++++-
>  2 files changed, 69 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in
> index b9b0ace8af..83f40f04fa 100644
> --- a/boot/opensbi/Config.in
> +++ b/boot/opensbi/Config.in
> @@ -13,6 +13,57 @@ config BR2_TARGET_OPENSBI
>  	  https://github.com/riscv/opensbi.git
>  
>  if BR2_TARGET_OPENSBI
> +choice
> +	prompt "OpenSBI Version"
> +	help
> +	  Select the specific OpenSBI version you want to use
> +
> +config BR2_TARGET_OPENSBI_LATEST_VERSION
> +	bool "0.8"

I believe the latest version of OpenSBI is v0.9 [1].

Note that we currently have a bit of a confusing situation for the
BeagleV Starlight board. There are two repositories:

  * starfive-tech/sft-riscv-opensbi [2]
  * starfive-tech/beagle_opensbi [3]

Wei Fu is going to sort this out and declare which is the official repo
to use going forward.

Thanks,
Drew

[1] https://github.com/riscv/opensbi/releases/tag/v0.9
[2] https://github.com/starfive-tech/sft-riscv-opensbi
[3] https://github.com/starfive-tech/beagle_opensbi

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration
  2021-04-30  8:51   ` Drew Fustini
@ 2021-04-30  8:56     ` Thomas Petazzoni
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Petazzoni @ 2021-04-30  8:56 UTC (permalink / raw)
  To: buildroot

Hello Drew,

On Fri, 30 Apr 2021 01:51:14 -0700
Drew Fustini <drew@beagleboard.org> wrote:

> > +config BR2_TARGET_OPENSBI_LATEST_VERSION
> > +	bool "0.8"  
> 
> I believe the latest version of OpenSBI is v0.9 [1].

Absolutely. The opensbi package should be upgraded to the latest
opensbi version if possible, but that's a separate matter from the
BeagleV support.

> Note that we currently have a bit of a confusing situation for the
> BeagleV Starlight board. There are two repositories:
> 
>   * starfive-tech/sft-riscv-opensbi [2]
>   * starfive-tech/beagle_opensbi [3]

Yes, this is (now) clear to me, and I've used the
starfive-tech/beagle_* repos in this defconfig (see PATCH 4/4).

Thanks a lot for your feedback!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig
  2021-04-29  7:46 ` [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
  2021-04-29 12:44   ` Bin Meng
@ 2021-05-01 14:37   ` Frank Hunleth
  1 sibling, 0 replies; 23+ messages in thread
From: Frank Hunleth @ 2021-05-01 14:37 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 29, 2021 at 3:48 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> This commit introduces support for the RISC-V based Beagle-V platform,
> which uses a Starfive VIC-7100.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> diff --git a/board/beaglev/post-build.sh b/board/beaglev/post-build.sh
> new file mode 100755
> index 0000000000..0e7337c96d
> --- /dev/null
> +++ b/board/beaglev/post-build.sh
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +BOARD_DIR=$(dirname $0)
> +
> +# The DTB to use is provided within the U-Boot source tree, so we grab
> +# it from there, and install it to TARGET_DIR/boot/.
> +UBOOT_DIR=$(make --no-print-directory VARS=UBOOT_DIR printvars | cut -f2 -d'=')

I had to set the directory for make since it was being run out of the
Buildroot source directory rather than my output directory:

UBOOT_DIR=$(make -C${O} --no-print-directory VARS=UBOOT_DIR printvars
| cut -f2 -d'=')

After that change, everything seems to work great! Thanks for this.
This patch made getting started with the BeagleV super easy.

Tested-by: Frank Hunleth <fhunleth@troodon-software.com>

-Frank


> +install -D -m0644 ${UBOOT_DIR}/arch/riscv/dts/starfive_vic7100_beagle_v.dtb \
> +       ${TARGET_DIR}/boot/starfive_vic7100_beagle_v.dtb
> +
> +# Bring the extlinux.conf file in.
> +install -D -m 0644 ${BOARD_DIR}/extlinux.conf \
> +       ${TARGET_DIR}/boot/extlinux/extlinux.conf
> +
> +# To be reflashed through Xmodem, the bootloader needs to be prepended
> +# with a 4-byte header that contains the total size of the file.
> +perl -e 'print pack("l", (stat @ARGV[0])[7])' ${BINARIES_DIR}/fw_payload.bin > ${BINARIES_DIR}/fw_payload.bin.flash
> +cat ${BINARIES_DIR}/fw_payload.bin >> ${BINARIES_DIR}/fw_payload.bin.flash
> diff --git a/board/beaglev/readme.txt b/board/beaglev/readme.txt
> new file mode 100644
> index 0000000000..903dd7975e

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-05-01 14:37 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29  7:46 [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Thomas Petazzoni
2021-04-29  7:46 ` [Buildroot] [PATCH 1/4] boot/opensbi: add support for version configuration Thomas Petazzoni
2021-04-29 12:45   ` Bin Meng
2021-04-30  7:48   ` Peter Korsgaard
2021-04-30  8:51   ` Drew Fustini
2021-04-30  8:56     ` Thomas Petazzoni
2021-04-29  7:46 ` [Buildroot] [PATCH 2/4] boot/opensbi: allow using U-Boot as a payload Thomas Petazzoni
2021-04-29 12:45   ` Bin Meng
2021-04-30  7:49   ` Peter Korsgaard
2021-04-29  7:46 ` [Buildroot] [PATCH 3/4] boot/opensbi: add options to enable/disable image installation Thomas Petazzoni
2021-04-29 12:39   ` Bin Meng
2021-04-29  7:46 ` [Buildroot] [PATCH 4/4] configs/beaglev_defconfig: new defconfig Thomas Petazzoni
2021-04-29 12:44   ` Bin Meng
2021-05-01 14:37   ` Frank Hunleth
2021-04-29 12:39 ` [Buildroot] [PATCH 0/4] Support for the Beagle-V platform Erico Nunes
2021-04-29 13:01   ` Thomas Petazzoni
2021-04-29 13:26     ` Erico Nunes
2021-04-29 13:48       ` Thomas Petazzoni
2021-04-29 13:52         ` Erico Nunes
2021-04-29 14:26           ` Thomas Petazzoni
2021-04-29 14:55             ` Erico Nunes
2021-04-30  0:35   ` Drew Fustini
2021-04-30  8:27 ` Drew Fustini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.