From fca180e34056525fa7357c76a65ac3271f1bfb5e Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 17 Aug 2009 17:07:40 -0700 Subject: [PATCH] AMD64 - Move fdisk and nextboot up one level and remove src/sbin/i386. * Move fdisk and nextboot up, remove src/sbin/i386, and conditionalize the build to build it for amd64 as well. Submitted-by: Antonio Huete --- sbin/Makefile | 10 +++++++--- sbin/{i386 => }/fdisk/Makefile | 0 sbin/{i386 => }/fdisk/fdisk.8 | 6 +++--- sbin/{i386 => }/fdisk/fdisk.c | 12 ++++++------ sbin/i386/Makefile | 7 ------- sbin/i386/Makefile.inc | 4 ---- sbin/{i386 => }/nextboot/Makefile | 0 sbin/{i386 => }/nextboot/nextboot.8 | 0 sbin/{i386 => }/nextboot/nextboot.c | 32 ++++++++++++++++---------------- 9 files changed, 32 insertions(+), 39 deletions(-) rename sbin/{i386 => }/fdisk/Makefile (100%) rename sbin/{i386 => }/fdisk/fdisk.8 (98%) rename sbin/{i386 => }/fdisk/fdisk.c (99%) delete mode 100644 sbin/i386/Makefile delete mode 100644 sbin/i386/Makefile.inc rename sbin/{i386 => }/nextboot/Makefile (100%) rename sbin/{i386 => }/nextboot/nextboot.8 (100%) rename sbin/{i386 => }/nextboot/nextboot.c (92%) diff --git a/sbin/Makefile b/sbin/Makefile index dee71cf496..b95bc9b60e 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -98,10 +98,14 @@ SUBDIR+=ipf \ ipnat .endif +.if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == amd64 .if ${MACHINE_ARCH} == i386 -SUBDIR+=kget \ - mount_nwfs \ - mount_smbfs +SUBDIR+=kget +.endif +SUBDIR+=mount_nwfs \ + mount_smbfs \ + fdisk \ + nextboot .endif .if exists(${.CURDIR}/${MACHINE}) diff --git a/sbin/i386/fdisk/Makefile b/sbin/fdisk/Makefile similarity index 100% rename from sbin/i386/fdisk/Makefile rename to sbin/fdisk/Makefile diff --git a/sbin/i386/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8 similarity index 98% rename from sbin/i386/fdisk/fdisk.8 rename to sbin/fdisk/fdisk.8 index 7610c34f16..18e7882ccc 100644 --- a/sbin/i386/fdisk/fdisk.8 +++ b/sbin/fdisk/fdisk.8 @@ -189,19 +189,19 @@ An example follows: Information from DOS bootblock is: The data for partition 1 is: sysid 165,(DragonFly/FreeBSD/NetBSD/386BSD) - start 495, size 380160 (185 Meg), flag 0 + start 495, size 380160 (185 Meg), flag 0 beg: cyl 1/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 2 is: sysid 164,(unknown) - start 378180, size 2475 (1 Meg), flag 0 + start 378180, size 2475 (1 Meg), flag 0 beg: cyl 764/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 3 is: The data for partition 4 is: sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach) - start 380656, size 224234 (109 Meg), flag 80 + start 380656, size 224234 (109 Meg), flag 80 beg: cyl 769/ sector 2/ head 0; end: cyl 197/ sector 33/ head 14 .Ed diff --git a/sbin/i386/fdisk/fdisk.c b/sbin/fdisk/fdisk.c similarity index 99% rename from sbin/i386/fdisk/fdisk.c rename to sbin/fdisk/fdisk.c index 01a7347fbd..1ac38c2cfb 100644 --- a/sbin/i386/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -79,8 +79,8 @@ int64_t disksecs; struct mboot { unsigned char padding[2]; /* force the longs to be long aligned */ - unsigned char *bootinst; /* boot code */ - off_t bootinst_size; + unsigned char *bootinst; /* boot code */ + off_t bootinst_size; struct dos_partition parts[4]; }; struct mboot mboot = {{0}, NULL, 0}; @@ -444,7 +444,7 @@ main(int argc, char *argv[]) } print_s0(-1); if (!t_flag) { - if (ok("Should we write new partition table?")) + if (ok("Should we write new partition table?")) write_s0(); } else @@ -462,7 +462,7 @@ usage(void) { fprintf(stderr, "%s%s", "usage: fdisk [-BCIaistu] [-b bootcode] [-p diskimage] [-1234] [disk]\n", - " fdisk -f configfile [-itv] [disk]\n"); + " fdisk -f configfile [-itv] [disk]\n"); exit(1); } @@ -503,7 +503,7 @@ print_part(int i) printf("sysid %d,(%s)\n", partp->dp_typ, get_type(partp->dp_typ)); printf(" start %lu, size %lu (%qd Meg), flag %x%s\n", (u_long)partp->dp_start, - (u_long)partp->dp_size, + (u_long)partp->dp_size, part_mb, partp->dp_flag, partp->dp_flag == ACTIVE ? " (active)" : ""); @@ -901,7 +901,7 @@ write_s0(void) if (ioctl(fd, DIOCWLABEL, &flag) < 0) warn("ioctl DIOCWLABEL"); #endif - for(sector = 0; sector < mboot.bootinst_size / secsize; sector++) + for(sector = 0; sector < mboot.bootinst_size / secsize; sector++) if (write_disk(sector, &mboot.bootinst[sector * secsize]) == -1) { warn("can't write fdisk partition table"); diff --git a/sbin/i386/Makefile b/sbin/i386/Makefile deleted file mode 100644 index 0165495b0a..0000000000 --- a/sbin/i386/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: src/sbin/i386/Makefile,v 1.9 2000/01/14 16:36:58 peter Exp $ -# $DragonFly: src/sbin/i386/Makefile,v 1.2 2003/06/17 04:27:33 dillon Exp $ - -SUBDIR= fdisk \ - nextboot - -.include diff --git a/sbin/i386/Makefile.inc b/sbin/i386/Makefile.inc deleted file mode 100644 index 410ca4a960..0000000000 --- a/sbin/i386/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: src/sbin/i386/Makefile.inc,v 1.4.2.1 2002/07/17 14:19:29 ru Exp $ -# $DragonFly: src/sbin/i386/Makefile.inc,v 1.2 2003/06/17 04:27:33 dillon Exp $ - -.include "../Makefile.inc" diff --git a/sbin/i386/nextboot/Makefile b/sbin/nextboot/Makefile similarity index 100% rename from sbin/i386/nextboot/Makefile rename to sbin/nextboot/Makefile diff --git a/sbin/i386/nextboot/nextboot.8 b/sbin/nextboot/nextboot.8 similarity index 100% rename from sbin/i386/nextboot/nextboot.8 rename to sbin/nextboot/nextboot.8 diff --git a/sbin/i386/nextboot/nextboot.c b/sbin/nextboot/nextboot.c similarity index 92% rename from sbin/i386/nextboot/nextboot.c rename to sbin/nextboot/nextboot.c index 4e98893b00..f42cfc739f 100644 --- a/sbin/i386/nextboot/nextboot.c +++ b/sbin/nextboot/nextboot.c @@ -63,21 +63,21 @@ main (int argc, char** argv) bflag = 0; while ((ch = getopt(argc, argv, "bde")) != -1) { - switch(ch) { - case 'b': - bflag = 1; - break; - case 'd': - dflag = 1; - break; - case 'e': - eflag = 1; - break; - case '?': - default: - usage(); + switch(ch) { + case 'b': + bflag = 1; + break; + case 'd': + dflag = 1; + break; + case 'e': + eflag = 1; + break; + case '?': + default: + usage(); } - } + } argc -= optind; argv += optind; @@ -156,8 +156,8 @@ main (int argc, char** argv) } if ((!dflag) && (!eflag)) { /******************************************* - * Create a new namesector in ram - */ + * Create a new namesector in ram + */ cp += 4; for ( i = 0 ; i < argc ; i++ ) { *cp++ = 'D'; -- 2.11.4.GIT