Skip to content

Commit

Permalink
fix(boot, Makefile): fix issues with --emit in boot build
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jan 24, 2018
1 parent f19d03d commit 2a8140a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,24 @@ $(wild_isofiles):
$(boot):
@cd boot && RUST_TARGET_PATH="$(shell pwd)/boot" xargo rustc \
--target $(boot_target) \
-- --emit=obj=target/$(boot_target)/debug/boot32.o
# # Place 32-bit bootstrap code into a 64-bit ELF
@x86_64-elf-objcopy -O elf64-x86-64 $(boot_outdir)/debug/boot32.o \
$(boot_outdir)/debug/boot.o
# @x86_64-elf-objcopy --strip-debug -G _start boot/target/boot.o
@cd $(boot_outdir)/debug && ar -crus libboot.a boot.o
-- --crate-type=staticlib
# Place 32-bit bootstrap code into a 64-bit ELF
@x86_64-pc-elf-objcopy -O elf64-x86-64 $(boot_outdir)/debug/libboot32.a \
$(boot_outdir)/debug/libboot.a
@x86_64-pc-elf-objcopy --strip-debug -G _start \
$(boot_outdir)/debug/libboot.a
# @cd $(boot_outdir)/debug && ar -crus libboot.a boot.o

$(release_boot):
@cd boot && RUST_TARGET_PATH="$(shell pwd)/boot" xargo rustc \
--target $(boot_target) \
-- --release \
--emit=obj=target/$(boot_target)release/boot32.o
# # Place 32-bit bootstrap code into a 64-bit ELF
@x86_64-elf-objcopy -O elf64-x86-64 $(boot_outdir)/release/boot32.o $(boot_outdir)/release/boot.o
@x86_64-elf-objcopy --strip-debug -G _start $(boot_outdir)/release/boot.o
@cd $(boot_outdir)/release && ar -crus libboot.a boot.o
--crate-type=staticlib
# Place 32-bit bootstrap code into a 64-bit ELF
@x86_64-pc-elf-objcopy -O elf64-x86-64 $(boot_outdir)/release/libboot32.a \
$(boot_outdir)/release/libboot.a
@x86_64-pc-elf-objcopy --strip-debug -G _start \
$(boot_outdir)/release/libboot.a

$(release_kernel): $(release_boot)
@xargo build --target $(target) --release
Expand Down
8 changes: 4 additions & 4 deletions boot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "boot"
name = "boot32"
version = "0.1.0"
authors = ["Eliza Weisman <[email protected]>"]

# [lib]
# crate-type = ["staticlib"]
[lib]
crate-type = ["staticlib"]

# [[bin]]
# name = "libboot.a"
# name = "libboot32.a"

[features]
default = ["log"]
Expand Down
10 changes: 9 additions & 1 deletion boot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! [OSDev Wiki]: http://wiki.osdev.org/Long_Mode#Long_Mode
//! [blog post]: http://os.phil-opp.com/entering-longmode.html

#![crate_name = "boot"]
#![crate_name = "boot32"]
#![feature(asm)]
#![feature(lang_items)]
#![feature(naked_functions)]
Expand Down Expand Up @@ -257,3 +257,11 @@ pub unsafe extern "C" fn _start() {
asm!("ljmpl $$8, $$long_mode_init");

}

#[cold]
#[lang = "panic_fmt"]
fn panic_fmt() -> ! {
loop {
boot_write(b"panic! panic! panic!");
}
}

0 comments on commit 2a8140a

Please sign in to comment.