Home | History | Annotate | Line # | Download | only in amiga
md.c revision 1.5.2.1
      1 /*	$NetBSD: md.c,v 1.5.2.1 2020/10/15 19:36:54 bouyer Exp $ */
      2 
      3 /*
      4  * Copyright 1997 Piermont Information Systems Inc.
      5  * All rights reserved.
      6  *
      7  * Based on code written by Philip A. Nelson for Piermont Information
      8  * Systems Inc.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. The name of Piermont Information Systems Inc. may not be used to endorse
     19  *    or promote products derived from this software without specific prior
     20  *    written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
     23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
     26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     32  * THE POSSIBILITY OF SUCH DAMAGE.
     33  */
     34 
     35 /* md.c -- amiga machine specific routines */
     36 
     37 #include <stdio.h>
     38 #include <util.h>
     39 #include <sys/param.h>
     40 #include <machine/cpu.h>
     41 #include <sys/sysctl.h>
     42 
     43 #include "defs.h"
     44 #include "md.h"
     45 #include "msg_defs.h"
     46 #include "menu_defs.h"
     47 
     48 void
     49 md_init(void)
     50 {
     51 }
     52 
     53 void
     54 md_init_set_status(int flags)
     55 {
     56 	(void)flags;
     57 }
     58 
     59 bool
     60 md_get_info(struct install_partition_desc *install)
     61 {
     62 	return true;
     63 }
     64 
     65 /*
     66  * md back-end code for menu-driven BSD disklabel editor.
     67  */
     68 int
     69 md_make_bsd_partitions(struct install_partition_desc *install)
     70 {
     71 	return 1;
     72 }
     73 
     74 /*
     75  * any additional partition validation
     76  */
     77 bool
     78 md_check_partitions(struct install_partition_desc *install)
     79 {
     80 	return true;
     81 }
     82 
     83 /*
     84  * hook called before writing new disklabel.
     85  */
     86 bool
     87 md_pre_disklabel(struct install_partition_desc *install,
     88     struct disk_partitions *parts)
     89 {
     90 	return false;
     91 }
     92 
     93 /*
     94  * hook called after writing disklabel to new target disk.
     95  */
     96 bool
     97 md_post_disklabel(struct install_partition_desc *install,
     98     struct disk_partitions *parts)
     99 {
    100 	return true;
    101 }
    102 
    103 /*
    104  * hook called after upgrade() or install() has finished setting
    105  * up the target disk but immediately before the user is given the
    106  * ``disks are now set up'' message.
    107  */
    108 int
    109 md_post_newfs(struct install_partition_desc *install)
    110 {
    111 	/* boot blocks ... */
    112 	msg_fmt_display(MSG_dobootblks, "%s", pm->diskdev);
    113 	return run_program(RUN_DISPLAY,
    114 	    "/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", pm->diskdev);
    115 }
    116 
    117 int
    118 md_post_extract(struct install_partition_desc *install)
    119 {
    120 	return 0;
    121 }
    122 
    123 void
    124 md_cleanup_install(struct install_partition_desc *install)
    125 {
    126 #ifndef DEBUG
    127 	enable_rc_conf();
    128 #endif
    129 }
    130 
    131 int
    132 md_pre_update(struct install_partition_desc *install)
    133 {
    134 	return 1;
    135 }
    136 
    137 /* Upgrade support */
    138 int
    139 md_update(struct install_partition_desc *install)
    140 {
    141 	md_post_newfs(install);
    142 	return 1;
    143 }
    144 
    145 int
    146 md_pre_mount(struct install_partition_desc *install, size_t ndx)
    147 {
    148 	return 0;
    149 }
    150 
    151 #ifdef HAVE_GPT
    152 /*
    153  * New GPT partitions have been written, update bootloader or remember
    154  * data untill needed in md_post_newfs
    155  */
    156 bool
    157 md_gpt_post_write(struct disk_partitions *parts, part_id root_id,
    158     bool root_is_new, part_id efi_id, bool efi_is_new)
    159 {
    160 
    161 	return true;
    162 }
    163 #endif
    164 
    165 bool
    166 md_parts_use_wholedisk(struct disk_partitions *parts)
    167 {
    168 	return parts_use_wholedisk(parts, 0, NULL);
    169 }
    170 
    171