Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Add NOPARTMAN compile-time option, which dr...



details:   https://anonhg.NetBSD.org/src/rev/4edc4fb2e600
branches:  trunk
changeset: 993611:4edc4fb2e600
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Sep 20 12:27:42 2018 +0000

description:
Add NOPARTMAN compile-time option, which drops extended partitioning
support provided by partman.c. It reduces, e.g., about 30KB for
crunched binary in atari install floppy.

OK christos

diffstat:

 usr.sbin/sysinst/Makefile.inc |   13 ++-
 usr.sbin/sysinst/defs.h       |   16 +++-
 usr.sbin/sysinst/install.c    |    6 +-
 usr.sbin/sysinst/main.c       |   10 ++-
 usr.sbin/sysinst/menus.mi     |  149 +++----------------------------------
 usr.sbin/sysinst/menus.pm     |  167 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 214 insertions(+), 147 deletions(-)

diffs (truncated from 519 to 300 lines):

diff -r 1101e99b5979 -r 4edc4fb2e600 usr.sbin/sysinst/Makefile.inc
--- a/usr.sbin/sysinst/Makefile.inc     Thu Sep 20 10:03:31 2018 +0000
+++ b/usr.sbin/sysinst/Makefile.inc     Thu Sep 20 12:27:42 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.12 2018/09/16 09:15:12 martin Exp $
+#      $NetBSD: Makefile.inc,v 1.13 2018/09/20 12:27:42 rin Exp $
 #
 # Makefile for sysinst
 
@@ -13,18 +13,22 @@
 
 SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \
        txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
-       label.c target.c md.c sizemultname.c configmenu.c checkrc.c partman.c
+       label.c target.c md.c sizemultname.c configmenu.c checkrc.c
 
 SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
 SRCS+= ${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/}
 SRCS+= ${CPPFLAGS:M-DWSKBD:S/-DWSKBD/wskbd.c/}
 SRCS+= ${NODISKLABEL:D:Ubsddisklabel.c savenewlabel.c}
+SRCS+= ${NOPARTMAN:D:Upartman.c}
 
 DPSRCS+= defs.h
 
 SYSINSTLANG?=  en
 LANGUAGES?=    de en es fr pl
 
+MENUS_MI=      menus.mi
+MENUS_MI+=     ${NOPARTMAN:D:Umenus.pm}
+
 MSG_MD?=       msg.md.${SYSINSTLANG}
 MENUS_MD?=     menus.md.${SYSINSTLANG}
 
@@ -48,7 +52,8 @@
 CPPFLAGS+=     -I. -I${.CURDIR}/../.. -I${.CURDIR} \
                -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
                -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
-               ${NODISKLABEL:D-DNO_DISKLABEL}
+               ${NODISKLABEL:D-DNO_DISKLABEL} \
+               ${NOPARTMAN:D-DNO_PARTMAN}
 
 .if defined(NETBSD_OFFICIAL_RELEASE) && ${NETBSD_OFFICIAL_RELEASE} == "yes"
 CPPFLAGS+= -DSYSINST_FTP_HOST=\"ftp.NetBSD.org\" -DNETBSD_OFFICIAL_RELEASE
@@ -168,7 +173,7 @@
        ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
        ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" > ${.TARGET}
 
-menus.def: menus.mi ${MENUS_MD} msgtouch
+menus.def: ${MENUS_MI} ${MENUS_MD} msgtouch
        ${_MKTARGET_CREATE}
        ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
        ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
diff -r 1101e99b5979 -r 4edc4fb2e600 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Thu Sep 20 10:03:31 2018 +0000
+++ b/usr.sbin/sysinst/defs.h   Thu Sep 20 12:27:42 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.18 2018/09/16 09:15:12 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.19 2018/09/20 12:27:42 rin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -613,9 +613,16 @@
 int    target_mounted(void);
 
 /* from partman.c */
+#ifndef NO_PARTMAN
 int partman(void);
+int pm_getrefdev(pm_devs_t *);
+void update_wedges(const char *);
+#else
+static inline int partman(void) { return -1; }
+static inline int pm_getrefdev(pm_devs_t *x __unused) { return -1; }
+#define update_wedges(x) __nothing
+#endif
 int pm_partusage(pm_devs_t *, int, int);
-int pm_getrefdev(pm_devs_t *);
 void pm_setfstype(pm_devs_t *, int, int);
 int pm_editpart(int);
 void pm_rename(pm_devs_t *);
