Skip to content

Commit

Permalink
Merge pull request #324 from mithro/master
Browse files Browse the repository at this point in the history
More tweaking or1k with QEMU
  • Loading branch information
mithro committed Apr 6, 2017
2 parents 875e556 + be30640 commit 8e7dc58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ env:
matrix:
# - PLATFORM=arty
- CPU=lm32 PLATFORM=atlys SKIP_TARGETS="hdmi2usb\|video.*"
- CPU=or1k PLATFORM=atlys SKIP_TARGETS="hdmi2usb\|video.*"
- CPU=or1k PLATFORM=atlys TARGETS="base net"
- PLATFORM=atlys TARGET=video
- PLATFORM=atlys TARGET=hdmi2usb
- PLATFORM=minispartan6
# - PLATFORM=netv2
# - PLATFORM=nexys_video
# - PLATFORM=pipistrello
- CPU=lm32 PLATFORM=opsis SKIP_TARGETS="hdmi2usb\|video.*"
- CPU=or1k PLATFORM=opsis SKIP_TARGETS="hdmi2usb\|video.*"
- CPU=or1k PLATFORM=opsis TARGETS="base net"
- PLATFORM=opsis TARGET=video
- PLATFORM=opsis TARGET=hdmi2usb
# - PLATFORM=sim
- CPU=lm32 PLATFORM=mimasv2
- CPU=or1k PLATFORM=mimasv2 SKIP_TARGETS="memtest" # or1k and memtest don't fit on mimasv2
- CPU=or1k PLATFORM=mimasv2 TARGETS="base" # or1k and memtest don't fit on mimasv2

install:
- $PWD/.travis/setup.sh
Expand Down
25 changes: 17 additions & 8 deletions scripts/build-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,22 @@ cd $OLD_DIR
/usr/bin/env python mkimage.py --output-file=qemu.bin --override-gateware=none --force-image-size=true
$TARGET_QEMU_BUILD_DIR/qemu-img convert -f raw $TARGET_BUILD_DIR/qemu.bin -O qcow2 -S 16M $TARGET_BUILD_DIR/qemu.qcow2

HAS_LITEETH=$(grep -q ETHMAC_BASE $TARGET_BUILD_DIR/software/include/generated/csr.h && echo 1 || echo 0)
# BIOS
if grep -q 'ROM_BASE 0x00000000' $TARGET_BUILD_DIR/software/include/generated/mem.h; then
echo "Platform has BIOS ROM, adding BIOS"
EXTRA_ARGS+=("-bios $TARGET_BUILD_DIR/software/bios/bios.bin")
fi

# SPI Flash
if grep -q 'SPIFLASH_BASE' $TARGET_BUILD_DIR/software/include/generated/mem.h; then
SPIFLASH_MODEL=$(grep spiflash_model platforms/$PLATFORM.py | sed -e's/[^"]*"//' -e's/".*$//')

echo "Platform has SPI flash - assuming n25q16!"
EXTRA_ARGS+=("-drive if=mtd,format=qcow2,file=$TARGET_BUILD_DIR/qemu.qcow2,serial=$SPIFLASH_MODEL")
fi

if [ $HAS_LITEETH -eq 1 ]; then
# Ethernet
if grep -q ETHMAC_BASE $TARGET_BUILD_DIR/software/include/generated/csr.h; then
if [ ! -e /dev/net/tap0 ]; then
sudo true
echo "Need to bring up a tun device."
Expand All @@ -112,8 +125,8 @@ if [ $HAS_LITEETH -eq 1 ]; then
sudo chown $(whoami) /dev/net/tap0
make tftpd_start
fi
EXTRA_ARGS="-net nic -net tap,ifname=tap0,script=no,downscript=no"
make tftp
EXTRA_ARGS+=("-net nic -net tap,ifname=tap0,script=no,downscript=no")
fi

SPIFLASH_MODEL=$(grep spiflash_model platforms/$PLATFORM.py | sed -e's/[^"]*"//' -e's/".*$//')
Expand All @@ -124,8 +137,4 @@ $TARGET_QEMU_BUILD_DIR/$QEMU_ARCH/qemu-system-$QEMU_CPU \
-nographic -nodefaults \
-monitor pty \
-serial stdio \
-bios $TARGET_BUILD_DIR/software/bios/bios.bin \
-drive if=mtd,format=qcow2,file=$TARGET_BUILD_DIR/qemu.qcow2,serial=$SPIFLASH_MODEL \
$EXTRA_ARGS


${EXTRA_ARGS[@]}

0 comments on commit 8e7dc58

Please sign in to comment.