实现内核日志系统 (#489)

* 实现写日志和读取日志,并且能够在用户态下执行dmesg命令查看日志

* 通过klogctl实现dmesg

* 改用ConstGenericRingBuffer作内核缓冲区

* 更改缓冲区容量

* 将能够输出到控制台的日志级别改为日志级别枚举类,使用SpinLock控制KMSG,使用枚举类定义SYSLOG_ACTION,将do_syslog系统调用接口放在syscall.rs

* fix warning

* 完善do_syslog注释

* 将KMSG接入kinfo、kdebug等

* fix warning

* 修复显示的秒数不正确,·以及无法通过CI的问题
This commit is contained in:
Jomo
2024-01-24 16:13:15 +08:00
committed by GitHub
parent d46c6d2794
commit 8d72b68da9
27 changed files with 763 additions and 26 deletions

View File

@ -15,7 +15,8 @@ runs:
with:
path: |
~/opt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
- name: Cache build tools
id: cache-build-tools
@ -28,7 +29,8 @@ runs:
~/.cargo
~/.rustup
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
~/opt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
- uses: ./.github/actions/install-apt-packages

View File

@ -18,14 +18,14 @@ jobs:
with:
path: |
~/opt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
- if: ${{ steps.cache-dragonos-gcc.outputs.cache-hit != 'true' }}
name: build dragonos-gcc
continue-on-error: true
run: |
bash tools/build_gcc_toolchain.sh -f
bash tools/install_musl_gcc.sh
- uses: ./.github/actions/install-apt-packages
@ -40,13 +40,15 @@ jobs:
~/.cargo
~/.rustup
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
~/opt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
- if: ${{ steps.cache-build-tools.outputs.cache-hit != 'true' }}
name: Install toolchain
continue-on-error: false
run: |
USE_GITHUB=1 bash tools/install_musl_gcc.sh
cargo install cargo-binutils
rustup toolchain install nightly-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-21-x86_64-unknown-linux-gnu

View File

@ -2,7 +2,7 @@ name: Build Check
on:
push:
branches: [ "master", "patch-add-riscv64-github-workflow" ]
branches: [ "master" ]
pull_request:
branches: [ "master" ]
@ -50,6 +50,7 @@ jobs:
- uses: ./.github/actions/import-toolchain
- name: Run kernel static test
shell: bash -ileo pipefail {0}
env:
ARCH: ${{ matrix.arch }}
run: bash -c "source ~/.cargo/env && cd kernel && make test"
@ -68,7 +69,14 @@ jobs:
- name: build the DragonOS
env:
ARCH: x86_64
run: bash -c "source ~/.cargo/env && export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin && make -j $(nproc) "
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)
build-riscv64:
@ -84,8 +92,9 @@ jobs:
- uses: ./.github/actions/import-toolchain
- name: build the DragonOS
shell: bash -ileo pipefail {0}
env:
ARCH: riscv64
run: bash -c "source ~/.cargo/env && make kernel -j $(nproc)"
run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)