I am trying to write a multi stage boot loader using NASM and gcc.
For this purpose I am referring grub boot loader source.
I have written a stage1 loader, but stuck at over writing partition
tables of MBR.
In grub stage1.S, they are using code like this to skip partition tables:
. = _start + STAGE1_PARTEND
.word STAGE1_SIGNATURE
How can I do that in NASM?.
using times it will over write the partition tables.
So please help me.
(see this page).
Thus, the code you pasted is changing the current origin to
_start + STAGE1_PARTENDand placing a word with the valueSTAGE1_SIGNATUREthere.So in NASM code you should be able to do something like:
Also see this example in the NASM manual showing how to pad a BIOS boot sector this way, as a replacement for MASM-style
orgor GAS-style. = new_positionactually seeking and filling with padding in a flat binary output file.