mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge pull request #384 from JacobPease/main
Updated Linux config. Modified flash-sd.sh script.
This commit is contained in:
commit
c60d56a1a5
@ -1,4 +1,28 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
###########################################
|
||||||
|
## proberange.sh
|
||||||
|
##
|
||||||
|
## Written: Jacob Pease jacobpease@protonmail.com
|
||||||
|
## Created: 6 April 2023
|
||||||
|
## Modified: 16 August 2023
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org#licenses#SHL-2.1#
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
24
fpga/probes
24
fpga/probes
@ -1,4 +1,28 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
###########################################
|
||||||
|
## probe.sh
|
||||||
|
##
|
||||||
|
## Written: Jacob Pease jacobpease@protonmail.com
|
||||||
|
## Created: 6 April 2023
|
||||||
|
## Modified: 16 August 2023
|
||||||
|
##
|
||||||
|
## A component of the CORE-V-WALLY configurable RISC-V project.
|
||||||
|
##
|
||||||
|
## Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
##
|
||||||
|
## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
||||||
|
## except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
||||||
|
## may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## https:##solderpad.org#licenses#SHL-2.1#
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, any work distributed under the
|
||||||
|
## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
## either express or implied. See the License for the specific language governing permissions
|
||||||
|
## and limitations under the License.
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -213,7 +213,6 @@ CONFIG_GENERIC_HWEIGHT=y
|
|||||||
CONFIG_FIX_EARLYCON_MEM=y
|
CONFIG_FIX_EARLYCON_MEM=y
|
||||||
CONFIG_PGTABLE_LEVELS=5
|
CONFIG_PGTABLE_LEVELS=5
|
||||||
CONFIG_LOCKDEP_SUPPORT=y
|
CONFIG_LOCKDEP_SUPPORT=y
|
||||||
CONFIG_RISCV_DMA_NONCOHERENT=y
|
|
||||||
CONFIG_AS_HAS_INSN=y
|
CONFIG_AS_HAS_INSN=y
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -246,8 +245,8 @@ CONFIG_MODULE_SECTIONS=y
|
|||||||
CONFIG_TUNE_GENERIC=y
|
CONFIG_TUNE_GENERIC=y
|
||||||
CONFIG_RISCV_ALTERNATIVE=y
|
CONFIG_RISCV_ALTERNATIVE=y
|
||||||
CONFIG_RISCV_ISA_C=y
|
CONFIG_RISCV_ISA_C=y
|
||||||
CONFIG_RISCV_ISA_SVPBMT=y
|
# CONFIG_RISCV_ISA_SVPBMT is not set
|
||||||
CONFIG_RISCV_ISA_ZICBOM=y
|
# CONFIG_RISCV_ISA_ZICBOM is not set
|
||||||
CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y
|
CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y
|
||||||
CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI=y
|
CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
@ -1427,22 +1426,14 @@ CONFIG_CRC32_SLICEBY8=y
|
|||||||
CONFIG_ZLIB_INFLATE=y
|
CONFIG_ZLIB_INFLATE=y
|
||||||
# CONFIG_XZ_DEC is not set
|
# CONFIG_XZ_DEC is not set
|
||||||
CONFIG_DECOMPRESS_GZIP=y
|
CONFIG_DECOMPRESS_GZIP=y
|
||||||
CONFIG_GENERIC_ALLOCATOR=y
|
|
||||||
CONFIG_HAS_IOMEM=y
|
CONFIG_HAS_IOMEM=y
|
||||||
CONFIG_HAS_IOPORT_MAP=y
|
CONFIG_HAS_IOPORT_MAP=y
|
||||||
CONFIG_HAS_DMA=y
|
CONFIG_HAS_DMA=y
|
||||||
CONFIG_NEED_DMA_MAP_STATE=y
|
CONFIG_NEED_DMA_MAP_STATE=y
|
||||||
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
||||||
CONFIG_DMA_DECLARE_COHERENT=y
|
CONFIG_DMA_DECLARE_COHERENT=y
|
||||||
CONFIG_ARCH_HAS_SETUP_DMA_OPS=y
|
|
||||||
CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y
|
|
||||||
CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y
|
|
||||||
CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y
|
|
||||||
CONFIG_SWIOTLB=y
|
CONFIG_SWIOTLB=y
|
||||||
# CONFIG_DMA_RESTRICTED_POOL is not set
|
# CONFIG_DMA_RESTRICTED_POOL is not set
|
||||||
CONFIG_DMA_NONCOHERENT_MMAP=y
|
|
||||||
CONFIG_DMA_COHERENT_POOL=y
|
|
||||||
CONFIG_DMA_DIRECT_REMAP=y
|
|
||||||
# CONFIG_DMA_API_DEBUG is not set
|
# CONFIG_DMA_API_DEBUG is not set
|
||||||
# CONFIG_DMA_MAP_BENCHMARK is not set
|
# CONFIG_DMA_MAP_BENCHMARK is not set
|
||||||
# CONFIG_IRQ_POLL is not set
|
# CONFIG_IRQ_POLL is not set
|
||||||
|
@ -4,14 +4,18 @@
|
|||||||
# set -e
|
# set -e
|
||||||
|
|
||||||
# Output colors
|
# Output colors
|
||||||
GREEN='\033[1;32m'
|
GREEN="\e[32m"
|
||||||
RED='\033[1;31m'
|
RED="\e[31m"
|
||||||
NC='\033[0m'
|
BOLDRED="\e[1;91m"
|
||||||
NAME="$GREEN"${0:2}"$NC"
|
BOLDGREEN="\e[1;32m"
|
||||||
|
NC="\e[0m"
|
||||||
|
NAME="$BOLDGREEN"${0:2}:"$NC"
|
||||||
|
ERRORTEXT="$BOLDRED"ERROR:"$NC"
|
||||||
|
|
||||||
# File location variables
|
# File location variables
|
||||||
RISCV=/opt/riscv
|
RISCV=/opt/riscv
|
||||||
IMAGES=$RISCV/buildroot/output/images/
|
BUILDROOT=$RISCV/buildroot
|
||||||
|
IMAGES=$BUILDROOT/output/images
|
||||||
FW_JUMP=$IMAGES/fw_jump.bin
|
FW_JUMP=$IMAGES/fw_jump.bin
|
||||||
LINUX_KERNEL=$IMAGES/Image
|
LINUX_KERNEL=$IMAGES/Image
|
||||||
DEVICE_TREE=$IMAGES/wally-vcu108.dtb
|
DEVICE_TREE=$IMAGES/wally-vcu108.dtb
|
||||||
@ -19,31 +23,61 @@ DEVICE_TREE=$IMAGES/wally-vcu108.dtb
|
|||||||
# Mount Directory
|
# Mount Directory
|
||||||
MNT_DIR=wallyimg
|
MNT_DIR=wallyimg
|
||||||
|
|
||||||
|
# Usage function
|
||||||
|
usage() { echo "Usage: $0 [-z] [-b <path/to/buildroot>] <device>" 1>&2; exit 1; }
|
||||||
|
|
||||||
|
# Process options and arguments. The following code grabs the single
|
||||||
|
# sdcard device argument no matter where it is in the positional
|
||||||
|
# parameters list.
|
||||||
|
ARGS=()
|
||||||
|
while [ $OPTIND -le "$#" ] ; do
|
||||||
|
if getopts "hzb:" arg ; then
|
||||||
|
case "${arg}" in
|
||||||
|
h) usage
|
||||||
|
;;
|
||||||
|
z) WIPECARD=y
|
||||||
|
;;
|
||||||
|
b) BUILDROOT=${OPTARG}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
ARGS+=("${!OPTIND}")
|
||||||
|
((OPTIND++))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
SDCARD=${ARGS[0]}
|
||||||
|
|
||||||
if [ "$#" -eq "0" ] ; then
|
if [ "$#" -eq "0" ] ; then
|
||||||
echo "$NAME: $RED ERROR $NC: You must supply the SD card device."
|
usage
|
||||||
echo "usage: ./flash-sd.sh <sd device> <mount directory>"
|
fi
|
||||||
|
|
||||||
|
# Check to make sure sd card device exists
|
||||||
|
|
||||||
|
if [ ! -e "$SDCARD" ] ; then
|
||||||
|
echo -e "$NAME $ERRORTEXT SD card device does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$1" ] ; then
|
# If no images directory, images have not been built
|
||||||
echo "$NAME:$RED ERROR $NC: SD card device does not exist."
|
if [ ! -d $IMAGES ] ; then
|
||||||
exit 1
|
echo -e "$ERRORTEXT Buildroot images directory does not exist"
|
||||||
fi
|
echo ' Make sure you have built the images before'
|
||||||
|
echo ' running this script.'
|
||||||
if [ ! -z "$2" ] ; then
|
|
||||||
MNT_DIR=$2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If images are not built, exit
|
|
||||||
if [ ! -e $FW_JUMP ] || [ ! -e $LINUX_KERNEL ] ; then
|
|
||||||
echo 'ERROR: Missing images in buildroot output directory.'
|
|
||||||
echo ' Build images before running this script.'
|
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
# If images are not built, exit
|
||||||
|
if [ ! -e $FW_JUMP ] || [ ! -e $LINUX_KERNEL ] ; then
|
||||||
|
echo -e '$ERRORTEXT Missing images in buildroot output directory.'
|
||||||
|
echo ' Build images before running this script.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ensure device tree binaries exist
|
||||||
if [ ! -e $DEVICE_TREE ] ; then
|
if [ ! -e $DEVICE_TREE ] ; then
|
||||||
echo 'ERROR: Missing device tree file'
|
echo -e '$ERRORTEXT Missing device tree files'
|
||||||
exit 1
|
make -C ../ generate BUILDROOT=$BUILDROOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Size of OpenSBI and the Kernel in 512B blocks
|
# Size of OpenSBI and the Kernel in 512B blocks
|
||||||
@ -57,23 +91,25 @@ KERNEL_START=$(( $FW_JUMP_START + $FW_JUMP_SIZE ))
|
|||||||
FS_START=$(( $KERNEL_START + $KERNEL_SIZE ))
|
FS_START=$(( $KERNEL_START + $KERNEL_SIZE ))
|
||||||
|
|
||||||
# Print out the sizes of the binaries in 512B blocks
|
# Print out the sizes of the binaries in 512B blocks
|
||||||
echo -e "$NAME: Device tree block size: $DST_SIZE"
|
echo -e "$NAME Device tree block size: $DST_SIZE"
|
||||||
echo -e "$NAME: OpenSBI FW_JUMP block size: $FW_JUMP_SIZE"
|
echo -e "$NAME OpenSBI FW_JUMP block size: $FW_JUMP_SIZE"
|
||||||
echo -e "$NAME: Kernel block size: $KERNEL_SIZE"
|
echo -e "$NAME Kernel block size: $KERNEL_SIZE"
|
||||||
|
|
||||||
read -p "Warning: Doing this will replace all data on this card.\nContinue? y/n: " -n 1 -r
|
read -p "Warning: Doing this will replace all data on this card. Continue? y/n: " -n 1 -r
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]] ; then
|
if [[ $REPLY =~ ^[Yy]$ ]] ; then
|
||||||
DEVBASENAME=$(basename $1)
|
DEVBASENAME=$(basename $SDCARD)
|
||||||
CHECKMOUNT=$(lsblk | grep "sdb4" | tr -s ' ' | cut -d' ' -f 7)
|
CHECKMOUNT=$(lsblk | grep "$DEVBASENAME"4 | tr -s ' ' | cut -d' ' -f 7)
|
||||||
|
|
||||||
if [ ! -z $CHECKMOUNT ] ; then
|
if [ ! -z $CHECKMOUNT ] ; then
|
||||||
sudo umount -v $CHECKMOUNT
|
sudo umount -v $CHECKMOUNT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Make empty image
|
#Make empty image
|
||||||
echo -e "$NAME: Creating blank image"
|
if [ ! -z $WIPECARD ] ; then
|
||||||
sudo dd if=/dev/zero of=$1 bs=64k status=progress && sync
|
echo -e "$NAME Wiping SD card. This could take a while."
|
||||||
|
sudo dd if=/dev/zero of=$SDCARD bs=64k status=progress && sync
|
||||||
|
fi
|
||||||
|
|
||||||
# GUID Partition Tables (GPT)
|
# GUID Partition Tables (GPT)
|
||||||
# ===============================================
|
# ===============================================
|
||||||
@ -83,19 +119,19 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then
|
|||||||
# to 1 sector boundaries I think? This would normally be set to 2048
|
# to 1 sector boundaries I think? This would normally be set to 2048
|
||||||
# apparently.
|
# apparently.
|
||||||
|
|
||||||
sudo sgdisk -z $1
|
sudo sgdisk -z $SDCARD
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
echo -e "$NAME: Creating GUID Partition Table"
|
echo -e "$NAME Creating GUID Partition Table"
|
||||||
sudo sgdisk -g --clear --set-alignment=1 \
|
sudo sgdisk -g --clear --set-alignment=1 \
|
||||||
--new=1:34:+$DST_SIZE: --change-name=1:'fdt' \
|
--new=1:34:+$DST_SIZE: --change-name=1:'fdt' \
|
||||||
--new=2:$FW_JUMP_START:+$FW_JUMP_SIZE --change-name=2:'opensbi' --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \
|
--new=2:$FW_JUMP_START:+$FW_JUMP_SIZE --change-name=2:'opensbi' --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \
|
||||||
--new=3:$KERNEL_START:+$KERNEL_SIZE --change-name=3:'kernel' \
|
--new=3:$KERNEL_START:+$KERNEL_SIZE --change-name=3:'kernel' \
|
||||||
--new=4:$FS_START:-0 --change-name=4:'filesystem' \
|
--new=4:$FS_START:-0 --change-name=4:'filesystem' \
|
||||||
$1
|
$SDCARD
|
||||||
|
|
||||||
sudo partprobe $1
|
sudo partprobe $SDCARD
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
@ -103,18 +139,18 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then
|
|||||||
DD_FLAGS="bs=4k iflag=fullblock oflag=direct conv=fsync status=progress"
|
DD_FLAGS="bs=4k iflag=fullblock oflag=direct conv=fsync status=progress"
|
||||||
|
|
||||||
echo -e "$NAME: Copying device tree"
|
echo -e "$NAME: Copying device tree"
|
||||||
sudo dd if=$DEVICE_TREE of="$1"1 $DD_FLAGS
|
sudo dd if=$DEVICE_TREE of="$SDCARD"1 $DD_FLAGS
|
||||||
|
|
||||||
echo -e "$NAME: Copying OpenSBI"
|
echo -e "$NAME: Copying OpenSBI"
|
||||||
sudo dd if=$FW_JUMP of="$1"2 $DD_FLAGS
|
sudo dd if=$FW_JUMP of="$SDCARD"2 $DD_FLAGS
|
||||||
|
|
||||||
echo -e "$NAME: Copying Kernel"
|
echo -e "$NAME: Copying Kernel"
|
||||||
sudo dd if=$LINUX_KERNEL of="$1"3 $DD_FLAGS
|
sudo dd if=$LINUX_KERNEL of="$SDCARD"3 $DD_FLAGS
|
||||||
|
|
||||||
sudo mkfs.ext4 "$1"4
|
sudo mkfs.ext4 "$SDCARD"4
|
||||||
sudo mkdir /mnt/$MNT_DIR
|
sudo mkdir /mnt/$MNT_DIR
|
||||||
|
|
||||||
sudo mount -v "$1"4 /mnt/$MNT_DIR
|
sudo mount -v "$SDCARD"4 /mnt/$MNT_DIR
|
||||||
|
|
||||||
sudo umount -v /mnt/$MNT_DIR
|
sudo umount -v /mnt/$MNT_DIR
|
||||||
|
|
||||||
@ -123,5 +159,5 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "GPT Information for $1 ==================================="
|
echo "GPT Information for $SDCARD ==================================="
|
||||||
sudo sgdisk -p $1
|
sudo sgdisk -p $SDCARD
|
||||||
|
Loading…
Reference in New Issue
Block a user