RSS
 

Cross compiling samba-3.6.1 for ARM

04 Jan

After some googling I figured out how to compile samba for ARM, the device I am compiling samba for is “chumby one” ( look at http://wiki.chumby.com to get the compiler toolchain for it )

Here are the steps:

1. Download the sources, obviously.
2. export these env vars on your build machine:

export LD_LIBRARY_PATH=/usr/arm-linux/lib
export LDFLAGS=-L/usr/arm-linux/lib
export CPPFLAGS=-I/usr/arm-linux/include
export CC=arm-linux-gcc

3. edit your configure file, look for this:

if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
# getaddrinfo is broken on some AIX systems
# see bug 5910, use our replacements if we detect
# a broken system.
if test "$cross_compiling" = yes; then :

change it to:

if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
# getaddrinfo is broken on some AIX systems
# see bug 5910, use our replacements if we detect
# a broken system.
if test "$cross_compiling" = no; then :

why this? more info here: https://bugzilla.samba.org/show_bug.cgi?id=8410
I made a guess and it works for me.

4. invoke the configure script like so:

./configure --host=i686 --target=arm-linux samba_cv_CC_NEGATIVE_ENUM_VALUES=yes ac_cv_file__proc_sys_kernel_core_pattern=yes --prefix=/mnt/usb/samba

5. edit the makefile, change this:

CPPFLAGS=-DHAVE_CONFIG_H -I/usr/arm-linux/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt -I/usr/local/include

to this:

CPPFLAGS=-DHAVE_CONFIG_H -I/usr/arm-linux/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt

I am not a linux guru so I dont understand why it is including /usr/local/include when I am cross compiling, Samba project needs to fix these small issues, specially for ARM, with ARM gaining foothold in the server market.

6. run make

make

7. Copy files to chumby
I didnt do “make install”, obviously. i copied the bins in the /samba-3.6.1/source3/bin in the samba source folder on build machine to /mnt/usb/samba on chumby


scp * root@CHUMBY-IP:/mnt/usb/samba/

8. update the LD_LIBRARY_PATH on your arm device, chumy in this case.

export LD_LIBRARY_PATH=/mnt/usb/samba:$LD_LIBRARY_PATH

9. Test *

ssh root@CHUMBY-IP
cd /mnt/usb/samba
./smbget

10. make some required folders in /mnt/usb/samba

mkdir private
mkdir var
mkdir var/locks

11. run smbd and give it the conf file

./smbd -i --configfile=/mnt/usb/samba/samba.conf -S

12. tip: use -d 10 for more incase of errors

./smbd -i --configfile=/mnt/usb/samba/samba.conf -S -d 10

13. you can put the samba.conf in /mnt/usb/samba/lib

mv /mnt/usb/samba/samba.conf /mnt/usb/samba/lib/

14. sample samba.conf file:

[global]
workgroup = WORKGROUP
netbios name = CHUMBY

[ready]
path = /mnt/usb/samba_share
guest ok = yes
read only = no

[torrents]
path = /mnt/usb/torrents_share
guest ok = yes
read only = no

15. add samba user, we will use root since chumby comes with this only and there is no useradd command on the device.


smbpasswd -L -a root
smbpasswd -L -e root

16. test on other computers, enter root as user and password you set as the password.

Good luck, you are going to need it.

* works for me ….

Be Sociable, Share!
 
 

Tags: , , ,

Leave a Reply

 

 
  1. Andy

    March 29, 2012 at 2:06 am

    I get confused . When I change CC & LD_LIBRARY_PATH to point to the arms directories.. configure cant compile and I cant even edit. LD_LIBRARY_PATH affects everything. Shouldnt there be a TARGET_LD_LIBRRY_PATH instead?

     
  2. aaaa

    June 24, 2014 at 1:18 pm

    How to cross compile samba 4.1.8 ??????????????
    can sombody share their ideas