Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump dadk to 0.2.0 #1058

Merged
merged 9 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 45 additions & 44 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,96 +2,97 @@ name: Build Check

on:
push:
branches: [ "master", "feat-*", "fix-*"]
branches: ["master", "feat-*", "fix-*"]
pull_request:
branches: [ "master", "feat-*", "fix-*"]
branches: ["master", "feat-*", "fix-*"]

jobs:

format-check:
name: Format check ${{ matrix.arch }}
runs-on: ubuntu-latest
continue-on-error: true
container: dragonos/dragonos-dev:v1.6
container: dragonos/dragonos-dev:v1.7

strategy:
matrix:
arch: [x86_64, riscv64]

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.6"
- uses: actions/checkout@v3
- run: echo "Running in dragonos/dragonos-dev:v1.7"
- uses: actions/checkout@v3

- name: Format check
env:
- name: Format check
env:
ARCH: ${{ matrix.arch }}
HOME: /root
shell: bash -ileo pipefail {0}
run: |
printf "\n" >> kernel/src/include/bindings/bindings.rs
FMT_CHECK=1 make fmt

shell: bash -ileo pipefail {0}
run: |
printf "\n" >> kernel/src/include/bindings/bindings.rs
sed -i 's/arch = ".*"/arch = "${{ matrix.arch }}"/' dadk-manifest.toml
FMT_CHECK=1 make fmt

kernel-static-test:
name: Kernel static test ${{ matrix.arch }}
runs-on: ubuntu-latest
continue-on-error: true
container: dragonos/dragonos-dev:v1.6
container: dragonos/dragonos-dev:v1.7

strategy:
matrix:
arch: [x86_64, riscv64]

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.6"
- run: echo "Running in dragonos/dragonos-dev:v1.7"

- uses: actions/checkout@v3
- uses: actions/checkout@v3

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

build-x86_64:

runs-on: ubuntu-latest
container: dragonos/dragonos-dev:v1.6
container: dragonos/dragonos-dev:v1.7

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.6"
- run: echo "Running in dragonos/dragonos-dev:v1.7"

- uses: actions/checkout@v3
- name: build the DragonOS
env:
- uses: actions/checkout@v3
- name: build the DragonOS
env:
ARCH: x86_64
HOME: /root
shell: bash -ileo pipefail {0}
shell: bash -ileo pipefail {0}

run: |
source ~/.bashrc
source ~/.cargo/env
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin

make -j $(nproc)
run: |
source ~/.bashrc
source ~/.cargo/env
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml

build-riscv64:
make all -j $(nproc)

build-riscv64:
runs-on: ubuntu-latest
container: dragonos/dragonos-dev:v1.6
container: dragonos/dragonos-dev:v1.7

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.6"
- run: echo "Running in dragonos/dragonos-dev:v1.7"

- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/checkout@v3
with:
submodules: "recursive"

- name: build the DragonOS
shell: bash -ileo pipefail {0}
env:
- name: build the DragonOS
shell: bash -ileo pipefail {0}
env:
ARCH: riscv64
HOME: /root

run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)

run: |
source ~/.bashrc && source ~/.cargo/env
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml
make kernel -j $(nproc)
46 changes: 22 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ else
FMT_CHECK=
endif

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

.PHONY: all
all: kernel user


.PHONY: kernel
kernel:
kernel: check_arch
mkdir -p bin/kernel/

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

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

.PHONY: clean
Expand All @@ -61,11 +64,6 @@ clean:
ECHO:
@echo "$@"

cppcheck-xml:
cppcheck kernel user --platform=unix64 --std=c11 -I user/libs/ -I=kernel/ --force -j $(NPROCS) --xml 2> cppcheck.xml

cppcheck:
cppcheck kernel user --platform=unix64 --std=c11 -I user/libs/ -I=kernel/ --force -j $(NPROCS)

docs: ECHO
bash -c "cd docs && make html && cd .."
Expand All @@ -81,74 +79,74 @@ else
endif

# 写入磁盘镜像
write_diskimage:
write_diskimage: check_arch
@echo "write_diskimage arch=$(ARCH)"
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 .."
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 .."

# 写入磁盘镜像(uefi)
write_diskimage-uefi:
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 .."
write_diskimage-uefi: check_arch
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 .."
# 不编译,直接启动QEMU
qemu:
qemu: check_arch
sh -c "cd tools && bash run-qemu.sh --bios=legacy --display=window && cd .."

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

# 不编译,直接启动QEMU(UEFI)
qemu-uefi:
qemu-uefi: check_arch
sh -c "cd tools && bash run-qemu.sh --bios=uefi --display=window && cd .."
# 不编译,直接启动QEMU,使用VNC Display作为图像输出
qemu-vnc:
qemu-vnc: check_arch
sh -c "cd tools && bash run-qemu.sh --bios=legacy --display=vnc && cd .."
# 不编译,直接启动QEMU(UEFI),使用VNC Display作为图像输出
qemu-uefi-vnc:
qemu-uefi-vnc: check_arch
sh -c "cd tools && bash run-qemu.sh --bios=uefi --display=vnc && cd .."

# 编译并写入磁盘镜像
build:
build: check_arch
$(MAKE) all -j $(NPROCS)
$(MAKE) write_diskimage || exit 1

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

# uefi方式启动
run-uefi:
run-uefi: check_arch
$(MAKE) all -j $(NPROCS)
$(MAKE) write_diskimage-uefi || exit 1
$(MAKE) qemu-uefi

# 编译并启动QEMU
run:
run: check_arch
$(MAKE) all -j $(NPROCS)
$(MAKE) write_diskimage || exit 1
$(MAKE) qemu

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

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

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

fmt:
fmt: check_arch
@echo "格式化代码"
FMT_CHECK=$(FMT_CHECK) $(MAKE) fmt -C kernel
FMT_CHECK=$(FMT_CHECK) $(MAKE) fmt -C user
Expand Down
14 changes: 14 additions & 0 deletions config/rootfs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[metadata]
# Filesystem type (options: `fat32`)
fs_type = "fat32"
# Size of the rootfs disk image (eg, `1G`, `1024M`)
size = "1G"

[partition]
# Partition type (options: "none", "mbr", "gpt")
#
# If "none" is specified, no partition table will be created,
# and the entire disk will be treated as a single partition.
#
# Note that the "none" option is incompatible with GRUB boot.
type = "mbr"
24 changes: 24 additions & 0 deletions dadk-manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# DADK 总控文件

[metadata]
# Target architecture. Options: x86_64, riscv64
arch = "x86_64"

# Hypervisor config path
hypervisor-config = "config/hypervisor.toml"

# RootFS config path
rootfs-config = "config/rootfs.toml"

# Boot config path
boot-config = "config/boot.toml"

# System root directory folder (DADK will copy the files in this directory to the root directory of the disk image)
sysroot-dir = "bin/sysroot"

# DADK Root Cache directory path
cache-root-dir = "bin/dadk_cache"

# User configuration directory path
# 这个字段只是临时用于兼容旧版本,v0.2版本重构完成后会删除
user-config-dir = "user/dadk/config"
1 change: 1 addition & 0 deletions docs/kernel/debug/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@

traceback
debug-kernel-with-gdb
profiling-kernel-with-dadk
Loading