world leader in high performance signal processing
Trace: » smb

Enabling SMB/CIFS Support

It is fairly easy to get samba working on your target system. This next section will help guide you through the process of enabling samba and mounting and unmounting the smbfs filesystem.

All Windows systems should support the SMB standard for mounting remote filesystems. Newer versions of Windows will also support CIFS, so you may want to turn support on for that as well, but this isn't strictly required.

For more information, lose an hour reading about Server Message Block.

Kernel Settings

In the kernel configuration menu, make sure the file system is enabled. It can be built into your kernel or as a module, either is fine.

Depending on the language your system uses, you may also have to enable additional language options in the NLS menu.

This step is needed only if you want to mount remote shares. In other words, if you want the Blackfin system to mount shares exported by other machines.

File systems  --->
  Network File Systems  --->
    <*> SMB file system support (to mount Windows shares etc.)
    <*> CIFS support (advanced network filesystem for Samba, Window and other CIFS compliant servers)
  Native Language Support  --->
    (languages in here according to your needs)

Actual Linux kernel configuration marks SMBFS as “Obsolete, please use CIFS”. In the case that CIFS fails to mount external windows directories you should have SMB still ticked besides CIFS - a runtime message like “smbfs is deprecated and will be removed from the 2.6.27 kernel. Please migrate to cifs” should be ignored.

uClinux-dist Settings

The management of permissions and server settings are done in userspace by the smbd and nmbd daemons. If you wish to run a samba server and allow other systems to mount shares that are on the Blackfin system, then you will need these daemons.

The management of mounting remote filesystems is handled by the smbmount and smbumount binaries. If you wish to have the Blackfin system mount remote shares that are hosted on other systems, you will need these two programs.

In the vendor/user configuration menu, you can find options for all of these. Disregard the SMBFS items, if still present in menuconfig, because these are obsolete. Select or deselect only the SAMBA items, as needed in your application. The shared libraries are not supported under FLAT build, so do not select shared libraries if you are using FLAT.

Filesystem Applications  --->
  --- SAMBA
  [*] samba
  [*]   smbd 
  [*]   nmbd                                     
  [*]   smbmount
  [*]   smbumount
  [*]   mount.cifs  
  [*]   umount.cifs   
  [ ]   uses shared library
  --- SMBFS 
  [ ] smbmount   
  [ ] smbumount 

Testing Samba Client

  • Now build up and boot this new setup.
  • If you have compiled smb support as a module, you will need to first run:
root:/> modprobe smbfs
  • To make sure support has been integrated properly, check the filesystems list:
root:/> cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   sockfs
nodev   pipefs
nodev   futexfs
nodev   eventpollfs
nodev   devpts
        ext2
nodev   ramfs
nodev   smbfs

If smbfs is not in the list, something has gone wrong.

  • Now you are ready to use smbmount to mount a shared system.

Make sure that the host system is properly set up for sharing with proper permissions on shared directories and that you have the proper user name and password to access the desired system.

  • You may want to add some settings to your smb.conf to use smbmount more fluidly. To access this file issue the following command:
root:~> vi ./etc/config/smb.conf
  • In here you can input whatever parameters you desire to suit your specific needs.

If your machine works with group, you can input parameters as below:

  [global]
     workgroup = WORKGROUP
     encrypt passwords = yes

If your machine works with domain,you can input parameters as below:

  [global]
     workgroup = [name of domain]
     encrypt passwords = yes
  • Now issue the following command to mount a drive. In this case, the machine name is TESTMACHINE. It can be the IP number if you don't know the name:
root:~> smbmount //TESTMACHINE/uClinux /mnt -o username=user

If you do not want to edit the ./etc/config/smb.conf file, you can smbmount with :

root:~> smbmount //TESTMACHINE/uClinux /mnt -o username=WORKGROUP\\user,port=139

You can only access a machine by name if you are connected through the same work group. You can edit your targets work group in the /etc/config/smb.conf. Also, you will more than likely have to enter a password to the machine you are trying to access so make sure you know the password for the specific user name that you have given.

  • To make sure that the file system was mounted with out any problems issue the mount command:
root:~> mount
  • You should see output similar to this:
/dev/mtdblock0 on / type ext2 (rw)
none on /proc type proc (rw,nodiratime)
/dev/ram0 on /var type ramfs (rw)
//TESTMACHINE/uClinux on /mnt type smbfs (rw,nodiratime,nosuid,nodev,uid=0,gid=0,file_mode=0755,dir_mode=0755)
  • Now if you cd into the location where you mounted the smbfs (/mnt in this example) then you should see the files and directories exactly as they are on original machine if you have appropriate permissions.
root:~> cd /mnt
root:/mnt> ls
dump
init.bat
test
unins.ico
unins000.dat
unins000.exe
  • Now you can accesses these files/directories and/or create new files/directories (if you have the necessary permissions) as if they were part of the targets file system.
  • To unmount the smb file system issue the following command:
root:~> smbumount /mnt
  • Now when issuing the mount command you will see that the smbfs is no longer there:
root:~> mount
/dev/mtdblock0 on / type ext2 (rw)
none on /proc type proc (rw,nodiratime)
/dev/ram0 on /var type ramfs (rw)

Testing Samba Server

  • Starting with the same system as in the Client above, create your /etc/config/smb.conf. The format/requirements of this file are way beyond the scope of this document, so we'll present a simple one that should work.
    [global]
    	workgroup = bfin-workgroup
    	server string = blackfin
    	security = SHARE
    
    [root]
    	path = /
    	read only = yes
    	guest ok = yes
  • If your /etc/services file does not declare the 139 entry, add this line:
    netbios-ssn 139/tcp
  • Start up the server via inetd by adding a line to your /etc/inetd.conf and restarting the inetd daemon:
    netbios-ssn stream tcp nowait root /sbin/smbd
  • Check the server is running properly from another machine.
    $ smbclient -N -L 192.168.0.15
    Domain=[BFIN-WORKGROUP] OS=[Unix] Server=[Samba 3.0.13]
    
            Sharename       Type      Comment
            ---------       ----      -------
            root            Disk
            IPC$            IPC       IPC Service (blackfin)
            ADMIN$          IPC       IPC Service (blackfin)
    Domain=[BFIN-WORKGROUP] OS=[Unix] Server=[Samba 3.0.13]
    
            Server               Comment
            ---------            -------
    
            Workgroup            Master
            ---------            -------
  • Now mount the server share root on the Blackfin board:
    $ sudo mount -t smbfs //192.168.0.15/root /mnt/tmp
    $ ls /mnt/tmp/
    bin  dev  etc  home  init  lib  mnt  out  proc  root  sbin  sys  tmp  usr  var