Skip to content

Commit e8b1db3

Browse files
fslongjinJomocool
andauthored
chore: Bump dadk to 0.2.0 (#1058)
# 概述 把dadk版本升级到0.2.0 dadk 0.2.0能够提升编译速度,并且支持使用dadk对内核进行profiling。 新版dadk的文档: https://docs.dragonos.org.cn/p/dadk/ # 注意 这是一个breaking change,升级后,将无法使用dadk 0.2.0去编译旧的项目。如有需要,请手动降级到dadk 0.1.11: ```shell cargo install --git https://git.mirrors.dragonos.org.cn/DragonOS-Community/DADK --tag v0.1.11 ``` # 更改列表 * chore: 把管理用户程序编译的dadk配置文件改为新格式的 * feat: 使用新版dadk来创建\挂载\卸载磁盘镜像 * chore: bump dadk min version to 0.2.0 * chore: fix ci * chore: 更新github ci镜像到1.7 * doc: 添加文档 --------- Co-Authored-by: xuzihao <[email protected]> Signed-off-by: longjin <[email protected]>
1 parent 539ee3e commit e8b1db3

File tree

110 files changed

+2216
-1327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2216
-1327
lines changed

.github/workflows/makefile.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,97 @@ name: Build Check
22

33
on:
44
push:
5-
branches: [ "master", "feat-*", "fix-*"]
5+
branches: ["master", "feat-*", "fix-*"]
66
pull_request:
7-
branches: [ "master", "feat-*", "fix-*"]
7+
branches: ["master", "feat-*", "fix-*"]
88

99
jobs:
10-
1110
format-check:
1211
name: Format check ${{ matrix.arch }}
1312
runs-on: ubuntu-latest
1413
continue-on-error: true
15-
container: dragonos/dragonos-dev:v1.6
14+
container: dragonos/dragonos-dev:v1.7
1615

1716
strategy:
1817
matrix:
1918
arch: [x86_64, riscv64]
2019

2120
steps:
22-
- run: echo "Running in dragonos/dragonos-dev:v1.6"
23-
- uses: actions/checkout@v3
21+
- run: echo "Running in dragonos/dragonos-dev:v1.7"
22+
- uses: actions/checkout@v3
2423

25-
- name: Format check
26-
env:
24+
- name: Format check
25+
env:
2726
ARCH: ${{ matrix.arch }}
2827
HOME: /root
29-
shell: bash -ileo pipefail {0}
30-
run: |
31-
printf "\n" >> kernel/src/include/bindings/bindings.rs
32-
FMT_CHECK=1 make fmt
33-
28+
shell: bash -ileo pipefail {0}
29+
run: |
30+
printf "\n" >> kernel/src/include/bindings/bindings.rs
31+
sed -i 's/arch = ".*"/arch = "${{ matrix.arch }}"/' dadk-manifest.toml
32+
FMT_CHECK=1 make fmt
33+
3434
kernel-static-test:
3535
name: Kernel static test ${{ matrix.arch }}
3636
runs-on: ubuntu-latest
3737
continue-on-error: true
38-
container: dragonos/dragonos-dev:v1.6
38+
container: dragonos/dragonos-dev:v1.7
3939

4040
strategy:
4141
matrix:
4242
arch: [x86_64, riscv64]
4343

4444
steps:
45-
- run: echo "Running in dragonos/dragonos-dev:v1.6"
45+
- run: echo "Running in dragonos/dragonos-dev:v1.7"
4646

47-
- uses: actions/checkout@v3
47+
- uses: actions/checkout@v3
4848

49-
- name: Run kernel static test
50-
shell: bash -ileo pipefail {0}
51-
env:
49+
- name: Run kernel static test
50+
shell: bash -ileo pipefail {0}
51+
env:
5252
ARCH: ${{ matrix.arch }}
5353
HOME: /root
54-
run: bash -c "source /root/.cargo/env && cd kernel && make test && make test-rbpf"
54+
run: bash -c "source /root/.cargo/env && cd kernel && make test && make test-rbpf"
5555

5656
build-x86_64:
57-
5857
runs-on: ubuntu-latest
59-
container: dragonos/dragonos-dev:v1.6
58+
container: dragonos/dragonos-dev:v1.7
6059

6160
steps:
62-
- run: echo "Running in dragonos/dragonos-dev:v1.6"
61+
- run: echo "Running in dragonos/dragonos-dev:v1.7"
6362

64-
- uses: actions/checkout@v3
65-
- name: build the DragonOS
66-
env:
63+
- uses: actions/checkout@v3
64+
- name: build the DragonOS
65+
env:
6766
ARCH: x86_64
6867
HOME: /root
69-
shell: bash -ileo pipefail {0}
68+
shell: bash -ileo pipefail {0}
7069

71-
run: |
72-
source ~/.bashrc
73-
source ~/.cargo/env
74-
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
75-
76-
make -j $(nproc)
70+
run: |
71+
source ~/.bashrc
72+
source ~/.cargo/env
73+
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
74+
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml
7775
78-
build-riscv64:
76+
make all -j $(nproc)
7977
78+
build-riscv64:
8079
runs-on: ubuntu-latest
81-
container: dragonos/dragonos-dev:v1.6
80+
container: dragonos/dragonos-dev:v1.7
8281

8382
steps:
84-
- run: echo "Running in dragonos/dragonos-dev:v1.6"
83+
- run: echo "Running in dragonos/dragonos-dev:v1.7"
8584

86-
- uses: actions/checkout@v3
87-
with:
88-
submodules: 'recursive'
85+
- uses: actions/checkout@v3
86+
with:
87+
submodules: "recursive"
8988

90-
- name: build the DragonOS
91-
shell: bash -ileo pipefail {0}
92-
env:
89+
- name: build the DragonOS
90+
shell: bash -ileo pipefail {0}
91+
env:
9392
ARCH: riscv64
9493
HOME: /root
9594

96-
run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)
97-
95+
run: |
96+
source ~/.bashrc && source ~/.cargo/env
97+
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml
98+
make kernel -j $(nproc)

