I think guys you were all right. My bios is really trying to look for a BPB but as I didn't created one, it ends up messing my code..
neon wrote:
Hi,
You got the idea. If the BIOS was indeed modifying the code trying to "correct" a nonexistent BPB you can introduce some initial padding where the BPB would normally go to test it (can be done with the times directive).
So the idea is to add some padding (because the far jump isn't effective). But what's the size of a BPB then ? I've looked at the source code of GRUB2 and saw this :
Code:
.globl _start, start;
_start:
start:
/*
* _start is loaded at 0x7c00 and is jumped to with CS:IP 0:0x7c00
*/
/*
* Beginning of the sector is compatible with the FAT/HPFS BIOS
* parameter block.
*/
jmp LOCAL(after_BPB)
nop /* do I care about this ??? */
#ifdef HYBRID_BOOT
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
jmp LOCAL(after_BPB)
#else
/*
* This space is for the BIOS parameter block!!!! Don't change
* the first jump, nor start the code anywhere but right after
* this area.
*/
.org GRUB_BOOT_MACHINE_BPB_START
.org 4
Is it to prevent the BPB check ? Are the nops just to prevent the strange behavior that I'm having with my computer ?
Also as Octocontrabass said :
Octocontrabass wrote:
Firmware gets picky if you don't have either a MBR with a valid partition table and one active partition, or a FAT VBR with a valid BPB.
Now, for programs like etcher, etc ... It's obvious that it won't work because of the missing BPB but with a MBR, it could technically skip the creation of a BPB. But here is a thing : It does nothing... In fact, I think I'm doing something wrong. I opened gparted, create a MSDOS partition table, create an empty partition and set the "boot" flag to make it active and finally, used dd directly on that partition. Have I done this right ?
neon wrote:
I would be interested to see the resulting image files with just that one change and how you are currently building it.
Well, I used
xxd against the created binary and compared them and strangely it's the same image.