I'm trying to port a certain software from one linux device to another. My software has a lot of lines pointing to /sys/bus/spi/devices/spi3.0. In the Linux device I'm porting to, that folder does not exist, it's in another place.

Is there a way to symlink so that the software goes to, say for e.g. "/tmp/folder" instead?

I've been trying to use "ln -s" but I get complaints that the folder "/sys/bus/spi/devices/spi3.0" does not exist. I know there are solutions for this if the device really exists but in my case "/sys/bus/spi/devices/spi3.0" does not exist on the target machine.


If you're going to have a symbolic link, it has to be named /spi/devices/spi3.0. If it isn't, nothing will work. So you need:

mkdir -p /spi/devices
ln -s /yournewlocation /spi/device/spi3.0  

If you don't have access to do that, a symbolic link isn't going to help.

  • So there's no way of making a folder there? I don't seem to be able, not even with root access. I'm thinking maybe I should do some virtual/dummy SPI interface with the name spi3.0 and then make a symlink or pipe everything from there to the true interface file. – koro Jul 11 '17 at 19:50
  • If you have root access, use those two commands above. The first makes sure you have all the parent folders. The second one makes a symbolic link called /spi/device/spi3.0 which will point at /yournewlocation (obviously, /yournewlocation will be /tmp/folder or whatever). Then you should be able to do cd /spi/device/spi3.0, and also your program should work OK. – Bob Eager Jul 11 '17 at 22:31
  • Thanks for helping but it's not working. I think it may be because i'm working with the /sys directory which is part of sysfs (virtual file system). I'm thinking that maybe i should mount a virtual driver there to pose as a fake spi. – koro Jul 12 '17 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.