Makefile

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,22 @@ else
3434
FMT_CHECK=
3535
endif
3636

37+
# Check if ARCH matches the arch field in dadk-manifest.toml
38+
check_arch:
39+
@bash tools/check_arch.sh
3740

3841
.PHONY: all
3942
all: kernel user
4043

4144

4245
.PHONY: kernel
43-
kernel:
46+
kernel: check_arch
4447
mkdir -p bin/kernel/
4548

4649
$(MAKE) -C ./kernel all ARCH=$(ARCH) || (sh -c "echo 内核编译失败" && exit 1)
4750

4851
.PHONY: user
49-
user:
52+
user: check_arch
5053
$(MAKE) -C ./user all ARCH=$(ARCH) || (sh -c "echo 用户程序编译失败" && exit 1)
5154

5255
.PHONY: clean
@@ -61,11 +64,6 @@ clean:
6164
ECHO:
6265
@echo "$@"
6366

64-
cppcheck-xml:
65-
cppcheck kernel user --platform=unix64 --std=c11 -I user/libs/ -I=kernel/ --force -j $(NPROCS) --xml 2> cppcheck.xml
66-
67-
cppcheck:
68-
cppcheck kernel user --platform=unix64 --std=c11 -I user/libs/ -I=kernel/ --force -j $(NPROCS)
6967

7068
docs: ECHO
7169
bash -c "cd docs && make html && cd .."
@@ -81,74 +79,74 @@ else
8179
endif
8280

8381
# 写入磁盘镜像
84-
write_diskimage:
82+
write_diskimage: check_arch
8583
@echo "write_diskimage arch=$(ARCH)"
86-
bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=legacy && cd .."
84+
bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo DADK=$(DADK) ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=legacy && cd .."
8785

8886
# 写入磁盘镜像(uefi)
89-
write_diskimage-uefi:
90-
bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=uefi && cd .."
87+
write_diskimage-uefi: check_arch
88+
bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo DADK=$(DADK) ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=uefi && cd .."
9189
# 不编译,直接启动QEMU
92-
qemu:
90+
qemu: check_arch
9391
sh -c "cd tools && bash run-qemu.sh --bios=legacy --display=window && cd .."
9492

9593
# 不编译,直接启动QEMU,不显示图像
96-
qemu-nographic:
94+
qemu-nographic: check_arch
9795
sh -c "cd tools && bash run-qemu.sh --bios=legacy --display=nographic && cd .."
9896

