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

A completely new version of boot code #188

Merged
merged 721 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
721 commits
Select commit Hold shift + click to select a range
552a638
feat(opensbi_interface): add new 3rd
MRNIU Mar 7, 2024
1f4b896
feat(opensbi): remove opensbi driver
MRNIU Mar 12, 2024
6cf3c57
feat(serial, printf): x86 serial support and printf impl
MRNIU Mar 14, 2024
ea277d7
test(efi): add serial output
MRNIU Mar 18, 2024
62fee5c
feat(printf): add printf_bare_metal
MRNIU Mar 19, 2024
4155f81
bug(kernel): efi 进入内核时需要 crt0 跳转,同时进行 C++ 全局对象构造
MRNIU Mar 19, 2024
37a46c9
test(efi): use boot
MRNIU Mar 20, 2024
9fa4c0e
移除兼容 osx 的相关代码
MRNIU Apr 22, 2024
47be8d2
移除兼容 osx 的相关代码
MRNIU Apr 22, 2024
2a944e5
feat(build): adapt osx m1
MRNIU Apr 23, 2024
a5be718
3rd(test): use bundled gtest
MRNIU Apr 23, 2024
09cd209
pref(build): use CMAKE_HOST_SYSTEM_PROCESSOR
MRNIU Apr 23, 2024
eb00663
fix(3rd): gnu-efi on aarch64
MRNIU Apr 23, 2024
5c27933
build: update riscv64 toolchain
MRNIU Apr 23, 2024
4dbb321
refactor: rename files
MRNIU Apr 24, 2024
01e223a
3rd: update opensbi_interface
MRNIU Apr 24, 2024
1448af9
fix: fix warning
MRNIU Apr 24, 2024
96d88ae
fix: adapt riscv64
MRNIU Apr 24, 2024
d703d3d
pref: move _putchar to arch_init
MRNIU Apr 24, 2024
408d2e5
pref: move _putchar towww arch_init
MRNIU Apr 24, 2024
f8569bd
3rd: update printf
MRNIU Apr 24, 2024
e13ec11
pref(build): remove excp
MRNIU Apr 24, 2024
8912e4c
pref(arch): riscv boot args
MRNIU Apr 24, 2024
a6e9718
pref(arch): riscv boot args
MRNIU Apr 24, 2024
cdf1c7f
fix(build): add -fPIC for kernel compile
MRNIU Apr 25, 2024
524f000
feat(cxx): cpp ctor
MRNIU Apr 26, 2024
3f63606
pref(cmake): update efi maker
MRNIU Apr 26, 2024
b864828
pref(build): update riscv compil options
MRNIU Apr 26, 2024
bfb8fd1
pref(build): update compile opts
MRNIU Apr 26, 2024
8c865a1
pref(build): 尝试解决全局构造问题,此版本现象:
MRNIU Apr 28, 2024
da1fa57
ci: add cmake
MRNIU May 22, 2024
51994b5
add qemu-system-aarch64 -machine virt -machine dumpdtb=qemu.dtb dts
MRNIU May 23, 2024
e1f7c67
feat(dtb): add fdt-parser
MRNIU May 23, 2024
9a9a5d3
feat(libcxx): add cstring, a sort of str funcs
MRNIU May 23, 2024
9394ba5
pref(libcxx): change define order
MRNIU May 23, 2024
1916292
pref(libcxx): change define order
MRNIU May 23, 2024
cd552d9
tools(dts): update riscv64 dts
MRNIU May 24, 2024
e4b5713
build(cmake): add -static for riscv64
MRNIU May 24, 2024
cf2148f
feat(driver): ns16550a for riscv64
MRNIU May 24, 2024
75a43c8
pref(libcxx): remove extern c
MRNIU May 24, 2024
cce7b28
pref(build): -fPIC as common kernel option
MRNIU May 24, 2024
7b8a2cd
pref(build): -fPIC as common kernel option
MRNIU May 24, 2024
cfb0a00
change var name
MRNIU May 24, 2024
c294f76
fix(boot.s): sd_base
MRNIU May 24, 2024
aed1ea4
fix(boot.s): sd_base
MRNIU May 24, 2024
91ca429
new branch
MRNIU May 24, 2024
58e9a77
fixed with -mno-relax
MRNIU May 24, 2024
7304433
doc(README): revert
MRNIU May 24, 2024
9b1664a
build(cmake): add fno-omit-frame-pointer
MRNIU May 24, 2024
7c54112
pref(cmake): add compile opts
MRNIU May 24, 2024
9b28252
feat(cmake): add USE_NO_RELAX flag
MRNIU May 24, 2024
4c46bb5
doc(README): update
MRNIU May 25, 2024
ea5bb70
fix warnning
MRNIU May 25, 2024
1074e88
style: update header macro style
MRNIU May 25, 2024
cf668ac
style(*): update class name
MRNIU May 26, 2024
a51b836
style(*): update var name
MRNIU May 26, 2024
68d7c51
style(*): update para name
MRNIU May 26, 2024
654ff7f
style(*): update func name
MRNIU May 26, 2024
0ba78d6
style(*): update
MRNIU May 26, 2024
66c8b31
style(*): update
MRNIU May 27, 2024
058be01
style(*): update
MRNIU May 27, 2024
578d657
build(x86_64): add compile opt
MRNIU May 27, 2024
8774d26
tcest(gnuefi): update
MRNIU May 27, 2024
ea0b08e
build(link): update link scripts
MRNIU May 27, 2024
42fe78a
build(link): update link scripts
MRNIU May 27, 2024
95b7fe5
build(link): align all sections to 0x1000
MRNIU May 28, 2024
ab0b6b6
pref(boot): update gnuefi bootloader
MRNIU May 28, 2024
fed44fe
bug(boot): find bug
MRNIU May 28, 2024
6d285f1
add todo
MRNIU May 28, 2024
aa7d84f
feat(cmake): add target for objdump -D and readelf -a
MRNIU May 28, 2024
e6a4f3c
bug: find bug
MRNIU May 28, 2024
41521ff
bug: find bug
MRNIU May 28, 2024
0e790e5
doc: update README
MRNIU May 29, 2024
da173fc
fix(cmake): add when make efi
MRNIU May 29, 2024
590ce5d
feat(x86_64): update cpu.hpp
MRNIU May 29, 2024
5b44e64
feat(x86_64): memory info from uefi
MRNIU May 30, 2024
905e33f
3rd: update gnuefi to 3.0.18
MRNIU May 30, 2024
35a39ee
pref(boot): add InitializeLib
MRNIU May 30, 2024
5d12805
builf(aarch64): add link opts
MRNIU May 30, 2024
c655a4d
feat(arch): add cpu.hpp for aarch64
MRNIU May 30, 2024
6de3610
find bug
MRNIU May 30, 2024
e9d486a
build(cmake): add -pedantic
MRNIU May 30, 2024
1fe296a
doc: update README, ready to next phase
MRNIU May 30, 2024
ff8a7e8
fix CI
MRNIU May 30, 2024
337a889
update README
MRNIU May 30, 2024
f75f7b7
style: update
MRNIU May 30, 2024
5c1ba17
pref(*): update dir structure
MRNIU May 30, 2024
35c476b
fix typo
MRNIU May 30, 2024
95d3906
builf(arch): add kernel header
MRNIU May 30, 2024
4f17eb2
feat(libcxx): add ostream
MRNIU May 31, 2024
41397dd
fix(boot): update riscv64 gp init code accroed to riscv_abi doc
MRNIU Jun 3, 2024
7c47a7c
pref(libcxx): update cpp ctor and dtor
MRNIU Jun 3, 2024
22b152c
comment: update
MRNIU Jun 3, 2024
4e6b075
pref(main): add include
MRNIU Jun 3, 2024
58c4d2b
feat(libcxx): new overload for iostream
MRNIU Jun 4, 2024
29e3f5c
pref(cpu): use namespace
MRNIU Jun 4, 2024
73d4e48
test: add ctor/dtor test
MRNIU Jun 5, 2024
76ee98e
fix(test): gnu-efi for x86_64
MRNIU Jun 5, 2024
4cbf716
bug(x86_64): static var cannot use
MRNIU Jun 5, 2024
2f1536c
bug(x86_64): static var cannot use
MRNIU Jun 5, 2024
39c0286
cmake(3rd): update fdt_parser to 3.1.0
MRNIU Jun 5, 2024
f8c5f9a
typo
MRNIU Jun 5, 2024
fc4d193
doc(README): update
MRNIU Jun 6, 2024
6b8a2c9
gitmodules: opensbi fdt_parser opensbi_interface printf_bare_metal
MRNIU Jun 6, 2024
9a38a24
gitmodules: opensbi fdt_parser opensbi_interface printf_bare_metal
MRNIU Jun 6, 2024
aa52fd4
gitmodules: gdbinit
MRNIU Jun 6, 2024
0342313
gitmodules: gnu-efi
MRNIU Jun 6, 2024
21f7cc6
doc(README): update
MRNIU Jun 6, 2024
219cd67
ci: update workflow
MRNIU Jun 6, 2024
efd2be4
update gitignore
MRNIU Jun 6, 2024
78c8272
ci: update workflow
MRNIU Jun 6, 2024
883aa3c
cmake(functions): update add_run_target
MRNIU Jun 6, 2024
4e15ab1
update gitignore
MRNIU Jun 6, 2024
1683e4d
typo
MRNIU Jun 6, 2024
55d613d
remove emio
MRNIU Jun 6, 2024
3ab9014
pref(function): update objdump_readelf_nm
MRNIU Jun 7, 2024
3380d0d
rename
MRNIU Jun 8, 2024
2b7a7be
fix(libc): add _init, _fini, _DYNAMIC symble define
MRNIU Jun 8, 2024
95d2846
feat(cmake): add -fPIC -fPIE
MRNIU Jun 8, 2024
2a7dc3e
bug: don not use builtin
MRNIU Jun 8, 2024
f1a00c4
update fdt_parser
MRNIU Jun 8, 2024
bafdb45
update fdt_parser
MRNIU Jun 8, 2024
60bc4e5
fix: define builtin
MRNIU Jun 8, 2024
f98034d
feat: add compile opt -nostdlib
MRNIU Jun 8, 2024
1fd1a29
feat: add compile opt -nostdlib
MRNIU Jun 8, 2024
dcd0467
feat: add compile opt -fno-rtti and -fno-exceptions
MRNIU Jun 11, 2024
8168f8b
feat: new/delete overload
MRNIU Jun 11, 2024
75e5165
test: rename
MRNIU Jun 11, 2024
bbc7d60
fix: fix warning
MRNIU Jun 11, 2024
4ed01ab
test: x86 test
MRNIU Jun 11, 2024
70e425d
feat(libcxx): __cxa_atexit, __cxa_finalize
MRNIU Jun 11, 2024
19007fd
style
MRNIU Jun 11, 2024
6246ccb
feat(arch): DumpStack for x86_64
MRNIU Jun 11, 2024
504a3f9
feat(arch): DumpStack for x86_64
MRNIU Jun 11, 2024
3db29a3
typo
MRNIU Jun 11, 2024
2dc98a2
typo
MRNIU Jun 11, 2024
06288f8
test: x86 test
MRNIU Jun 11, 2024
447d720
test: x86 test
MRNIU Jun 11, 2024
a7d59f9
test(riscv): update cmake
MRNIU Jun 11, 2024
f5a9cf9
test(riscv): update cmake
MRNIU Jun 11, 2024
adcc9e4
bug(riscv): dumpstack not finished
MRNIU Jun 11, 2024
25a8cae
feat(riscv): DumpStack done
MRNIU Jun 11, 2024
8d1bb1f
feat(x86_64): printf function name when DumpStack()
MRNIU Jun 12, 2024
b55f2e1
refactor(kernel): add KernelElf class
MRNIU Jun 12, 2024
994b722
test(ut): add test case
MRNIU Jun 12, 2024
7d026d6
test(st): update gnu-efi test
MRNIU Jun 12, 2024
40b9ca1
feat(arch): use KernelElf in riscv
MRNIU Jun 12, 2024
8f23aa7
pref(kernel): kernel_elf add default param
MRNIU Jun 12, 2024
b0abff3
feat(libc): support stack check
MRNIU Jun 12, 2024
99fa409
feat(libc): add strrchr and memchr
MRNIU Jun 12, 2024
ac60c5b
feat(dtc): add libfdt support
MRNIU Jun 12, 2024
55cac4b
feat(3rd): replace fdt_parser with libfdt
MRNIU Jun 13, 2024
d11d78e
feat(arch): riscv get mem use libfdt
MRNIU Jun 13, 2024
cdd22a9
style
MRNIU Jun 13, 2024
c9d762b
style
MRNIU Jun 13, 2024
3b54b98
pref(arch): update to libfdt
MRNIU Jun 13, 2024
74b27e2
style
MRNIU Jun 13, 2024
6e32765
rename global var
MRNIU Jun 13, 2024
33d9091
doc: update readme
MRNIU Jun 13, 2024
b195a54
update gitignore
MRNIU Jun 13, 2024
0818bfe
typo
MRNIU Jun 13, 2024
080ed31
feat(kernel): add Singleton
MRNIU Jun 13, 2024
78e96ff
feat(kernel): add Singleton
MRNIU Jun 13, 2024
1509a35
feat(libcxx): __cxa_guard*
MRNIU Jun 13, 2024
45e770f
doc: update README
MRNIU Jun 13, 2024
b964d58
doc: update README
MRNIU Jun 13, 2024
ef4a506
feat(libcxx): __cxa_pure_virtual
MRNIU Jun 13, 2024
718164d
style
MRNIU Jun 13, 2024
4ea4aff
Merge remote-tracking branch 'upstream/boot' into boot
MRNIU Jun 13, 2024
cb24f25
typo
MRNIU Jun 13, 2024
bc77f49
feat(arch): add backtrace
MRNIU Jun 13, 2024
5a0493c
feat(arch): add backtrace
MRNIU Jun 13, 2024
2e77012
feat(arch): add backtrace
MRNIU Jun 13, 2024
ed73bd3
feat(libcxx): c++ exctption only with `throw`
MRNIU Jun 13, 2024
3c137c5
style
MRNIU Jun 14, 2024
caef936
feat(kernel): add printf with color
MRNIU Jun 14, 2024
3a85209
feat(kernel): add printf with color
MRNIU Jun 14, 2024
20adc71
style
MRNIU Jun 14, 2024
71ec4f4
fix(libcxx): _Unwind_Resume __gxx_personality_v0
MRNIU Jun 14, 2024
54528b3
refactor(cpu): update riscv64 cpu.hpp
MRNIU Jun 14, 2024
c445666
refactor(cpu): update x86_64 cpu.hpp
MRNIU Jun 14, 2024
d69967c
doc: update arch/README.md
MRNIU Jun 14, 2024
89ee139
doc: update arch/README.md
MRNIU Jun 14, 2024
1b82afa
pref(libc/libcxx): remove printf
MRNIU Jun 14, 2024
ebf44bf
pref(cpu): update RegInfoBase
MRNIU Jun 15, 2024
bc7a0ce
working on ut
MRNIU Jun 15, 2024
286e417
working on ut
MRNIU Jun 15, 2024
ad286e9
test(ut): add cpu.hpp test
MRNIU Jun 16, 2024
13b2c2d
test(ut): add cpu.hpp test
MRNIU Jun 16, 2024
a690c34
test(ut): add cpu.hpp test
MRNIU Jun 16, 2024
352e09f
update workflow
MRNIU Jun 16, 2024
e63919d
update cmake
MRNIU Jun 17, 2024
44afaee
test(st): add cxx-init-test
MRNIU Jun 17, 2024
99d8b43
test(st): add kernel_fdt_test
MRNIU Jun 17, 2024
cb5462e
style
MRNIU Jun 17, 2024
812e86d
fix(st): fix kernel_fdt_test
MRNIU Jun 17, 2024
2f10091
fix(st): fix kernel_fdt_test
MRNIU Jun 17, 2024
e406b77
pref(cpu): update cpu
MRNIU Jun 18, 2024
77f65e8
feat(cpu): update cpu template
MRNIU Jun 18, 2024
f79aa1f
doc(README): update
MRNIU Jul 2, 2024
c45b8c0
feat(kernel): spilt basic_info as a file
MRNIU Jul 8, 2024
c8376e0
feat(basic_info, qemu): remove graphic support
MRNIU Jul 8, 2024
f3d8ace
feat(basic_info): update basic_info struct
MRNIU Jul 8, 2024
ca5e45e
feat(basic_info): add ctor
MRNIU Jul 8, 2024
6aa17eb
doc: update README
MRNIU Jul 8, 2024
08a067f
doc: update README
MRNIU Jul 8, 2024
607bcab
feat: add docker support
MRNIU Jul 31, 2024
b1dae9c
feat: docker suport
MRNIU Jul 31, 2024
7aa7de0
feat: add Debug
MRNIU Jul 31, 2024
4b1797f
feat: add Debug log
MRNIU Jul 31, 2024
2c84f70
feat: add log support
MRNIU Aug 1, 2024
1bf6ad9
feat: update docker
MRNIU Aug 1, 2024
ae1249a
fix: add header
MRNIU Aug 1, 2024
ddccd74
3rd: dtc opensbi for all arch
MRNIU Aug 5, 2024
4a6553a
feat: working on riscv64 gnu-efi support
MRNIU Aug 5, 2024
f456756
feat: working on riscv64 gnu-efi support
MRNIU Aug 5, 2024
e97f2c6
feat: add riscv64 ovmf
MRNIU Aug 5, 2024
9466fcf
todo: qemu->uefi->opensbi + kernel(payload)
MRNIU Aug 5, 2024
6d6a930
perf: update COMPILE_DEPENDS
MRNIU Aug 7, 2024
eb45735
fix: aarch64 compile
MRNIU Aug 7, 2024
527f305
fix: aarch64 objdump
MRNIU Aug 7, 2024
58bb3db
fix: aarch64 test
MRNIU Aug 7, 2024
071768e
refactor: rename std::ostream with sk_std::
MRNIU Aug 7, 2024
f8e8f2a
refactor: rename std:: with sk_std
MRNIU Aug 9, 2024
4a9b4a3
refactor: COMMON_COMPILE_OPTIONS INTERFACE
MRNIU Aug 9, 2024
ef70b8a
refactor: COMMON_LINK_OPTIONS INTERFACE
MRNIU Aug 9, 2024
59daceb
refactor: COMMON_LINK_LIB INTERFACE
MRNIU Aug 9, 2024
0d55f2b
refactor: replace with INTERFACE, not finished
MRNIU Aug 9, 2024
6a319b2
refactor: replace with INTERFACE, not finished
MRNIU Aug 13, 2024
8003763
refactor: replace with INTERFACE, arch
MRNIU Aug 26, 2024
5d9d62e
refactor: replace with INTERFACE, arch
MRNIU Aug 26, 2024
34b68fb
refactor: replace with INTERFACE, arch
MRNIU Aug 26, 2024
039ba0e
refactor: replace with INTERFACE, driver
MRNIU Aug 26, 2024
ad61a6f
refactor: replace with INTERFACE, libc/libcxx
MRNIU Aug 26, 2024
6db87e8
refactor: replace with INTERFACE, boot
MRNIU Aug 26, 2024
bbbada7
refactor: replace with INTERFACE, kernel
MRNIU Aug 26, 2024
cdb2000
refactor: replace with INTERFACE, ut, not finished
MRNIU Aug 26, 2024
70327ce
refactor: replace with INTERFACE, gnu-efi
MRNIU Aug 26, 2024
da41f45
refactor: replace with INTERFACE, dtc
MRNIU Aug 26, 2024
9c44d9f
refactor: replace with INTERFACE, printf_bare_metal
MRNIU Aug 26, 2024
845ee61
refactor: replace with INTERFACE, 3rd
MRNIU Aug 26, 2024
9817d42
refactor: replace with INTERFACE, add_header
MRNIU Aug 26, 2024
1b2c862
refactor: replace with INTERFACE, DEPENDS
MRNIU Aug 26, 2024
1166ea4
refactor: replace with INTERFACE, DEFAULT_KERNEL_LINK_LIB
MRNIU Aug 26, 2024
0795c29
refactor: replace with INTERFACE, DEFAULT_KERNEL_LINK_LIB
MRNIU Aug 26, 2024
9111882
refactor: replace with INTERFACE, boot_link_libraries
MRNIU Aug 26, 2024
0792d6e
refactor: replace with INTERFACE, boot_link_libraries
MRNIU Aug 26, 2024
6089c3d
feat: spilt cpu.hpp; test: fix err
MRNIU Aug 30, 2024
c61cc09
rename
MRNIU Aug 30, 2024
a3652c1
feat: print mem info after load kernel
MRNIU Aug 30, 2024
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
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
---
# @version clang-format version 15
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# 使用 LLVM 规范
BasedOnStyle: LLVM
# 使用 Google 规范
BasedOnStyle: Google
...
103 changes: 30 additions & 73 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ env:
CMAKE_BUILD_TYPE: Release

