Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat-dynamic-link
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiichen committed Dec 5, 2024
2 parents c157070 + 4f8f269 commit 380b4c0
Show file tree
Hide file tree
Showing 431 changed files with 37,089 additions and 2,933 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs-multiversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOY_S3_SECRET_KEY }}

run: |
aws s3 sync ./_build/html s3://dragonos-docs --delete
aws s3 sync ./_build/html s3://dragonos-docs --delete --exclude "p/*"
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.4
container: dragonos/dragonos-dev:v1.7

strategy:
matrix:
arch: [x86_64, riscv64]

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.4"
- 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.4
container: dragonos/dragonos-dev:v1.7

strategy:
matrix:
arch: [x86_64, riscv64]

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.4"
- 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"
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.4
container: dragonos/dragonos-dev:v1.7

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.4"
- 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.4
container: dragonos/dragonos-dev:v1.7

steps:
- run: echo "Running in dragonos/dragonos-dev:v1.4"
- 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
2 changes: 1 addition & 1 deletion build-scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ fmt:
clean:
@cargo clean
check:
@cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json
@cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json
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"
3 changes: 3 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ help:
.PHONY:
html-multiversion:
rm -rf ./$(BUILDDIR) && CURRENT_GIT_COMMIT_DIRTY=0 sphinx-multiversion $(SPHINXOPTS) "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/

http_server:
python3 -m http.server --directory $(BUILDDIR)/html
3 changes: 2 additions & 1 deletion docs/community/code_contribution/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
.. toctree::
:maxdepth: 1

the-development-process
how-to-contribute <https://community.dragonos.org/contributors/>

c-coding-style
rust-coding-style
conventional-commit
Loading

0 comments on commit 380b4c0

Please sign in to comment.