NavigationUser loginSpam?See spam posts on this site? If so, please don't reply to the spam! Instead, just report the URL to the webmaster. |
Linux detect/read/write from a sata driveI am trying to verify an AHCI HBA that is built using the Amirix/FPGA board. The Amirix AP1000 board is sitting on the PCI bus of the PC. There is no SATA drive attached to the AHCI HBA, but a collection of SRAM(onchip) is to be treated as sectors of data on a real disk. The goal is to have the SATA drive recognized and accessed using Linux. I am new to Linux, so I am not sure how to do that, I will really appreciate if someone can give me some hints/guidelines/pointers/advices/etc. Currently, I am running Debian Etch with kernel 2.6.25.2, which already has AHCI module. Since my AHCI HBA is not fully implemented/only has few features/using ABAR=2 (instead of 5)/etc, so I need to modify the AHCI driver code to match what I have implemented/modification in the implementation. I did some online searching… 1. modify the AHCI driver mknod /dev/xxx b major# minor# However, I don’t really know what major or minor # that I should use? 4. Do I need to mount the SATA drive? If yes, how do I do that…just use the “mount” command 5. read/write to the SATA drive. I only know the ”echo”, is that the right way to write/read from the SATA drive? My project is due really SOON, please HELP. Thanks for helping in advance! |
Re: Linux detect/read/write from a sata drive
1. modify the AHCI driver
- OK
2. rebuild/recompile it..and load it into the kernel (insmod ahci.ko)
- Fine if you don't actually need it to boot your machine; is your lack of features going to cause the driver to crash or hang?
3. Creates a special block device file named xxx and gives it major number and minor number.
- You can use any major/minor pair which does not clash with already assigned numbers. The major/minor list in 'device.txt' will slowly become obsolete as driver maintainers switch to dynamically assigned numbers - the catch is that maintainers would much rather do more interesting things like write a new driver.
4. Do I need to mount the SATA drive? If yes, how do I do that…just use the “mount” command
- NO. mounting the drive requires that it has a valid partition scheme and filesystem; instead you have to play with the raw device.
5. read/write to the SATA drive. I only know the ”echo”, is that the right way to write/read from the SATA drive?
- use 'dd' (man dd). You can read/write an arbitrary length of data from a device starting at an arbitrary offset.