Return to BSD News archive
Newsgroups: comp.unix.bsd.freebsd.misc Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!csn!boulder.openware.com!imp From: imp@boulder.parcplace.com (Warner Losh) Subject: Re: How to make wd1 default boot drive??? Message-ID: <D5I8ws.L60@boulder.openware.com> Sender: news@boulder.openware.com Organization: Openware Boulder References: <3jsrsq$h0e@acmey.gatech.edu> <flipk.794988215@soclab.soc.iastate.edu> Date: Wed, 15 Mar 1995 23:22:03 GMT Lines: 57 In article <flipk.794988215@soclab.soc.iastate.edu>, Phil Knaack <flipk@iastate.edu> wrote: >In <3jsrsq$h0e@acmey.gatech.edu> > ccastco@prism.gatech.edu (Costas Malamas) writes: > >> part = unit = 0; >> maj = (drive&0x80 ? 0 : 2); /* a good first bet */ >> name = names[currname++]; > >I think you want to change the maj, instead. It is checking to see >if it should boot from a hard disk or a floppy (major number 0 or 2). >As for which is 0 and which is 2, I don't remember. For now I have >modified my boot blocks in this same manner, except that I have >written the boot blocks to a floppy that I pop in when I want it to >boot to bsd (i.e., most all of the time). ;) > >I don't remember exactly but I think the unit number corresponds to the >partition number in the disklabel, i.e., wd0a or wd0e or wd1a, so changing >unit to 1 as in your modifications are probably trying to make it boot >from your swap partition on wd1b .. I don't actually think that works. :) From what I recall when hacking the boot blocks, I don't think this is accurate. You want to change the unit number to be (drive &0x0f) for most bioses. That will tell you what you are booting off of. The Maj is the partion number, and should almost always be 0. The test in the code is to tell the difference between a floppy boot (where the high bit isn't set) and a non-floppy boot, where the bit is set. For floppies, we want the 'c' partion, and for non-floppies, you'd want the 'a' partition. I've used part = 0; unit = drive & 0xf; maj = (drive&0x80 ? 0 : 2); /* a good first bet */ name = names[currname++]; in my boot blocks from around FreeBSD 1.0 gamma through 1.1R. At this point I changed my freebsd disk from the second disk to the first one and have since not applied the patch. I don't know if 1.1.5R or 2.0R will work with this, but I suspect that they will. drive turns out to be dx or dh from the initial bios bootstrap, which in most bioses tells you the bios device that has been booted from. There are some, evidentally, that don't do this, so the patch I submitted was rejected on those grounds :-(. Anyway, have fun. I'm unable to check this out right now, but you'll know if you got it right when the default boot looks something like wd1a/kernel rather than wd0a/kernel. A printf of drive in the boot blocks will tell you exactly what is going on, and how to hack it. Warner -- Warner Losh imp@boulder.openware.com Openware Boulder "... but I can't promote you to "Prima Donna" unless you demonstrate a few more serious personality disorders"