Skip to content

Commit 1c6aea6

Browse files
committed
Squashed commit of the following:
commit 43ef2a0 Author: LoGin <[email protected]> Date: Sun Jan 21 18:45:07 2024 +0800 添加riscv64的github workflow (DragonOS-Community#499) * 添加riscv64的github workflow commit 7a29d4f Author: LoGin <[email protected]> Date: Sun Jan 21 15:38:12 2024 +0800 riscv64: 映射uefi systemtable,并完善了riscv64页表填写的部分内容 (DragonOS-Community#498) * 从fdt的chosen段获取几个需要的字段 * merge patch-early-ioremap * feature: 增加early io remap的fixmap功能 允许在内存管理初始化之前,使用fixmap功能,映射一些物理内存,并记录. * riscv64: 映射uefi systemtable,并完善了riscv64页表填写的部分内容 * 更新仓库网址 commit 3e3c631 Author: Chiichen <[email protected]> Date: Sun Jan 21 01:38:45 2024 +0800 fix: 修复了ps2和tty初始化顺序的错误 (DragonOS-Community#497) * 修复了ps2和tty初始化顺序的错误 commit 74ffde6 Author: LoGin <[email protected]> Date: Sun Jan 21 01:21:55 2024 +0800 feature: 增加early io remap的fixmap功能 (DragonOS-Community#495) 允许在内存管理初始化之前,使用fixmap功能,映射一些物理内存,并记录. commit 1f58c8f Author: LoGin <[email protected]> Date: Thu Jan 18 22:39:58 2024 +0800 Update mini-backtrace版本到e0b1d90940 (DragonOS-Community#494) 内容: [https://github.com/DragonOS-Community/mini-backtrace/pull/1](https://github.com/DragonOS-Community/mini-backtrace/pull/1) Co-authored-by: Yao Zhao <[email protected]> commit c75ef4e Author: LoGin <[email protected]> Date: Thu Jan 18 00:09:36 2024 +0800 添加early ioremap支持 (DragonOS-Community#492) * 使用early io remap来映射早期的vesa缓冲区 commit d8e29bf Author: R0ronoa <[email protected]> Date: Wed Jan 17 23:57:49 2024 +0800 增加serio总线和相关trait (DragonOS-Community#488) * 新增serio总线和相关trait * 补充SerioDeviceManager和SerioDriverManager
1 parent 2392f50 commit 1c6aea6

File tree

39 files changed

+1298
-167
lines changed

39 files changed

+1298
-167
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: import-toolchain
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: actions/checkout@v3
7+
with:
8+
submodules: 'recursive'
9+
10+
- name: Cache DragonOS GCC
11+
id: cache-dragonos-gcc
12+
uses: actions/cache@v3
13+
env:
14+
cache-name: cache-dragonos-gcc
15+
with:
16+
path: |
17+
~/opt
18+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
19+
20+
- name: Cache build tools
21+
id: cache-build-tools
22+
uses: actions/cache@v3
23+
env:
24+
cache-name: cache-build-tools
25+
dadk_version: 0.1.6
26+
with:
27+
path: |
28+
~/.cargo
29+
~/.rustup
30+
~/.bashrc
31+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
32+
33+
- uses: ./.github/actions/install-apt-packages
34+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: install-apt-packages
2+
3+
runs:
4+
using: composite
5+
steps:
6+
7+
- uses: awalsh128/cache-apt-pkgs-action@latest
8+
with:
9+
packages: llvm-dev libclang-dev clang gcc-multilib libssl-dev pkg-config
10+
version: ${{ hashFiles('.github/actions/install-apt-packages/action.yml') }}
11+
12+
- uses: awalsh128/cache-apt-pkgs-action@latest
13+
with:
14+
packages: gcc-riscv64-unknown-elf gcc-riscv64-linux-gnu gdb-multiarch
15+
version: ${{ hashFiles('.github/actions/install-apt-packages/action.yml') }}
16+

.github/workflows/cache-toolchain.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Reusable workflow example
1+
name: Cache toolchain
22

33
on: workflow_call
44

@@ -18,19 +18,23 @@ jobs:
1818
with:
1919
path: |
2020
~/opt
21-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
21+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
2222

2323
- if: ${{ steps.cache-dragonos-gcc.outputs.cache-hit != 'true' }}
2424
name: build dragonos-gcc
2525
continue-on-error: true
26-
run: bash tools/build_gcc_toolchain.sh -f
26+
run: |
27+
bash tools/build_gcc_toolchain.sh -f
28+
bash tools/install_musl_gcc.sh
2729
30+
- uses: ./.github/actions/install-apt-packages
31+
2832
- name: Cache build tools
2933
id: cache-build-tools
3034
uses: actions/cache@v3
3135
env:
3236
cache-name: cache-build-tools
33-
dadk_version: 0.1.2
37+
dadk_version: 0.1.6
3438
with:
3539
path: |
3640
~/.cargo
@@ -40,23 +44,38 @@ jobs:
4044

4145
- if: ${{ steps.cache-build-tools.outputs.cache-hit != 'true' }}
4246
name: Install toolchain
43-
continue-on-error: true
47+
continue-on-error: false
4448
run: |
45-
sudo sh -c "apt update && apt install -y llvm-dev libclang-dev clang gcc-multilib libssl-dev pkg-config"
49+
4650
cargo install cargo-binutils
47-
rustup toolchain install nightly
51+
rustup toolchain install nightly-x86_64-unknown-linux-gnu
4852
rustup toolchain install nightly-2023-01-21-x86_64-unknown-linux-gnu
4953
rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu
50-
rustup default nightly
51-
rustup component add rust-src
52-
rustup component add llvm-tools-preview
53-
rustup target add x86_64-unknown-none
54-
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
5554
rustup component add rust-src --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
5655
rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
56+
rustup target add x86_64-unknown-none --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
57+
rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
58+
59+
rustup toolchain install nightly-2023-01-21-riscv64gc-unknown-linux-gnu --force-non-host
60+
rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host
61+
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
62+
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
63+
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
64+
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
65+
66+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
67+
rustup component add rust-src
68+
rustup component add llvm-tools-preview
69+
5770
rustup component add rustfmt
71+
rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu
5872
rustup component add rustfmt --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
5973
rustup component add rustfmt --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
74+
rustup component add rustfmt --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
75+
rustup component add rustfmt --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
76+
77+
rustup default nightly
78+
6079
cargo install dadk --version 0.1.6
6180
6281

.github/workflows/makefile.yml

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build Check
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [ "master", "patch-add-riscv64-github-workflow" ]
66
pull_request:
77
branches: [ "master" ]
88

@@ -11,45 +11,81 @@ jobs:
1111
ensure-toolchain:
1212
uses: ./.github/workflows/cache-toolchain.yml
1313

14-
build:
15-
14+
format-check:
15+
name: Format check ${{ matrix.arch }}
1616
runs-on: ubuntu-latest
1717
needs: [ensure-toolchain]
18+
continue-on-error: true
19+
20+
strategy:
21+
matrix:
22+
arch: [x86_64, riscv64]
1823

1924
steps:
2025
- uses: actions/checkout@v3
2126

22-
- name: Cache DragonOS GCC
23-
id: cache-dragonos-gcc
24-
uses: actions/cache@v3
25-
env:
26-
cache-name: cache-dragonos-gcc
27-
with:
28-
path: |
29-
~/opt
30-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
31-
32-
- name: Cache build tools
33-
id: cache-build-tools
34-
uses: actions/cache@v3
35-
env:
36-
cache-name: cache-build-tools
37-
dadk_version: 0.1.2
38-
with:
39-
path: |
40-
~/.cargo
41-
~/.rustup
42-
~/.bashrc
43-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
44-
27+
- uses: ./.github/actions/import-toolchain
28+
4529
- name: Format check
30+
env:
31+
ARCH: ${{ matrix.arch }}
4632
run: |
4733
printf "\n" >> kernel/src/include/bindings/bindings.rs
4834
printf "\n" >> user/libs/libc/src/include/internal/bindings/bindings.rs
4935
FMT_CHECK=1 make fmt
36+
37+
kernel-static-test:
38+
name: Kernel static test ${{ matrix.arch }}
39+
runs-on: ubuntu-latest
40+
needs: [ensure-toolchain]
41+
continue-on-error: true
42+
43+
strategy:
44+
matrix:
45+
arch: [x86_64, riscv64]
46+
47+
steps:
48+
- uses: actions/checkout@v3
49+
50+
- uses: ./.github/actions/import-toolchain
51+
52+
- name: Run kernel static test
53+
env:
54+
ARCH: ${{ matrix.arch }}
55+
run: bash -c "source ~/.cargo/env && cd kernel && make test"
56+
57+
build-x86_64:
58+
59+
runs-on: ubuntu-latest
60+
needs: [ensure-toolchain]
61+
62+
steps:
63+
- uses: actions/checkout@v3
64+
65+
- uses: ./.github/actions/import-toolchain
66+
5067

5168
- name: build the DragonOS
69+
env:
70+
ARCH: x86_64
5271
run: bash -c "source ~/.cargo/env && export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin && make -j $(nproc) "
53-
54-
- name: Run kernel static test
55-
run: bash -c "source ~/.cargo/env && cd kernel && make test"
72+
73+
74+
build-riscv64:
75+
76+
runs-on: ubuntu-latest
77+
needs: [ensure-toolchain]
78+
79+
steps:
80+
- uses: actions/checkout@v3
81+
with:
82+
submodules: 'recursive'
83+
84+
- uses: ./.github/actions/import-toolchain
85+
86+
- name: build the DragonOS
87+
env:
88+
ARCH: riscv64
89+
90+
run: bash -c "source ~/.cargo/env && make kernel -j $(nproc)"
91+

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ all: kernel user
4242
.PHONY: kernel
4343
kernel:
4444
mkdir -p bin/kernel/
45-
@if [ -z $$DragonOS_GCC ]; then echo "\033[31m [错误]尚未安装DragonOS交叉编译器, 请使用tools文件夹下的build_gcc_toolchain.sh脚本安装 \033[0m"; exit 1; fi
45+
4646
$(MAKE) -C ./kernel all ARCH=$(ARCH) || (sh -c "echo 内核编译失败" && exit 1)
4747

4848
.PHONY: user
4949
user:
50-
51-
@if [ -z $$DragonOS_GCC ]; then echo "\033[31m [错误]尚未安装DragonOS交叉编译器, 请使用tools文件夹下的build_gcc_toolchain.sh脚本安装 \033[0m"; exit 1; fi
5250
$(MAKE) -C ./user all ARCH=$(ARCH) || (sh -c "echo 用户程序编译失败" && exit 1)
5351

5452
.PHONY: clean

env.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ endif
1212
# 设置编译器
1313
ifeq ($(ARCH), x86_64)
1414

15+
# 如果 x86_64时,DragonOS_GCC 为空,那么设置为默认值
16+
export DragonOS_GCC?=$(HOME)/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
17+
1518
export CC=$(DragonOS_GCC)/x86_64-elf-gcc
1619
export LD=ld
1720
export AS=$(DragonOS_GCC)/x86_64-elf-as

kernel/Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ backtrace = []
2323

2424
# 运行时依赖项
2525
[dependencies]
26-
acpi = { git = "https://git.mirrors.dragonos.org/DragonOS-Community/acpi-rs.git", rev = "fb69243dcf" }
26+
acpi = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/acpi-rs.git", rev = "fb69243dcf" }
2727
atomic_enum = "0.2.0"
2828
bit_field = "0.10"
2929
bitfield-struct = "0.5.3"
@@ -39,13 +39,16 @@ klog_types = { path = "crates/klog_types" }
3939
linkme = "0.2"
4040
num = { version = "0.4.0", default-features = false }
4141
num-derive = "0.3"
42-
num-traits = { git = "https://git.mirrors.dragonos.org/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }
42+
num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }
4343
raw-cpuid = "11.0.1"
44-
smoltcp = { git = "https://git.mirrors.dragonos.org/DragonOS-Community/smoltcp.git", rev = "9027825", default-features = false, features = ["log", "alloc", "socket-raw", "socket-udp", "socket-tcp", "socket-icmp", "socket-dhcpv4", "socket-dns", "proto-ipv4", "proto-ipv6"]}
44+
smoltcp = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/smoltcp.git", rev = "9027825", default-features = false, features = ["log", "alloc", "socket-raw", "socket-udp", "socket-tcp", "socket-icmp", "socket-dhcpv4", "socket-dns", "proto-ipv4", "proto-ipv6"]}
4545
system_error = { path = "crates/system_error" }
4646
unified-init = { path = "crates/unified-init" }
47-
virtio-drivers = { git = "https://git.mirrors.dragonos.org/DragonOS-Community/virtio-drivers.git", rev = "f1d1cbb" }
47+
virtio-drivers = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/virtio-drivers.git", rev = "f1d1cbb" }
4848
fdt = "0.1.5"
49+
uefi = { version = "0.26.0", features = ["alloc"] }
50+
uefi-raw = "0.5.0"
51+
4952

5053
# target为x86_64时,使用下面的依赖
5154
[target.'cfg(target_arch = "x86_64")'.dependencies]
@@ -56,7 +59,7 @@ x86_64 = "0.14.10"
5659

5760
# target为riscv64时,使用下面的依赖
5861
[target.'cfg(target_arch = "riscv64")'.dependencies]
59-
62+
riscv = { version = "0.11.0", features = [ "s-mode" ] }
6063

6164

6265
# 构建时依赖项

kernel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ ECHO:
1616
@echo "$@"
1717

1818
all:
19-
@if [ -z $$DragonOS_GCC ]; then echo "\033[31m [错误]尚未安装DragonOS交叉编译器, 请使用tools文件夹下的build_gcc_toolchain.sh脚本安装 \033[0m"; exit 1; fi
2019
$(MAKE) -C src all ARCH=$(ARCH) || (sh -c "echo 内核编译失败" && exit 1)
2120

2221

kernel/crates/kdepends/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crc = { path = "../crc" }
1212

1313
# 一个无锁MPSC队列
1414
[dependencies.thingbuf]
15-
git = "https://git.mirrors.dragonos.org/DragonOS-Community/thingbuf.git"
15+
git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/thingbuf.git"
1616
rev = "2dded730c3"
1717
default-features = false
1818
features = ["alloc", "static"]

kernel/crates/system_error/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ edition = "2021"
77

88
[dependencies]
99
kdepends = { path = "../kdepends" }
10-
num-traits = { git = "https://git.mirrors.dragonos.org/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }
10+
num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }
1111
num = { version = "0.4.0", default-features = false }
1212
num-derive = "0.3"

0 commit comments

Comments
 (0)