Subject: Arm-Linux onto a SCSI

From: Hendrik den Hartog <[email-masked]>
Date: Wed, 22 Jul 1998 18:13:28 +1200 (GMT)

Hello...

 I'm after some help with installing ArmLinux via a HardDisc onto a 
 scsi disc. 
 
 Has anyone got any instructions for doing this?
 
 I've installed HardDisc >> IDE Disc OK, so highlighting the
 differences would be enough.
 
 In particular, the instructions I used to install linux to an IDE
 drive had..
 
 'mknod /dev/hda? b 3 3'  
 
 with a formulae for working out the last '2nd' number that went....  
  
 64* ?+Partition Number etc. (then some dire warnings about not 
 getting this mknod command wrong)
   
 What I'd like to know is the 'version' of this for a scsi drive, 
 
 Cheers!
 Hendrik
  
-- 
   Hendrik den Hartog- Pasadena Intermediate School- Auckland- NZ
   (E-Mail)[email-masked] <or> [email-masked]
             (WWW)   http://www.pasadena.school.nz/

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Phil Norman <[email-masked]>
Date: Wed, 22 Jul 1998 10:20:14 +0100 (BST)

OK.  This is a little more long-winded than it needs to be, but I've
written this with the intention (since this subject has, AFAICR, come up
more than once before) that it can be put in the mailing list archive.  It
might be a good idea to follow this up by putting a copy of
linux/Documents/devices.txt on the armlinux ftp/web site so people can
refer to it when working out major/minor numbers etc.

>  What I'd like to know is the 'version' of this for a scsi drive, 

AFAICR, the second of those two numbers is as you say, and the first
number is the number of the device type itself.  A list of these and a
complete guide to working out the numbers (and other bits and pieces) can
be found amongst the linux kernel source, in (assuming you have the kernel
source installed in /usr/src):

/usr/src/linux/Documentation/devices.txt

[looks in said file]

It took me a little while to work out which bits of the file meant what.
So here's a run-down on how to decode the thing.

Firstly, do 'man mknod'.  This tells you you should use mknod like this:

mknod [options] filename {bcu} major minor

We'll ignore options.  'filename' is the device filename which, for (as an
example) partition 3 on your first SCSI disc, will be '/dev/sda3'.  The
major and minor numbers I'll go into later, but the {bcu} bit is either:

b: block (buffered) special file
c: character special file
u: unbuffered character special file

We're not after a character device (that's for things like keyboards and
serial ports where the input/output is in a steady stream).  We're after
type 'b'.

Now all we need is are the major and minor numbers.

If you look down the devices.txt file you'll see a load of entries which
have, on the left hand side, a number followed by 'block', 'char' or maybe
something else too.  The number is the major device number, and the word
describes the kind of device it is (ie 'block' corresponds to 'b' in the
mknod arguments, 'char' to 'c' etc).  Then, for each of these entries,
there's some descriptive text.  This text describes the minor number, and
how to get it.

We need SCSI discs in this case, so search for 'SCSI' in the file.  We now
have a section which describes the kind of numbers you should use to
creating SCSI device inodes.  From this block we can see that:

The number on the right is '8' (the major number) and it is, indeed, a
block device.

You can fit a maximum of 15 partitions per SCSI disc (cf IDE discs which
can take up to 63 partitions).  There is a good reason for this.  You can
only have 4 IDE discs (the minor number then going up to a maximum of 255)
whereas you can have up to 16 SCSI discs (256/16 = 16, therefore 15
partitions (one number is allocated to accessing the entire disc)).

So.  We now know that the letter we need is 'b', the major number is '8'
(yeek - sounds like sesame street!) and we know how to calculate the
minor number.  So here's a few examples:

For partition 3 on the first SCSI disc:

  mknod /dev/sda3 b 8 3

For partition 5 on the second SCSI disc:

  mknod /dev/sdb5 b 8 21

There.  Easy when you know how.  Now I'll expect you to be able to work
out the arguments for mknod for any device you encounter.  Enjoy,

Phil

-- 
strcpy((newstring=(char *)malloc(1+strlen(source)))? newstring :
        (exit(1), 0), source);

Phil Norman, mailing from Oregan Networks.
email:	[email-masked]
URL:	http://newton.ex.ac.uk/general/ug/norman