> bb_NetBSD E $NetBSD: bb_netbsd,v 1.2 2002/07/10 11:47:45 reinoud Exp $  (( Copyright (c) 1995 Mark Brinicombe 2 All rights reserved < FH Redistribution and use in source and binary forms, with or without PH modification, are permitted provided that the following conditions Z are met: dG 1. Redistributions of source code must retain the above copyright nF notice, this list of conditions and the following disclaimer. xJ 2. Redistributions in binary form must reproduce the above copyright L notice, this list of conditions and the following disclaimer in the M documentation and/or other materials provided with the distribution. N 3. All advertising materials mentioning features or use of this software 4 must display the following acknowledgement: I This product includes software developed by Mark Brinicombe. J 4. The name of the company nor the name of the author may be used to P endorse or promote products derived from this software without specific " prior written permission.  J THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR O IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES M OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. F IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, J INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, K BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS L OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND "H ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ,K OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 6J THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH @ DAMAGE. J T NetBSD kernel project ^ h bb_NetBSD r |> Modifies the filecore bootblock to point to a section of # the disc reserved for NetBSD.   Created : 24/11/94  Last updated : 12/07/95    buf% 512   Get Filesystem type   < "ADFS, ATAFS, IDEFS, SCSI or SCSIFS (A/T/I/S/F) ? ";  filesys% = &DF  (filesys%) S filesys%="A" filesys%="T" filesys%="S" filesys%="I" filesys%="F"  &Ȏ filesys% 0$ "A" : discop$="ADFS_DiscOp" :% "I" : discop$="IDEFS_DiscOp" D% "T" : discop$="ATAFS_DiscOp" N$ "S" : discop$="SCSI_DiscOp" X& "F" : discop$="SCSIFS_DiscOp" b l v Get the drive number   "Drive "d%  ( Read in current filecore bootblock  0ș discop$,, 1, &c00 + (d% << 29), buf%, 512  Dș "OS_File", 10, ".OldBB", &FFD,, buf%, buf%+512 5 "Old boot block saved in .OldBB"  @ Get the byte size of the filecore partition and the number  of bytes per cylinder  size=buf%!&1d0  3clsize=buf%?&1c2 * buf%?&1c1 * (1 << buf%?&1c0)    A bit of info to the user * 41 "Filecore partition size = ";~size;" bytes" > H% Convert the size into cylinders R \'size = (size + clsize - 1) / clsize fsize = (size+0.5) p zD "Filecore partition size = ";size; " cylinders (0-";size-1;")"  ? We should be clever about here and read the real geometry = of the disc so that we know the maximum cylinder number  ? Get the starting cylinder for the NetBSD part of the disc   "NetBSD Starting Cyl "c%  2 Make sure it is after the filecore partition   (c% < size) 2 "Filecore occupies cylinders upto ";size-1 - "Are you sure you mean this value "a$ ' (a$ <> "yes" a$ <> "YES") H "This will allow NetBSD to overwrite part of the ADFS partition" 4 "Are you really sure you mean this value "a$ $' (a$ <> "yes" a$ <> "YES") . 8 B3 "Initialising NetBSD partition offset at ";c% L: "On drive ";d%;", using ";discop$;" to access drive" V2 "Press any key to continue, escape to abort" ` j dummy%= t ~? Modifiy the non-ADFS partition descriptor to describe the * start of the NetBSD part of the disc  5buf%?&1FC = &42 : NetBSD identifier > 8 : high byte of start cylinder  2 Recalculate the filecore boot block checksum  #buf%?&1FF = CheckSum(buf%,511)  ' Write the boot block back to disc  0ș discop$,, 2, &c00 + (d% << 29), buf%, 512     ( 2 CheckSum(addr%, length%) < sum% = 0 F n% = 0 length% - 1 P sum% += addr%?n% Z sum% > 255 d sum% -= 255 n x  = sum%