forked from rcore-os/zCore
Set `libos` as the default feature, update CI
This commit is contained in:
parent
169088dc31
commit
9b6c1f5928
|
@ -0,0 +1,96 @@
|
||||||
|
name: Build CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '40 3 * * *' # every day at 3:40
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly-2021-07-27
|
||||||
|
override: true
|
||||||
|
components: rust-src, rustfmt, clippy
|
||||||
|
- name: Check code format
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
- name: Clippy LibOS
|
||||||
|
run: cargo clippy --all-features
|
||||||
|
- name: Clippy x86_64 bare-metal
|
||||||
|
run: cd zCore && make clippy ARCH=x86_64
|
||||||
|
- name: Clippy riscv64 bare-metal
|
||||||
|
run: cd zCore && make clippy ARCH=riscv64 LINUX=1
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-20.04, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly-2021-07-27
|
||||||
|
components: rust-src, llvm-tools-preview
|
||||||
|
- uses: actions-rs/install@v0.1
|
||||||
|
with:
|
||||||
|
crate: cargo-binutils
|
||||||
|
version: latest
|
||||||
|
- name: Build all packages
|
||||||
|
run: cargo build
|
||||||
|
- name: Build linux LibOS
|
||||||
|
run: cargo build --features "linux libos"
|
||||||
|
- name: Build zircon LibOS
|
||||||
|
run: cargo build --features "zircon libos"
|
||||||
|
- name: Build x86_64 bare-metal
|
||||||
|
run: cd zCore && make build ARCH=x86_64
|
||||||
|
- name: Build riscv64 bare-metal
|
||||||
|
run: cd zCore && make build ARCH=riscv64 LINUX=1
|
||||||
|
|
||||||
|
build-aarch64:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly-2021-07-27
|
||||||
|
override: true
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
use-cross: true
|
||||||
|
args: -p zircon-loader --target aarch64-unknown-linux-gnu --workspace --exclude linux-syscall --exclude linux-loader --exclude zcore
|
||||||
|
|
||||||
|
build-user:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-20.04, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Pull prebuilt images
|
||||||
|
run: git lfs pull -I prebuilt/zircon/x64/libc.so,prebuilt/zircon/x64/libfdio.so,prebuilt/zircon/x64/libunwind.so,prebuilt/zircon/x64/libzircon.so,prebuilt/zircon/x64/Scrt1.o
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly-2021-07-27
|
||||||
|
target: x86_64-fuchsia
|
||||||
|
- name: Build Zircon user programs
|
||||||
|
run: cd zircon-user && make build MODE=release
|
||||||
|
|
||||||
|
build-doc:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build docs
|
||||||
|
run: cargo doc --no-deps --all-features
|
|
@ -1,4 +1,4 @@
|
||||||
name: deploy CI
|
name: Deploy docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
|
@ -1,4 +1,4 @@
|
||||||
name: current CI
|
name: Test CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -7,90 +7,6 @@ on:
|
||||||
- cron: '40 3 * * *' # every day at 3:40
|
- cron: '40 3 * * *' # every day at 3:40
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly-2021-07-27
|
|
||||||
override: true
|
|
||||||
components: rust-src, rustfmt, clippy
|
|
||||||
- name: Check code format
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: fmt
|
|
||||||
args: --all -- --check
|
|
||||||
- name: Clippy LibOS
|
|
||||||
run: cargo clippy --all-features
|
|
||||||
- name: Clippy x86_64 bare-metal
|
|
||||||
run: cd zCore && make clippy ARCH=x86_64
|
|
||||||
- name: Clippy riscv64 bare-metal
|
|
||||||
run: cd zCore && make clippy ARCH=riscv64 LINUX=1
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-20.04, macos-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: 'recursive'
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly-2021-07-27
|
|
||||||
components: rust-src, llvm-tools-preview
|
|
||||||
- uses: actions-rs/install@v0.1
|
|
||||||
with:
|
|
||||||
crate: cargo-binutils
|
|
||||||
version: latest
|
|
||||||
- name: Build linux LibOS
|
|
||||||
run: cargo build --features "linux libos"
|
|
||||||
- name: Build zircon LibOS
|
|
||||||
run: cargo build --features "zircon libos"
|
|
||||||
- name: Build x86_64 bare-metal
|
|
||||||
run: cd zCore && make build ARCH=x86_64
|
|
||||||
- name: Build riscv64 bare-metal
|
|
||||||
run: cd zCore && make build ARCH=riscv64 LINUX=1
|
|
||||||
|
|
||||||
build-aarch64:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly-2021-07-27
|
|
||||||
override: true
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
use-cross: true
|
|
||||||
args: -p zircon-loader --target aarch64-unknown-linux-gnu
|
|
||||||
|
|
||||||
build-user:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-20.04, macos-latest]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Pull prebuilt images
|
|
||||||
run: git lfs pull -I prebuilt/zircon/x64/libc.so,prebuilt/zircon/x64/libfdio.so,prebuilt/zircon/x64/libunwind.so,prebuilt/zircon/x64/libzircon.so,prebuilt/zircon/x64/Scrt1.o
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly-2021-07-27
|
|
||||||
target: x86_64-fuchsia
|
|
||||||
- name: Build Zircon user programs
|
|
||||||
run: |
|
|
||||||
cd zircon-user
|
|
||||||
make build MODE=release
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -145,17 +61,14 @@ jobs:
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install qemu-system-x86
|
sudo apt install qemu-system-x86
|
||||||
- name: Build zCore
|
- name: Build zCore
|
||||||
run: |
|
run: cd zCore && make build MODE=release
|
||||||
cd zCore
|
|
||||||
make build MODE=release
|
|
||||||
cd ..
|
|
||||||
- name: Run core-tests
|
- name: Run core-tests
|
||||||
run: |
|
run: |
|
||||||
cd scripts
|
cd scripts
|
||||||
pip3 install pexpect
|
pip3 install -r requirements.txt
|
||||||
python3 core-tests.py
|
python3 core-tests.py
|
||||||
|
|
||||||
core-test-libos:
|
libos-core-test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -166,13 +79,13 @@ jobs:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: nightly-2021-07-27
|
toolchain: nightly-2021-07-27
|
||||||
components: rust-src
|
components: rust-src
|
||||||
- name: Run core-tests
|
- name: Run libos-core-tests
|
||||||
run: |
|
run: |
|
||||||
cd scripts
|
cd scripts
|
||||||
pip3 install pexpect
|
pip3 install -r requirements.txt
|
||||||
python3 unix-core-tests.py
|
python3 unix-core-tests.py
|
||||||
|
|
||||||
libc-test:
|
libos-libc-test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -182,38 +95,13 @@ jobs:
|
||||||
run: sudo apt-get install musl-tools musl-dev -y
|
run: sudo apt-get install musl-tools musl-dev -y
|
||||||
- name: Prepare rootfs and libc-test
|
- name: Prepare rootfs and libc-test
|
||||||
run: make rootfs && make libc-test
|
run: make rootfs && make libc-test
|
||||||
- name: Build
|
- name: Run libos-libc-tests
|
||||||
run: cargo build --release -p linux-loader
|
|
||||||
# uses: actions-rs/cargo@v1
|
|
||||||
# with:
|
|
||||||
# command: build
|
|
||||||
# args: --release -p linux-loader
|
|
||||||
- name: Run libc-tests
|
|
||||||
run: |
|
run: |
|
||||||
cd scripts
|
cd scripts
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
python3 libc-tests.py
|
python3 libos-libc-tests.py
|
||||||
cat linux/test-result.txt
|
cat linux/test-result.txt
|
||||||
|
|
||||||
doc:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build docs
|
|
||||||
run: cargo doc --no-deps --all-features
|
|
||||||
# uses: actions-rs/cargo@v1
|
|
||||||
# with:
|
|
||||||
# command: doc
|
|
||||||
# args: --no-deps --all-features
|
|
||||||
# - name: Deploy to Github Pages
|
|
||||||
# if: ${{ github.ref == 'refs/heads/master' }}
|
|
||||||
# uses: JamesIves/github-pages-deploy-action@releases/v3
|
|
||||||
# with:
|
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# BRANCH: gh-pages
|
|
||||||
# FOLDER: target/doc
|
|
||||||
|
|
||||||
|
|
||||||
baremetal-libc-test:
|
baremetal-libc-test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -233,7 +121,7 @@ jobs:
|
||||||
sudo apt-get install musl-tools musl-dev qemu-system-x86 -y
|
sudo apt-get install musl-tools musl-dev qemu-system-x86 -y
|
||||||
- name: Prepare rootfs and libc-test
|
- name: Prepare rootfs and libc-test
|
||||||
run: make baremetal-test-img
|
run: make baremetal-test-img
|
||||||
- name: Build kernel
|
- name: Build kernel
|
||||||
run: cd zCore && make build MODE=release LINUX=1 ARCH=x86_64
|
run: cd zCore && make build MODE=release LINUX=1 ARCH=x86_64
|
||||||
- name: create qemu disk
|
- name: create qemu disk
|
||||||
run: cd zCore && make baremetal-qemu-disk MODE=release LINUX=1 ARCH=x86_64
|
run: cd zCore && make baremetal-qemu-disk MODE=release LINUX=1 ARCH=x86_64
|
||||||
|
@ -241,6 +129,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd scripts
|
cd scripts
|
||||||
python3 ./baremetal-libc-test.py
|
python3 ./baremetal-libc-test.py
|
||||||
|
|
||||||
baremetal-rv64-oscomp-test:
|
baremetal-rv64-oscomp-test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
@ -266,7 +155,7 @@ jobs:
|
||||||
tar xJf qemu-share.tar.xz && sudo cp -r qemu /usr/local/share/
|
tar xJf qemu-share.tar.xz && sudo cp -r qemu /usr/local/share/
|
||||||
- name: Prepare rootfs and oscomp
|
- name: Prepare rootfs and oscomp
|
||||||
run: make riscv-image
|
run: make riscv-image
|
||||||
- name: Build kernel
|
- name: Build kernel
|
||||||
run: cd zCore && make build MODE=release LINUX=1 ARCH=riscv64
|
run: cd zCore && make build MODE=release LINUX=1 ARCH=riscv64
|
||||||
- name: Run baremetal-libc-test
|
- name: Run baremetal-libc-test
|
||||||
run: |
|
run: |
|
|
@ -8,8 +8,9 @@ description = "Kernel HAL interface definations."
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["libos"]
|
||||||
smp = []
|
smp = []
|
||||||
libos = ["async-std", "bitmap-allocator", "zcore-drivers/mock"]
|
libos = ["nix", "tempfile", "async-std", "bitmap-allocator", "zcore-drivers/mock"]
|
||||||
graphic = ["zcore-drivers/graphic"]
|
graphic = ["zcore-drivers/graphic"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -25,8 +26,8 @@ zcore-drivers = { path = "../drivers", features = ["virtio"] }
|
||||||
|
|
||||||
# LibOS mode
|
# LibOS mode
|
||||||
[target.'cfg(not(target_os = "none"))'.dependencies]
|
[target.'cfg(not(target_os = "none"))'.dependencies]
|
||||||
nix = "0.23"
|
nix = { version = "0.23", optional = true }
|
||||||
tempfile = "3"
|
tempfile = { version = "3", optional = true }
|
||||||
async-std = { version = "1.10", optional = true }
|
async-std = { version = "1.10", optional = true }
|
||||||
bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev = "b3f9f51", optional = true }
|
bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev = "b3f9f51", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ log = "0.4"
|
||||||
linux-syscall = { path = "../linux-syscall" }
|
linux-syscall = { path = "../linux-syscall" }
|
||||||
linux-object = { path = "../linux-object" }
|
linux-object = { path = "../linux-object" }
|
||||||
zircon-object = { path = "../zircon-object" }
|
zircon-object = { path = "../zircon-object" }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["libos"]
|
default = ["libos"]
|
||||||
|
|
|
@ -16,7 +16,7 @@ bitflags = "1.3"
|
||||||
hashbrown = "0.9"
|
hashbrown = "0.9"
|
||||||
numeric-enum-macro = "0.2"
|
numeric-enum-macro = "0.2"
|
||||||
zircon-object = { path = "../zircon-object", features = ["elf"] }
|
zircon-object = { path = "../zircon-object", features = ["elf"] }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
downcast-rs = { version = "1.2", default-features = false }
|
downcast-rs = { version = "1.2", default-features = false }
|
||||||
lazy_static = { version = "1.4", features = ["spin_no_std"] }
|
lazy_static = { version = "1.4", features = ["spin_no_std"] }
|
||||||
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7c232ec" }
|
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7c232ec" }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//! Process init info
|
//! Process init info
|
||||||
#![allow(unsafe_code)]
|
#![allow(unsafe_code)]
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use alloc::collections::btree_map::BTreeMap;
|
use alloc::collections::btree_map::BTreeMap;
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
|
|
|
@ -14,7 +14,7 @@ bitflags = "1.3"
|
||||||
numeric-enum-macro = "0.2"
|
numeric-enum-macro = "0.2"
|
||||||
zircon-object = { path = "../zircon-object" }
|
zircon-object = { path = "../zircon-object" }
|
||||||
linux-object = { path = "../linux-object" }
|
linux-object = { path = "../linux-object" }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7c232ec" }
|
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7c232ec" }
|
||||||
lazy_static = { version = "1.4", features = ["spin_no_std"] }
|
lazy_static = { version = "1.4", features = ["spin_no_std"] }
|
||||||
bitvec = { version = "0.22", default-features = false, features = ["alloc"] }
|
bitvec = { version = "0.22", default-features = false, features = ["alloc"] }
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
//! let args = [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9];
|
//! let args = [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9];
|
||||||
//! let mut syscall = Syscall {
|
//! let mut syscall = Syscall {
|
||||||
//! thread,
|
//! thread,
|
||||||
//! #[cfg(feature = "std")]
|
//! #[cfg(feature = "libos")]
|
||||||
//! syscall_entry: kernel_hal::context::syscall_entry as usize,
|
//! syscall_entry: kernel_hal::context::syscall_entry as usize,
|
||||||
//! #[cfg(not(feature = "std"))]
|
//! #[cfg(not(feature = "libos"))]
|
||||||
//! syscall_entry: 0,
|
//! syscall_entry: 0,
|
||||||
//! thread_fn,
|
//! thread_fn,
|
||||||
//! regs,
|
//! regs,
|
||||||
|
|
|
@ -25,7 +25,7 @@ def print_cases(cases, file=None):
|
||||||
print(case, file=file)
|
print(case, file=file)
|
||||||
|
|
||||||
|
|
||||||
subprocess.run("cd .. && cargo build -p zcore --release --features 'linux libos'",
|
subprocess.run("cargo build -p zcore --release --features 'linux libos'",
|
||||||
shell=True, check=True)
|
shell=True, check=True)
|
||||||
|
|
||||||
for path in sorted(glob.glob("../rootfs/libc-test/src/*/*.exe")):
|
for path in sorted(glob.glob("../rootfs/libc-test/src/*/*.exe")):
|
|
@ -1 +1,2 @@
|
||||||
|
pexpect
|
||||||
termcolor
|
termcolor
|
||||||
|
|
|
@ -12,7 +12,7 @@ parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('testcase', nargs=1)
|
parser.add_argument('testcase', nargs=1)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
child = pexpect.spawn("cargo run -p zcore --features 'zircon libos' -- '%s' '%s'" %
|
child = pexpect.spawn("cargo run -p zcore --release --features 'zircon libos' -- '%s' '%s'" %
|
||||||
(ZBI_PATH, CMDLINE_BASE+args.testcase[0]),
|
(ZBI_PATH, CMDLINE_BASE+args.testcase[0]),
|
||||||
timeout=TIMEOUT, encoding='utf-8')
|
timeout=TIMEOUT, encoding='utf-8')
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import pexpect
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
TIMEOUT = 300
|
TIMEOUT = 300
|
||||||
ZIRCON_LOADER_PATH = 'zircon-loader'
|
ZIRCON_LOADER_PATH = 'zircon-loader'
|
||||||
|
@ -40,9 +41,11 @@ with open(TEST_CASE_EXCEPTION, "r") as tcf:
|
||||||
exception_case = set([case.strip() for case in tcf.readlines()])
|
exception_case = set([case.strip() for case in tcf.readlines()])
|
||||||
check_case = all_case - exception_case
|
check_case = all_case - exception_case
|
||||||
|
|
||||||
|
subprocess.run("cargo build -p zcore --release --features 'zircon libos'",
|
||||||
|
shell=True, check=True)
|
||||||
|
|
||||||
for line in check_case:
|
for line in check_case:
|
||||||
child = pexpect.spawn("cargo run -p zcore --features 'zircon libos' -- '%s' '%s'" %
|
child = pexpect.spawn("../target/release/zcore", [ZBI_PATH, CMDLINE_BASE+line],
|
||||||
(ZBI_PATH, CMDLINE_BASE+line),
|
|
||||||
timeout=TIMEOUT, encoding='utf-8')
|
timeout=TIMEOUT, encoding='utf-8')
|
||||||
|
|
||||||
child.logfile = Tee(OUTPUT_FILE, 'a')
|
child.logfile = Tee(OUTPUT_FILE, 'a')
|
||||||
|
|
|
@ -15,18 +15,18 @@ bench = false
|
||||||
doc = false
|
doc = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["color_log"]
|
default = ["libos"]
|
||||||
color_log = []
|
colorless-log = []
|
||||||
graphic = ["kernel-hal/graphic"]
|
graphic = ["kernel-hal/graphic"]
|
||||||
init_ram_disk = []
|
init-ram-disk = []
|
||||||
link_user_img = ["init_ram_disk"]
|
link-user-img = ["init-ram-disk"]
|
||||||
|
|
||||||
zircon = ["zircon-loader"]
|
zircon = ["zircon-loader"]
|
||||||
linux = ["linux-loader", "linux-object", "rcore-fs", "rcore-fs-sfs"]
|
linux = ["linux-loader", "linux-object", "rcore-fs", "rcore-fs-sfs"]
|
||||||
|
|
||||||
libos = ["async-std", "chrono", "rcore-fs-hostfs", "linux-loader/libos", "zircon-loader/libos"]
|
libos = ["async-std", "chrono", "rcore-fs-hostfs", "kernel-hal/libos", "linux-loader/libos", "zircon-loader/libos"]
|
||||||
board_qemu = []
|
board-qemu = []
|
||||||
board_d1 = ["link_user_img"]
|
board-d1 = ["link-user-img"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
@ -34,7 +34,7 @@ spin = "0.9"
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
lazy_static = { version = "1.4", features = ["spin_no_std" ] }
|
lazy_static = { version = "1.4", features = ["spin_no_std" ] }
|
||||||
bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev = "b3f9f51" }
|
bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev = "b3f9f51" }
|
||||||
kernel-hal = { path = "../kernel-hal", features = ["smp"] }
|
kernel-hal = { path = "../kernel-hal", default-features = false, features = ["smp"] }
|
||||||
zircon-object = { path = "../zircon-object" }
|
zircon-object = { path = "../zircon-object" }
|
||||||
linux-object = { path = "../linux-object", optional = true }
|
linux-object = { path = "../linux-object", optional = true }
|
||||||
zircon-loader = { path = "../zircon-loader", default-features = false, optional = true }
|
zircon-loader = { path = "../zircon-loader", default-features = false, optional = true }
|
||||||
|
|
|
@ -80,12 +80,12 @@ ifeq ($(LIBOS), 1)
|
||||||
features += libos
|
features += libos
|
||||||
else
|
else
|
||||||
ifeq ($(ARCH), x86_64)
|
ifeq ($(ARCH), x86_64)
|
||||||
features += init_ram_disk
|
features += init-ram-disk
|
||||||
else ifeq ($(ARCH), riscv64)
|
else ifeq ($(ARCH), riscv64)
|
||||||
ifeq ($(PLATFORM), d1)
|
ifeq ($(PLATFORM), d1)
|
||||||
features += board_d1 link_user_img
|
features += board-d1 link-user-img
|
||||||
else
|
else
|
||||||
features += board_qemu
|
features += board-qemu
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -106,7 +106,7 @@ endif
|
||||||
build_args := --features "$(features)"
|
build_args := --features "$(features)"
|
||||||
|
|
||||||
ifneq ($(LIBOS), 1) # no_std
|
ifneq ($(LIBOS), 1) # no_std
|
||||||
build_args += --target $(ARCH).json -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem
|
build_args += --no-default-features --target $(ARCH).json -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MODE), release)
|
ifeq ($(MODE), release)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn init_ram_disk() -> &'static mut [u8] {
|
fn init_ram_disk() -> &'static mut [u8] {
|
||||||
if cfg!(feature = "link_user_img") {
|
if cfg!(feature = "link-user-img") {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn _user_img_start();
|
fn _user_img_start();
|
||||||
fn _user_img_end();
|
fn _user_img_end();
|
||||||
|
@ -36,7 +36,7 @@ cfg_if! {
|
||||||
use linux_object::fs::rcore_fs_wrapper::{Block, BlockCache, MemBuf};
|
use linux_object::fs::rcore_fs_wrapper::{Block, BlockCache, MemBuf};
|
||||||
use rcore_fs::dev::Device;
|
use rcore_fs::dev::Device;
|
||||||
|
|
||||||
let device: Arc<dyn Device> = if cfg!(feature = "init_ram_disk") {
|
let device: Arc<dyn Device> = if cfg!(feature = "init-ram-disk") {
|
||||||
Arc::new(MemBuf::new(init_ram_disk()))
|
Arc::new(MemBuf::new(init_ram_disk()))
|
||||||
} else {
|
} else {
|
||||||
let block = kernel_hal::drivers::all_block().first_unwrap();
|
let block = kernel_hal::drivers::all_block().first_unwrap();
|
||||||
|
@ -66,7 +66,7 @@ cfg_if! {
|
||||||
|
|
||||||
// Hard link rootfs img
|
// Hard link rootfs img
|
||||||
#[cfg(not(feature = "libos"))]
|
#[cfg(not(feature = "libos"))]
|
||||||
#[cfg(feature = "link_user_img")]
|
#[cfg(feature = "link-user-img")]
|
||||||
global_asm!(concat!(
|
global_asm!(concat!(
|
||||||
r#"
|
r#"
|
||||||
.section .data.img
|
.section .data.img
|
||||||
|
|
|
@ -52,10 +52,10 @@ enum ColorCode {
|
||||||
/// Add escape sequence to print with color in Linux console
|
/// Add escape sequence to print with color in Linux console
|
||||||
macro_rules! with_color {
|
macro_rules! with_color {
|
||||||
($color_code:expr, $($arg:tt)*) => {{
|
($color_code:expr, $($arg:tt)*) => {{
|
||||||
#[cfg(feature = "color_log")]
|
#[cfg(feature = "colorless-log")]
|
||||||
|
{ let _ = $color_code; format_args!($($arg)*) }
|
||||||
|
#[cfg(not(feature = "colorless-log"))]
|
||||||
{ format_args!("\u{1B}[{}m{}\u{1B}[m", $color_code as u8, format_args!($($arg)*)) }
|
{ format_args!("\u{1B}[{}m{}\u{1B}[m", $color_code as u8, format_args!($($arg)*)) }
|
||||||
#[cfg(not(feature = "color_log"))]
|
|
||||||
{ format_args!($($arg)*) }
|
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ type FrameAlloc = bitmap_allocator::BitAlloc16M; // max 64G
|
||||||
#[cfg(target_arch = "riscv64")]
|
#[cfg(target_arch = "riscv64")]
|
||||||
type FrameAlloc = bitmap_allocator::BitAlloc1M; // max 4G
|
type FrameAlloc = bitmap_allocator::BitAlloc1M; // max 4G
|
||||||
|
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
type FrameAlloc = bitmap_allocator::BitAlloc1M; // max 4G
|
||||||
|
|
||||||
const PAGE_SIZE: usize = 4096;
|
const PAGE_SIZE: usize = 4096;
|
||||||
|
|
||||||
/// Global physical frame allocator
|
/// Global physical frame allocator
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(not(target_os = "none"))] {
|
if #[cfg(feature = "libos")] {
|
||||||
#[path = "libos/entry.rs"]
|
#[path = "libos/entry.rs"]
|
||||||
mod entry;
|
mod entry;
|
||||||
#[path = "libos/consts.rs"]
|
#[path = "libos/consts.rs"]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// RISCV
|
// RISCV
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "board_qemu")] {
|
if #[cfg(feature = "board-qemu")] {
|
||||||
pub const KERNEL_OFFSET: usize = 0xFFFF_FFFF_8000_0000;
|
pub const KERNEL_OFFSET: usize = 0xFFFF_FFFF_8000_0000;
|
||||||
pub const PHYS_MEMORY_BASE: usize = 0x8000_0000;
|
pub const PHYS_MEMORY_BASE: usize = 0x8000_0000;
|
||||||
pub const PHYS_MEMORY_END: usize = 0x8800_0000; // TODO: get memory end from device tree
|
pub const PHYS_MEMORY_END: usize = 0x8800_0000; // TODO: get memory end from device tree
|
||||||
} else if #[cfg(feature = "board_d1")] {
|
} else if #[cfg(feature = "board-d1")] {
|
||||||
pub const KERNEL_OFFSET: usize = 0xFFFF_FFFF_C000_0000;
|
pub const KERNEL_OFFSET: usize = 0xFFFF_FFFF_C000_0000;
|
||||||
pub const PHYS_MEMORY_BASE: usize = 0x4000_0000;
|
pub const PHYS_MEMORY_BASE: usize = 0x4000_0000;
|
||||||
pub const PHYS_MEMORY_END: usize = 0x6000_0000; // 512M
|
pub const PHYS_MEMORY_END: usize = 0x6000_0000; // 512M
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#[cfg(feature = "board_qemu")]
|
#[cfg(feature = "board-qemu")]
|
||||||
global_asm!(include_str!("boot/boot_qemu.asm"));
|
global_asm!(include_str!("boot/boot_qemu.asm"));
|
||||||
#[cfg(feature = "board_d1")]
|
#[cfg(feature = "board-d1")]
|
||||||
global_asm!(include_str!("boot/boot_d1.asm"));
|
global_asm!(include_str!("boot/boot_d1.asm"));
|
||||||
|
|
||||||
global_asm!(include_str!("boot/entry64.asm"));
|
global_asm!(include_str!("boot/entry64.asm"));
|
||||||
|
|
|
@ -13,11 +13,11 @@ cfg-if = "1.0"
|
||||||
xmas-elf = "0.7"
|
xmas-elf = "0.7"
|
||||||
zircon-object = { path = "../zircon-object", features = ["elf"] }
|
zircon-object = { path = "../zircon-object", features = ["elf"] }
|
||||||
zircon-syscall = { path = "../zircon-syscall" }
|
zircon-syscall = { path = "../zircon-syscall" }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["libos"]
|
default = ["libos"]
|
||||||
libos = ["kernel-hal/libos", "zircon-object/aspace-separate", "zircon-syscall/std"]
|
libos = ["kernel-hal/libos", "zircon-object/aspace-separate", "zircon-syscall/libos"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
|
|
@ -18,7 +18,7 @@ spin = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
hashbrown = "0.9"
|
hashbrown = "0.9"
|
||||||
downcast-rs = { version = "1.2", default-features = false }
|
downcast-rs = { version = "1.2", default-features = false }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
numeric-enum-macro = "0.2"
|
numeric-enum-macro = "0.2"
|
||||||
futures = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
futures = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
||||||
xmas-elf = { version = "0.7", optional = true }
|
xmas-elf = { version = "0.7", optional = true }
|
||||||
|
|
|
@ -11,8 +11,7 @@ description = "Zircon syscalls implementation"
|
||||||
# hypervisor = ["zircon-object/hypervisor"]
|
# hypervisor = ["zircon-object/hypervisor"]
|
||||||
default = []
|
default = []
|
||||||
deny-page-fault = []
|
deny-page-fault = []
|
||||||
std = ["deny-page-fault"]
|
libos = ["deny-page-fault", "kernel-hal/libos"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
@ -20,6 +19,6 @@ spin = "0.9"
|
||||||
bitflags = "1.3"
|
bitflags = "1.3"
|
||||||
numeric-enum-macro = "0.2"
|
numeric-enum-macro = "0.2"
|
||||||
zircon-object = { path = "../zircon-object" }
|
zircon-object = { path = "../zircon-object" }
|
||||||
kernel-hal = { path = "../kernel-hal" }
|
kernel-hal = { path = "../kernel-hal", default-features = false }
|
||||||
futures = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
futures = { version = "0.3", default-features = false, features = ["alloc", "async-await"] }
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
|
|
Loading…
Reference in New Issue