A Minimal Rust Kernel (zh-CN) #1019
Replies: 38 comments 42 replies
-
|
抱歉有一个疑问、文章中"设置默认目标"的一节、最后直接使用的命令是否应该是、
|
Beta Was this translation helpful? Give feedback.
-
|
cc @Rustin-Liu @luojia65 Maybe you can help here? (I don't speak Chinese) |
Beta Was this translation helpful? Give feedback.
-
|
是的,应该 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
@luojia65 Thanks a lot for translating! Seems like this was fixed in #794. |
Beta Was this translation helpful? Give feedback.
-
|
似乎已经修好了,感谢。我的repo里也得改改(回头验证一下 |
Beta Was this translation helpful? Give feedback.
-
|
使用cargo bootimage 命令时候,需要在Cargo.toml中配置使用xbuild进行编译。如下: |
Beta Was this translation helpful? Give feedback.
-
|
when i use |
Beta Was this translation helpful? Give feedback.
-
|
@curtainp Looks like you somehow depend on the standard library. Did you set the |
Beta Was this translation helpful? Give feedback.
-
|
yes, and all step follow the blog, // no_std attribute disable automatic include std
#![no_std]
// disable runtime entry
#![no_main]with nightly version rust installed |
Beta Was this translation helpful? Give feedback.
-
|
Do you have your code online somewhere so that I can take a look? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
You need to compile your code for the custom target. The command |
Beta Was this translation helpful? Give feedback.
-
|
yeah,i get it, thanks a lot |
Beta Was this translation helpful? Give feedback.
-
|
failed to run "cargo bootimage" |
Beta Was this translation helpful? Give feedback.
-
|
cargo install bootimage |
Beta Was this translation helpful? Give feedback.
-
|
This error occurs when I run with the |
Beta Was this translation helpful? Give feedback.
-
|
在mac上无法运行,也没有任何报错,同一个bin文件,Windows 10没有问题。 |
Beta Was this translation helpful? Give feedback.
-
|
请问怎么使用纯命令行执行qemu-system-x86_64 -drive format=raw,file=target/x86_64-blog_os/debug/bootimage-blog_os.bin里面的helloworld打印? 我使用nohup 和 -nographic , nohup.out 只会有bootstage,如何把qenu的东西定向出来? |
Beta Was this translation helpful? Give feedback.
-
|
I got an error when I run with ^cargo xbuild --target x86.....json$,I can't complie rust-std-workspace-core v1.99.0,and the error message said "multiple candidate for tmeta depandency core found". |
Beta Was this translation helpful? Give feedback.
-
|
My friends made too many mistakes. I guarantee that I didn’t miss any step. Even the previous step json was still successful until cargo install bootimageand I stalled erro: % cargo bootimage --target x86_64-blog_os.json
error: data-layout for target `x86_64-bootloader-15639772412341111525`, `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128`, differs from LLVM target's `x86_64-unknown-none-gnu` default layout, `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128`
error: could not compile `rustc-std-workspace-core` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `core` (lib) due to 1 previous error
error: could not compile `compiler_builtins` (lib) due to 1 previous error
Error: Bootloader build failed.
Stderr: |
Beta Was this translation helpful? Give feedback.
-
|
qemu-system-x86_64 -drive format=raw,file=target/x86_64-blog_os/debug |
Beta Was this translation helpful? Give feedback.
-
|
cargo bootimage build error PS C:\Code\Rust\os-guide\blog_os> cargo bootimage "C:\Develop\rust.cargo" is my CARGO_HOME |
Beta Was this translation helpful? Give feedback.
-
|
This error occurs when I run with the cargo bootimage,I didn't find a similar one in previous review, can you help me see what the reason is? To build for the target system either pass a error: failed to copy Cargo.lock from |
Beta Was this translation helpful? Give feedback.
-
|
请参考
https://os.phil-opp.com/zh-CN/minimal-rust-kernel/
清歌与
***@***.***
…---Original---
From: ***@***.***>
Date: Thu, Mar 6, 2025 17:30 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [phil-opp/blog_os] A Minimal Rust Kernel (zh-CN) (Discussion#1019)
我用了然后变成这样了
Error: Failed to read bootimage configuration: unexpected package.metadata.bootimage key build-command with value ["xbuild"]
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Windows平台上项目目录不要太长,否则编译过程中链接器(rust-lld)会报错: 我原来的目录就是因为太长所以报错,直接把项目目录剪切桌面上就好了,文件目录里有空格和特殊字符(我用了英文 ’ 字符),目前没有什么问题。 用VS code可能会在main.rs中 #![no_std] 那一行提示 can't find crate for test ,但只要你自己确定创建包的时候时bin而不是lib (默认不加参数是bin),就不用管这个报错,不影响编译。 |
Beta Was this translation helpful? Give feedback.
-
|
在windows中运行cargo install bootimage 时发生错误: Some errors have detailed explanations: E0405, E0412, E0425, E0432, E0433, E0463, E0531. 在项目的Cargo.toml里添加 [dependencies] 仍无助于解决问题。 |
Beta Was this translation helpful? Give feedback.
-
|
Has anyone encountered the following errors when run command: cargo bootimage I resolved by modify the file of ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.31/x86_64-bootloader.json. My rustc version: rustc 1.90.0-nightly (498ae9fed 2025-07-28) |
Beta Was this translation helpful? Give feedback.
-
|
Cargo.toml 中的 “bootloader = "0.9"” 要改成 bootloader = "=0.9.32"(固定版本)或者选择不高于0.9.33的版本,但也要固定版本,因为0.9.33不兼容本程序了; |
Beta Was this translation helpful? Give feedback.
-
分享一下我的环境配置,希望能帮到你们.系统: win10 , msys2环境配置将路径 sed -i "s#https\?://mirror.msys2.org/#https://mirrors.tuna.tsinghua.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*
pacman -Syu安装qemu pacman -S mingw-w64-ucrt-x86_64-qemurust 环境配置安装llvm-tools rustup component add llvm-tools-x86_64-pc-windows-msvc 推荐使用cargo-binstall安装bootimage, 直接安装预编译的二进制文件. cargo binstall bootimage |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a general purpose comment thread for the “A Minimal Rust Kernel (zh-CN)” post.
Please note that I (@phil-opp) do not speak Chinese, so please comment in English if possible.
Beta Was this translation helpful? Give feedback.
All reactions