jobs:
build_docs:
name: Build and publish documentation
build_ubuntu:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -25,90 +24,48 @@ jobs:

- name: Install dependencies
run: |
sudo apt update
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck qemu-system lcov
sudo apt install --fix-missing -y gcc g++ gcc-riscv64-linux-gnu g++-riscv64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

- name: Build
run: |
cmake --preset=build_x86_64
cmake --build build_x86_64 --target doc

- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/doc/html

build_ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck qemu-system lcov
sudo apt update --fix-missing -y
sudo apt upgrade --fix-missing -y
sudo apt install --fix-missing -y gcc g++ gcc-riscv64-linux-gnu g++-riscv64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt install --fix-missing -y cmake qemu-system gdb-multiarch
sudo apt install --fix-missing -y doxygen graphviz
sudo apt install --fix-missing -y clang-format clang-tidy cppcheck libgtest-dev lcov
git submodule update --init --recursive

- name: x86_64
run: |
cmake --preset=build_x86_64
# @todo ci 暂时跑不过
# cmake --build build_x86_64 --target boot
# cmake --build build_x86_64 --target kernel
cmake --preset=build_x86_64
cmake --build build_x86_64 --target boot
cmake --build build_x86_64 --target kernel
cmake --build build_x86_64 --target unit-test
cmake --build build_x86_64 --target coverage

