Skip to content

bin file does not exist #109

Open
Open

Description

@erayerdin

Hello, I've been following A Minimal Rust Kernel tutorial. I am on Creating a Bootimage section. The problem is, even though build finishes successfully, .bin file does not exist. Here's build stdout:

WARNING: `CARGO_MANIFEST_DIR` env variable not set
Building kernel
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
Building bootloader
    Finished `release` profile [optimized + debuginfo] target(s) in 0.07s
Created bootimage for `cernel` at `/var/home/erayerdin/Projects/cernel/target/x86_64-cernel/debug/bootimage-cernel.bin`

I do ls target/x86-64_cernel/debug/, which does not show any bin file at all.

Just in case if it is needed, here are some configurations:

# Cargo.toml
[package]
name = "cernel"
version = "0.1.0"
edition = "2024"

[dependencies]
bootloader = "0.9"

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

[[bin]]
name = "cernel"
test = false
bench = false
# .cargo/config.toml

[unstable]
json-target-spec = true
build-std = ["core", "compiler_builtins"]
build-std-features = ["compiler-builtins-mem"]

[build]
target = "x86_64-cernel.json"
// x86_64-cernel.json
{
  "llvm-target": "x86_64-unknown-none",
  "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
  "arch": "x86_64",
  "target-endian": "little",
  "target-pointer-width": 64,
  "target-c-int-width": 32,
  "os": "none",
  "executables": true,
  "linker-flavor": "ld.lld",
  "linker": "rust-lld",
  "panic-strategy": "abort",
  "disable-redzone": true,
  "features": "-mmx,-sse,+soft-float",
  "rustc-abi": "x86-softfloat"
}
# rust-toolchain.toml
[toolchain]
channel = "nightly"

Activity

  1. Freax13 commented on Mar 17, 2026

    @Freax13
    Member

    I cannot reproduce this.

    I used your files and the following src/main.rs file:

    // src/main.rs
    
    #![no_std] // don't link the Rust standard library
    #![no_main] // disable all Rust-level entry points
    
    use core::panic::PanicInfo;
    
    /// This function is called on panic.
    #[panic_handler]
    fn panic(_info: &PanicInfo) -> ! {
        loop {}
    }
    
    #[unsafe(no_mangle)] // don't mangle the name of this function
    pub extern "C" fn _start() -> ! {
        // this function is the entry point, since the linker looks for a function
        // named `_start` by default
        loop {}
    }

    Log:

    [nix-shell:~/code/cernel]$ cargo bootimage
    WARNING: `CARGO_MANIFEST_DIR` env variable not set
    Building kernel
       Compiling compiler_builtins v0.1.160 (/home/freax13/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
       Compiling bootloader v0.9.34
       Compiling core v0.0.0 (/home/freax13/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Compiling cernel v0.1.0 (/home/freax13/code/cernel)
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 8.60s
    Building bootloader
       Compiling compiler_builtins v0.1.160 (/home/freax13/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins)
       Compiling core v0.0.0 (/home/freax13/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
       Compiling serde v1.0.116
       Compiling bitflags v1.2.1
       Compiling llvm-tools v0.1.1
       Compiling x86_64 v0.14.7
       Compiling toml v0.5.6
       Compiling bootloader v0.9.34 (/home/freax13/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.34)
       Compiling bit_field v0.10.1
       Compiling volatile v0.4.4
       Compiling zero v0.1.2
       Compiling fixedvec v0.2.4
       Compiling rlibc v1.0.0
       Compiling usize_conversions v0.2.0
       Compiling xmas-elf v0.6.2
        Finished `release` profile [optimized + debuginfo] target(s) in 10.79s
    Created bootimage for `cernel` at `/home/freax13/code/cernel/target/x86_64-cernel/debug/bootimage-cernel.bin`
    
    [nix-shell:~/code/cernel]$ ls target/x86_64-cernel/debug/
    bootimage-cernel.bin  build  cernel  cernel.d  deps  examples  incremental
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions