Error if the root partition exceeds the PDC 2GB limit. The check now

catches invalid "existing" partitions. PR/45742

Thanks to martin for the German translation. The others are all my fault.

Thanks to mrg for comments
This commit is contained in:
skrll 2012-01-09 11:51:41 +00:00
parent 008d551992
commit ccf87b9e24
6 changed files with 39 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.13 2012/01/05 21:32:36 christos Exp $ */
/* $NetBSD: md.c,v 1.14 2012/01/09 11:51:41 skrll Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -50,6 +50,8 @@
#include "msg_defs.h"
#include "menu_defs.h"
#define HP700_PDC_LIMIT ((unsigned)2*1024*1024*1024)
void
md_init(void)
{
@ -108,7 +110,7 @@ md_get_info(void)
/*
* hp700 PDC can only address up to 2GB.
*/
root_limit = ((unsigned)2*1024*1024*1024) / (unsigned)sectorsize;
root_limit = HP700_PDC_LIMIT / (unsigned)sectorsize;
return 1;
}
@ -128,6 +130,23 @@ md_make_bsd_partitions(void)
int
md_check_partitions(void)
{
/* Check the root partition is sane. */
uint32_t limit = HP700_PDC_LIMIT / (unsigned)sectorsize;
int part;
for (part = PART_A; part < MAXPARTITIONS; part++) {
if (strcmp(bsdlabel[part].pi_mount, "/") == 0) {
uint32_t offset = bsdlabel[part].pi_offset;
uint32_t size = bsdlabel[part].pi_size;
if (offset > limit || offset + size > limit) {
msg_display(MSG_md_pdclimit);
process_menu(MENU_ok, NULL);
return 0;
}
}
}
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.de,v 1.5 2011/04/04 08:30:29 mbalmer Exp $ */
/* $NetBSD: msg.md.de,v 1.6 2012/01/09 11:51:41 skrll Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -50,3 +50,6 @@ message dobootblks
message set_kernel_1
{Kernel (GENERIC)}
message md_pdclimit
{Die Root-Partition überschreitet die PDC Grenze von 2GB}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.5 2011/04/04 08:30:29 mbalmer Exp $ */
/* $NetBSD: msg.md.en,v 1.6 2012/01/09 11:51:41 skrll Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -50,3 +50,6 @@ message dobootblks
message set_kernel_1
{Kernel (GENERIC)}
message md_pdclimit
{The root partition extends beyond the PDC limit of 2GB}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.es,v 1.5 2011/04/04 08:30:29 mbalmer Exp $ */
/* $NetBSD: msg.md.es,v 1.6 2012/01/09 11:51:41 skrll Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -50,3 +50,6 @@ message dobootblks
message set_kernel_1
{Kernel (GENERIC)}
message md_pdclimit
{La partición raíz se extiende más allá del límite de 2 GB PDC}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.6 2011/04/04 08:30:29 mbalmer Exp $ */
/* $NetBSD: msg.md.fr,v 1.7 2012/01/09 11:51:41 skrll Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -51,3 +51,5 @@ message dobootblks
message set_kernel_1
{Kernel (GENERIC)}
message md_pdclimit
{La partition racine s'étend au-delà de la limite de 2Go PDC}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.5 2011/04/04 08:30:29 mbalmer Exp $ */
/* $NetBSD: msg.md.pl,v 1.6 2012/01/09 11:51:41 skrll Exp $ */
/* Based on english version: */
/* NetBSD: msg.md.en,v 1.2 2002/12/03 01:54:49 minoura Exp */
@ -53,3 +53,5 @@ message dobootblks
message set_kernel_1
{Kernel (GENERIC)}
message md_pdclimit
{Partycja jest d?u?szy ni? PDC 2GB}