Question

I'm building a custom linux kernel that should be able to access cdrom and usb mass storage devices, but not hard disks.

I tried disabling CONFIG_BLK_DEV_SD, but I lose usb mass storage support.

How can I achieve that? If not possible, is there a way to remove hard disk nodes in /dev at startup?

Was it helpful?

Solution

First, you need to define, what exactly "hard disk" means.

Second, you need to express the above definition as a set of udev rules. This way, device nodes for devices you don't want would not even get created in /dev/ in the first place.

One nice tutorial for udev rules is here:

http://www.reactivated.net/writing_udev_rules.html

Relevant Q/A: https://unix.stackexchange.com/questions/66897/what-is-the-udev-rule-to-allow-specific-thumb-drive-vendors

OTHER TIPS

Frankly, I'm amazed you even managed a bootable system with CONFIG_BLK_DEV_SD disabled: modern Linux kernels funnel virtually all storage I/O through the SCSI layer, then treat the specific types (SATA, PATA, USB mass storage, etc.) as flavors of SCSI.

I'd try disabling things at the next layer down in the system: enable SCSI disk and CD-ROM support, then disable all methods of actually talking to those disks: low-level SCSI drivers, ATA SFF support, ACHI support, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top