OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Sun Feb 17, 2019 6:27 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
I got your file in email thanks. Can you dome one last thing. Retrieve the image from the USB device (a version that doesn't work) with the command:

dd id=d: of=disk2.img bs=1024 count=1440

Where D: is whatever the USB drive for your system is. Then send me a copy of disk2.img .


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

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Okay, I got your disk2.img in email and can see from the image something is not right at all.When I did hexdump -C disk2.img on it I got this:
Code:
00000000  eb 74 90 6d 6b 66 73 2e  66 61 74 00 02 01 01 00  |�t.mkfs.fat.....|
00000010  02 e0 00 40 0b f0 09 00  12 00 02 00 00 00 00 00  |.�.@.�..........|
00000020  00 00 00 00 00 00 29 1a  5a 7e 2d 47 52 59 50 48  |......).Z~-GRYPH|
00000030  55 53 20 20 20 20 46 41  54 31 32 20 20 20 b4 0e  |US    FAT12   �.|
00000040  31 db eb 02 cd 10 ac 84  c0 75 f9 c3 b7 00 b4 02  |1��.�.�.�u�÷.�.|
00000050  cd 10 c3 ba 00 00 b7 00  b4 02 cd 10 b9 d0 07 b7  |�.ú..�.�.�.��.�|
00000060  00 b3 0f b0 20 b4 09 cd  10 c3 b4 0e b7 00 cd 10  |.�.� �.�.ô.�.�.|
00000070  c3 31 c0 cd 16 c3 66 31  c0 8e d8 8e c0 8e d0 66  |�1��.�f1�.�.�.�f|
00000080  89 c4 fc b9 00 01 be 00  7c bf 00 06 f3 a5 ea 93  |.���..�.|�..��.|
00000090  06 00 00 88 16 19 07 bf  80 00 be 35 07 e8 9e ff  |.......�..�5.�.�|
000000a0  be 1a 07 e8 98 ff be 01  00 eb 1a bd 03 00 e8 2d  |�..�.��..�.�..�-|
000000b0  00 8e c7 31 db b0 4f e8  b0 ff b8 01 02 cd 13 72  |..�1۰O���..�.r|
000000c0  0c 83 c7 20 46 81 fe 1c  00 7c e0 eb 3b 30 e4 cd  |..� F.�..|��;0��|
000000d0  13 4d 7d e6 b0 58 e8 91  ff eb df f4 eb fd 50 89  |.M}�X�.������P.|
000000e0  f0 31 d2 f7 36 18 06 88  d1 fe c1 31 d2 f7 36 1a  |�1��6...���1��6.|
000000f0  06 88 d6 8a 16 19 07 88  c5 c0 e4 06 08 e1 58 c3  |..�.....���..�X�|
00000100  e8 6e ff e8 64 ff eb f8  66 bf 80 3c 00 00 66 b9  |�n��d���f�.<..f�|
00000110  ec 04 00 00 f3 ab e9 c3  01 00 53 45 43 54 4f 52  |�...���..SECTOR|
00000120  53 3a 20 4f 20 3d 20 4f  4b 2c 20 58 20 3d 20 42  |S: O = OK, X = B|
00000130  41 44 0a 0d 00 0a 0d 47  72 79 70 68 75 73 20 69  |AD.....Gryphus i|
00000140  73 20 6c 6f 61 64 69 6e  67 2e 20 50 6c 65 61 73  |s loading. Pleas|
00000150  65 20 77 61 69 74 2e 0a  0d 00 00 00 00 00 00 00  |e wait..........|
00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U�|
00000200  00 00 00 ff ff ff 00 00  00 00 00 00 00 00 00 00  |...���..........|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00001400  00 00 00 ff ff ff 00 00  00 00 00 00 00 00 00 00  |...���..........|
00001410  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00002600  42 20 00 49 00 6e 00 66  00 6f 00 0f 00 72 72 00  |B .I.n.f.o...rr.|
00002610  6d 00 61 00 74 00 69 00  6f 00 00 00 6e 00 00 00  |m.a.t.i.o...n...|
00002620  01 53 00 79 00 73 00 74  00 65 00 0f 00 72 6d 00  |.S.y.s.t.e...rm.|
00002630  20 00 56 00 6f 00 6c 00  75 00 00 00 6d 00 65 00  | .V.o.l.u...m.e.|
00002640  53 59 53 54 45 4d 7e 31  20 20 20 16 00 b0 11 a4  |SYSTEM~1   ..�.�|
00002650  51 4e 51 4e 00 00 12 a4  51 4e 02 00 00 00 00 00  |QNQN...�QN......|
00002660  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00004200  2e 20 20 20 20 20 20 20  20 20 20 10 00 b0 11 a4  |.          ..�.�|
00004210  51 4e 51 4e 00 00 12 a4  51 4e 02 00 00 00 00 00  |QNQN...�QN......|
00004220  2e 2e 20 20 20 20 20 20  20 20 20 10 00 b0 11 a4  |..         ..�.�|
00004230  51 4e 51 4e 00 00 12 a4  51 4e 00 00 00 00 00 00  |QNQN...�QN......|
00004240  42 47 00 75 00 69 00 64  00 00 00 0f 00 ff ff ff  |BG.u.i.d.....���|
00004250  ff ff ff ff ff ff ff ff  ff ff 00 00 ff ff ff ff  |����������..����|
00004260  01 49 00 6e 00 64 00 65  00 78 00 0f 00 ff 65 00  |.I.n.d.e.x...�e.|
00004270  72 00 56 00 6f 00 6c 00  75 00 00 00 6d 00 65 00  |r.V.o.l.u...m.e.|
00004280  49 4e 44 45 58 45 7e 31  20 20 20 20 00 b3 11 a4  |INDEXE~1    .�.�|
00004290  51 4e 51 4e 00 00 12 a4  51 4e 03 00 4c 00 00 00  |QNQN...�QN..L...|
000042a0  42 74 00 00 00 ff ff ff  ff ff ff 0f 00 ce ff ff  |Bt...������..���|
000042b0  ff ff ff ff ff ff ff ff  ff ff 00 00 ff ff ff ff  |����������..����|
000042c0  01 57 00 50 00 53 00 65  00 74 00 0f 00 ce 74 00  |.W.P.S.e.t...�t.|
000042d0  69 00 6e 00 67 00 73 00  2e 00 00 00 64 00 61 00  |i.n.g.s.....d.a.|
000042e0  57 50 53 45 54 54 7e 31  44 41 54 20 00 61 6e ac  |WPSETT~1DAT .an�|
000042f0  51 4e 51 4e 00 00 70 ac  51 4e 04 00 0c 00 00 00  |QNQN..p�QN......|
00004300  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00004400  7b 00 30 00 46 00 36 00  35 00 45 00 30 00 43 00  |{.0.F.6.5.E.0.C.|
00004410  42 00 2d 00 35 00 35 00  36 00 41 00 2d 00 34 00  |B.-.5.5.6.A.-.4.|
00004420  30 00 34 00 41 00 2d 00  42 00 36 00 38 00 38 00  |0.4.A.-.B.6.8.8.|
00004430  2d 00 41 00 43 00 32 00  34 00 43 00 30 00 41 00  |-.A.C.2.4.C.0.A.|
00004440  41 00 32 00 33 00 32 00  39 00 7d 00 00 00 00 00  |A.2.3.2.9.}.....|
00004450  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00004600  0c 00 00 00 39 5c cc ca  8c 0e 95 6e 00 00 00 00  |....9\��...n....|
00004610  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00168000
None of the code and data from the second sector 0x200 (and after) is there at all. It looks like a formatted disk (with some files on it) where only the boot sector was replaced. The output of disk.img hexdump -C disk.img looks correct.


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

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

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
Any idea why gets truncated to 512B?
Is weird...


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

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Have no idea. Have you tried a different USB stick? Do you know if that disk was modified with DD or WIN32DISK?


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

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
Have no idea. Have you tried a different USB stick? Do you know if that disk was modified with DD or WIN32DISK?

