Skip to content

Commit

Permalink
Merge pull request #64 from keystone-enclave/dev
Browse files Browse the repository at this point in the history
Dev bump
  • Loading branch information
dkohlbre authored Mar 13, 2019
2 parents a3e54c5 + b4d6f49 commit d79d2a3
Show file tree
Hide file tree
Showing 34 changed files with 1,513 additions and 131 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "linux-keystone-driver"]
path = linux-keystone-driver
url = https://github.com/keystone-enclave/linux-keystone-driver
[submodule "buildroot"]
path = buildroot
url = https://github.com/keystone-enclave/buildroot.git
46 changes: 31 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ language: minimal
dist: xenial
cache:
apt: true
timeout: 1000 #In seconds
directories:
# - $TRAVIS_BUILD_DIR/firesim-riscv-tools-prebuilt
- $TRAVIS_BUILD_DIR/riscv
- $TRAVIS_BUILD_DIR/riscv-linux
- $TRAVIS_BUILD_DIR/riscv-qemu

git:
submodules: false
depth: 1

env:
- RISCV=$TRAVIS_BUILD_DIR/riscv PATH=$PATH:$RISCV/bin
Expand All @@ -13,23 +20,23 @@ addons:
apt:
packages:
- expect
- autoconf
- automake
- autotools-dev
- bc
- bison
- build-essential
- curl
- expat
- libexpat-dev
- flex
- autoconf
- automake
- autotools-dev
- bc
- bison
- build-essential
- curl
- expat
- libexpat-dev
- flex
- gawk
- gcc
- git
- gperf
- libgmp-dev
- libmpc-dev
- libmpfr-dev
- libmpfr-dev
- libtool
- texinfo
- tmux
Expand All @@ -44,27 +51,36 @@ addons:
- pkg-config
- libglib2.0-dev
- libpixman-1-dev
- libssl-dev

branches:
only:
- dev
- master


before_install:
- git submodule init -- riscv-linux
- git submodule init -- riscv-qemu
- git clone --shallow-since=2018-05-01 https://github.com/riscv/riscv-linux riscv-linux
- git clone --shallow-since=2018-05-01 https://github.com/riscv/riscv-qemu riscv-qemu
- if [ -d "riscv-linux/.git" ]; then ls; else git clone --shallow-since=2018-05-01 https://github.com/riscv/riscv-linux riscv-linux; fi
- if [ -d "riscv-qemu/.git" ]; then ls; else git clone --shallow-since=2018-05-01 https://github.com/riscv/riscv-qemu riscv-qemu; fi
- git submodule update --depth=1 -- riscv-linux
- git submodule update --depth=1 -- riscv-qemu
- ./fast-setup.sh
- cp -r riscv-linux/.git riscv-linux-git
- cp -r riscv-qemu/.git riscv-qemu-git

jobs:
include:
- stage: cache warmup
script: true
- stage: build everything & test
script:
- source ./source.sh
- travis_wait 120 make
- travis_wait 120 make -j2
- travis_wait 10 ./scripts/travis.sh
- cd riscv-qemu; git clean -fxd > /dev/null;git reset --hard > /dev/null;rm -rf .git;mv ../riscv-qemu-git .git;cd ..
- cd riscv-linux;git clean -fxd > /dev/null;git reset --hard > /dev/null;rm -rf .git;mv ../riscv-linux-git .git;cd ..
after_failure:
- cat screenlog.0
- cat output.log
- cat output.log
71 changes: 22 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,71 +1,44 @@
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
all: hifive

qemu: all
qemu:
./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
.PHONY: busybear-qemu
busybear-qemu: $(BOOTROM) $(QEMU) sdk
$(MAKE) -f busybear.mk

$(DRIVER): $(VMLINUX) $(LINUX_CONFIG)
make -C $(DRIVER_DIR)
.PHONY: hifive
hifive: sdk $(QEMU) $(BOOTROM)
$(MAKE) -f hifive.mk
$(MAKE) -C hifive-work/buildroot_initramfs
$(MAKE) -f hifive.mk

$(DISK):
make -C $(BUSYBEAR_DIR)
sudo chmod og+w $(DISK)
.PHONY: sdk
sdk:
$(MAKE) -C $(SDK_DIR)

$(LINUX_CONFIG):
cp $(BUSYBEAR_DIR)/conf/linux.config $(LINUX_DIR)/.config
make -C $(LINUX_DIR) ARCH=riscv olddefconfig

$(VMLINUX): $(LINUX_CONFIG)
$(QEMU):
./scripts/apply-patch.sh
make -C $(LINUX_DIR) ARCH=riscv -j$(NPROC) vmlinux
cd $(QEMU_DIR); ./configure --target-list=riscv64-softmmu,riscv32-softmmu;
$(MAKE) -C $(QEMU_DIR)

$(BOOTROM):
cd bootrom; make; cd ..

busybear-clean:
$(MAKE) -f busybear.mk clean

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
$(MAKE) -f hifive.mk clean

clean-all: busybear-clean clean
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

