mbr new

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ammar
Posts: 14
Joined: Thu Feb 11, 2016 10:55 am
Libera.chat IRC: ammars6

mbr new

Post 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
Attachments
mbr&boot.rar
(2.93 KiB) Downloaded 21 times
swadallail
Posts: 10
Joined: Tue Feb 09, 2016 4:24 am
Libera.chat IRC: swad-al-lail

Re: mbr new

Post by swadallail »

maybe reason
0x0003DC00 ;Total Sectors in Partition
your have flash 8GB
That's probably an error
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Re: mbr new

Post 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!
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: mbr new

Post 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
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: mbr new

Post by Roman »

Please learn how to describe your problems in English and stop posting junk.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: mbr new

Post 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.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: mbr new

Post 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
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: mbr new

Post by Combuster »

I know he probably does. But first and foremost, dd will tell you that command has syntax errors. :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
swadallail
Posts: 10
Joined: Tue Feb 09, 2016 4:24 am
Libera.chat IRC: swad-al-lail

int 13h

Post 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
Attachments
mb.rar
(4.25 KiB) Downloaded 19 times
Last edited by Combuster on Mon Feb 22, 2016 5:07 am, edited 1 time in total.
Reason: And please use the "reply" button instead of insistently recreating threads
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: mbr new

Post by Combuster »

I see two accounts posting nearly similar questions from the same /24 subnet. Can you try and stick to one account?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
swadallail
Posts: 10
Joined: Tue Feb 09, 2016 4:24 am
Libera.chat IRC: swad-al-lail

Re: mbr new

Post 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
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: mbr new

Post 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.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
~
Member
Member
Posts: 1228
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Re: mbr new

Post 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

Post Reply