Skip to content

Commit

Permalink
diag/: Add Makefile,README here and mbr/
Browse files Browse the repository at this point in the history
  • Loading branch information
geneC committed Mar 10, 2011
1 parent bc7b9f7 commit 0b298f8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions diag/Makefile
@@ -0,0 +1,4 @@
SUBDIRS = mbr

all tidy dist clean spotless install:
set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
4 changes: 4 additions & 0 deletions diag/README
@@ -0,0 +1,4 @@
Diagnostic tools and images to assist with troubleshooting Syslinux-related issues. See README in each directory for more details.

geodsp/ Display geometry/LBA translation as the BIOS detects it.
mbr/ Diagnostic MBRs
45 changes: 45 additions & 0 deletions diag/mbr/Makefile
@@ -0,0 +1,45 @@
## -----------------------------------------------------------------------
##
## Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
## Boston MA 02111-1307, USA; either version 2 of the License, or
## (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

#
# Makefile for MBR
#

topdir = ../..
mbrdir = $(topdir)/mbr
include $(topdir)/MCONFIG.embedded

all: handoff.bin

%.o: %.S
$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<

.PRECIOUS: %.elf
%.elf: %.o $(mbrdir)/mbr.ld
$(LD) $(LDFLAGS) -T $(mbrdir)/mbr.ld -e _start -o $@ $<

%.bin: %.elf $(mbrdir)/checksize.pl
$(OBJCOPY) -O binary $< $@
$(CHMOD) -x $@

mbr_bin.c: mbr.bin

tidy dist:
rm -f *.o *.elf *.lst .*.d

clean: tidy

spotless: clean
rm -f *.bin

-include .*.d
15 changes: 15 additions & 0 deletions diag/mbr/README
@@ -0,0 +1,15 @@
Diagnostic MBR/VBR files

handoff.bin Show the data that the BIOS/MBR hands off to an MBR/VBR.


+++ USAGE +++

Writing out an MBR is straight forward (it is assumed below that /dev/hda is the target raw device and /dev/hda1 is the target partition):

dd bs=440 conv=notrunc count=1 if=mbr.bin of=/dev/hda

Writing a VBR to match Syslinux requires more work as it must have a jump and be offset into the partition:

echo -en "\0353\0130\0220" |dd conv=notrunc bs=1 count=3 of=/dev/hda1
dd conv=notrunc bs=2 count=210 seek=45 if=mbr.bin of=/dev/hda1

0 comments on commit 0b298f8

Please sign in to comment.