- name: riscv64
run: |
cmake --preset=build_riscv64
# @todo ci 暂时跑不过
# cmake --build build_riscv64 --target kernel
cmake --build build_riscv64 --target kernel

- name: aarch64
run: |
cmake --preset=build_aarch64
cmake --build build_aarch64 --target boot
cmake --build build_aarch64 --target kernel

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: build_x86_64/coverage/coverage.info
verbose: true

# build_osx:
# runs-on: macos-latest
# steps:
# - name: get code
# uses: actions/checkout@v3
#
# - name: setup toolchain
# shell: bash
# run: |
# brew install x86_64-elf-gcc
# brew tap riscv-software-src/riscv
# brew install riscv-tools
#
# - name: make build dir
# shell: bash
# run: |
# mkdir ${{github.workspace}}/build
#
# - name: osx-i386
# shell: bash
# working-directory: ${{github.workspace}}/build
# run: |
# cmake -DTOOLCHAIN_PREFIX=x86_64-elf- -DCMAKE_C_COMPILER=x86_64-elf-gcc -DCMAKE_CXX_COMPILER=x86_64-elf-g++ -DARCH=i386 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 ..
# make
# rm -rf ./*
#
# - name: osx-x86_64
# shell: bash
# working-directory: ${{github.workspace}}/build
# run: |
# cmake -DTOOLCHAIN_PREFIX=x86_64-elf- -DCMAKE_C_COMPILER=x86_64-elf-gcc -DCMAKE_CXX_COMPILER=x86_64-elf-g++ -DARCH=x86_64 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 ..
# make
# rm -rf ./*
#
# - name: osx-riscv64
# shell: bash
# working-directory: ${{github.workspace}}/build
# run: |
# cmake -DTOOLCHAIN_PREFIX=riscv64-unknown-elf- -DCMAKE_C_COMPILER=riscv64-unknown-elf-gcc -DCMAKE_CXX_COMPILER=riscv64-unknown-elf-g++ -DARCH=riscv64 -DCMAKE_BUILD_TYPE=RELEASE -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 ..
# make
# rm -rf ./*
- name: Build Doc
if: github.ref == 'refs/heads/main'
run: |
cmake --preset=build_x86_64
cmake --build build_x86_64 --target doc

- name: Publish
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ${{github.workspace}}/doc/html
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
#
# .gitignore for Simple-XX/SimpleKernel.

*.o
.DS_Store
build
build_aarch64
build_riscv64
build_x86_64
doc/html
cmake-build*
.gdbinit
tools/opensbi/build
.vscode
.idea
3rd
Doxyfile
.gdbinit
22 changes: 22 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

[submodule "3rd/printf_bare_metal"]
path = 3rd/printf_bare_metal
url = https://github.com/MRNIU/printf_bare_metal.git
[submodule "3rd/opensbi_interface"]
path = 3rd/opensbi_interface
url = https://github.com/MRNIU/opensbi_interface.git
[submodule "3rd/opensbi"]
path = 3rd/opensbi
url = https://github.com/riscv-software-src/opensbi.git
[submodule "3rd/gdbinit"]
path = 3rd/gdbinit
url = https://github.com/gdbinit/Gdbinit.git
[submodule "3rd/gnu-efi"]
path = 3rd/gnu-efi
url = https://github.com/ncroxon/gnu-efi.git
[submodule "3rd/dtc"]
path = 3rd/dtc
url = https://git.kernel.org/pub/scm/utils/dtc/dtc.git
[submodule "3rd/googletest"]
path = 3rd/googletest
url = https://github.com/google/googletest.git
1 change: 1 addition & 0 deletions 3rd/dtc
Submodule dtc added at c17d76
1 change: 1 addition & 0 deletions 3rd/gdbinit
Submodule gdbinit added at 40c819
1 change: 1 addition & 0 deletions 3rd/gnu-efi
Submodule gnu-efi added at 9e4797
1 change: 1 addition & 0 deletions 3rd/googletest
Submodule googletest added at 1d17ea
1 change: 1 addition & 0 deletions 3rd/opensbi
Submodule opensbi added at a2b255
1 change: 1 addition & 0 deletions 3rd/opensbi_interface
Submodule opensbi_interface added at 993b56
1 change: 1 addition & 0 deletions 3rd/printf_bare_metal
Submodule printf_bare_metal added at 127aaa
64 changes: 37 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# 导入项目配置
include(project_config)
# 导入头文件处理
include(add_header)
# 导入函数
include(functions)

