Page 1 of 1

mbr new

Posted: Fri Feb 19, 2016 3:40 pm
by ammar
hi programmer
i am used that code mbr for usb flash emulation hdd
my usb flash 8Gb
i am put that code in first sector
and 63 sector put bootloader
put here problem
that print (Invalid partition table!)
i am used dd here
sudo dd if=/mbr.bin bs=446 count=1 conv=notrunc of/dev/sdb1
sudo dd if=/boot.bin bs=512 conv=notrunc seek=63 of/dev/sdb1
i don't know what problem

Re: mbr new

Posted: Fri Feb 19, 2016 3:48 pm
by swadallail
maybe reason
0x0003DC00 ;Total Sectors in Partition
your have flash 8GB
That's probably an error

Re: mbr new

Posted: Fri Feb 19, 2016 3:52 pm
by BASICFreak
I'm just going to reply with a bunch of links, I want you to read and fully understand.

http://forum.osdev.org/viewtopic.php?f=1&t=16944
http://www.catb.org/~esr/faqs/smart-questions.html
http://wiki.osdev.org/Required_Knowledge
http://wiki.osdev.org/Kernel_Debugging
http://wiki.osdev.org/Bochs
http://wiki.osdev.org/Qemu
http://wiki.osdev.org/GDB

TIP: Single step your code and find exactly what goes wrong and where... (I recommend Bochs myself)

We are not going to debug the code for you; but we will help you, if you help yourself.

But if I were to guess your Segment registers are incorrect.



Best Regards,

B!

Re: mbr new

Posted: Sat Feb 20, 2016 3:05 am
by Combuster
sudo dd if=/mbr.bin bs=446 count=1 conv=notrunc of/dev/sdb1
Please don't post things here that are different from what you really run.

You should also learn the difference between sdb and sdb1

Re: mbr new

Posted: Sat Feb 20, 2016 4:21 am
by Roman
Please learn how to describe your problems in English and stop posting junk.

Re: mbr new

Posted: Sat Feb 20, 2016 5:27 am
by alexfru
Roman wrote:Please learn how to describe your problems in English and stop posting junk.
While it would certainly be great to see problem description in proper English, I'm afraid you might be demanding unrealistically too much from the OP. The OP doesn't know what he doesn't know. It'll take time for him to learn some useful English and various bits of OS dev. I think, until then you have two options: coping with whatever he's capable of writing or ignoring his posts.

Re: mbr new

Posted: Sat Feb 20, 2016 9:49 am
by onlyonemac
Combuster wrote:
sudo dd if=/mbr.bin bs=446 count=1 conv=notrunc of/dev/sdb1
Please don't post things here that are different from what you really run.
How do we know that that's not what he really ran? ;-) Maybe he actually does store his mbr image in the root of his filesystem. :-D

Re: mbr new

Posted: Sun Feb 21, 2016 1:44 pm
by Combuster
I know he probably does. But first and foremost, dd will tell you that command has syntax errors. :wink:

int 13h

Posted: Mon Feb 22, 2016 4:57 am
by swadallail
hi
i am using that code for mbr
i am put that in first sector
ind put bootloader in sector=63
i follow that code part part
the mbr He was able to identifies flash( i am check that by using int 13h and dl=0x81)
but the mbr can't reading the bootloader
give me the error ((Missing Operating System))
note:i am using usb flash memory size 8GB

Re: mbr new

Posted: Mon Feb 22, 2016 5:12 am
by Combuster
I see two accounts posting nearly similar questions from the same /24 subnet. Can you try and stick to one account?

Re: mbr new

Posted: Mon Feb 22, 2016 5:20 am
by swadallail
Sorry
But we are from the same country
There is a difference in the questions
I have a small part in no job code

Re: mbr new

Posted: Mon Feb 22, 2016 3:41 pm
by onlyonemac
Combuster wrote:I know he probably does. But first and foremost, dd will tell you that command has syntax errors. :wink:
I did consider that part - how do we know that dd didn't say the command has syntax errors? ;-) Nevertheless I agree with you - that's probably not the real command that he ran.
Combuster wrote:I see two accounts posting nearly similar questions from the same /24 subnet. Can you try and stick to one account?
I assume that they are different accounts otherwise they wouldn't be replying to each other's threads. I must admit though that I did consider for some time if they were the same user.

Re: mbr new

Posted: Tue Feb 23, 2016 6:46 am
by ~
You need to reformat your Flash with Windows or Linux.
Then you need to save the original MBR.
After that, you need to fill the following values because they are empty (they only contain 0).
You need to fill these values manually with the values of the original MBR or split the binary files and join the header into a new binary file.

Code: Select all

PT2_Status			db 0x00
PT2_First_Head  	db 0x00
PT2_First_Sector	db 0x00
PT2_First_Cylinder	db 0x00
PT2_Part_Type		db 0x00
PT2_Last_Head	  	db 0x00
PT2_Last_Sector		db 0x00
PT2_Last_Cylinder	db 0x00
PT2_First_LBA		dd 0x00000000
PT2_Total_Sectors	dd 0x00000000

PT3_Status			db 0x00
PT3_First_Head  	db 0x00
PT3_First_Sector	db 0x00
PT3_First_Cylinder	db 0x00
PT3_Part_Type		db 0x00
PT3_Last_Head	  	db 0x00
PT3_Last_Sector		db 0x00
PT3_Last_Cylinder	db 0x00
PT3_First_LBA		dd 0x00000000
PT3_Total_Sectors	dd 0x00000000

PT4_Status			db 0x00
PT4_First_Head  	db 0x00
PT4_First_Sector	db 0x00
PT4_First_Cylinder	db 0x00
PT4_Part_Type		db 0x00
PT4_Last_Head	  	db 0x00
PT4_Last_Sector		db 0x00
PT4_Last_Cylinder	db 0x00
PT4_First_LBA		dd 0x00000000
PT4_Total_Sectors	dd 0x00000000