Initial Commit
- initial default booting image
This commit is contained in:
127
board/beagleboard/beaglev_fire/README.txt
Normal file
127
board/beagleboard/beaglev_fire/README.txt
Normal file
@@ -0,0 +1,127 @@
|
||||
Beagle-V Fire
|
||||
==============
|
||||
|
||||
BeagleV Fire is a low-cost RISC-V 64-bit based platform, powered by
|
||||
Microchip's PolarFire SoC. This file describes how to use the
|
||||
pre-defined Buildroot configuration for the Beagle-V Fire board.
|
||||
|
||||
Further information about the Beagle-V Fire can be found at
|
||||
https://docs.beagleboard.org/latest/boards/beaglev/fire/index.html.
|
||||
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
Configure Buildroot using the default board configuration:
|
||||
|
||||
'$ make beaglev_fire_defconfig'
|
||||
|
||||
Customise the build as necessary:
|
||||
|
||||
'$ make menuconfig'
|
||||
|
||||
Start the build:
|
||||
|
||||
'$ make'
|
||||
|
||||
|
||||
Result of the build
|
||||
===================
|
||||
|
||||
Once the build has finished you will have the following files:
|
||||
|
||||
output/images/
|
||||
+-- boot.scr
|
||||
+-- boot.vfat
|
||||
+-- Image
|
||||
+-- Image.gz
|
||||
+-- beaglev_fire.itb
|
||||
+-- beaglev_fire.its
|
||||
+-- mpfs-beaglev-fire.dtb
|
||||
+-- payload.bin
|
||||
+-- rootfs.ext2
|
||||
+-- rootfs.ext4
|
||||
+-- rootfs.tar
|
||||
+-- sdcard.img
|
||||
+-- u-boot.bin
|
||||
|
||||
|
||||
Flashing the image to your eMMC
|
||||
===============================
|
||||
|
||||
By default Buildroot builds an image suitable for the eMMC. The first partition
|
||||
of this image contains a U-Boot binary, embedded in a Hart Software Services
|
||||
(HSS) payload. The second partition contains a FAT filesystem with a U-Boot env
|
||||
and an ITB file containing the kernel and the device tree. The third partition
|
||||
contains the file system. This image can be written directly to the eMMC.
|
||||
|
||||
To do so, follow the below steps:
|
||||
|
||||
1. Connect to BeagleV-Fire UART debug port using a 3.3v USB to UART bridge.
|
||||
|
||||
2. Now you can run `tio <port>` in a terminal window to access the UART debug
|
||||
port connection.
|
||||
e.g `tio /dev/ttyUSB4`
|
||||
|
||||
3. Once you are connected properly, you can press the Reset button which will
|
||||
show you a progress bar.
|
||||
|
||||
4. Press any key in the terminal application to stop the HSS from booting. This
|
||||
will give you access to the HSS command line interface and a ">>" for input
|
||||
will be displayed in the terminal.
|
||||
|
||||
5. Type `usbdmsc` in the HSS command line interface. The HSS `usbdmsc` command
|
||||
exposes the eMMC as a USB mass storage device using the USB type C connector.
|
||||
If successful, a message saying "USB Host connected" will be displayed.
|
||||
|
||||
6. The eMMC should now appear as mass storage device/drive on your host PC, as
|
||||
it is mounted through your USB type C connector.
|
||||
|
||||
7. Now, all you need to do is dd the image to the eMMC, which can be done with
|
||||
the following command on your development host:
|
||||
|
||||
'$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M'
|
||||
|
||||
You will have to replace /dev/sdX by the actual device name of your eMMC.
|
||||
Please, be especially cautious not to overwrite the wrong drive as this cannot
|
||||
be undone.
|
||||
|
||||
8. Once the image transfer has completed you can type `CTRL+C` to disconnect
|
||||
your device.
|
||||
|
||||
9. Finally, type `boot` or reset your board to boot your new Linux image.
|
||||
|
||||
Customize BeagleV-Fire Cape Gateware Using Verilog (Optional)
|
||||
=============================================================
|
||||
|
||||
To customize your Beagle-V Fire gateware please follow the guide below to
|
||||
create your custom bitstream (steps 1 - 6):
|
||||
https://docs.beagleboard.org/latest/boards/beaglev/fire/demos-and-tutorials/gateware/customize-cape-gateware-verilog.html
|
||||
|
||||
|
||||
Program BeagleV-Fire With Your Custom Bitstream with Buildroot
|
||||
==============================================================
|
||||
|
||||
After following the steps 1-6 from the above tutorial, you should now have a
|
||||
artifacts.zip file on your local host.
|
||||
|
||||
Unzip the downloaded artifacts.zip file.
|
||||
|
||||
Go to the custom FPGA design directory:
|
||||
'cd artifacts/bitstreams/my_custom_fpga_design/LinuxProgramming/'
|
||||
|
||||
On your Linux host development computer, copy the bitstream to BeagleV-Fire
|
||||
board, replacing </path/to/your/> with the path to your BeagleV-Fire root file
|
||||
system.
|
||||
'cp ./* /path/to/your/buildroot/board/beagleboard/beaglev_fire/rootfs-overlay/lib/firmware/'
|
||||
|
||||
To apply these changes to your image, make sure to re-build it with:
|
||||
`make`
|
||||
|
||||
Then, re-flash your image - to ensure you have the necessary firmware files - by
|
||||
following the above section "Flashing the image to your eMMC".
|
||||
|
||||
On BeagleV-Fire initiate the reprogramming of the FPGA with your gateware bitstream:
|
||||
`/usr/share/microchip/update-gateware.sh`
|
||||
|
||||
Wait for a couple of minutes for the BeagleV-Fire to reprogram itself.
|
||||
55
board/beagleboard/beaglev_fire/beaglev_fire.its
Normal file
55
board/beagleboard/beaglev_fire/beaglev_fire.its
Normal file
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
/*
|
||||
* Flattened Image Tree file for BVF
|
||||
*
|
||||
* Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "U-Boot fitImage for the BeagleV-Fire";
|
||||
#address-cells = <2>;
|
||||
|
||||
images {
|
||||
kernel {
|
||||
description = "Linux kernel";
|
||||
data = /incbin/("./Image.gz");
|
||||
type = "kernel";
|
||||
arch = "riscv";
|
||||
os = "linux";
|
||||
compression = "gzip";
|
||||
load = <0x80200000>;
|
||||
entry = <0x80200000>;
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
base_fdt {
|
||||
description = "Flattened Device Tree blob";
|
||||
data = /incbin/("./mpfs-beaglev-fire.dtb");
|
||||
type = "flat_dt";
|
||||
arch = "riscv";
|
||||
compression = "none";
|
||||
load = <0x8a000000>;
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "kernel_dtb";
|
||||
kernel_dtb {
|
||||
description = "1 Linux kernel, FDT blob";
|
||||
kernel = "kernel";
|
||||
fdt = "base_fdt";
|
||||
};
|
||||
|
||||
base_dtb {
|
||||
description = "Base FDT blob for BeagleV-Fire board";
|
||||
fdt = "base_fdt";
|
||||
};
|
||||
};
|
||||
};
|
||||
15
board/beagleboard/beaglev_fire/boot.cmd
Normal file
15
board/beagleboard/beaglev_fire/boot.cmd
Normal file
@@ -0,0 +1,15 @@
|
||||
# this assumes ${scriptaddr} is already set!!
|
||||
|
||||
# Try to boot a fitImage from eMMC/SD
|
||||
|
||||
setenv fdt_high 0xffffffffffffffff
|
||||
setenv initrd_high 0xffffffffffffffff
|
||||
|
||||
load mmc 0:${distro_bootpart} ${scriptaddr} beaglev_fire.itb;
|
||||
bootm start ${scriptaddr}#kernel_dtb;
|
||||
bootm loados ${scriptaddr};
|
||||
# Try to load a ramdisk if available inside fitImage
|
||||
bootm ramdisk;
|
||||
bootm prep;
|
||||
run design_overlays;
|
||||
bootm go;
|
||||
28
board/beagleboard/beaglev_fire/config.yaml
Normal file
28
board/beagleboard/beaglev_fire/config.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# HSS Payload Generator - buildroot configuration file
|
||||
#
|
||||
|
||||
# First, we can optionally set a name for our image, otherwise one will be created dynamically
|
||||
set-name: 'PolarFire-SoC-HSS::U-Boot'
|
||||
|
||||
#
|
||||
# Next, we'll define the entry point addresses for each hart, as follows:
|
||||
#
|
||||
hart-entry-points: {u54_1: '0x80200000', u54_2: '0x80200000', u54_3: '0x80200000', u54_4: '0x80200000'}
|
||||
#
|
||||
# Finally, we'll define a payloads (source binary file) that will be placed at certain regions in memory
|
||||
# The payload section is defined with the keyword payloads, and then a number of individual
|
||||
# payload descriptors.
|
||||
#
|
||||
# Each payload has a name (path to its ELF/bin file), an owner-hart, and optionally 1-3 secondary-harts.
|
||||
#
|
||||
# Additionally, it has a privilege mode in which it will start execution.
|
||||
# * Valid privilege modes are PRV_M, PRV_S and PRV_U.
|
||||
#
|
||||
#
|
||||
# In this case, the only payload is the u-boot s-mode binary.
|
||||
#
|
||||
# Case only matters for the ELF path names, not the keywords.
|
||||
#
|
||||
payloads:
|
||||
u-boot.bin: {exec-addr: '0x80200000', owner-hart: u54_1, secondary-hart: u54_2, secondary-hart: u54_3, secondary-hart: u54_4, priv-mode: prv_s}
|
||||
35
board/beagleboard/beaglev_fire/genimage.cfg
Normal file
35
board/beagleboard/beaglev_fire/genimage.cfg
Normal file
@@ -0,0 +1,35 @@
|
||||
# Image for eMMC boot on the Microchip PolarFire SOC BeagleV-Fire Board
|
||||
#
|
||||
image boot.vfat {
|
||||
vfat {
|
||||
files = {
|
||||
"beaglev_fire.itb",
|
||||
}
|
||||
|
||||
file boot.scr {
|
||||
image = "boot.scr"
|
||||
}
|
||||
}
|
||||
size = 60M
|
||||
}
|
||||
|
||||
image sdcard.img {
|
||||
hdimage {
|
||||
partition-table-type = "gpt"
|
||||
}
|
||||
|
||||
partition uboot {
|
||||
partition-type-uuid = 21686148-6449-6E6F-744E-656564454649
|
||||
image = "payload.bin"
|
||||
}
|
||||
|
||||
partition kernel {
|
||||
partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4
|
||||
bootable = "true"
|
||||
image = "boot.vfat"
|
||||
}
|
||||
|
||||
partition root {
|
||||
image = "rootfs.ext4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../linux/linux.hash
|
||||
2
board/beagleboard/beaglev_fire/patches/linux/linux.hash
Normal file
2
board/beagleboard/beaglev_fire/patches/linux/linux.hash
Normal file
@@ -0,0 +1,2 @@
|
||||
# Locally calculated
|
||||
sha256 37191994758d521dc7223cb5010a67ef83bd061bf70194ea522abc9ef2b17391 linux-linux4microchip+fpga-2025.10.tar.gz
|
||||
2
board/beagleboard/beaglev_fire/patches/uboot/uboot.hash
Normal file
2
board/beagleboard/beaglev_fire/patches/uboot/uboot.hash
Normal file
@@ -0,0 +1,2 @@
|
||||
# Locally calculated
|
||||
sha256 591c80f7e16d6f43192deb7ab7587ae81b31ba7c7de1a668c14b9997b6c976c8 uboot-linux4microchip+fpga-2025.10.tar.gz
|
||||
14
board/beagleboard/beaglev_fire/post-image.sh
Executable file
14
board/beagleboard/beaglev_fire/post-image.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
HSS_PAYLOAD_GENERATOR="${HOST_DIR}"/bin/hss-payload-generator
|
||||
MKIMAGE="${HOST_DIR}"/bin/mkimage
|
||||
BOARD_DIR="$(pwd)"/"${0%/*}"
|
||||
|
||||
pushd "${BINARIES_DIR}"
|
||||
"${HSS_PAYLOAD_GENERATOR}" -c "${BOARD_DIR}"/config.yaml payload.bin
|
||||
cp "${BOARD_DIR}"/beaglev_fire.its "${BINARIES_DIR}"/beaglev_fire.its
|
||||
gzip -9 Image -c > Image.gz
|
||||
"${MKIMAGE}" -f beaglev_fire.its beaglev_fire.itb
|
||||
popd
|
||||
support/scripts/genimage.sh -c "${BOARD_DIR}"/genimage.cfg
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No gateware location provided. Checking default location."
|
||||
if [ ! -e /lib/firmware/mpfs_bitstream.spi ]; then
|
||||
echo "No gateware file found."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Gateware location provided: $1"
|
||||
if [ ! -e "$1"/mpfs_bitstream.spi ]; then
|
||||
echo "No gateware file found."
|
||||
exit 1
|
||||
else
|
||||
if [ ! -d /lib/firmware ]; then
|
||||
mkdir /lib/firmware
|
||||
fi
|
||||
cp "$1"/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
|
||||
cp "$1"/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Trash existing device tree overlay in case the rest of the process fails:
|
||||
flash_erase /dev/mtd0 0 16
|
||||
|
||||
# Initiate FPGA update for dtbo
|
||||
echo 1 > /sys/class/firmware/mpfs-auto-update/loading
|
||||
|
||||
# Write device tree overlay
|
||||
cat /lib/firmware/mpfs_dtbo.spi > /sys/class/firmware/mpfs-auto-update/data
|
||||
|
||||
# Signal completion for dtbo load
|
||||
echo 0 > /sys/class/firmware/mpfs-auto-update/loading
|
||||
|
||||
while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do
|
||||
# Do nothing, just keep checking
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Fake the presence of a golden image for now.
|
||||
dd if=/dev/zero of=/dev/mtd0 count=1 bs=4
|
||||
|
||||
# Initiate FPGA update for bitstream
|
||||
echo 1 > /sys/class/firmware/mpfs-auto-update/loading
|
||||
|
||||
# Write the firmware image to the data sysfs file
|
||||
cat /lib/firmware/mpfs_bitstream.spi > /sys/class/firmware/mpfs-auto-update/data
|
||||
|
||||
# Signal completion for bitstream load
|
||||
echo 0 > /sys/class/firmware/mpfs-auto-update/loading
|
||||
|
||||
while [ "$(cat /sys/class/firmware/mpfs-auto-update/status)" != "idle" ]; do
|
||||
# Do nothing, just keep checking
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# When the status is 'idle' and no error has occured, reboot the system for
|
||||
# the gateware update to take effect. FPGA reprogramming takes places between
|
||||
# Linux shut-down and HSS restarting the board.
|
||||
if [ "$(cat /sys/class/firmware/mpfs-auto-update/error)" = "" ]; then
|
||||
echo "FPGA update ready. Rebooting."
|
||||
reboot
|
||||
else
|
||||
echo "FPGA update failed with status: $(cat /sys/class/firmware/mpfs-auto-update/error)"
|
||||
exit 1
|
||||
fi
|
||||
3
board/beagleboard/beaglev_fire/uboot-fragment.config
Normal file
3
board/beagleboard/beaglev_fire/uboot-fragment.config
Normal file
@@ -0,0 +1,3 @@
|
||||
CONFIG_USE_BOOTARGS=y
|
||||
CONFIG_BOOTARGS="root=/dev/mmcblk0p3 rootwait uio_pdrv_genirq.of_id=generic-uio"
|
||||
CONFIG_MPFS_PRIORITISE_QSPI_BOOT=n
|
||||
Reference in New Issue
Block a user