Skip to content

Commit

Permalink
build-renode: Allow to boot Linux from flash
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-holenko committed Feb 19, 2020
1 parent 07140bc commit 471871f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
31 changes: 25 additions & 6 deletions scripts/build-renode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ case $CPU in
;;
esac

LITEX_RENODE="$TOP_DIR/third_party/litex-renode"
LITEX_CONFIG_FILE="$TARGET_BUILD_DIR/test/csr.csv"
if [ ! -f "$LITEX_CONFIG_FILE" ]; then
make firmware
Expand Down Expand Up @@ -75,12 +76,30 @@ RENODE_RESC="$RENODE_SCRIPTS_DIR/litex_buildenv.resc"
RENODE_REPL="$RENODE_SCRIPTS_DIR/litex_buildenv.repl"

mkdir -p $RENODE_SCRIPTS_DIR
python $TOP_DIR/third_party/litex-renode/generate-renode-scripts.py $LITEX_CONFIG_FILE \
--repl "$RENODE_REPL" \
--resc "$RENODE_RESC" \
--bios-binary "$TARGET_BUILD_DIR/software/bios/bios.bin" \
--firmware-binary "$TARGET_BUILD_DIR/software/$FIRMWARE/firmware.bin" \
--configure-network ${TAP_INTERFACE:-""}

KERNEL_FLASH_OFFSET=`python $LITEX_RENODE/litex-config-parser.py $LITEX_CONFIG_FILE --constant kernel_image_flash_offset`
ROOTFS_FLASH_OFFSET=`python $LITEX_RENODE/litex-config-parser.py $LITEX_CONFIG_FILE --constant rootfs_image_flash_offset`
DTB_FLASH_OFFSET=`python $LITEX_RENODE/litex-config-parser.py $LITEX_CONFIG_FILE --constant device_tree_image_flash_offset`
EMULATOR_FLASH_OFFSET=`python $LITEX_RENODE/litex-config-parser.py $LITEX_CONFIG_FILE --constant emulator_image_flash_offset`

if [ "$FIRMWARE" == "linux" ]; then
python $LITEX_RENODE/generate-renode-scripts.py $LITEX_CONFIG_FILE \
--repl "$RENODE_REPL" \
--resc "$RENODE_RESC" \
--bios-binary "$TARGET_BUILD_DIR/software/bios/bios.bin" \
--flash-binary "$TARGET_BUILD_DIR/software/linux/firmware.bin:$KERNEL_FLASH_OFFSET" \
--flash-binary "$TARGET_BUILD_DIR/software/linux/riscv32-rootfs.cpio:$ROOTFS_FLASH_OFFSET"\
--flash-binary "$TARGET_BUILD_DIR/software/linux/rv32.dtb:$DTB_FLASH_OFFSET" \
--flash-binary "$TARGET_BUILD_DIR/emulator/emulator.bin:$EMULATOR_FLASH_OFFSET" \
--configure-network ${TAP_INTERFACE:-""}
else
python $LITEX_RENODE/generate-renode-scripts.py $LITEX_CONFIG_FILE \
--repl "$RENODE_REPL" \
--resc "$RENODE_RESC" \
--bios-binary "$TARGET_BUILD_DIR/software/bios/bios.bin" \
--firmware-binary "$TARGET_BUILD_DIR/software/$FIRMWARE/firmware.bin" \
--configure-network ${TAP_INTERFACE:-""}
fi

# 1. include the generated script
# 2. set additional parameters
Expand Down
2 changes: 1 addition & 1 deletion third_party/litex-renode

0 comments on commit 471871f

Please sign in to comment.