Can the software be run in an open metal machine?

I'm just wondering if we can run the program on a machine without an operating system?

In addition, I heard that the Linux kernel is written in C, and the kernel starts at boot time, so I'm just wondering how the computer understands the language without first compiling it?

+7
c linux-kernel machine-code
source share
8 answers

From Wikipedia:

When the computer is turned on, it does not have an operating system in ROM or RAM. First, the computer must execute a small program stored in ROM, with the minimum amount of data necessary to access non-volatile devices, from which programs and operating system data are loaded into RAM. A small program that runs this boot sequence in RAM is called a bootloader, bootloader or bootloader. This task is only for a small bootloader - it is loading other data and programs that are then executed from RAM.

The computer can understand the Linux kernel because it has already been compiled and saved (usually) on disk. The bootloader gives the computer enough functionality to load a precompiled kernel into memory.

You will not need to load the entire operating system to run the program on the computer; you can write a bootloader to run the program that you compiled. You will not have access to operating system calls that make life easier for programmers.

+8
source share

In short, yes.

Linux is still a software program in machine code that runs on a bare metal machine. While you can run the program without an operating system, your program will need to implement ALL the code that is used to talk with various hardware on the computer to varying degrees - for example. data output to the display, interpretation of keyboard / mouse / network input, etc. (some of the lowest-level materials are implemented by firmware in computer components, but otherwise your program will need to be implemented). This makes it very time consuming and difficult for you to write something that works completely without an operating system.

+9
source share

The linux kernel can be written in C. It is still compiled for machine code. And it is this machine code that is executed at boot time

You can also write software that starts at boot time. Thus, you can create your own OS or create your own software that can work without the OS directly. Beware, however, that the OS gives you many functions that you have to do yourself. Things like driver support, disk I / O, network stacks, multitasking and memory management, you have to do yourself.

Finally: I don’t think that people really like this if they have to restart their machine in order to run your software. So I would go write for the OS ... it makes life easier for you and the user.

+7
source share

Yes, and this is done today for small microcontrollers with several KB of memory.

The program is usually written in C and compiled on another computer (called cross-compilation), and then loaded as binary data into the controller flash memory.

+7
source share

What is an operating system if not software running on a bare computer? Voodoo Xd

+3
source share

Just look at any game console up to 32-bit. Almost all of them had no boot code, and it just loaded directly from the inserted cartridge.

+1
source share

1st: Of course. You really don't need an operating system to record multiple loops.

You may need some kind of OS support if you want to load or save files or data, control input or output, but this can also be done directly with the BIOS functions: read the key from the keyboard, write to any screen or LED or serial interface . Only if you want to run several programs or deal with interrupts from the outside, conflicting resources or such, then you desperately need an OS.

2nd: The kernel is compiled into machine code, which is executed at boot time. No C at kernel startup. C helps to write only the kernel or any program that should run if in the kernel or "bare metal".

+1
source share

theoretically, you can build a bootloader using a hex editor on another computer.

0
source share

All Articles