使用submodule引入DragonStub (#462)

* 修正构建系统文档: 使用repo工具克隆代码

* 使用submodule管理
This commit is contained in:
LoGin 2023-12-03 17:16:03 +08:00 committed by GitHub
parent 83ed0ebc29
commit af35431005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 16 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "kernel/submodules/DragonStub"]
path = kernel/submodules/DragonStub
url = https://github.com/DragonOS-Community/DragonStub.git

View File

@ -151,6 +151,19 @@ log-monitor:
@echo "启动日志监控" @echo "启动日志监控"
@sh -c "cd tools/debugging/logmonitor && cargo run --release -- --log-dir $(ROOT_PATH)/logs/ --kernel $(ROOT_PATH)/bin/kernel/kernel.elf" @sh -c "cd tools/debugging/logmonitor && cargo run --release -- --log-dir $(ROOT_PATH)/logs/ --kernel $(ROOT_PATH)/bin/kernel/kernel.elf"
.PHONY: update-submodules
update-submodules:
@echo "更新子模块"
@git submodule update --init --recursive
@git submodule foreach git pull origin master
.PHONY: update-submodules-by-mirror
update-submodules-by-mirror:
@echo "从镜像更新子模块"
@git config --global url."https://git.mirrors.dragonos.org.cn/DragonOS-Community/".insteadOf https://github.com/DragonOS-Community/
@$(MAKE) update-submodules
@git config --global --unset url."https://git.mirrors.dragonos.org.cn/DragonOS-Community/".insteadOf
help: help:
@echo "编译:" @echo "编译:"
@echo " make all -j <n> - 本地编译,不运行,n为要用于编译的CPU核心数" @echo " make all -j <n> - 本地编译,不运行,n为要用于编译的CPU核心数"
@ -168,3 +181,14 @@ help:
@echo "" @echo ""
@echo "" @echo ""
@echo "注: 对于上述的run, run-uefi, qemu, qemu-uefi命令可以在命令后加上-vnc后缀,来通过vnc连接到DragonOS, 默认会在5900端口运行vnc服务器。如make run-vnc " @echo "注: 对于上述的run, run-uefi, qemu, qemu-uefi命令可以在命令后加上-vnc后缀,来通过vnc连接到DragonOS, 默认会在5900端口运行vnc服务器。如make run-vnc "
@echo ""
@echo "其他:"
@echo " make clean - 清理编译产生的文件"
@echo " make fmt - 格式化代码"
@echo " make log-monitor - 启动日志监控"
@echo " make docs - 生成文档"
@echo " make clean-docs - 清理文档"
@echo ""
@echo " make update-submodules - 更新子模块"
@echo " make update-submodules-by-mirror - 从镜像更新子模块"

View File

@ -11,21 +11,13 @@
### 1.1 下载DragonOS的源代码 ### 1.1 下载DragonOS的源代码
#### 1.1.1 安装git和repo工具
```shell
sudo apt-get install git repo
echo "export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'" >> ~/.$(basename $SHELL)rc
source ~/.$(basename $SHELL)rc
```
#### 1.1.2 克隆DragonOS的代码
使用https克隆 使用https克隆
```shell ```shell
curl -sSL https://git.mirrors.dragonos.org.cn/DragonOS-Community/manifest/raw/master/scripts/init.sh | bash git clone https://github.com/DragonOS-Community/DragonOS.git
cd DragonOS
# 使用镜像源更新子模块
make update-submodules-by-mirror
``` ```
为了方便后续的开发我们建议您使用ssh克隆请先配置好github的SSH Key以避免由于网络问题导致的克隆失败 为了方便后续的开发我们建议您使用ssh克隆请先配置好github的SSH Key以避免由于网络问题导致的克隆失败
@ -35,7 +27,10 @@ curl -sSL https://git.mirrors.dragonos.org.cn/DragonOS-Community/manifest/raw/ma
```shell ```shell
# 使用ssh克隆 # 使用ssh克隆
bash <(curl -sSL https://git.mirrors.dragonos.org.cn/DragonOS-Community/manifest/raw/master/scripts/init.sh) --use-ssh-after-clone git clone git@github.com:DragonOS-Community/DragonOS.git
cd DragonOS
# 使用镜像源更新子模块
make update-submodules-by-mirror
``` ```
## 2.使用一键初始化脚本进行安装(推荐) ## 2.使用一键初始化脚本进行安装(推荐)

2
env.mk
View File

@ -2,7 +2,7 @@
ifeq ($(ARCH), ) ifeq ($(ARCH), )
# 在这里设置ARCH可选x86_64和riscv64 # 在这里设置ARCH可选x86_64和riscv64
# !!!!!!!如果不同时调整这里以及vscode的settings.json那么自动补全和检查将会失效 # !!!!!!!如果不同时调整这里以及vscode的settings.json那么自动补全和检查将会失效
export ARCH=x86_64 export ARCH?=x86_64
endif endif
ifeq ($(EMULATOR), ) ifeq ($(EMULATOR), )

View File

@ -102,7 +102,8 @@ endif
__dragon_stub: __dragon_stub:
@echo "Linking dragon_stub..." @echo "Linking dragon_stub..."
PAYLOAD_ELF=$(PAYLOAD_ELF) TARGET_SYSROOT=$(ROOT_PATH)/bin/sysroot $(MAKE) -C $(ROOT_PATH)/../DragonStub install -j $(NPROCS) @mkdir -p $(ROOT_PATH)/bin/sysroot
PAYLOAD_ELF=$(PAYLOAD_ELF) TARGET_SYSROOT=$(ROOT_PATH)/bin/sysroot $(MAKE) -C $(ROOT_PATH)/kernel/submodules/DragonStub install -j $(NPROCS)
clean: clean:

@ -0,0 +1 @@
Subproject commit a09217116ba686489b46f0bee85581924604b2f6