Skip to content

Commit

Permalink
2024S: build offline
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf2019 committed Feb 27, 2024
1 parent 6d8ec83 commit 49d98ad
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
- name: Mirror + trigger CI
uses: tkf2019/gitlab-mirror-and-ci-action@master
with:
args: "https://git.tsinghua.edu.cn/os-lab/2024s/public/rcore-tutorial-code"
args: "https://git.tsinghua.edu.cn/os-lab/2024s/public/rcore-tutorial-code-2024s"
env:
GITLAB_HOSTNAME: "git.tsinghua.edu.cn"
GITLAB_PROJECT_ID: "29091"
GITLAB_PROJECT_NAME: "rcore-tutorial-code"
GITLAB_PROJECT_NAME: "rcore-tutorial-code-2024s"
GITLAB_PROJECT_TOKEN: ${{secrets.GITLAB_PROJECT_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
deploy:
Expand Down
8 changes: 5 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ stages:
test-code-job:
stage: test
script:
- git clone https://github.com/LearningOS/rCore-Tutorial-Checker-2024S.git ci-user
- git clone https://github.com/LearningOS/rCore-Tutorial-Test-2024S.git ci-user/user
- cd ci-user && make test CHAPTER=`echo $CI_COMMIT_REF_NAME | grep -oP 'ch\K[0-9]'` passwd=$BASE_TEST_TOKEN
- git clone https://token:${RCORE_CHECKER_REPO_READ_TOKEN_2024S}@git.tsinghua.edu.cn/os-lab/2024s/ta/rcore-tutorial-checker-2024s.git ci-user
- git clone https://token:${RCORE_TEST_REPO_READ_TOKEN_2024S}@git.tsinghua.edu.cn/os-lab/2024s/public/rcore-tutorial-test-2024s.git ci-user/user
- cp -r $HOME/os-vendor os/vendor
- cp -r $HOME/user-vendor ci-user/user/vendor
- cd ci-user && make test CHAPTER=`echo $CI_COMMIT_REF_NAME | grep -oP 'ch\K[0-9]'` passwd=$BASE_TEST_TOKEN OFFLINE=1
19 changes: 12 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ RUN rustup --version && \
cargo --version && \
rustc --version

# 3. Build env for labs
# See os1/Makefile `env:` for example.
# This avoids having to wait for these steps each time using a new container.
RUN rustup target add riscv64gc-unknown-none-elf && \
cargo install cargo-binutils --vers ~0.2 && \
rustup component add rust-src && \
rustup component add llvm-tools-preview
# 2.3 Env
RUN cargo install cargo-binutils; \
rustup target add riscv64gc-unknown-none-elf; \
rustup component add rust-src; \
rustup component add llvm-tools-preview; \
rustup component add rustfmt; \
rustup component add clippy;

# 3. Cargo vendor
WORKDIR ${HOME}
COPY os/vendor ./os-vendor
COPY user/vendor ./user-vendor

# Ready to go
WORKDIR ${HOME}
2 changes: 1 addition & 1 deletion os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ bitflags = "1.2.1"
buddy_system_allocator = "0.6"
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }
log = "0.4"
riscv = { git = "https://gitee.com/rcore-os/riscv", features = ["inline-asm"] }
riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
xmas-elf = "0.7.0"
3 changes: 3 additions & 0 deletions os/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MODE := release
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
KERNEL_BIN := $(KERNEL_ELF).bin
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
OFFLINE :=

# BOARD
BOARD := qemu
Expand Down Expand Up @@ -32,10 +33,12 @@ DISASM ?= -x
build: env $(KERNEL_BIN)

env:
ifeq ($(OFFLINE),)
(rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET)
cargo install cargo-binutils
rustup component add rust-src
rustup component add llvm-tools-preview
endif

$(KERNEL_BIN): kernel
@$(OBJCOPY) $(KERNEL_ELF) --strip-all -O binary $@
Expand Down

0 comments on commit 49d98ad

Please sign in to comment.