init
commit
86a991b0a5
@ -0,0 +1 @@
|
|||||||
|
#+title: Build Linux
|
@ -0,0 +1,157 @@
|
|||||||
|
|
||||||
|
# Table of Contents
|
||||||
|
|
||||||
|
1. [Preface](#org1ca0724)
|
||||||
|
2. [Prerequisites](#orgd880ca0)
|
||||||
|
1. [Using the riscv toolchain provided via crossdev](#org0c91d99)
|
||||||
|
2. [Using a precompiled toolchain](#org95740e3)
|
||||||
|
3. [Clone & Build Heart Software Services (HSS)](#org5786970)
|
||||||
|
1. [Clone HSS](#org7fecd92)
|
||||||
|
2. [Build HSS](#org7510e9a)
|
||||||
|
4. [Clone & Build u-boot](#org02222bb)
|
||||||
|
1. [Clone u-boot](#org3cf2c32)
|
||||||
|
2. [Download the patches](#org2ecaabc)
|
||||||
|
3. [Build u-boot](#org2f41dfd)
|
||||||
|
5. [Build the Linux kernel](#orgcb36949)
|
||||||
|
6. [Generate the HSS payload](#orgc553d95)
|
||||||
|
7. [Gentoo](#orgd715570)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org1ca0724"></a>
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
<a id="orgd880ca0"></a>
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org0c91d99"></a>
|
||||||
|
|
||||||
|
## Using the riscv toolchain provided via crossdev
|
||||||
|
|
||||||
|
Crossdev is required for this step. If you don’t have crossdev set up, use [this](https: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](#org95740e3).
|
||||||
|
|
||||||
|
crossdev -t riscv64-unknown-linux-gnu
|
||||||
|
export RISCV64_CC="riscv64-unknown-linux-gnu-"
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org95740e3"></a>
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org5786970"></a>
|
||||||
|
|
||||||
|
# Clone & Build Heart Software Services (HSS)
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org7fecd92"></a>
|
||||||
|
|
||||||
|
## 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}
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org7510e9a"></a>
|
||||||
|
|
||||||
|
## 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/
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org02222bb"></a>
|
||||||
|
|
||||||
|
# Clone & Build u-boot
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org3cf2c32"></a>
|
||||||
|
|
||||||
|
## 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}
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org2ecaabc"></a>
|
||||||
|
|
||||||
|
## Download the patches
|
||||||
|
|
||||||
|
The patches currently exist as part of BeagleV’s `BeagleV-Fire-ubuntu` repo, so we’ll just clone the whole thing for now. Eventually, I’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}
|
||||||
|
|
||||||
|
|
||||||
|
<a id="org2f41dfd"></a>
|
||||||
|
|
||||||
|
## Build u-boot
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
<a id="orgcb36949"></a>
|
||||||
|
|
||||||
|
# Build the Linux kernel
|
||||||
|
|
||||||
|
|
||||||
|
<a id="orgc553d95"></a>
|
||||||
|
|
||||||
|
# Generate the HSS payload
|
||||||
|
|
||||||
|
|
||||||
|
<a id="orgd715570"></a>
|
||||||
|
|
||||||
|
# Gentoo
|
||||||
|
|
@ -0,0 +1,106 @@
|
|||||||
|
#+title: Gentoo on BeagleV: Fire
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* Prerequisites
|
||||||
|
|
||||||
|
#+begin_src bash :noeval
|
||||||
|
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
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Using the riscv toolchain provided via crossdev
|
||||||
|
|
||||||
|
Crossdev is required for this step. If you don't have crossdev set up, use [[https:https://wiki.gentoo.org/wiki/Crossdev][this]] 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 [[*Using a precompiled toolchain][these steps]].
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
crossdev -t riscv64-unknown-linux-gnu
|
||||||
|
export RISCV64_CC="riscv64-unknown-linux-gnu-"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Using a precompiled toolchain
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
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-"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
From this point forward, instructions will use the ~RISCV64_CC~ variable as the toolchain.
|
||||||
|
|
||||||
|
Export some other misc. environment variables:
|
||||||
|
#+begin_src bash
|
||||||
|
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)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Clone & Build Heart Software Services (HSS)
|
||||||
|
** Clone HSS
|
||||||
|
#+begin_src bash
|
||||||
|
# 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}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Build HSS
|
||||||
|
#+begin_src bash
|
||||||
|
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/
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Clone & Build u-boot
|
||||||
|
** Clone u-boot
|
||||||
|
#+begin_src bash
|
||||||
|
# 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}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Download the patches
|
||||||
|
|
||||||
|
The patches currently exist as part of BeagleV's ~BeagleV-Fire-ubuntu~ repo, so we'll just clone the whole thing for now. Eventually, I'll see if I can mirror just the patches somewhere.
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
git clone https://git.beagleboard.org/beaglev-fire/BeagleV-Fire-ubuntu.git ./beaglev --depth=${GIT_DEPTH}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
** Build u-boot
|
||||||
|
#+begin_src bash
|
||||||
|
# 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
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Build the Linux kernel
|
||||||
|
* Generate the HSS payload
|
||||||
|
* Gentoo
|
@ -0,0 +1 @@
|
|||||||
|
#!/usr/bin/env bash
|
Loading…
Reference in New Issue