You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
5.3 KiB
Markdown

12 months ago
# Table of Contents
12 months ago
1. [Preface](#org1e835ab)
2. [Prerequisites](#org906530a)
1. [Using the riscv toolchain provided via crossdev](#org81f210c)
2. [Using a precompiled toolchain](#orgcee506a)
3. [Clone & Build Heart Software Services (HSS)](#orgcf597f6)
1. [Clone HSS](#org457b83e)
2. [Build HSS](#org3e3a28d)
4. [Clone & Build u-boot](#orgf0e36bd)
1. [Clone u-boot](#org8956801)
2. [Download the patches](#org93d8740)
3. [Build u-boot](#org6208aac)
5. [Build the Linux kernel](#org9277169)
6. [Generate the HSS payload](#org48e5afc)
7. [Gentoo](#orgdc16ac3)
12 months ago
12 months ago
<a id="org1e835ab"></a>
12 months ago
# Preface
This guide is written in a way that forces the reader to manually perform every step, excluding environment variables via the setup script because I want to be able to change those. If you would like to follow the official guide provided by beagleboard, which is far more streamlined and automated, please see the references at the bottom of this document.
12 months ago
<a id="org906530a"></a>
12 months ago
# Prerequisites
emerge -a sys-block/bmap-tools sys-fs/genimage dev-libs/libyaml sys-fs/mtools
mkdir beaglev-fire-gentoo && cd beaglev-fire-gentoo
# deploy will contain any output files, images, etc
mkdir deploy
12 months ago
<a id="org81f210c"></a>
12 months ago
## Using the riscv toolchain provided via crossdev
12 months ago
Crossdev is required for this step. If you don&rsquo;t have crossdev set up, use [this](https://wiki.gentoo.org/wiki/Crossdev) guide to install it. At the time of writing this installs riscv64-unknown-linux-gnu-gcc 13.2.1. This is note worthy because the official guide uses 11.4. If there are issues with this toolchain, use the precompiled toolchain via [these steps](#orgcee506a).
12 months ago
crossdev -t riscv64-unknown-linux-gnu
export RISCV64_CC="riscv64-unknown-linux-gnu-"
12 months ago
<a id="orgcee506a"></a>
12 months ago
## Using a precompiled toolchain
mkdir mirror
mkdir toolchain
export GCC_VERSION=11.4.0
wget -c --directory-prefix=./mirror/ "https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/${GCC_VERSION}/x86_64-gcc-${GCC_VERSION}-nolibc-riscv64-linux.tar.xz"
tar xvf ./mirror/x86_64-gcc-${GCC_VERSION}-nolibc-riscv64-linux.tar.xz --strip-components=2 -C ./toolchain/
export RISCV64_CC="$PWD/toolchain/bin/riscv64-linux-"
From this point forward, instructions will use the `RISCV64_CC` variable as the toolchain.
Export some other misc. environment variables:
export HSS_BRANCH="v2023.02"
export HSS_REPO="https://github.com/polarfire-soc/hart-software-services.git"
export UBOOT_BRANCH="linux4microchip+fpga-2023.02"
export UBOOT_REPO="https://github.com/polarfire-soc/u-boot.git"
export GIT_DEPTH=20
export CORES=$(getconf _NPROCESSORS_ONLN)
12 months ago
<a id="orgcf597f6"></a>
12 months ago
# Clone & Build Heart Software Services (HSS)
12 months ago
<a id="org457b83e"></a>
12 months ago
## Clone HSS
# remove old if it exists, optional
if [ -d ./hart-software-services/ ] ; then
rm -rf ./hart-software-services/ || true
fi
git clone -b ${HSS_BRANCH} ${HSS_REPO} ./hart-software-services/ --depth=${GIT_DEPTH}
12 months ago
<a id="org3e3a28d"></a>
12 months ago
## Build HSS
make -C hart-software-services/tools/hss-payload-generator/ clean
make -C hart-software-services/tools/hss-payload-generator/
cp -v ./hart-software-services/tools/hss-payload-generator/hss-payload-generator ./deploy/
12 months ago
<a id="orgf0e36bd"></a>
12 months ago
# Clone & Build u-boot
12 months ago
<a id="org8956801"></a>
12 months ago
## Clone u-boot
# remove old if it exists, optional
if [ -d ./u-boot ] ; then
rm -rf ./u-boot || true
fi
git clone -b ${UBOOT_BRANCH} ${UBOOT_REPO} ./u-boot/ --depth=${GIT_DEPTH}
12 months ago
<a id="org93d8740"></a>
12 months ago
## Download the patches
The patches currently exist as part of BeagleV&rsquo;s `BeagleV-Fire-ubuntu` repo, so we&rsquo;ll just clone the whole thing for now. Eventually, I&rsquo;ll see if I can mirror just the patches somewhere.
git clone https://git.beagleboard.org/beaglev-fire/BeagleV-Fire-ubuntu.git ./beaglev --depth=${GIT_DEPTH}
12 months ago
<a id="org6208aac"></a>
12 months ago
12 months ago
## WIP Build u-boot
12 months ago
# Apply patches to uboot
cp -v ./patches/u-boot/beaglev-fire/microchip_mpfs_icicle.h ./u-boot/include/configs/microchip_mpfs_icicle.h
cp -v ./patches/u-boot/beaglev-fire/microchip-mpfs-icicle-kit.dts ./u-boot/arch/riscv/dts/
cp -v ./patches/u-boot/beaglev-fire/microchip_mpfs_icicle_defconfig ./u-boot/configs/microchip_mpfs_icicle_defconfig
make -C u-boot ARCH=riscv CROSS_COMPILE=${RISCV64_CC} microchip_mpfs_icicle_defconfig
# if you want to make configurations....
# make -C u-boot ARCH=riscv CROSS_COMPILE=${RISCV64_CC} menuconfig
make -C u-boot ARCH=riscv CROSS_COMPILE=${RISCV64_CC} olddefconfig
make -C u-boot ARCH=riscv CROSS_COMPILE=${RISCV64_CC} savedefconfig
cp -v ./u-boot/defconfig ./u-boot/configs/microchip_mpfs_icicle_defconfig
cp -v ./u-boot/defconfig ./patches/u-boot/beaglev-fire/microchip_mpfs_icicle_defconfig
make -C u-boot -j${CORES} ARCH=riscv CROSS_COMPILE=${RISCV_CC} all
# copy the generated uboot into our deploy folder
cp -v ./u-boot/u-boot.bin ./deploy/
# i have no idea why 2 copies are being made, one u-boot.bin and one src.bin
cp -v ./u-boot/u-boot.bin ./deploy/src.bin
12 months ago
<a id="org9277169"></a>
12 months ago
12 months ago
# TODO Build the Linux kernel
12 months ago
12 months ago
<a id="org48e5afc"></a>
12 months ago
12 months ago
# TODO Generate the HSS payload
12 months ago
12 months ago
<a id="orgdc16ac3"></a>
12 months ago
12 months ago
# TODO Gentoo
12 months ago