@@ -626,13 +633,16 @@
 int pm_gpt_convert(pm_devs_t *);
 void pm_wedges_fill(pm_devs_t *);
 void pm_make_bsd_partitions(pm_devs_t *);
-void update_wedges(const char *);
 
 /* flags whether to offer the respective options (depending on helper
    programs available on install media */
 int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
 /* initialize above variables */
+#ifndef NO_PARTMAN
 void check_available_binaries(void);
+#else
+#define check_available_binaries() __nothing
+#endif
 
 /* from bsddisklabel.c */
 int    make_bsd_partitions(void);
diff -r 1101e99b5979 -r 4edc4fb2e600 usr.sbin/sysinst/install.c
--- a/usr.sbin/sysinst/install.c        Thu Sep 20 10:03:31 2018 +0000
+++ b/usr.sbin/sysinst/install.c        Thu Sep 20 12:27:42 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: install.c,v 1.4 2015/05/10 10:14:02 martin Exp $       */
+/*     $NetBSD: install.c,v 1.5 2018/09/20 12:27:42 rin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -47,7 +47,11 @@
 {
        int find_disks_ret;
        int retcode = 0;
+#ifndef NO_PARTMAN
        partman_go = -1;
+#else
+       partman_go = 0;
+#endif
 
 #ifndef DEBUG
        msg_display(MSG_installusure);
diff -r 1101e99b5979 -r 4edc4fb2e600 usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Thu Sep 20 10:03:31 2018 +0000
+++ b/usr.sbin/sysinst/main.c   Thu Sep 20 12:27:42 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.9 2018/09/12 13:44:05 martin Exp $  */
+/*     $NetBSD: main.c,v 1.10 2018/09/20 12:27:42 rin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -179,7 +179,11 @@
        }
 
        /* argv processing */
-       while ((ch = getopt(argc, argv, "Dr:f:C:p")) != -1)
+       while ((ch = getopt(argc, argv, "Dr:f:C:"
+#ifndef NO_PARTMAN
+           "p"
+#endif
+           )) != -1)
                switch(ch) {
                case 'D':       /* set to get past certain errors in testing */
                        debug = 1;
@@ -196,10 +200,12 @@
                        /* Define colors */
                        sscanf(optarg, "%u:%u", &clr_arg.bg, &clr_arg.fg);
                        break;
+#ifndef NO_PARTMAN
                case 'p':
                        /* Partition tool */
                        partman_go = 1;
                        break;
+#endif
                case '?':
                default:
                        usage();
diff -r 1101e99b5979 -r 4edc4fb2e600 usr.sbin/sysinst/menus.mi
--- a/usr.sbin/sysinst/menus.mi Thu Sep 20 10:03:31 2018 +0000
+++ b/usr.sbin/sysinst/menus.mi Thu Sep 20 12:27:42 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menus.mi,v 1.14 2018/09/11 08:05:18 martin Exp $       */
+/*     $NetBSD: menus.mi,v 1.15 2018/09/20 12:27:42 rin Exp $  */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@
        }
 }
 
+#ifndef NO_PARTMAN
 static void
 remove_menu_option(int menuID, const char *option)
 {
@@ -101,6 +102,7 @@
                }
        }
 }
+#endif
 
 void
 remove_color_options()
@@ -113,6 +115,7 @@
        remove_sub_menu(MENU_colors);
 }
 
+#ifndef NO_PARTMAN
 void
 remove_raid_options()
 {
@@ -152,6 +155,7 @@
        remove_menu_option(MENU_pmdiskentry, MSG_encrypt);
        remove_menu_option(MENU_pmpartentry, MSG_encrypt);
 }
+#endif
 
 }
 
@@ -271,7 +275,13 @@
                        network_up = 0;
                        config_network();
                };
-       option MSG_Partition_a_disk, action { partman_go = 1; partman(); };
+       option MSG_Partition_a_disk,
+               action {
+#ifndef NO_PARTMAN
+                       partman_go = 1;
+                       partman();
+#endif
+               };
        option MSG_Logging_functions, action { do_logging(); };
        option MSG_Color_scheme, sub menu colors;
        option MSG_Halt_the_system, exit,
@@ -622,138 +632,3 @@
        option "/bin/sh",  exit, action { ushell = "/bin/sh";}; 
        option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
        option "/bin/csh", exit, action { ushell = "/bin/csh";};
