Comments (9)
How are you linking the code? It looks like you are invoking the linker yourself rather than having rustc invoke it for you. You may be missing necessary linker flags.
from blog_os.
How are you linking the code? It looks like you are invoking the linker yourself rather than having rustc invoke it for you. You may be missing necessary linker flags.
After compiling it in rustc, I'm using the command i686-elf-ld -o tmp/kernel.bin -Ttext 0x1000 tmp/kernel_entry.o tmp/kernel.o --oformat binary
with the compiled .o file being kernel.o, and kernel_entry being an assembly script to import and run _start.
from blog_os.
How did you get that kernel.o
file? If you literally passed --emit obj
, that will not work. That will not include the machine code for dependencies. What you could do however is compile with the staticlib crate type and then link the resulting libkernel.a
. This bundles all dependencies.
from blog_os.
What would the config need to look like in order to do that?
from blog_os.
In Cargo.toml
you can add
[lib]
crate-type = ["staticlib"]
from blog_os.
Recompiling it with that change, as well as changing the file name from main to lib, then copying the .a file from target/i686/debug
, it produced a linking error since it was using a GOT with PIE enabled. When I disabled PIE, the script compiled correctly and linked properly, but running it in qemu gets stuck in a boot loop of flashing the "SeaBIOS" header as well as "Booting from hard disk", then going to a blank screen, then repeating.
from blog_os.
The bootloader crate only supports booting x86_64 kernels, not 32-bit kernels.
from blog_os.
The bootloader crate only supports booting x86_64 kernels, not 32-bit kernels.
I am not using the bootloader crate at all. As I mentioned before, I'm using my own bootloader
from blog_os.
Ah, I missed that! In that case, you probably have to debug your bootloader. You can either connect gdb and step through the assembly to see where it fails, or you use QEMU's -d int
flag to see which exceptions occur where. If course you can also insert endless loops at various stages in your bootloader to narrow down which part causes the crash.
from blog_os.
Related Issues (20)
- Translate support me and Comment? HOT 1
- Where can i see APIC example? HOT 3
- data-layout error when running cargo build HOT 10
- GDB missing in edition 2
- Double Fault in Interrupts post in latest nightly HOT 5
- QEMU booting in endless looping at post-03 HOT 14
- cargo build --target x86_64-blog_os.json error[E0463]: can't find crate for `core` HOT 2
- Edition 3 post-2 build-dependencies problem HOT 4
- How to add USB support? HOT 5
- broken link HOT 2
- Edition 3: Published a new `lazy_heap` crate to streamline new version of heap allocation module HOT 1
- testing failed HOT 4
- question: Book print or `pdf` version? HOT 1
- Edition-3 Post 2 (booting): profiles for the non root package will be ignored
- Edition 3 Post 3: Compiler Error HOT 1
- Edition 3: Post 3: Proposal to change the contents of a certain code snippet
- bootloader seems to generated dead_code warnings HOT 2
- Should I follow edition 2 or 3? HOT 4
- Examples for APIC? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog_os.