Visit [Project Website](https://keystone-enclave.org) for more information.

The ``dev`` branch is more up-to-date than ``master`` always. Until
there are stable releases we suggest only using ``dev``.

# Quick Start

```bash
Expand All @@ -19,15 +22,20 @@ sudo apt update
sudo apt install autoconf automake autotools-dev bc bison build-essential curl \
expat libexpat1-dev flex gawk gcc git gperf libgmp-dev libmpc-dev libmpfr-dev \
libtool texinfo tmux patchutils zlib1g-dev wget bzip2 patch vim-common lbzip2 \
python pkg-config libglib2.0-dev libpixman-1-dev
python pkg-config libglib2.0-dev libpixman-1-dev device-tree-compiler
```

Some of the utilities also use ``expect`` so we recommend that you install that as well though it is not strictly necessary.
```
sudo apt install expect
```

Setup Tools and Submodules
```
./fast-setup.sh
```

Build All
Build All for QEMU
```
make
```
Expand All @@ -37,9 +45,9 @@ Run QEMU
./scripts/run-qemu.sh
```

Test
Test

login with `root`/`busybear`.
login with `root`/`sifive`.

```
[in QEMU machine]
Expand All @@ -54,7 +62,9 @@ poweroff

# Documentation

See [docs](http://docs.keystone-enclave.org) for detailed documentation.
See [docs](http://docs.keystone-enclave.org) for detailed
documentation. You may wish to switch to the dev version of the docs,
rather than 'latest'.

# Contributing

Expand Down
1 change: 1 addition & 0 deletions buildroot
Submodule buildroot added at d79ac1
56 changes: 56 additions & 0 deletions busybear.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
BUSYBEAR_DIR=busybear-linux
DISK=$(BUSYBEAR_DIR)/busybear.bin
DRIVER_DIR=$(shell pwd)/linux-keystone-driver
DRIVER=$(DRIVER_DIR)/keystone-driver.ko
WORK=$(shell pwd)/busybear-work
LINUX_QEMU_OUT=$(WORK)/linux
LINUX_CONFIG=$(LINUX_QEMU_OUT)/.config
VMLINUX=$(LINUX_QEMU_OUT)/vmlinux
LINUX_SRC_DIR=riscv-linux
SDK_DIR=sdk
SM_DIR=riscv-pk
SM=$(SM_DIR)/build/bbl
SM_BUILD_DIR=$(SM_DIR)/build

all: $(VMLINUX) $(SM) $(DISK) $(DRIVER)
$(MAKE) -C $(SM_BUILD_DIR)
$(MAKE) -C $(SDK_DIR) copy-tests
$(MAKE) -C $(DRIVER_DIR) copy


$(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 $(LINUX_SRC_DIR) O=$(LINUX_QEMU_OUT) ARCH=riscv SUBDIRS=$(DRIVER_DIR) modules

$(DISK):
$(MAKE) -C $(BUSYBEAR_DIR)
sudo chmod og+w $(DISK)

$(LINUX_CONFIG):
mkdir -p $(LINUX_QEMU_OUT)
cp $(BUSYBEAR_DIR)/conf/linux.config $(LINUX_CONFIG)
$(MAKE) -C $(LINUX_SRC_DIR) O=$(LINUX_QEMU_OUT) ARCH=riscv olddefconfig

$(VMLINUX): $(LINUX_CONFIG)
./scripts/apply-patch.sh
$(MAKE) -C $(LINUX_SRC_DIR) O=$(LINUX_QEMU_OUT) ARCH=riscv -j$(NPROC) vmlinux


clean:
rm -f $(LINUX_CONFIG)
rm -rf $(WORK)
$(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
20 changes: 16 additions & 4 deletions docs/source/Contributing-to-Keystone/How-to-Contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ bootloader modifications, to make compilers and toolchains for programming encla
support for novel use-cases for end users.


Knwon Issues and Ongoing Projects
--------------------------------
Known Issues and Ongoing Projects
---------------------------------

Known issues are updated in `github issues <https://github.com/keystone-enclave/keystone/issues>`_.
We also post ongoing projects on `github projects <https://github.com/keystone-enclave/keystone/projects>`_.
Expand All @@ -36,5 +36,17 @@ specific builds!
General Contributions
--------------------------------

Fork ``keystone`` repo to your own account, mess around, and submit a pull request (PR) to the remote ``develop`` branch.
A PR must be separated if it contains multiple patches for different parts.
General workflow is as follows:

- Fork ``keystone`` repo
- Create a branch (ex: ``dev-cool-feature``)
- PR your branch to ``keystone`` on the ``dev`` branch
- Make sure all CI tests pass
- Wait for reviews

If you are modifying a submodule:

- Fork ``$submodule`` repo
- Create a branch (ex: ``keystone-another-fix``)
- PR your branch to ``$submodule`` on ``keystone`` branch
- Wait for reviews
11 changes: 9 additions & 2 deletions docs/source/Getting-Started/Guide-to-Components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ bootrom

Keystone bootrom, including trusted boot chain.

buildroot
---------

Link: `<https://github.com/keystone-enclave/buildroot>`_

Linux buildroot. Builds a minimal working Linux image for our test platforms.

busybear-linux
--------------

Link: `<https://github.com/keystone-enclave/busybear-linux>`_

Unmodified busybear Linux, supporting riscv. Our default untrusted
Linux OS for testing.
Unmodified busybear Linux, supporting riscv. Deprecated. Soon to be
removed.

docs
----
Expand Down
Loading

0 comments on commit d79d2a3

Please sign in to comment.