Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit794d80a

Browse files
author
Matthew Dillon
committed
kernel - Change legacy MBR partition type from 0xA5 to 0x6C
* Should have done this years ago but finally change the legacy MBR partition type DragonFlyBSD uses from 0xA5 (which was shared with FreeBSD), to something different 0x6C.* Makes it less confusing for Grub.* Does not change EFI boot, which uses 16-byte UUIDs (we already have our own) and does not use 8-bit partition ids.* Boot code and kernel now recognize both 0xA5 and 0x6C. Existing users do *NOT* need to reinstall their boot code.
1 parent2116b62 commit794d80a

File tree

9 files changed

+49
-32
lines changed

9 files changed

+49
-32
lines changed

‎sbin/fdisk/fdisk.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ struct part_type
174174
,{0x63,"ISC UNIX, other System V/386, GNU HURD or Mach"}
175175
,{0x64,"Novell Netware 2.xx"}
176176
,{0x65,"Novell Netware 3.xx"}
177+
,{0x6C,"DragonFlyBSD"}
177178
,{0x70,"DiskSecure Multi-Boot"}
178179
,{0x75,"PCIX"}
179180
,{0x77,"QNX4.x"}
@@ -363,7 +364,7 @@ main(int argc, char *argv[])
363364
read_s0();
364365
reset_boot();
365366
partp= (structdos_partition*) (&mboot.parts[0]);
366-
partp->dp_typ=DOSPTYP_386BSD;
367+
partp->dp_typ=DOSPTYP_DFLYBSD;
367368
partp->dp_flag=ACTIVE;
368369
partp->dp_start=dos_sectors;
369370
if (disksecs-dos_sectors>0xFFFFFFFFU) {
@@ -559,7 +560,7 @@ struct dos_partition *partp = (struct dos_partition *) (&mboot.parts[3]);
559560

560561
init_boot();
561562

562-
partp->dp_typ=DOSPTYP_386BSD;
563+
partp->dp_typ=DOSPTYP_DFLYBSD;
563564
partp->dp_flag=ACTIVE;
564565
start=roundup(start,dos_sectors);
565566
if (start==0)

‎sys/boot/pc32/boot0/boot0.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ tables:
516516
/*
517517
* These values indicate bootable types we know the names of.
518518
*/
519-
.byte0x1,0x6,0x7,0xb,0xc,0xe,0x83
520-
.byte0x9f,0xa5,0xa6,0xa9
519+
.byte0x1,0x6,0x7,0xc,0xe,0x6c,0x83,0x9f
520+
.byte0xa5,0xa6,0xa9
521521

522522
/*
523523
* These are offsets thatmatch the known names aboveand
@@ -529,10 +529,10 @@ tables:
529529
.byte os_dos-.# Windows
530530
.byte os_dos-.# Windows
531531
.byte os_dos-.# Windows
532-
.byteos_dos-.# Windows
532+
.byteos_dfbsd-.# DragonFly (new)
533533
.byte os_linux-.# Linux
534534
.byte os_bsd-.# BSD/OS
535-
.byte os_dfbsd-.# DragonFly/FreeBSD
535+
.byte os_dfbsd-.# DragonFly (old) /FreeBSD
536536
.byte os_bsd-.# OpenBSD
537537
.byte os_bsd-.# NetBSD
538538

‎sys/boot/pc32/boot2/boot1.S

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
.set PRT_OFF,0x1be// Partition offset
5555
.set PRT_NUM,0x4// Partitions
5656
.set PRT_BSD,0xa5// Partition type
57+
.set PRT_DFLY,0x6c// Partition type
5758

5859
// Flag Bits
5960
.set FL_PACKET,0x80// Packet mode
@@ -178,9 +179,11 @@ main:cld// String ops inc
178179
mov$0x1,%cx// Two passes
179180
main.1:mov $BOOT2_LOAD_BUF+PRT_OFF,%si// Partition table
180181
movb$0x1,%dh// Partition
181-
main.2:cmpb $PRT_BSD,0x4(%si)// Our partition type?
182+
main.2:cmpb $PRT_BSD,0x4(%si)// FreeBSD / old DFly
183+
je main.2a
184+
cmpb $PRT_DFLY,0x4(%si)// New DFly
182185
jne main.3// No
183-
jcxz main.5// If second pass
186+
main.2a:jcxz main.5// If second pass
184187
testb$0x80,(%si)// Active?
185188
jnz main.5// Yes
186189
main.3:add$0x10,%si// Next entry
@@ -193,7 +196,6 @@ main.3: add $0x10,%si // Next entry
193196
// If we get here, we didn't find any FreeBSD slices at all, so print an
194197
// error message and die.
195198
//
196-
mov $msg_part,%si// Message
197199
jmp error// Error
198200
//
199201
// Floppies use partition 0 of drive 0.
@@ -299,14 +301,12 @@ nread_alt:
299301
push%cs// Read from
300302
callw xread.1// disk
301303
jnc return// If success, return
302-
mov $msg_read,%si// Otherwise, set the error
303-
// message and fall through to
304-
// the error routine
305-
//
306-
// Print out the error message pointed to by %ds:(%si) followed
307-
// by a prompt, wait for a keypress, and then reboot the machine.
304+
305+
// Print that an error occured (no room to determine which error
306+
// occured) and the prompt. Then wait for a keypress, then reboot the
307+
// machine.
308308
//
309-
error:callw putstr// Display message
309+
error:
310310
mov $prompt,%si// Display
311311
callw putstr// prompt
312312
xorb%ah,%ah// BIOS: Get
@@ -440,9 +440,6 @@ read.6: retw// To caller
440440

441441
// Messages
442442

443-
msg_read:.asciz"Read"
444-
msg_part:.asciz"Boot"
445-
446443
prompt:.asciz" error\r\n"
447444

448445
flags:.byte FLAGS// Flags

‎sys/boot/pc32/boot2/boot2.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ dskprobe(void)
539539
sl=dsk.slice;
540540
if (sl<BASE_SLICE) {
541541
for (i=0;i<NDOSPART;i++)
542-
if (dp[i].dp_typ==DOSPTYP_386BSD&&
542+
if ((dp[i].dp_typ==DOSPTYP_386BSD||
543+
dp[i].dp_typ==DOSPTYP_DFLYBSD)&&
543544
(dp[i].dp_flag&0x80||sl<BASE_SLICE)) {
544545
sl=BASE_SLICE+i;
545546
if (dp[i].dp_flag&0x80||
@@ -552,7 +553,7 @@ dskprobe(void)
552553
if (sl!=WHOLE_DISK_SLICE) {
553554
if (sl!=COMPATIBILITY_SLICE)
554555
dp+=sl-BASE_SLICE;
555-
if (dp->dp_typ!=DOSPTYP_386BSD) {
556+
if (dp->dp_typ!=DOSPTYP_386BSD&&dp->dp_typ!=DOSPTYP_DFLYBSD) {
556557
printf(INVALID_S,"slice");
557558
return-1;
558559
}

‎sys/boot/pc32/libi386/biosdisk.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ bd_print(int verbose)
277277
dptr=&od->od_slicetab[0];
278278

279279
/* Check for a "dedicated" disk */
280-
if (((dptr[3].dp_typ==DOSPTYP_386BSD)||
281-
(dptr[3].dp_typ==DOSPTYP_NETBSD))&&
280+
if ((dptr[3].dp_typ==DOSPTYP_386BSD||
281+
dptr[3].dp_typ==DOSPTYP_NETBSD||
282+
dptr[3].dp_typ==DOSPTYP_DFLYBSD)&&
282283
(dptr[3].dp_start==0)&&
283284
(dptr[3].dp_size==50000)) {
284285
sprintf(line," disk%d",i);
@@ -306,6 +307,7 @@ bd_printslice(struct open_disk *od, struct dos_partition *dp, char *prefix,
306307
charline[80];
307308

308309
switch (dp->dp_typ) {
310+
caseDOSPTYP_DFLYBSD:
309311
caseDOSPTYP_386BSD:
310312
caseDOSPTYP_NETBSD:
311313
/* XXX: possibly add types 0 and 1, as in subr_disk, for gpt magic */
@@ -637,7 +639,8 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
637639
/*
638640
* Check for the historically bogus MBR found on true dedicated disks
639641
*/
640-
if ((dptr[3].dp_typ==DOSPTYP_386BSD)&&
642+
if ((dptr[3].dp_typ==DOSPTYP_386BSD||
643+
dptr[3].dp_typ==DOSPTYP_DFLYBSD)&&
641644
(dptr[3].dp_start==0)&&
642645
(dptr[3].dp_size==50000)) {
643646
sector=0;
@@ -664,10 +667,14 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
664667
DEBUG("slice entry %d at %d, %d sectors",dev->d_kind.biosdisk.slice-1,sector,dptr->dp_size);
665668

666669
/*
667-
* If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition
670+
* If we are looking at a BSD slice, and the partition is < 0,
671+
* assume the 'a' partition
668672
*/
669-
if ((dptr->dp_typ==DOSPTYP_386BSD)&& (dev->d_kind.biosdisk.partition<0))
673+
if ((dptr->dp_typ==DOSPTYP_386BSD||
674+
dptr->dp_typ==DOSPTYP_DFLYBSD)&&
675+
dev->d_kind.biosdisk.partition<0) {
670676
dev->d_kind.biosdisk.partition=0;
677+
}
671678

672679
unsliced:
673680
/*
@@ -878,7 +885,8 @@ bd_bestslice(struct open_disk *od)
878885
dp=&od->od_slicetab[0];
879886
for (i=0;i<od->od_nslices;i++,dp++) {
880887
switch (dp->dp_typ) {
881-
caseDOSPTYP_386BSD:/* FreeBSD */
888+
caseDOSPTYP_DFLYBSD:/* DragonFlyBSD */
889+
caseDOSPTYP_386BSD:/* FreeBSD and old DFlyBSD */
882890
pref=dp->dp_flag&0x80 ?PREF_FBSD_ACT :PREF_FBSD;
883891
break;
884892

‎sys/kern/subr_disk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ disk_probe_slice(struct disk *dp, cdev_t dev, int slice, int reprobe)
290290
}else {
291291
if (sp->ds_type==DOSPTYP_386BSD||/* XXX */
292292
sp->ds_type==DOSPTYP_NETBSD||
293-
sp->ds_type==DOSPTYP_OPENBSD) {
293+
sp->ds_type==DOSPTYP_OPENBSD||
294+
sp->ds_type==DOSPTYP_DFLYBSD) {
294295
log(LOG_WARNING,"%s: cannot find label (%s)\n",
295296
dev->si_name,msg);
296297
}
@@ -453,6 +454,7 @@ disk_probe(struct disk *dp, int reprobe)
453454
if (sp->ds_type==DOSPTYP_386BSD||
454455
sp->ds_type==DOSPTYP_NETBSD||
455456
sp->ds_type==DOSPTYP_OPENBSD||
457+
sp->ds_type==DOSPTYP_DFLYBSD||
456458
sp->ds_type==0||
457459
sp->ds_type==1) {
458460
if (dp->d_slice->dss_first_bsd_slice==0)

‎sys/kern/subr_diskmbr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
6767
{0,0,0,0,0,0,0,0,0,0, },
6868
{0,0,0,0,0,0,0,0,0,0, },
6969
{0,0,0,0,0,0,0,0,0,0, },
70-
{0x80,0,1,0,DOSPTYP_386BSD,255,255,255,0,50000, },
70+
{0x80,0,1,0,DOSPTYP_DFLYBSD,255,255,255,0,50000, },
7171
};
7272
staticstructdos_partitionhistorical_bogus_partition_table_fixed[NDOSPART]= {
7373
{0,0,0,0,0,0,0,0,0,0, },
7474
{0,0,0,0,0,0,0,0,0,0, },
7575
{0,0,0,0,0,0,0,0,0,0, },
76-
{0x80,0,1,0,DOSPTYP_386BSD,254,255,255,0,50000, },
76+
{0x80,0,1,0,DOSPTYP_DFLYBSD,254,255,255,0,50000, },
7777
};
7878

7979
staticintcheck_part (char*sname,structdos_partition*dp,
@@ -205,7 +205,8 @@ mbrinit(cdev_t dev, struct disk_info *info, struct diskslices **sspp)
205205
/*
206206
* TODO:
207207
* Perhaps skip entries with 0 size.
208-
* Perhaps only look at entries of type DOSPTYP_386BSD.
208+
* Perhaps only look at entries of type DOSPTYP_386BSD or
209+
* DOSPTYP_DFLYBSD
209210
*/
210211
max_ncyls=0;
211212
max_nsectors=0;

‎sys/kern/subr_diskslice.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,11 @@ dsreadandsetlabel(cdev_t dev, u_int flags,
778778
lp=ops->op_clone_label(info,sp);
779779
}
780780
if (msg!=NULL) {
781-
if (sp->ds_type==DOSPTYP_386BSD/* XXX */)
781+
if (sp->ds_type==DOSPTYP_386BSD||
782+
sp->ds_type==DOSPTYP_DFLYBSD) {
782783
log(LOG_WARNING,"%s: cannot find label (%s)\n",
783784
sname,msg);
785+
}
784786
if (lp.opaque)
785787
kfree(lp.opaque,M_DEVBUF);
786788
}else {

‎sys/sys/diskmbr.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
#defineDOSMAGICOFFSET510
4848
#defineDOSMAGIC0xAA55
4949

50+
/*
51+
* NOTE: DragonFlyBSD had been using 0xA5 forever but after many years
52+
* we're finally shifting to our own as A5 causes conflicts in grub.
53+
*/
54+
#defineDOSPTYP_DFLYBSD0x6c/* DragonFlyBSD partition type */
5055
#defineDOSPTYP_386BSD0xa5/* 386BSD partition type */
5156
#defineDOSPTYP_OPENBSD0xa6/* OpenBSD partition type */
5257
#defineDOSPTYP_NETBSD0xa9/* NetBSD partition type */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp