Move assembly into the arch directory
This commit is contained in:
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
Experimenting with operating system development.
|
||||
|
||||
- Programming language: [Elna](https://git.caraus.tech/belka/elna).
|
||||
- Architecture: RISC-V 32-bit.
|
||||
- Target machine: Qemu.
|
||||
|
||||
This repository contains some rake (ruby's task runner) tasks to build
|
||||
a cross compiler and the code. Assuming that all dependencies needed to build
|
||||
GCC are installed in the system the build is tested on Linux an MacOS.
|
||||
|
||||
To build the cross compiler do:
|
||||
|
||||
```sh
|
||||
rake cross
|
||||
```
|
||||
|
||||
To build and run the rest in qemu:
|
||||
|
||||
```sh
|
||||
rake
|
||||
```
|
17
Rakefile
17
Rakefile
@@ -324,14 +324,19 @@ def relative_from_tmp(path)
|
||||
Pathname.new(path).relative_path_from(TMP).each_filename
|
||||
end
|
||||
|
||||
def architecture_instruction_set(architecture)
|
||||
architecture.gsub /[[:digit:]]+$/, ''
|
||||
end
|
||||
|
||||
CLEAN.include(TMP + 'riscv32')
|
||||
directory(TMP + 'riscv32')
|
||||
|
||||
rule '.s.o' => ->(match) {
|
||||
architecture, *path_components = relative_from_tmp(match).to_a
|
||||
path_components[-1] = path_components.last.ext('')
|
||||
instruction_set = architecture_instruction_set architecture
|
||||
|
||||
[File.join(path_components), TMP + architecture]
|
||||
[File.join('arch', instruction_set, path_components), TMP + architecture]
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
@@ -356,9 +361,15 @@ rule '.elna.o' => ->(match) {
|
||||
end
|
||||
|
||||
rule 'kernel.elf' => ->(match) {
|
||||
architecture_tmp = TMP + relative_from_tmp(match).first
|
||||
architecture = relative_from_tmp(match).first
|
||||
instruction_set = architecture_instruction_set architecture
|
||||
|
||||
FileList['*.s', '*.elna'].map { |source| (architecture_tmp + source).to_path + '.o' } << 'kernel.ld'
|
||||
arch_objects = FileList["arch/#{instruction_set}/*.s"]
|
||||
.map { |source| Pathname.new(source).relative_path_from("arch/#{instruction_set}").sub_ext('.s.o') }
|
||||
.map { |source| TMP + architecture + source }
|
||||
.map(&:to_path)
|
||||
|
||||
arch_objects + FileList['*.elna'].map { |source| (TMP + architecture + source).to_path + '.o' } << 'kernel.ld'
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
|
Reference in New Issue
Block a user