# when does system load the harddrive driver



## williamy (Mar 8, 2013)

Hi
I read the handbook for multiple times already. But I am still not clear about how the system find the drivers. After stage2 the process will come to the loader and it will load the kernel. But how can it read the kernel file without the harddisk driver? And I also don't understand where the driver it is. If I need to migrate a system to a new hardware and if the harddisk driver is different then how to replace the driver? In linux there is an initrd.img file. It contains al the things which I want to know. How about FreeBSD? Can someone help to explain this part? Thanks very much! And sorry for the format. I sent this via and handphone


----------



## sossego (Mar 8, 2013)

Have you tried enabling verbose during the process?


----------



## wblock@ (Mar 8, 2013)

See the Handbook: The Booting Problem.

The BIOS loads the bootcode, which loads the kernel.  The disk device drivers are built into the kernel.  Additional drivers can be loaded as modules after that.


----------



## williamy (Mar 8, 2013)

Oh, I see, the disk driver is in the kernel, so If I copy a system into a new hardware machine, at this moment, is that any way to update the disk driver? 

And that also means I need to rebuild the kernel when I want to update the disk driver. Is it correct ?


----------



## throAU (Mar 8, 2013)

williamy said:
			
		

> And that also means I need to rebuild the kernel when I want to update the disk driver. is it correct ?



You will need support for your root disk's controller to be built into the kernel, yes.


----------



## SirDice (Mar 8, 2013)

If you use the GENERIC kernel there's usually no need to rebuild anything. It already contains the most popular drivers.


----------



## williamy (Mar 8, 2013)

How and where to get the support then it is needed?

For example, Now I am installing a machine with A version,(e.g. 9.1 currently it is the latest), And I will continue build some service on it, all the services are not easy to be removed. They are not well designed. So few years later, hardware need to be upgraded. And this FreeBSD will not have the driver for the machine. In this situation, what can I do ?

We can simplify this situation, Say, for example, Now I have a 9.1 and tomorrow, I need upgrade the hard disk , and this hard disk is totally new in this world, that means 9.1 maybe not have the driver for the hard disk.So in this situation , what can we do ?

In Linux we can just replace the ko file, but now I am going to use FreeBSD. And I didn't do any testing on this,So here I want someone come can share with me the experience about how to handle this kind of situation.

Thanks in Advance.


----------



## SirDice (Mar 8, 2013)

A harddisk doesn't require a driver, it's the controller that needs it. And you're going to have very exotic hardware if the controller isn't supported.


----------



## williamy (Mar 8, 2013)

SirDice said:
			
		

> If you use the GENERIC kernel there's usually no need to rebuild anything. It already contains the most popular drivers.



Sorry , I just missed you post.  

Does it mean that FreeBSD usually have all kinds of drivers in the kernel? just like XP. So by default it already can support multi-types of devices. 

So If the device is new for this system, then what can I do? This is my concern. I am trying to understand how FreeBSD boots up. because I already understand how a CentOS boots up.


----------



## SirDice (Mar 8, 2013)

williamy said:
			
		

> Does it mean that FreeBSD usually have all kinds of drivers in the kernel? just like XP. So by default it already can support multi-types of devices.


Yes, have a look at the kernel config for GENERIC:
http://www.freebsd.org/cgi/cvsweb.c...IC?rev=1.568.2.14;only_with_tag=RELENG_9_1_BP



> So If the device is new for this system, then what can I do?


If there's no driver for it, you're screwed. Simple solution? Buy hardware you know is supported.


----------



## williamy (Mar 8, 2013)

Thanks very much,


----------



## wblock@ (Mar 8, 2013)

williamy said:
			
		

> Does it mean that FreeBSD usually have all kinds of drivers in the kernel? just like XP.



XP is custom-tailored for a machine during the install.  FreeBSD is very different, having lots of drivers built into the default kernel.  Moving a FreeBSD installation from one system to another is much, much easier.


----------