9997
# 不编译,直接启动QEMU(UEFI)
100-
qemu-uefi:
98+
qemu-uefi: check_arch
10199
sh -c "cd tools && bash run-qemu.sh --bios=uefi --display=window && cd .."
102100
# 不编译,直接启动QEMU,使用VNC Display作为图像输出
103-
qemu-vnc:
101+
qemu-vnc: check_arch
104102
sh -c "cd tools && bash run-qemu.sh --bios=legacy --display=vnc && cd .."
105103
# 不编译,直接启动QEMU(UEFI),使用VNC Display作为图像输出
106-
qemu-uefi-vnc:
104+
qemu-uefi-vnc: check_arch
107105
sh -c "cd tools && bash run-qemu.sh --bios=uefi --display=vnc && cd .."
108106

109107
# 编译并写入磁盘镜像
110-
build:
108+
build: check_arch
111109
$(MAKE) all -j $(NPROCS)
112110
$(MAKE) write_diskimage || exit 1
113111

114112
# 在docker中编译,并写入磁盘镜像
115-
docker:
113+
docker: check_arch
116114
@echo "使用docker构建"
117115
sudo bash tools/build_in_docker.sh || exit 1
118116
$(MAKE) write_diskimage || exit 1
119117

120118
# uefi方式启动
121-
run-uefi:
119+
run-uefi: check_arch
122120
$(MAKE) all -j $(NPROCS)
123121
$(MAKE) write_diskimage-uefi || exit 1
124122
$(MAKE) qemu-uefi
125123

126124
# 编译并启动QEMU
127-
run:
125+
run: check_arch
128126
$(MAKE) all -j $(NPROCS)
129127
$(MAKE) write_diskimage || exit 1
130128
$(MAKE) qemu
131129

132130
# uefi方式启动,使用VNC Display作为图像输出
133-
run-uefi-vnc:
131+
run-uefi-vnc: check_arch
134132
$(MAKE) all -j $(NPROCS)
135133
$(MAKE) write_diskimage-uefi || exit 1
136134
$(MAKE) qemu-uefi-vnc
137135

138136
# 编译并启动QEMU,使用VNC Display作为图像输出
139-
run-vnc:
137+
run-vnc: check_arch
140138
$(MAKE) all -j $(NPROCS)
141139
$(MAKE) write_diskimage || exit 1
142140
$(MAKE) qemu-vnc
143141

144142
# 在docker中编译,并启动QEMU
145-
run-docker:
143+
run-docker: check_arch
146144
@echo "使用docker构建并运行"
147145
sudo bash tools/build_in_docker.sh || exit 1
148146
$(MAKE) write_diskimage || exit 1
149147
$(MAKE) qemu
150148

151-
fmt:
149+
fmt: check_arch
152150
@echo "格式化代码"
153151
FMT_CHECK=$(FMT_CHECK) $(MAKE) fmt -C kernel
154152
FMT_CHECK=$(FMT_CHECK) $(MAKE) fmt -C user

config/rootfs.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[metadata]
2+
# Filesystem type (options: `fat32`)
3+
fs_type = "fat32"
4+
# Size of the rootfs disk image (eg, `1G`, `1024M`)
5+
size = "1G"
6+
7+
[partition]
8+
# Partition type (options: "none", "mbr", "gpt")
9+
#
10+
# If "none" is specified, no partition table will be created,
11+
# and the entire disk will be treated as a single partition.
12+
#
13+
# Note that the "none" option is incompatible with GRUB boot.
14+
type = "mbr"

dadk-manifest.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# DADK 总控文件
2+
3+
[metadata]
4+
# Target architecture. Options: x86_64, riscv64
5+
arch = "x86_64"
6+
7+
# Hypervisor config path
8+
hypervisor-config = "config/hypervisor.toml"
9+
10+
# RootFS config path
11+
rootfs-config = "config/rootfs.toml"
12+
13+
# Boot config path
14+
boot-config = "config/boot.toml"
15+
16+
# System root directory folder (DADK will copy the files in this directory to the root directory of the disk image)
17+
sysroot-dir = "bin/sysroot"
18+
19+
# DADK Root Cache directory path
20+
cache-root-dir = "bin/dadk_cache"
21+
22+
# User configuration directory path
23+
# 这个字段只是临时用于兼容旧版本,v0.2版本重构完成后会删除
24+
user-config-dir = "user/dadk/config"

docs/kernel/debug/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99

1010
traceback
1111
debug-kernel-with-gdb
12+
profiling-kernel-with-dadk

0 commit comments

Comments
 (0)