-
-
-menu pmdiskentry, x=50, y=5, exit, default exit;
-       option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
-       option MSG_editmbr,             exit, action { md_get_info();
-                                                                                       md_pre_disklabel();
-                                                                                       memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
-       option MSG_switchgpt,   exit, action { if (pm_gpt_convert(pm) == 0)
-                                                                                               pm_partusage(pm, -1, 1); };
-       option MSG_renamedisk,  exit, action { pm->unsaved = 1; pm_rename(pm); };
-       option MSG_fmtasraid,   exit, action { pm->unsaved = 1;
-                                                                                       pm_partusage(pm, -1, 1);
-                                                                                       layoutkind = LY_NEWRAID;
-                                                                                       md_make_bsd_partitions();};
-       option MSG_fmtaslvm,    exit, action { pm->unsaved = 1;
-                                                                                       pm_partusage(pm, -1, 1);
-                                                                                       layoutkind = LY_NEWLVM;
-                                                                                       md_make_bsd_partitions(); };
-       option MSG_encrypt,             exit, action { pm->unsaved = 1;
-                                                                                       pm_partusage(pm, -1, 1);
-                                                                                       layoutkind = LY_NEWCGD;
-                                                                                       md_make_bsd_partitions();
-                                                                                       pm_cgd_edit(0, &(part_entry_t)
-                                                                                               {.dev_ptr = pm, .dev_num = PART_E}
-                                                                                       ); };
-       option MSG_setbootable, exit, action { pm->unsaved = 1;
-                                                                                       pm->bootable = !pm->bootable; };
-       option MSG_erase,               next menu shred_modes;
-       option MSG_undo,                exit, action { label_read(); pm->unsaved = 0;
-                                                                                       pm_partusage(pm, -1, 1); };
-       option MSG_unconfig,    exit, action { if (pm_unconfigure(pm) == 0)
-                                                                                               pm_partusage(pm, -1, 1); };
-
-menu pmpartentry, x=50, y=5, exit, default exit;
-       option MSG_edit,                exit, action { 
-                                                                       pm->unsaved = 1;
-                                                                       int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
-                                                                       int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
-                                                                       pm_editpart(*(int*)arg);
-                                                                       if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
-                                                                               tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
-                                                                               /* Oops, partition type changed */
-                                                                               pm_partusage(pm, *(int*)arg, 1);
-                                                               };
-       option MSG_fmtasraid,   exit, action {
-                                                                       if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
-                                                                               return -1;
-                                                                       }
-                                                                       pm->unsaved = 1;
-                                                                       pm_partusage(pm, *(int*)arg, 1);
-                                                                       pm_setfstype(pm, *(int*)arg, FS_RAID);
-                                                               };
-       option MSG_fmtaslvm,    exit, action {
-                                                                       if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
-                                                                               return -1;
-                                                                       }
-                                                                       pm->unsaved = 1;
-                                                                       pm_partusage(pm, *(int*)arg, 1);
-                                                                       pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
-                                                                   pm->bsdlabel[*(int*)arg].lvmpv = 1;
-                                                               };
-       option MSG_encrypt,             exit, action {
-                                                                       if (pm->gpt || pm->isspecial) {
-                                                                               process_menu(MENU_ok, __UNCONST(MSG_notsupported));
-                                                                               return -1;
-                                                                       }
-                                                                       pm->unsaved = 1;
-                                                                       pm_partusage(pm, *(int*)arg, 1);
-                                                                       pm_setfstype(pm, *(int*)arg, FS_CGD);
-                                                                       pm_cgd_edit(0,
-                                                                               &(part_entry_t){.dev_ptr = pm,
-                                                                                                               .dev_num = *(int*)arg});
-                                                               };
-       option MSG_erase,               next menu shred_modes;
-       option MSG_doumount,    exit, action { pm_umount(pm, *(int*)arg); };
-       option MSG_Delete_partition,    exit, action {
-                                                                       pm->unsaved = 1;
-                                                                       pm_partusage(pm, *(int*)arg, 1);
-                                                                       if (pm->isspecial)
-                                                                               pm_unconfigure(pm);
-                                                                       else
-                                                                               pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
-                                                                       };
-
-menu pmgptentry, x=50, y=8, exit, default exit;



Home | Main Index | Thread Index | Old Index