Doing some tests, the disk was modified with dd. Win32Disk does not truncate the file as dd.
But (again...) triple faults. That means that actually the disk file is correctly writed. and... that is there an issue in my code. Maybe I can fix that by myself.
Mystery solved. Thanks! :D


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

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
What command did you use to write with DD? I'm just curious at this point.


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

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
What command did you use to write with DD? I'm just curious at this point.

dd if=disk.img od=d: bs=512
That command is that I used to write disk.img to the USB.
I think that I found the error. #-o


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

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
In the future if you have a chance I wonder if this works:

dd if=disk.img od=d:

Would be odd if one did and the other didn't. One should have written 2880 512-byte sectors and this one will try to write it in one go.

If you think you found your code problem, great.


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

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
In the future if you have a chance I wonder if this works:

dd if=disk.img od=d:

Would be odd if one did and the other didn't. One should have written 2880 512-byte sectors and this one will try to write it in one go.

If you think you found your code problem, great.

I found the problem.
The problem was my paging initialization function, removed it, and boots correctly!, but I have no paging now. :(
Anyway, fixed problem. I will try to fix my paging implementation.
Thanks


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

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
Looking at your paging code you are getting close to the EBDA (extended BIOS Data area) that sits just below 0xA0000. You start one of the page tables at 0x9D000. You should make sure that the EBDA doesn't sit in that area. On most (not all) the EBDA is usually 1KiB, but it can be larger (and often is on some modern hardware). You can read the 16-bit word value at memory address 0x040e (in the BDA in lower memory) and then shift that value left by 4. That will be the base address where the EBDA starts. You want to make sure you are not clobbering that area. Generally though people build a system map of usable RAM with http://www.ctyme.com/intr/rb-1741.htm (int 15h/ax=0e820h) while in real mode but reading 0x040e while in protected mode is a quick hack to determine where the EBDA is.


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

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
Looking at your paging code you are getting close to the EBDA (extended BIOS Data area) that sits just below 0xA0000. You start one of the page tables at 0x9D000. You should make sure that the EBDA doesn't sit in that area. On most (not all) the EBDA is usually 1KiB, but it can be larger (and often is on some modern hardware). You can read the 16-bit word value at memory address 0x040e (in the BDA in lower memory) and then shift that value left by 4. That will be the base address where the EBDA starts. You want to make sure you are not clobbering that area. Generally though people build a system map of usable RAM with http://www.ctyme.com/intr/rb-1741.htm (int 15h/ax=0e820h) while in real mode but reading 0x040e while in protected mode is a quick hack to determine where the EBDA is.


I think that is better to build a system map of usable RAM as you said. I want that my OS can boot on most x86 systems.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Mon Feb 18, 2019 2:27 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
Is better if I make my own multiboot or I just move to GRUB and use GRUB mutiboot? I'm not very good at assembly.


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Mon Feb 18, 2019 2:39 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
I'd move away from custom bootloaders and use GRUB/multiboot if you are not well versed in assembly. You will still need to understand some assembly to do certain kernel related tasks


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Mon Feb 18, 2019 2:42 pm 
Offline
Member
Member

Joined: Wed Dec 12, 2018 12:16 pm
Posts: 119
MichaelPetch wrote:
I'd move away from custom bootloaders and use GRUB/multiboot if you are not well versed in assembly. You will still need to understand some assembly to do certain kernel related tasks

Sad to hear that, but I agree, since it will be easier for me to do the multiboot.
Is there any guide to start using GRUB as bootloader?


Top
 Profile  
 
 Post subject: Re: My OS does not boot in real hardware
PostPosted: Mon Feb 18, 2019 3:07 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
You might want to start with the OSDEv Bare Bones tutorial


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 76 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