title: Creating a symbolic link for use by another Linux instance
body: <p>I am using linux to develop an embedded application. I have a HOST linux distro (fedora) and a TARGET linux distro (not sure what it is but it doesnt matter).</p>
  
  <p>The TARGET file system is a folder in the HOST file system. So for example the TARGET boots via nfs from /home/paul/target/rootfs on the HOST filesystem, inside which is the usual linux file structure.</p>
  
  <p>I am adding a daemon program to the TARGET. I am cross compiling it on the HOST and using a make target (make install) to copy files into the TARGET file system and set up the daemon to run. I copy</p>
  
  <ul>
  <li>the daemon binary</li>
  <li>some libs &amp; a start up script</li>
  <li>some symbolic links (symlinks) to facilitate auto starting of the daemon</li>
  </ul>
  
  <p>It is the later of these that is giving me problems. In order to auto start on boot I need to create symlinks in the TARGET fs at /etc/rc.d/rc0.d through to rc6.d, which point to my start up script /etc/rc.d/init/d/mdns.</p>
  
  <p>The problem is I need to create these symlinks on the HOST machine but for use by the TARGET. So they cannot point to the full path as seen by the HOST machine, they need to point to the path as seen when the TARGET runs.</p>
  
  <p>So for example </p>
  
  <p>I need to create a symlink in /home/paul/target/rootfs/etc/rc0.d but the symlink needs to be called K16mdns and point to /etc/init.d/mdns not /home/paul/target/rootfs/etc/init.d/mdns</p>
  
  <p>How can I use the ln command to do this? I need to specify 3 things to ln (besides the -s flag):- The links file name, the target of the link and the directory to create the link in. I dont see this combination in the ln man page.</p>
  
  <p>It always seems to end up either mucking up the /etc/rc.d directories on the HOST or creating symlinks in the TARGET fs using paths only relevant to the HOST which obviously fail (The TARGET doesnt have the path /home/paul/target/rootfs/etc/init.d/mdns).</p>
  
  <p>When I create the symlinks manually on the TARGETs command line it all works great but clearly this isnt a practical solution.</p>
  
  <p>Thank you in advance.</p>