os-tutorial
os-tutorial copied to clipboard
How To Run On A Real PC
I Have Gone through the whole tutorial, and now that i am complete, i want to boot the tutorial on my computer, but i don't know how. I have tried everything from using rufus, to using the windows disk-part utility. Please Help
try balenaEtcher. Also when you are done, tell me if it worked because I am trying to do the same thing and it won't work. However, I think it's just my computer.
Why not just use dd? Safer and easier.
@thecoder08 I tried balena etcher but it didn’t work.
As for the recommendation to use dd, I don’t know how to do that and wish you would further explain how to do that
the tools you are using are fine, you likely have CSM (for legacy BIOS with newer UEFI systems), the problem is because the code doesn't actually work on real hardware. For real hardware, you are probably better off starting with something like GRUB.
@circutrider21 Let's say the image I want to burn is in my current working directory and is called disk.img. Also my flash drive is on /dev/sdb. Then it would be as simple as dd if=disk.img of=/dev/sdb bs=4M
. if
is input file, of
is output file, bs
is block size, which in this case, because no huge amounts of data must be written, 4M is probably fine. You'll probably have to run this as root. And it should be as easy as that.
Thanks for the help
If you have any old computer lying around there is a good chance it will work there.
For me it is just a blinking cursor a few lines down from the top of the screen. I used dd command to just put the os-image.bin to a blank usb and then i have a laptop which has uefi on it and when i try to boot there is just a blinking cursor. Can someone help? (Sorry for the small amount of details. I need to write this quickly.)
If you use EFI it won't boot, you need your EFI to have legacy support or just a regular good old BIOS. As I said previously:
If you have any old computer lying around there is a good chance it will work there.
I have csm enabled (forgot that very crucial detail), but still the same thing.
So there is no way to make this run on a real pc?
Try to translate the os-image to el-torito format before use dd: El-Torito
I tried the commands from here: https://littleosbook.github.io/ at the section "building an iso image" on the os-image.bin with appropriate modifications (os-image instead of kernel.elf in the guide). Now when i type file
Edit: And running file on the el torito formatted file says: "GRand Unified Bootloader stage2 version 3.2, identifier 0x0, GRUB version 0.95, configuration file /boot/grub/menu.lst"
Does your PC use EFI or BIOS? Are you using GRUB? Can you describe your hardware?
I've had the same problem with this tutorial, with CSM on, the code is likely broken due to some bug that only affects certain machines, such as mine. Like I said above, I recommend GRUB2 or qloader2, which loads you into 64-bit mode and you can do more fun things there, you will need a different cross compiler though, so remember that.
It can be a alternative, but it isn't a solve to this specific problem. I think we can do a little more research before change the approach.
True
For example, in the boot sector, the segment registers are never cleared.
That should be done as soon as you get code execution, especially in real mode. Also, setting the stack pointer to 0x7b00 isn't a terrible idea for real mode afaik
I think the problem is before that. I have been reading a few things and el-torito should be our solution. It defines three types of boot: hard disk emulation, floppy emulation and no emulation. I think we can try them all.
Or we can write our boot_sector directly on a hard drive (if anyone has a spare HD).
OK i decided to stop procrastinating and actually do something. So the laptop i am using is an ASUS laptop model number X551MA, it is quite old but but still pretty new. It has UEFI, but i have csm enabled. the laptop arch is x64 and the main os (windows 8) is also 64 bit. the computer has 4 gb of ram. as an usb i use kingston 64 gb usb stick. i doubt that this will help anyone because there is who knows how many laptops out there with slightly different io addresses etc.. Any help again?
Edit: Actually the laptop has windows 8.1 my bad
Found this gem: https://www.youtube.com/watch?v=1rnA6wpF0o4&list=PLHh55M_Kq4OApWScZyPl5HhgsTJS9MZ6M
I think the problem is before that. I have been reading a few things and el-torito should be our solution. It defines three types of boot: hard disk emulation, floppy emulation and no emulation. I think we can try them all.
uh just write a bootsector on a usb drive bruh it should boot fine with CSM, and proper code that actually works on systems that don't clear the segment registers.
@personnumber3377 I have checked out this Playlist And found this tutorial that goes with the playlist I just mentioned. Together those 2 tutorials are better than this one. The best part is, that tutorial works on real hardware👍🎉
I've had the same problem with this tutorial, with CSM on, the code is likely broken due to some bug that only affects certain machines, such as mine. Like I said above, I recommend GRUB2 or qloader2, which loads you into 64-bit mode and you can do more fun things there, you will need a different cross compiler though, so remember that.
Does this mean it is not possible to modify this bootloader to run in 64 bit mode like with [BITS 64]
I've had the same problem with this tutorial, with CSM on, the code is likely broken due to some bug that only affects certain machines, such as mine. Like I said above, I recommend GRUB2 or qloader2, which loads you into 64-bit mode and you can do more fun things there, you will need a different cross compiler though, so remember that.
Does this mean it is not possible to modify this bootloader to run in 64 bit mode like with [BITS 64]
64 bit long mode requires a lot of other important things to run properly, also [bits 64] just tells the assembler to create 64 bit instructions, it doesn't put CPU to 64 bit mode.
@Menotdan I'm glad to see you still do osdev😄
If you have Linux just use dd to put on a drive and boot it on a compatible machine.
@Menotdan I'm glad to see you still do osdev😄
I don't really work on my project anymore I'm just here because I like to help people with stuff