Subject: Re: bug#25602: [parted] Problem with msdos mbr creation

From: "Brian C. Lane" <[email-masked]>
Date: Wed, 1 Feb 2017 15:33:52 -0800

On Wed, Feb 01, 2017 at 11:28:03AM +0100, Lukasz Majewski wrote:
> Dear All,
> 
> My parted version is 3.2. OS: Linux GNU Debian 8.6
> 
> For one of my embedded systems (arm based one) I do use parted to create
> bootable SD card.
> 
> parted -s $DRIVE mklabel msdos
> 
> First, I do clean up the first 1MiB of SD card:
> 
> dd if=/dev/zero of=$DRIVE bs=1024 count=1024
> 
> The problem is that parted is generating following code from the very
> beginning of the MBR:
> 
> 00000000  FA B8 00 10  8E D0 BC 00   B0 B8 00 00  8E D8 8E C0
> 00000010  FB BE 00 7C  BF 00 06 B9   00 02 F3 A4  EA 21 06 00
> 00000020  00 BE BE 07  38 04 75 0B   83 C6 10 81  FE FE 07 75
> 00000030  F3 EB 16 B4  02 B0 01 BB   00 7C B2 80  8A 74 01 8B
> 
> 
> What is the purpose of this code? Why is has been put there?
> 
> Such data in this place fools the ROM bootloader and hangs the board.
> 
> Also, fdisk (from util-linux 2.25.2) when is creating "dos" partition
> table is not writing such data.

That's the MBR boot code normally used to boot a BIOS system. If it
causes problems on a non-x86 system you should zero it out (or write the
system bootloader after partitioning).

-- 
Brian C. Lane (PST8PDT)