Expand All @@ -41,42 +39,54 @@ include(compile_config)

# qemu 参数设置
list(APPEND QEMU_FLAGS
# 使用标准输出显示
-serial stdio
# 启动 telnet 服务,使用 2333 端口,不等待连接
-monitor ${QEMU_MONITOR_ARG}
# 不启用图形界面
-nographic
# 使用标准输出显示
-serial stdio
# 启动 telnet 服务,使用 2333 端口,不等待连接
-monitor ${QEMU_MONITOR_ARG}
)
# 目标平台参数
if(TARGET_ARCH STREQUAL "x86_64")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
list(APPEND QEMU_FLAGS
-m 128M
-net none
-bios ${ovmf_BINARY_DIR}/OVMF_${TARGET_ARCH}.fd
-hda fat:rw:./image/
-m 128M
-net none
-bios ${ovmf_BINARY_DIR}/OVMF_${CMAKE_SYSTEM_PROCESSOR}.fd
-hda fat:rw:./image/
)
elseif(TARGET_ARCH STREQUAL "riscv64")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
list(APPEND QEMU_FLAGS
-machine virt
-nographic
# 可选项,qemu7.0 自带了 opensbi1.0
-bios ${opensbi_BINARY_DIR}/platform/generic/firmware/fw_jump.elf
-kernel $<TARGET_FILE:kernel>
-machine virt
# 可选项,qemu7.0 自带了 opensbi1.0
-bios ${opensbi_BINARY_DIR}/platform/generic/firmware/fw_jump.elf
-kernel $<TARGET_FILE:kernel>
# @todo 暂时还不支持 riscv64 的 uefi 启动
# 预期路线: qemu->uefi->opensbi + kernel(payload)
# -bios ${ovmf_BINARY_DIR}/OVMF_${CMAKE_SYSTEM_PROCESSOR}.fd
# -hda fat:rw:./image/
)
elseif(TARGET_ARCH STREQUAL "aarch64")
# @todo
endif()
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
list(APPEND QEMU_FLAGS
-machine virt
-cpu cortex-a57
-m 128M
-net none
-bios ${ovmf_BINARY_DIR}/OVMF_${CMAKE_SYSTEM_PROCESSOR}.fd
-hda fat:rw:./image/
)
endif ()

# 添加要编译的目录
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(${PROJECT_SOURCE_DIR}/test)
add_subdirectory(${PROJECT_SOURCE_DIR}/doc)

# 添加 run 和 debug target
add_run_target(NAME run
DEPENDS $<$<STREQUAL:${TARGET_ARCH},x86_64>:boot> kernel ${RUN_DEPENDS} ${DEBUG_DEPENDS}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
TARGET ${TARGET_ARCH}
BOOT ${PROJECT_BINARY_DIR}/src/boot/boot.efi
KERNEL $<TARGET_FILE:kernel>
QEMU_FLAGS ${QEMU_FLAGS}
add_run_target(
DEPENDS ovmf $<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},riscv64>:opensbi-fw_jump> $<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},x86_64>:boot> $<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},riscv64>:boot> $<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},aarch64>:boot> kernel
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
TARGET ${CMAKE_SYSTEM_PROCESSOR}
BOOT ${PROJECT_BINARY_DIR}/src/boot/boot.efi
KERNEL $<TARGET_FILE:kernel>
QEMU_FLAGS ${QEMU_FLAGS}
)
Loading
Loading