OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:24 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:10 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
I converted my OS .img file to .iso using mkisofs, and flashed it to an USB pendrive using UNeetBootin (because Rufus refused to flash the ISO).
So, I plugged the USB into the computer (the computer is not very old, 5 years old) and nothing. The BIOS does not boot my OS.
Okay, what's next? I tweaked a little bit the BIOS configuration, in order to boot my non-UEFI system.
Now it boots, but...
This is what I get:
Image
Image
(sorry for the bad quality of the pics)
Beautiful. I don't know what is the problem.
Any ideas?


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:21 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Are you using GRUB or a custom bootloader?


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:23 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
Are you using GRUB or a custom bootloader?

Custom one.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:28 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
It could be anything.Is your entire code available? Since it is custom,if you booted with USB and were using Floppy Disk Emulation (FDD) the BIOS may have clobbered some of your code and data by blindly writing drive geometry data into your bootloader. If you are using USB with FDD Emulation I recommend consider putting a BIOS Parameter Block in your boot sector. See this SO answer: https://stackoverflow.com/a/47320115/3857942 . I'm suggesting you do that to eliminate one possibility. Other issues could be not having A20 properly enabled or you relied on a segment register being initialized when on real hardware it may not have been. I haven't seen your kernel, and it is hard to tell how far your code got just by looking at the pattern on the screen.I'm just tossing ideas out there.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:32 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
I found the problem, I was calling an APM function. As spected in an modern APM no longer exists.
Removed that call, and it boots (it prints the "loading" message), but it gets stuck when jumping to protected mode.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:41 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
I remember you now. You posted this APM question on SO: https://stackoverflow.com/questions/546 ... ected-mode . I actually wrote some code for that but never got around to cleaning it up and posting an answer.Think I saw a comment you were potentially looking for another answer - I had assumed one that may have workable code.

As for not getting into protected mode, could be a variety of things. Do you have all your code available to look at? Could also be something to do with how you burned the ISO (a possibility, but not likely).


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sat Feb 16, 2019 11:48 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
I remember you now. You posted this APM question on SO: https://stackoverflow.com/questions/546 ... ected-mode . I actually wrote some code for that but never got around to cleaning it up and posting an answer.Think I saw a comment you were potentially looking for another answer - I had assumed one that may have workable code.

As for not getting into protected mode, could be a variety of things. Do you have all your code available to look at? Could also be something to do with how you burned the ISO (a possibility, but not likely).

Tomorrow I post the code, now it's too late here. :D
Also, maybe is the ISO, who knows.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 8:36 am 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
Here is the source code: GryphusOS

Code:
;call enableAPM
cli ; Disable interrupts
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 08h:proc_mode2

I think that gets stuck in that part of the bootloader (boot2.asm).


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 12:12 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
Tested again, and, now it triple faults.
Awesome... I think that I'm dealing with a buggy BIOS


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 1:57 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Have you tried to print anything out (use print_string to print a message) in boot2.asm as the first thing at label proc_mode before going to protected mode to ensure that it even got that far? I'm wondering if it even loaded the next part from disk.

I'm wondering if you considered dd'ing disk.img directly to the USB device and set your BIOS to boot as USB with floppy drive emulation.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 2:29 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
Have you tried to print anything out (use print_string to print a message) in boot2.asm as the first thing at label proc_mode before going to protected mode to ensure that it even got that far? I'm wondering if it even loaded the next part from disk.

I'm wondering if you considered dd'ing disk.img directly to the USB device and set your BIOS to boot as USB with floppy drive emulation.

Ok, I added a call to print_string like you told me, and magically it booted again, but, it still stuck in real mode, and the print_string call that I added after the proc_mode label, does not get called.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 2:40 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
When I wrote that bootloader code it was specifically for Floppy Disk media. I'm wondering if the way you built the ISO, burned it and then set your BIOS to boot has done something. Possibly you need to change the bootloader code to use int 13h/ah=42h. An enhancement to the code I wrote would be to check if the drive you are reading supports extended disk BIOS functions and use them. If it doesn't it falls back to int 13/ah=2h.

Right now, the process of building the ISO, burning it, and what your BIOS is set to is likely factoring into this. At this point I highly doubt it is a buggy BIOS for this kind of thing. It seems you are using Windows to burn your image? I'd try using Chryscome's DD for Windows to place disk.img onto the USB drive directly and then set the BIOS to boot using Floppy Disk Drive emulation. I wrote a Stackoverflow Article (the second part) that includes instructions on using it: https://stackoverflow.com/a/36052385/3857942 .

In Windows with a console window in Administrator priveleges you could issue a command like:

dd if=disk.img od=<driveletterofUSB>: bs=512

Where driveletterofUSB is the drive letter followed by a colon.Note it doesn't use of= it uses od= which is special to this version of DD for Windows. Once DD'ed you need to safely eject the USB device (right mouse click the USB device icon on the task bar at the bottom) to ensure all the data is properly flushed to the USB device.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 2:57 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
When I wrote that bootloader code it was specifically for Floppy Disk media. I'm wondering if the way you built the ISO, burned it and then set your BIOS to boot has done something. Possibly you need to change the bootloader code to use int 13h/ah=42h. An enhancement to the code I wrote would be to check if the drive you are reading supports extended disk BIOS functions and use them. If it doesn't it falls back to int 13/ah=2h.

Right now, the process of building the ISO, burning it, and what your BIOS is set to is likely factoring into this. At this point I highly doubt it is a buggy BIOS for this kind of thing. It seems you are using Windows to burn your image? I'd try using Chryscome's DD for Windows to place disk.img onto the USB drive directly and then set the BIOS to boot using Floppy Disk Drive emulation. I wrote a Stackoverflow Article (the second part) that includes instructions on using it: https://stackoverflow.com/a/36052385/3857942 .

In Windows with a console window in Administrator priveleges you could issue a command like:

dd if=disk.img od=<driveletterofUSB>: bs=512

Where driveletterofUSB is the drive letter followed by a colon.Note it doesn't use of= it uses od= which is special to this version of DD for Windows. Once DD'ed you need to safely eject the USB device (right mouse click the USB device icon on the task bar at the bottom) to ensure all the data is properly flushed to the USB device.

I get this error from dd (Windows)
Code:
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <[email protected]>
This program is covered by terms of the GPL Version 2.

Device d: is a link to \\?\Device\HarddiskVolume31
\\?\Device\HarddiskVolume31 is a partition on \Device\Harddisk1
0 Error writing file: 5 Acceso denegado
0
1+0 records in
0+0 records out

Using this flags:
Code:
dd if=disk.img od=d: bs=512

Tried using D: and D:\, with no luck...
Ugh, what a bad luck I have! :|
(I'm in Administrator mode)


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 3:05 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Did you heed the notice to use command prompt in with Administrator privileges? A regular user doesn't have the ability to write to the beginning of the device. You can right mouse click the windows COMMAND program and select Run as Administrator


Last edited by MichaelPetch on Sun Feb 17, 2019 3:06 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 3:06 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
Did you heed the notice to use command prompt in with Administrator privileges? A regular user doesn't have the ability to write to the beginning of the device.

Eh, yes. I'm in Administrator mode.


Last edited by deleted8917 on Sun Feb 17, 2019 3:13 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 89 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group