install.md revision 1.4
1# $NetBSD: install.md,v 1.4 2017/11/25 09:41:45 tsutsui Exp $ 2# 3# 4# Copyright (c) 1996 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Jason R. Thorpe. 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# 19# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29# POSSIBILITY OF SUCH DAMAGE. 30# 31 32# 33# machine dependent section of installation/upgrade script. 34# 35 36VERSION= # filled in automatically (see list) 37export VERSION 38 39md_set_term() { 40 if [ ! -z "$TERM" ]; then 41 return 42 fi 43 echo -n "Specify terminal type [vt220]: " 44 getresp "vt220" 45 TERM="$resp" 46 export TERM 47} 48 49__mount_kernfs() { 50 # Make sure kernfs is mounted. 51 if [ ! -d /kern -o ! -e /kern/msgbuf ]; then 52 mkdir /kern > /dev/null 2>&1 53 /sbin/mount_kernfs /kern /kern 54 fi 55} 56 57md_makerootwritable() { 58 # Mount root rw for convenience of the tester ;-) 59 if [ ! -e /tmp/.root_writable ]; then 60 __mount_kernfs 61 mount -u /kern/rootdev / 62 cp /dev/null /tmp/.root_writable 63 fi 64} 65 66md_get_diskdevs() { 67 # return available disk devices 68 __mount_kernfs 69 sed -n -e '/^sd[0-9] /s/ .*//p' \ 70 -e '/^wd[0-9] /s/ .*//p' \ 71 < /kern/msgbuf | sort -u 72} 73 74md_prep_disklabel() 75{ 76 # $1 is the root disk 77 # Note that the first part of this function is just a *very* verbose 78 # version of md_label_disk(). 79 80 cat << \__md_prep_disklabel_1 81You now have to prepare your root disk for the installation of NetBSD. This 82is further referred to as 'labeling' a disk. 83 84First you get the chance to edit or create an AHDI compatible partitioning on 85the installation disk. Note that NetBSD can do without AHDI partitions, 86check the documentation. 87If you want to use an AHDI compatible partitioning, you have to assign some 88partitions to NetBSD before NetBSD is able to use the disk. Change the 'id' 89of all partitions you want to use for NetBSD filesystems to 'NBD'. Change 90the 'id' of the partition you wish to use for swap to 'SWP'. 91 92Hit the <return> key when you have read this... 93__md_prep_disklabel_1 94 getresp "" 95 ahdilabel /dev/r${1}c 96 97 # display example 98 cat << \__md_prep_disklabel_3 99Here is an example of what the partition information will look like once 100you have entered the disklabel editor. Disk partition sizes and offsets 101are in sector (most likely 512 bytes) units. 102 103[Example] 104partition start (c/t/s) nblks (c/t/s) type 105 106 a (root) 0 (0/00/00) 31392 (109/00/00) 4.2BSD 107 b (swap) 31392 (109/00/00) 73440 (255/00/00) swap 108 c (disk) 0 (0/00/00) 1070496 (3717/00/00) unused 109 d (user) 104832 (364/00/00) 30528 (106/00/00) 4.2BSD 110 e (user) 135360 (470/00/00) 40896 (142/00/00) 4.2BSD 111 f (user) 176256 (612/00/00) 92160 (320/00/00) 4.2BSD 112 g (user) 268416 (932/00/00) 802080 (2785/00/00) 4.2BSD 113 114[End of example] 115 116Hit the <return> key when you have read this... 117 118__md_prep_disklabel_3 119 getresp "" 120 edlabel /dev/r${1}c 121 122 cat << \__md_prep_disklabel_4 123 124You will now be given the opportunity to place disklabels on any additional 125disks on your system. 126__md_prep_disklabel_4 127 128 _DKDEVS=`rmel ${1} ${_DKDEVS}` 129 resp="X" # force at least one iteration 130 while [ "X$resp" != X"done" ]; do 131 labelmoredisks 132 done 133} 134 135md_labeldisk() { 136 edahdi /dev/r${1}c < /dev/null > /dev/null 2>&1 137 [ $? -eq 0 ] && edahdi /dev/r${1}c 138 edlabel /dev/r${1}c 139} 140 141md_welcome_banner() { 142 echo "" 143 echo "Welcome to the NetBSD/atari ${VERSION} preparation program." 144 cat << \__welcome_banner_1 145 146This program is designed to partition your disk in preparation of the 147NetBSD installation. At this stage, the only thing you _must_ setup 148is a swap partition. If you wish, the remaining partitioning work might 149be delayed until the actual installation. 150 151As with anything which modifies your disk's contents, this 152program can cause SIGNIFICANT data loss, and you are advised 153to make sure your data is backed up before beginning the 154preparation process. 155 156Default answers are displayed in brackets after the questions. 157You can hit Control-C at any time to quit, but if you do so at a 158prompt, you may have to hit return. 159__welcome_banner_1 160} 161 162md_not_going_to_install() { 163 cat << \__not_going_to_install_1 164 165OK, then. Enter `halt' at the prompt to halt the machine. Once the 166machine has halted, power-cycle the system to load new boot code. 167 168Note: If you wish to have another try. Just type '^D' at the prompt. After 169 a moment, the program will restart itself. 170 171__not_going_to_install_1 172} 173 174md_congrats() { 175 cat << __congratulations_1 176 177CONGRATULATIONS! You have successfully partitioned your disks! 178Now you can use file2swap.ttp to transfer the install.fs to your 179swap partition and continue the installation. 180Enter halt at the command prompt. Once the system has halted, reset the 181machine and re-boot it. 182 183Note: If you wish to have another try. Just type '^D' at the prompt. After 184 a moment, the installer will restart itself. 185 186__congratulations_1 187} 188