help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions about bootstrap code on MBR


From: Shantanu Shekhar
Subject: Questions about bootstrap code on MBR
Date: Wed, 28 Sep 2016 15:13:31 +0000 (UTC)

I am trying to understand the boot process a little better. If this email is 
not appropriate for this thread then my apologies in advance. I got the first 
512 bytes of my bootable device and I tried a hexdump to see its contents. I 
have one solid state drive (and no other bootable device) with an MBR. Its 
parted output looks as shown below:
Model: ATA SAMSUNG SSD PM83 (scsi)Disk /dev/sda: 128GBSector size 
(logical/physical): 512B/512BPartition Table: msdos
Number  Start   End     Size    Type      File system     Flags 1      1049kB  
316MB   315MB   primary   ntfs            boot 2      317MB   84.8GB  84.5GB  
primary 3      84.8GB  128GB   43.2GB  extended 5      84.8GB  120GB   34.7GB  
logical   ext4 6      120GB   128GB   8488MB  logical   linux-swap(v1)
I have following questions/confusions arising from it:
(1) Is the bootstrap code, that sits between bytes 0x0 and 0x1BD of the MBR, a 
part of GRUB?  (2) Is it correct to say that in order to locate the active 
partition the bootstrap code inspects the 7th bit of the 1st byte of each 
partition entry in the partition table? Below is a hexdump from bytes 
(1B0-1FF). Based on MBR documentation the first partition entry starts at 1BE 
and goes on for 16 bytes. So the first byte for my partitions are 0x0d, 0x70, 
0x43, and 0x72. None of these bytes have a 7th bit of 1. How does the bootstrap 
code figure out which partition Grub lives on?
000001b0  47 52 20 69 73 20 6d 69  73 73 69 6e 67 00 0d 0a  000001c0  42 4f   
4f 54 4d 47 52 20  69 73 20 63  6f 6d 70 72  000001d0  65 73 73 65 64 00 0d 0a  
50 72 65 73 73 20 43 74  000001e0  72 6c 2b 41 6c 74 2b 44  65 6c  20 74  6f 20 
72 65  000001f0   73 74 61 72 74 0d 0a 00  8c a9 be d6 00 00 55 aa   

reply via email to

[Prev in Thread] Current Thread [Next in Thread]