forked from rarias/nixos-riscv
Add bootrom support
This commit is contained in:
@@ -7,6 +7,6 @@ source ./env.sh
|
||||
|
||||
#bitstream="-w system-acme_ea-4h2v.bit"
|
||||
|
||||
./fpgactl $bitstream -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img
|
||||
./fpgactl $bitstream -b opensbi.bin -k kernel.bin -i initrd.bin -r rootfs.img -R bootrom.bin
|
||||
|
||||
picocom -b 115200 /dev/ttyUSB2
|
||||
|
||||
@@ -37,11 +37,14 @@ function setup_meep()
|
||||
# Setup mappings
|
||||
|
||||
# Delta between where we load in the dma device and RAM
|
||||
local delta_addr=-0x60000000
|
||||
local delta_addr=-0x5ffe0000
|
||||
|
||||
# See https://gitlab.bsc.es/hwdesign/fpga/integration-lab/fpga-tools/-/blob/6a63bcea6d1d59df3c7d62311aa4935efd54d3a3/boot_riscv/boot_sa.sh#L36-40
|
||||
export FPGACTL_BOOTLOADER_ADDR=$((0x80000000+$delta_addr))
|
||||
export FPGACTL_KERNEL_ADDR=$((0x84000000+$delta_addr))
|
||||
export FPGACTL_INITRD_ADDR=$((0x8c300000+$delta_addr))
|
||||
export FPGACTL_ROOTFS_ADDR=$((0x100000000+$delta_addr))
|
||||
export FPGACTL_BOOTROM_ADDR=$((0x00000100))
|
||||
}
|
||||
|
||||
hostname=$(hostname)
|
||||
|
||||
@@ -370,6 +370,7 @@ bootloader=
|
||||
kernel=
|
||||
initrd=
|
||||
rootfs=
|
||||
bootrom=
|
||||
resetcpu=
|
||||
verbose=
|
||||
pcidev=
|
||||
@@ -383,6 +384,7 @@ bootloader_addr="${FPGACTL_BOOTLOADER_ADDR:-0x80000000}"
|
||||
kernel_addr="${FPGACTL_KERNEL_ADDR:-0x84000000}"
|
||||
initrd_addr="${FPGACTL_INITRD_ADDR:-0x8c300000}"
|
||||
rootfs_addr="${FPGACTL_ROOTFS_ADDR:-0x140000000}"
|
||||
bootrom_addr="${FPGACTL_BOOTROM_ADDR:-0x60000100}"
|
||||
|
||||
hostname="${hostname:-$(hostname)}"
|
||||
echo "hostname=$hostname"
|
||||
@@ -390,7 +392,7 @@ echo "hostname=$hostname"
|
||||
function usage()
|
||||
{
|
||||
echo "" >&2
|
||||
echo "Usage: $0 [-p pcidev] [-v] [-w bitstream] [-j serial] [-b bootloader] [-k kernel] [-i initrd]" >&2
|
||||
echo "Usage: $0 [-p pcidev] [-v] [-w bitstream] [-j serial] [-b bootloader] [-k kernel] [-i initrd] [-R bootroom] " >&2
|
||||
echo "" >&2
|
||||
echo "First writes the bitstream if given. Then loads the rest of files" >&2
|
||||
echo "into memory and restarts the CPU." >&2
|
||||
@@ -405,13 +407,14 @@ function usage()
|
||||
echo " -k kernel Load the kernel file in $kernel_addr" >&2
|
||||
echo " -i initrd Load the initrd file in $initrd_addr" >&2
|
||||
echo " -r rootfs Load the rootfs file in $rootfs_addr" >&2
|
||||
echo " -R bootrom Load the bootrom file in $bootrom_addr" >&2
|
||||
echo " -m model CPU model: Either 'hun' or 'ox' (default ox)" >&2
|
||||
echo " -v Be verbose" >&2
|
||||
echo "" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "hvw:b:k:i:r:p:j:m:" opt; do
|
||||
while getopts "hvw:b:k:i:r:p:j:m:R:" opt; do
|
||||
case "${opt}" in
|
||||
v) verbose=1 ;;
|
||||
w) bitstream="${OPTARG}" ;;
|
||||
@@ -419,6 +422,7 @@ while getopts "hvw:b:k:i:r:p:j:m:" opt; do
|
||||
k) kernel="${OPTARG}"; resetcpu=1 ;;
|
||||
i) initrd="${OPTARG}"; resetcpu=1 ;;
|
||||
r) rootfs="${OPTARG}"; resetcpu=1 ;;
|
||||
R) bootrom="${OPTARG}"; resetcpu=1 ;;
|
||||
p) pcidev="${OPTARG}" ;;
|
||||
j) jtagserial="${OPTARG}" ;;
|
||||
m) model="${OPTARG}" ;;
|
||||
@@ -441,6 +445,7 @@ test "$bootloader" && load_file_in_memory "$bootloader" $bootloader_addr
|
||||
test "$kernel" && load_file_in_memory "$kernel" $kernel_addr
|
||||
test "$initrd" && load_file_in_memory "$initrd" $initrd_addr
|
||||
test "$rootfs" && load_file_in_memory "$rootfs" $rootfs_addr
|
||||
test "$bootrom" && load_file_in_memory "$bootrom" $bootrom_addr
|
||||
test "$resetcpu" && do_cpu_release
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -22,6 +22,7 @@ else
|
||||
echo "Skipping rootfs"
|
||||
fi
|
||||
rsync "$BITSTREAM" "$dst/bitstream.bit"
|
||||
rsync "$BOOTROM" "$dst/bootrom.bin"
|
||||
rsync "$UBOOT_ENV" "$dst/uboot.env"
|
||||
|
||||
echo "Now go to $dst and run ./boot.sh"
|
||||
|
||||
Reference in New Issue
Block a user