Merge branch 'master' of https://github.com/wangrunji0408/RustOS into arch-aarch64
commit
28d872064d
@ -1,14 +0,0 @@
|
||||
[[package]]
|
||||
name = "atags"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"volatile 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "volatile"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum volatile 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ca391c55768e479d5c2f8beb40c136df09257292a809ea514e82cfdfc15d00"
|
@ -1,5 +1,59 @@
|
||||
# arch = {riscv32, x86_64, aarch64}
|
||||
arch := riscv32
|
||||
# mode = {debug, release}
|
||||
arch ?= riscv32
|
||||
mode ?= debug
|
||||
|
||||
all:
|
||||
cargo xbuild --target $(arch)-ucore.json
|
||||
rust_src_dir := src/bin
|
||||
rust_bin_path := target/$(arch)-ucore/$(mode)
|
||||
user_rust_bins := $(patsubst $(rust_src_dir)/%.rs, $(rust_bin_path)/%, $(wildcard $(rust_src_dir)/*.rs))
|
||||
c_src_dir :=
|
||||
c_bin_path :=
|
||||
user_c_bins :=
|
||||
user_bins := $(user_rust_bins) $(user_c_bins)
|
||||
|
||||
build_path := build
|
||||
sfsroot := $(build_path)/sfsroot-$(arch)
|
||||
sfsimg := $(build_path)/user-$(arch).img
|
||||
|
||||
mksfs := mksfs
|
||||
|
||||
build_args := --target $(arch)-ucore.json
|
||||
ifeq ($(mode), release)
|
||||
build_args := $(build_args) --release
|
||||
endif
|
||||
|
||||
.PHONY: all clean build-rust build-c build mksfs sfsimg
|
||||
|
||||
all: $(sfsimg)
|
||||
|
||||
build-rust:
|
||||
@echo Building user rust programs
|
||||
@cargo xbuild $(build_args)
|
||||
|
||||
build-c:
|
||||
@echo Building user C programs
|
||||
|
||||
build: build-rust build-c
|
||||
|
||||
$(user_rust_bins): build-rust
|
||||
|
||||
$(user_c_bins): build-c
|
||||
|
||||
mksfs:
|
||||
ifeq ($(shell which $(mksfs)),)
|
||||
@cargo install --git https://github.com/wangrunji0408/SimpleFileSystem-Rust --features="std"
|
||||
endif
|
||||
|
||||
$(sfsroot): $(user_bins)
|
||||
@mkdir -p $@
|
||||
@cp $^ $@/
|
||||
|
||||
$(sfsimg): $(user_bins) $(sfsroot) | mksfs
|
||||
@echo Creating SFS image at $@
|
||||
@$(mksfs) zip $(sfsroot) $@
|
||||
|
||||
sfsimg: $(sfsimg)
|
||||
|
||||
clean:
|
||||
@cargo clean
|
||||
@rm -rf $(build_path)
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* Simple linker script for ucore user-level programs.
|
||||
See the GNU ld 'info' manual ("info ld") to learn the syntax. */
|
||||
|
||||
OUTPUT_ARCH(aarch64)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
/* Load programs at this address: "." means the current address */
|
||||
. = 0xffff000000000000;
|
||||
|
||||
.text : {
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
}
|
||||
|
||||
PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
}
|
||||
|
||||
/* Adjust the address for the data segment to the next page */
|
||||
. = ALIGN(0x1000);
|
||||
|
||||
/* The data segment */
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
|
||||
.sdata : {
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
}
|
||||
|
||||
PROVIDE(edata = .);
|
||||
|
||||
.bss : {
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame .note.GNU-stack .comment)
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/* Simple linker script for ucore user-level programs.
|
||||
See the GNU ld 'info' manual ("info ld") to learn the syntax. */
|
||||
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
/* Load programs at this address: "." means the current address */
|
||||
. = 0x800020;
|
||||
|
||||
.text : {
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
}
|
||||
|
||||
PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
}
|
||||
|
||||
/* Adjust the address for the data segment to the next page */
|
||||
. = ALIGN(0x1000);
|
||||
|
||||
/* The data segment */
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
|
||||
.sdata : {
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
}
|
||||
|
||||
PROVIDE(edata = .);
|
||||
|
||||
.bss : {
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame .note.GNU-stack .comment)
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/* Simple linker script for ucore user-level programs.
|
||||
See the GNU ld 'info' manual ("info ld") to learn the syntax. */
|
||||
|
||||
OUTPUT_ARCH(x86_64)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
/* Load programs at this address: "." means the current address */
|
||||
. = 0x800020;
|
||||
|
||||
.text : {
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
}
|
||||
|
||||
PROVIDE(etext = .); /* Define the 'etext' symbol to this value */
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
}
|
||||
|
||||
/* Adjust the address for the data segment to the next page */
|
||||
. = ALIGN(0x1000);
|
||||
|
||||
/* The data segment */
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
}
|
||||
|
||||
.sdata : {
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
}
|
||||
|
||||
PROVIDE(edata = .);
|
||||
|
||||
.bss : {
|
||||
*(.bss)
|
||||
}
|
||||
|
||||
PROVIDE(end = .);
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame .note.GNU-stack .comment)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue