Commit 5cd3c3d3 authored by John Hodge's avatar John Hodge
Browse files

Kernel - Working xargo kernel build (all modules I think)

parent ba22ff94
[package]
name = "main"
version = "0.0.0"
[lib]
path = "main/main.rs"
crate-type = ["staticlib"]
[dependencies]
kernel = { path = "Core" }
syscalls = { path = "Modules/syscalls" }
network = { path = "Modules/network" }
usb-core = { path = "Modules/usb_core" }
fs_fat = { path = "Modules/fs_fat" }
fs_iso9660 = { path = "Modules/fs_iso9660" }
fs_extN = { path = "Modules/fs_extN" }
virtio = { path = "Modules/virtio" }
storage-ata = { path = "Modules/storage_ata" }
storage-ahci = { path = "Modules/storage_ahci" }
input_ps2 = { path = "Modules/input_ps2" }
nic-rtl8139 = { path = "Modules/nic_rtl8139" }
usb-ohci = { path = "Modules/usb_ohci" }
[target.'cfg(target_arch = "x86_64")'.dependencies]
#video-vga = { path = "Modules/video_vga" }
[package]
name = "kernel"
version = "0.0.0"
[lib]
path = "main.rs"
[dependencies]
stack_dst = { path = "../../externals/crates.io/stack_dst", default-features = false }
tag_safe = "0.2"
#
#
#
V ?= @
-include ../common.mk
-include BuildNum.$(ARCH).mk
BUILDNUM ?= 1
OBJDIR := .obj/$(ARCH)/
OBJS := $(addprefix $(OBJDIR),start.ao log_cfg.ao libmain.a)
ENV := RUST_VERSION="$(shell $(RUSTC) --version)"
ENV += TK_GITSPEC="$(shell git log -n 1 | head -n 1 | awk '{print $$2}')"
ENV += TK_VERSION="0.1"
ENV += TK_BUILD="$(shell hostname --fqdn):$(BUILDNUM)"
LINKFLAGS := -T Core/arch/$(ARCH)/link.ld -Map $(OBJDIR)map.txt -g
LINKFLAGS += -z max-page-size=0x1000 # Reduces binary size
LINKFLAGS += --gc-sections # Prevents complaining about floating point methods
#LINKFLAGS += --print-gc-sections
EXCLUDE_FEATURES :=
ifeq ($(ARCH),amd64)
EXCLUDE_FEATURES := 3dnow avx avx2 sse sse2 sse3 sse4.1 sse4.2 mmx
endif
XARGO := RUST_TARGET_PATH=$(abspath targets) $(XARGO)
.PHONY: all dsm PHONY
all: bin/kernel-$(ARCH).bin
dsm: bin/kernel-$(ARCH).bin.dsm
#
# Final linking stage
#
bin/kernel-$(ARCH).bin: $(OBJS) Core/arch/$(ARCH)/link.ld
@mkdir -p bin/
@echo [LD] -o [email protected]
$V$(LD) -o [email protected] $(OBJS) --no-whole-archive $(LINKFLAGS)
ifeq ($(ARCH),amd64)
$Vobjcopy [email protected] --only-keep-debug [email protected]
$Vobjcopy [email protected] -F elf32-i386 [email protected]
$V$(TRIPLE)-strip -g [email protected]
else
#$V$(TRIPLE)-strip [email protected]
endif
@echo "BUILDNUM := $$(( $(BUILDNUM) + 1 ))" > BuildNum.$(ARCH).mk
#
# Disassembly
#
%.dsm: %
@echo "[OBJDUMP] >" $*.dsm
$V$(OBJDUMP) -s -C -S $* > $*.dsm
#
# Invoke xargo to build the main part of the kernel
# - This includes all modules enabled in ./Cargo.toml
#
$(OBJDIR)libmain.a: PHONY targets/target-$(ARCH).json
@echo "[XARGO] . > [email protected]"
$V$(ENV) $(XARGO) rustc --target=target-$(ARCH) --release -- -C target-feature=$(subst $(space),$(comma),$(EXCLUDE_FEATURES:%=-%))
@mkdir -p $(dir [email protected])
@cp target/target-$(ARCH)/release/libmain.a [email protected]
targets/target-$(ARCH).json: Core/arch/$(ARCH)/target.json
@mkdir -p $(dir [email protected])
$Vcp $< [email protected]
$(OBJDIR)%.ao: Core/arch/$(ARCH)/%.asm
@echo [AS] -o [email protected]
@mkdir -p $(dir [email protected])
$Vnasm -o [email protected] $< -f elf64 -MD [email protected] -MP
$(OBJDIR)%.ao: Core/arch/$(ARCH)/%.S
@echo [AS] -o [email protected]
@mkdir -p $(dir [email protected])
$V$(CC) -o [email protected] -c $<
# Log configuration
$(OBJDIR)log_cfg.ao: Core/log_cfg.S
@echo [AS] -o [email protected]
@mkdir -p $(dir [email protected])
$V$(CC) -o [email protected] -c $<
[package]
name = "block_cache"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
[package]
name = "blockcache"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
[package]
name = "fs_extN"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
block_cache = { path = "../block_cache" }
[package]
name = "fs_fat"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
blockcache = { path = "../blockcache" }
block_cache = { path = "../block_cache" }
utf16 = { path = "../utf16" }
[package]
name = "fs_iso9660"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
block_cache = { path = "../block_cache" }
[package]
name = "gui"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
tag_safe = "*"
[package]
name = "input_ps2"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
gui = { path = "../gui" }
[package]
name = "network"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
stack_dst = { path = "../../../externals/crates.io/stack_dst", default-features = false }
shared_map = { path = "../shared_map" }
......@@ -7,7 +7,6 @@
#![feature(linkage)]
#![feature(const_fn)]
#![feature(no_more_cas)] // AtomicUsize::fetch_update
#![feature(crate_in_paths)]
#[cfg(test)] #[macro_use] extern crate /**/ std;
......
[package]
name = "nic-rtl8139"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
network = { path = "../network" }
[package]
name = "shared_map"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
[package]
name = "storage-ahci"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
storage-ata = { path = "../storage_ata" }
storage-scsi = { path = "../storage_scsi" }
[package]
name = "storage-ata"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
storage-scsi = { path = "../storage_scsi" }
[package]
name = "storage-scsi"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
[package]
name = "syscalls"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
stack_dst = { path = "../../../externals/crates.io/stack_dst", default-features = false }
kernel = { path = "../../Core" }
gui = { path = "../gui" }
[package]
name = "usb-core"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
stack_dst = { path = "../../../externals/crates.io/stack_dst", default-features = false }
[package]
name = "usb-ohci"
version = "0.0.0"
[lib]
path = "lib.rs"
[dependencies]
kernel = { path = "../../Core" }
usb-core = { path = "../usb_core" }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment