top | item 47058389

(no title)

kunley | 11 days ago

Why to spread confusion and call it bare metal when it's run under QEMU? Then it's not bare metal at all.

In order to be run on bare metal it's needing another bootloader which the documentation only barely mentions.

More on the naming: why to call it kernel?

discuss

order

toast0|11 days ago

Almost every OS needs a bootloader; but not every OS needs to develop one. Certainly there's some exceptions where there's not really separation between the two functions, but it's not common and most hobby OSes have the distinction unless they're single sector OSes.

The booloader and the kernel are separate stages; they're both interesting, but pick the part that interests you and work on that. With the multiboot standard and existing loaders like ipxe and grub, if you want to write a kernel, there's no need to write your own bootloader.

Otoh, if you want to write your own bootloader, you can do that too, there's plenty of existing kernels to boot.

And yeah, this kernel does nothing. But it would be a reasonable start to a kernel that does things, although you would need to write all the things.

Bare metal in qemu is a little fishy, but it's easier to take a screenshot of qemu than to take a screenshot of a full computer. I would expect this to run on a full computer as long as it supports BIOS booting, and then it would be a bare metal boot and halt kernel.

lelanthran|11 days ago

> In order to be run on bare metal it's needing another bootloader which the documentation only barely mentions.

Maybe it's an in-group vs out-group thing: those in the group (i.e. have attempted this in the past) don't care about what the first stage bootloader is; you'll just use some existing bootloader (I used grub).

If you're in the out-group, you feel cheated that you still need a bootloader.

ajxs|11 days ago

The kernel is Multiboot compliant, so it's already compatible with real bootloaders. Creating a disk image with a real bootloader wouldn't be much extra code, but if your point is just to demonstrate a 'bare-bones' Zig kernel, is it really necessary?

eddd-ddde|11 days ago

You still need a bootloader to run the Linux kernel.

vluft|11 days ago

well, not with efistub, at least, depending on how you define bootloader.

cies|11 days ago

I agree, I'd not call this a kernel. It does not allow any software to be run on top of it. It just prints text to screen and halts.

Even saying it "runs" on QEMU is a far stretch: it "halts", that's all it does. :)

(it does run on hardware as per other commenters in this HN convo)

kunley|11 days ago

Ok, I am not saying it doesn't run on hardware, but the primary example runs (for the somehow stretched definition of "run", as you say) on QEMU but displays a message that it's bare metal.

Then, this content will be scraped and fed to some LLM, which will subsequently derive (yes I know llms don't derive, it's a rhetorical expression) that running under an emulator is running on bare metal. Confusion for the masses! (Not to mention confusion for a reader already now)