-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from keystone-enclave/dev
- Loading branch information
Showing
17 changed files
with
278 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
riscv/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
LINUX_DIR=riscv-linux | ||
BUSYBEAR_DIR=busybear-linux | ||
BOOTROM_DIR=bootrom | ||
SM_DIR=riscv-pk | ||
SM_BUILD_DIR=$(SM_DIR)/build | ||
DRIVER_DIR=linux-keystone-driver | ||
SDK_DIR=sdk | ||
QEMU_DIR=riscv-qemu | ||
|
||
BOOTROM=$(BOOTROM_DIR)/bootrom.elf | ||
VMLINUX=$(LINUX_DIR)/vmlinux | ||
SM=$(SM_DIR)/build/bbl | ||
|
||
DISK=$(BUSYBEAR_DIR)/busybear.bin | ||
DRIVER=$(DRIVER_DIR)/keystone-driver.ko | ||
LINUX_CONFIG=$(LINUX_DIR)/.config | ||
QEMU=$(QEMU_DIR)/riscv64-softmmu/qemu-system-riscv64 | ||
|
||
NPROC=$(shell nproc) | ||
|
||
all: $(BOOTROM) $(VMLINUX) $(SM) $(DISK) $(DRIVER) $(QEMU) | ||
make -C $(SM_BUILD_DIR) | ||
make -C $(SDK_DIR) | ||
make -C $(SDK_DIR) copy-tests | ||
make -C $(DRIVER_DIR) copy | ||
|
||
qemu: all | ||
./scripts/run-qemu.sh | ||
|
||
$(QEMU): | ||
./scripts/apply-patch.sh | ||
cd $(QEMU_DIR); ./configure --target-list=riscv64-softmmu,riscv32-softmmu; | ||
make -C $(QEMU_DIR) | ||
|
||
$(SM): $(VMLINUX) $(SM_BUILD_DIR) | ||
make -C $(SM_BUILD_DIR) | ||
|
||
$(SM_BUILD_DIR): $(VMLINUX) | ||
mkdir -p $(SM_BUILD_DIR) | ||
cd $(SM_BUILD_DIR); ../configure \ | ||
--enable-logo \ | ||
--host=riscv64-unknown-elf \ | ||
--with-payload=../../$(VMLINUX) \ | ||
--enable-sm | ||
|
||
$(DRIVER): $(VMLINUX) $(LINUX_CONFIG) | ||
make -C $(DRIVER_DIR) | ||
|
||
$(DISK): | ||
make -C $(BUSYBEAR_DIR) | ||
sudo chmod og+w $(DISK) | ||
|
||
$(LINUX_CONFIG): | ||
cp $(BUSYBEAR_DIR)/conf/linux.config $(LINUX_DIR)/.config | ||
make -C $(LINUX_DIR) ARCH=riscv olddefconfig | ||
|
||
$(VMLINUX): $(LINUX_CONFIG) | ||
./scripts/apply-patch.sh | ||
make -C $(LINUX_DIR) ARCH=riscv -j$(NPROC) vmlinux | ||
|
||
$(BOOTROM): | ||
cd bootrom; make; cd .. | ||
|
||
clean: | ||
rm -f $(LINUX_CONFIG) | ||
make -C $(LINUX_DIR) ARCH=riscv clean | ||
make -C $(BUSYBEAR_DIR) clean | ||
make -C $(BOOTROM_DIR) clean | ||
make -C $(SM_BUILD_DIR) clean | ||
make -C $(DRIVER_DIR) clean | ||
make -C $(QEMU_DIR) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
echo "Starting..." | ||
if ( $(command -v riscv64-unknown-linux-gnu-gcc > /dev/null) && | ||
$(command -v riscv64-unknown-elf-gcc > /dev/null) ) | ||
then | ||
echo "RISCV tools are already installed" | ||
else | ||
echo "Downloading Prebuilt RISC-V Toolchain... " | ||
export RISCV=$(pwd)/riscv | ||
export PATH=$PATH:$RISCV/bin | ||
git clone https://github.com/keystone-enclave/firesim-riscv-tools-prebuilt.git --depth 1 | ||
|
||
cd firesim-riscv-tools-prebuilt | ||
./installrelease.sh > riscv-tools-install.log | ||
mv distrib riscv | ||
cp -R riscv ../ | ||
cd .. | ||
echo "Toolchain has been installed in $RISCV" | ||
fi | ||
|
||
git config --global submodule.riscv-gnu-toolchain.update none | ||
git submodule update --init --recursive |
Submodule riscv-qemu
updated
from 3b3e2e to 3cc4af
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/env bash | ||
cd riscv-qemu | ||
patch hw/riscv/boot.c < ../patches/qemu-kernel-reloc.patch | ||
patch -p0 --forward hw/riscv/boot.c < ../patches/qemu-kernel-reloc.patch || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/usr/bin/env bash | ||
./riscv-qemu/riscv64-softmmu/qemu-system-riscv64 -D debug.log -nographic -machine virt\ | ||
./riscv-qemu/riscv64-softmmu/qemu-system-riscv64 -D debug.log -nographic -m 4G -machine virt\ | ||
-bios bootrom/bootrom.elf \ | ||
-kernel riscv-pk/build/bbl -append "root=/dev/vda ro console=ttyS0" \ | ||
-drive file=busybear-linux/busybear.bin,format=raw,id=hd0 \ | ||
-device virtio-blk-device,drive=hd0 \ | ||
#-netdev type=tap,script=./ifup,downscript=./ifdown,id=net0 \ | ||
-netdev user,id=net0,net=192.168.100.1/24,dhcpstart=192.168.100.128,hostfwd=tcp::5555-:22 \ | ||
-device virtio-net-device,netdev=net0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/expect | ||
|
||
set timeout 60 | ||
spawn ssh root@localhost -p 5555 | ||
expect "yes/no" { | ||
send "yes\r" | ||
expect "*?assword" { send "busybear\r" } | ||
} "*?assword" { send "busybear\r" } | ||
|
||
log_file -noappend output.log | ||
|
||
expect "# " { send "busybox --install -s /bin\r" } | ||
expect "# " { send "insmod keystone-driver.ko\r" } | ||
expect "# " { send "./test\r" } | ||
expect "# " { send "poweroff\r" } | ||
expect eof |
Oops, something went wrong.