public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/9] disk/part: check bootable flag for DOS partitions
Date: Thu, 23 Aug 2012 16:31:43 -0500	[thread overview]
Message-ID: <1345757510-6756-3-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1345757510-6756-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Determine which partitions are bootable/active. In the partition listing,
print "Boot" for partitions with the bootable/active flag set.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 disk/part_dos.c |   11 +++++++++--
 include/part.h  |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index a43dd9c..24ac00c 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -60,14 +60,20 @@ static inline int is_extended(int part_type)
 	    part_type == 0x85);
 }
 
+static inline int is_bootable(dos_partition_t *p)
+{
+	return p->boot_ind == 0x80;
+}
+
 static void print_one_part (dos_partition_t *p, int ext_part_sector, int part_num)
 {
 	int lba_start = ext_part_sector + le32_to_int (p->start4);
 	int lba_size  = le32_to_int (p->size4);
 
-	printf ("%5d\t\t%10d\t%10d\t%2x%s\n",
+	printf("%5d\t\t%10d\t%10d\t%2x%s%s\n",
 		part_num, lba_start, lba_size, p->sys_ind,
-		(is_extended (p->sys_ind) ? " Extd" : ""));
+		(is_extended(p->sys_ind) ? " Extd" : ""),
+		(is_bootable(p) ? " Boot" : ""));
 }
 
 static int test_block_type(unsigned char *buffer)
@@ -222,6 +228,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
 			}
 			/* sprintf(info->type, "%d, pt->sys_ind); */
 			sprintf ((char *)info->type, "U-Boot");
+			info->bootable = is_bootable(pt);
 			return 0;
 		}
 
diff --git a/include/part.h b/include/part.h
index e1478f4..447f69d 100644
--- a/include/part.h
+++ b/include/part.h
@@ -93,6 +93,7 @@ typedef struct disk_partition {
 	ulong	blksz;		/* block size in bytes			*/
 	uchar	name[32];	/* partition name			*/
 	uchar	type[32];	/* string type description		*/
+	int	bootable;	/* Active/Bootable flag is set		*/
 } disk_partition_t;
 
 /* Misc _get_dev functions */
-- 
1.7.9.5

  parent reply	other threads:[~2012-08-23 21:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 21:31 [U-Boot] [PATCH 0/9] Auto partition selection and fs partition consolidation Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 1/9] combine block device load commands into common function Rob Herring
2012-09-05 23:36   ` Tom Rini
2012-09-05 23:47     ` Rob Herring
2012-09-05 23:50       ` Tom Rini
2012-09-21 14:02   ` [U-Boot] [PATCH v2 " Rob Herring
2012-09-25 23:17     ` Tom Rini
2012-08-23 21:31 ` Rob Herring [this message]
2012-08-23 21:31 ` [U-Boot] [PATCH 3/9] disk/part: introduce get_device_and_partition Rob Herring
2012-08-23 22:36   ` Stephen Warren
2012-08-24  1:57     ` Rob Herring
2012-08-24  2:51       ` Stephen Warren
2012-09-05 23:53         ` Tom Rini
2012-09-21 14:08   ` [U-Boot] [PATCH v2 " Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 4/9] ext4: remove init_fs/deinit_fs Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 5/9] cmd_extX: use common get_device_and_partition function Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 6/9] cmd_fat: " Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 7/9] cmd_disk: " Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 8/9] cmd_zfs: " Rob Herring
2012-08-23 21:31 ` [U-Boot] [PATCH 9/9] cmd_reiser: " Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345757510-6756-3-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox